Fix OLSR example: don't add static routes, increase simulation time to 300 seconds.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri Feb 01 17:17:24 2008 +0000 (2008-02-01)
changeset 229539452dbe604b
parent 2294 aa08830477cb
child 2296 15c4fbd9c7c6
Fix OLSR example: don't add static routes, increase simulation time to 300 seconds.
examples/simple-point-to-point-olsr.cc
     1.1 --- a/examples/simple-point-to-point-olsr.cc	Fri Feb 01 15:16:44 2008 +0000
     1.2 +++ b/examples/simple-point-to-point-olsr.cc	Fri Feb 01 17:17:24 2008 +0000
     1.3 @@ -21,7 +21,7 @@
     1.4  //
     1.5  // Network topology
     1.6  //
     1.7 -//  n0
     1.8 +//   n0
     1.9  //     \ 5 Mb/s, 2ms
    1.10  //      \          1.5Mb/s, 10ms
    1.11  //       n2 -------------------------n3
    1.12 @@ -151,13 +151,12 @@
    1.13        channel2, n2, Ipv4Address("10.1.3.1"),
    1.14        n3, Ipv4Address("10.1.3.2"));
    1.15  
    1.16 -  // Finally, we add static routes.  These three steps (Channel and
    1.17 -  // NetDevice creation, IP Address assignment, and routing) are 
    1.18 -  // separated because there may be a need to postpone IP Address
    1.19 -  // assignment (emulation) or modify to use dynamic routing
    1.20 +
    1.21 +  // Enable OLSR
    1.22    NS_LOG_INFO ("Enabling OLSR Routing.");
    1.23    olsr::EnableAllNodes ();
    1.24  
    1.25 +
    1.26    // Create the OnOff application to send UDP datagrams of size
    1.27    // 210 bytes at a rate of 448 Kb/s
    1.28    NS_LOG_INFO ("Create Applications.");
    1.29 @@ -170,7 +169,6 @@
    1.30      ConstantVariable(0));
    1.31    // Start the application
    1.32    ooff->Start(Seconds(1.0));
    1.33 -  ooff->Stop (Seconds(10.0));
    1.34  
    1.35    // Create an optional packet sink to receive these packets
    1.36    Ptr<PacketSink> sink = CreateObject<PacketSink> (
    1.37 @@ -179,7 +177,6 @@
    1.38      "Udp");
    1.39    // Start the sink
    1.40    sink->Start (Seconds (1.0));
    1.41 -  sink->Stop (Seconds (10.0));
    1.42  
    1.43    // Create a similar flow from n3 to n1, starting at time 1.1 seconds
    1.44    ooff = CreateObject<OnOffApplication> (
    1.45 @@ -189,8 +186,7 @@
    1.46      ConstantVariable(1), 
    1.47      ConstantVariable(0));
    1.48    // Start the application
    1.49 -  ooff->Start(Seconds(1.1));
    1.50 -  ooff->Stop (Seconds(10.0));
    1.51 +  ooff->Start (Seconds(1.1));
    1.52  
    1.53    // Create a packet sink to receive these packets
    1.54    sink = CreateObject<PacketSink> (
    1.55 @@ -199,17 +195,7 @@
    1.56      "Udp");
    1.57    // Start the sink
    1.58    sink->Start (Seconds (1.1));
    1.59 -  sink->Stop (Seconds (10.0));
    1.60  
    1.61 -  // Here, finish off packet routing configuration
    1.62 -  // This will likely set by some global StaticRouting object in the future
    1.63 -  NS_LOG_INFO ("Set Default Routes.");
    1.64 -  Ptr<Ipv4> ipv4;
    1.65 -  ipv4 = n0->GetObject<Ipv4> ();
    1.66 -  ipv4->SetDefaultRoute (Ipv4Address ("10.1.1.2"), 1);
    1.67 -  ipv4 = n3->GetObject<Ipv4> ();
    1.68 -  ipv4->SetDefaultRoute (Ipv4Address ("10.1.3.1"), 1);
    1.69 -  
    1.70    // Configure tracing of all enqueue, dequeue, and NetDevice receive events
    1.71    // Trace output will be sent to the simple-point-to-point.tr file
    1.72    NS_LOG_INFO ("Configure Tracing.");
    1.73 @@ -226,7 +212,7 @@
    1.74    pcaptrace.TraceAllIp ();
    1.75  
    1.76    NS_LOG_INFO ("Run Simulation.");
    1.77 -  Simulator::StopAt (Seconds (10));
    1.78 +  Simulator::StopAt (Seconds (300));
    1.79    Simulator::Run ();    
    1.80    Simulator::Destroy ();
    1.81    NS_LOG_INFO ("Done.");