A Discrete-Event Network Simulator
API
adaptive-red-tests.cc
Go to the documentation of this file.
1 
2 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 /*
4  * Copyright (c) 2015 NITK Surathkal
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20  *
21  */
22 
67 #include "ns3/core-module.h"
68 #include "ns3/network-module.h"
69 #include "ns3/internet-module.h"
70 #include "ns3/flow-monitor-helper.h"
71 #include "ns3/point-to-point-module.h"
72 #include "ns3/applications-module.h"
73 #include "ns3/traffic-control-module.h"
74 
75 using namespace ns3;
76 
77 NS_LOG_COMPONENT_DEFINE ("AdaptiveRedTests");
78 
79 uint32_t checkTimes;
81 
82 // The times
89 
95 
101 
102 std::stringstream filePlotQueueDisc;
103 std::stringstream filePlotQueueDiscAvg;
104 
105 void
107 {
108  uint32_t qSize = queue->GetCurrentSize ().GetValue ();
109 
110  avgQueueDiscSize += qSize;
111  checkTimes++;
112 
113  // check queue disc size every 1/100 of a second
115 
116  std::ofstream fPlotQueueDisc (filePlotQueueDisc.str ().c_str (), std::ios::out | std::ios::app);
117  fPlotQueueDisc << Simulator::Now ().GetSeconds () << " " << qSize << std::endl;
118  fPlotQueueDisc.close ();
119 
120  std::ofstream fPlotQueueDiscAvg (filePlotQueueDiscAvg.str ().c_str (), std::ios::out | std::ios::app);
121  fPlotQueueDiscAvg << Simulator::Now ().GetSeconds () << " " << avgQueueDiscSize / checkTimes << std::endl;
122  fPlotQueueDiscAvg.close ();
123 }
124 
125 void
126 BuildAppsTest (uint32_t test)
127 {
128  // SINK is in the right side
129  uint16_t port = 50000;
130  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
131  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
132  ApplicationContainer sinkApp = sinkHelper.Install (n3n4.Get (1));
133  sinkApp.Start (Seconds (sink_start_time));
134  sinkApp.Stop (Seconds (sink_stop_time));
135 
136  // Connection one
137  // Clients are in left side
138  /*
139  * Create the OnOff applications to send TCP to the server
140  * onoffhelper is a client that send data to TCP destination
141  */
142  OnOffHelper clientHelper1 ("ns3::TcpSocketFactory", Address ());
143  clientHelper1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
144  clientHelper1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
145  clientHelper1.SetAttribute ("PacketSize", UintegerValue (1000));
146 
147  // Connection two
148  OnOffHelper clientHelper2 ("ns3::TcpSocketFactory", Address ());
149  clientHelper2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
150  clientHelper2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
151  clientHelper2.SetAttribute ("PacketSize", UintegerValue (1000));
152 
153  if (test == 6 || test == 7 || test == 8 || test == 9 || test == 10 || test == 12)
154  {
155  clientHelper1.SetAttribute ("DataRate", DataRateValue (DataRate ("100Mb/s")));
156  clientHelper2.SetAttribute ("DataRate", DataRateValue (DataRate ("100Mb/s")));
157  }
158  else
159  {
160  clientHelper1.SetAttribute ("DataRate", DataRateValue (DataRate ("10Mb/s")));
161  clientHelper2.SetAttribute ("DataRate", DataRateValue (DataRate ("10Mb/s")));
162  }
163 
164  ApplicationContainer clientApps1;
165  AddressValue remoteAddress (InetSocketAddress (i3i4.GetAddress (1), port));
166  clientHelper1.SetAttribute ("Remote", remoteAddress);
167  clientApps1.Add (clientHelper1.Install (n0n2.Get (0)));
168  clientApps1.Start (Seconds (client_start_time));
169  clientApps1.Stop (Seconds (client_stop_time));
170 
171  ApplicationContainer clientApps2;
172  clientHelper2.SetAttribute ("Remote", remoteAddress);
173  clientApps2.Add (clientHelper2.Install (n1n2.Get (0)));
174  clientApps2.Start (Seconds (client_start_time));
175  clientApps2.Stop (Seconds (client_stop_time));
176 }
177 
178 int
179 main (int argc, char *argv[])
180 {
181  LogComponentEnable ("RedQueueDisc", LOG_LEVEL_INFO);
182 
183  uint32_t aredTest;
184  std::string aredLinkDataRate = "1.5Mbps";
185  std::string aredLinkDelay = "20ms";
186 
187  std::string pathOut;
188  bool writeForPlot = false;
189  bool writePcap = false;
190  bool flowMonitor = false;
191 
192  bool printAredStats = true;
193 
194  global_start_time = 0.0;
197  global_stop_time = 7.0;
200 
201  // Configuration and command line parameter parsing
202  aredTest = 1;
203  // Will only save in the directory if enable opts below
204  pathOut = "."; // Current directory
206  cmd.AddValue ("testNumber", "Run test 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15", aredTest);
207  cmd.AddValue ("pathOut", "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor", pathOut);
208  cmd.AddValue ("writeForPlot", "<0/1> to write results for plot (gnuplot)", writeForPlot);
209  cmd.AddValue ("writePcap", "<0/1> to write results in pcapfile", writePcap);
210  cmd.AddValue ("writeFlowMonitor", "<0/1> to enable Flow Monitor and write their results", flowMonitor);
211 
212  cmd.Parse (argc, argv);
213  if ((aredTest < 1) || (aredTest == 5) || (aredTest > 15))
214  {
215  std::cout << "Invalid test number. Supported tests are 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15" << std::endl;
216  exit (1);
217  }
218 
219  NS_LOG_INFO ("Create nodes");
220  NodeContainer c;
221  c.Create (6);
222  Names::Add ( "N0", c.Get (0));
223  Names::Add ( "N1", c.Get (1));
224  Names::Add ( "N2", c.Get (2));
225  Names::Add ( "N3", c.Get (3));
226  Names::Add ( "N4", c.Get (4));
227  Names::Add ( "N5", c.Get (5));
228  n0n2 = NodeContainer (c.Get (0), c.Get (2));
229  n1n2 = NodeContainer (c.Get (1), c.Get (2));
230  n2n3 = NodeContainer (c.Get (2), c.Get (3));
231  n3n4 = NodeContainer (c.Get (3), c.Get (4));
232  n3n5 = NodeContainer (c.Get (3), c.Get (5));
233 
234  Config::SetDefault ("ns3::TcpL4Protocol::SocketType", StringValue ("ns3::TcpNewReno"));
235  // 42 = headers size
236  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1000 - 42));
237  Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (1));
238  GlobalValue::Bind ("ChecksumEnabled", BooleanValue (false));
239 
240  uint32_t meanPktSize = 1000;
241 
242  // RED params
243  NS_LOG_INFO ("Set RED params");
244  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("1000p"));
245  Config::SetDefault ("ns3::RedQueueDisc::MeanPktSize", UintegerValue (meanPktSize));
246  Config::SetDefault ("ns3::RedQueueDisc::Wait", BooleanValue (true));
247  Config::SetDefault ("ns3::RedQueueDisc::Gentle", BooleanValue (true));
248  Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.002));
249  Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (5));
250  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (15));
251 
252  if (aredTest == 1) // test 1: red1
253  {
254  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
255  }
256  else if (aredTest == 2) // test 2: red1Adapt
257  {
258  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
259  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
260  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
261  }
262  else if (aredTest == 3) //test 3: red1ECN
263  {
264  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
265  Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
266  Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
267  }
268  else if (aredTest == 4) // test 4: red1AdaptECN
269  {
270  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
271  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
272  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("25p"));
273  Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
274  Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
275  }
276  else if (aredTest == 7) // test 7: fastlinkAutowq
277  {
278  Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (0.0));
279  }
280  else if (aredTest == 8) // test 8: fastlinkAutothresh
281  {
282  Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (0));
283  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (0));
284  }
285  else if (aredTest == 9) // test 9: fastlinkAdaptive
286  {
287  Config::SetDefault ("ns3::RedQueueDisc::AdaptMaxP", BooleanValue (true));
288  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
289  }
290  else if (aredTest == 10) // test 10: fastlinkAllAdapt
291  {
292  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
293  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
294  }
295  else if (aredTest == 11) // test 11: fastlinkAllAdaptECN
296  {
297  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
298  Config::SetDefault ("ns3::RedQueueDisc::UseHardDrop", BooleanValue (false));
299  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
300  Config::SetDefault ("ns3::TcpSocketBase::UseEcn", StringValue ("On"));
301  Config::SetDefault ("ns3::RedQueueDisc::UseEcn", BooleanValue (true));
302  }
303  else if (aredTest == 12) // test 12: fastlinkAllAdapt1
304  {
305  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
306  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
307  Config::SetDefault ("ns3::RedQueueDisc::TargetDelay", TimeValue (Seconds (0.2)));
308  }
309  else if (aredTest == 13) // test 13: longlink
310  {
311  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
312  }
313  else if (aredTest == 14) // test 14: longlinkAdapt
314  {
315  Config::SetDefault ("ns3::RedQueueDisc::ARED", BooleanValue (true));
316  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
317  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
318  }
319  else if (aredTest == 15) // test 15: longlinkAdapt1
320  {
321  Config::SetDefault ("ns3::RedQueueDisc::QW", DoubleValue (-1.0));
322  Config::SetDefault ("ns3::RedQueueDisc::MinTh", DoubleValue (0));
323  Config::SetDefault ("ns3::RedQueueDisc::MaxTh", DoubleValue (0));
324  Config::SetDefault ("ns3::RedQueueDisc::AdaptMaxP", BooleanValue (true));
325  Config::SetDefault ("ns3::RedQueueDisc::LInterm", DoubleValue (10));
326  Config::SetDefault ("ns3::RedQueueDisc::MaxSize", StringValue ("100p"));
327  }
328 
329  NS_LOG_INFO ("Install internet stack on all nodes.");
330  InternetStackHelper internet;
331  internet.Install (c);
332 
333  TrafficControlHelper tchPfifo;
334  uint16_t handle = tchPfifo.SetRootQueueDisc ("ns3::PfifoFastQueueDisc");
335  tchPfifo.AddInternalQueues (handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue ("1000p"));
336 
337  TrafficControlHelper tchRed;
338  tchRed.SetRootQueueDisc ("ns3::RedQueueDisc", "LinkBandwidth", StringValue (aredLinkDataRate),
339  "LinkDelay", StringValue (aredLinkDelay));
340 
341  NS_LOG_INFO ("Create channels");
342  PointToPointHelper p2p;
343 
344  NetDeviceContainer devn0n2;
345  NetDeviceContainer devn1n2;
346  NetDeviceContainer devn2n3;
347  NetDeviceContainer devn3n4;
348  NetDeviceContainer devn3n5;
349 
350  QueueDiscContainer queueDiscs;
351 
352  if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4)
353  {
354  p2p.SetQueue ("ns3::DropTailQueue");
355  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
356  p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
357  devn0n2 = p2p.Install (n0n2);
358  tchPfifo.Install (devn0n2);
359 
360  p2p.SetQueue ("ns3::DropTailQueue");
361  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
362  p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
363  devn1n2 = p2p.Install (n1n2);
364  tchPfifo.Install (devn1n2);
365 
366  p2p.SetQueue ("ns3::DropTailQueue");
367  p2p.SetDeviceAttribute ("DataRate", StringValue (aredLinkDataRate));
368  p2p.SetChannelAttribute ("Delay", StringValue (aredLinkDelay));
369  devn2n3 = p2p.Install (n2n3);
370  // only backbone link has ARED queue disc
371  queueDiscs = tchRed.Install (devn2n3);
372 
373  p2p.SetQueue ("ns3::DropTailQueue");
374  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
375  p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
376  devn3n4 = p2p.Install (n3n4);
377  tchPfifo.Install (devn3n4);
378 
379  p2p.SetQueue ("ns3::DropTailQueue");
380  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
381  p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
382  devn3n5 = p2p.Install (n3n5);
383  tchPfifo.Install (devn3n5);
384  }
385  else if (aredTest == 13 || aredTest == 14 || aredTest == 15)
386  {
387  p2p.SetQueue ("ns3::DropTailQueue");
388  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
389  p2p.SetChannelAttribute ("Delay", StringValue ("0ms"));
390  devn0n2 = p2p.Install (n0n2);
391  tchPfifo.Install (devn0n2);
392 
393  p2p.SetQueue ("ns3::DropTailQueue");
394  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
395  p2p.SetChannelAttribute ("Delay", StringValue ("1ms"));
396  devn1n2 = p2p.Install (n1n2);
397  tchPfifo.Install (devn1n2);
398 
399  p2p.SetQueue ("ns3::DropTailQueue");
400  p2p.SetDeviceAttribute ("DataRate", StringValue (aredLinkDataRate));
401  p2p.SetChannelAttribute ("Delay", StringValue ("100ms"));
402  devn2n3 = p2p.Install (n2n3);
403  // only backbone link has ARED queue disc
404  queueDiscs = tchRed.Install (devn2n3);
405 
406  p2p.SetQueue ("ns3::DropTailQueue");
407  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
408  p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
409  devn3n4 = p2p.Install (n3n4);
410  tchPfifo.Install (devn3n4);
411 
412  p2p.SetQueue ("ns3::DropTailQueue");
413  p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
414  p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
415  devn3n5 = p2p.Install (n3n5);
416  tchPfifo.Install (devn3n5);
417  }
418  else if (aredTest == 6 || aredTest == 7 || aredTest == 8 || aredTest == 9 || aredTest == 10 || aredTest == 11 || aredTest == 12)
419  {
420  p2p.SetQueue ("ns3::DropTailQueue");
421  p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
422  p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
423  devn0n2 = p2p.Install (n0n2);
424  tchPfifo.Install (devn0n2);
425 
426  p2p.SetQueue ("ns3::DropTailQueue");
427  p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
428  p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
429  devn1n2 = p2p.Install (n1n2);
430  tchPfifo.Install (devn1n2);
431 
432  p2p.SetQueue ("ns3::DropTailQueue");
433  p2p.SetDeviceAttribute ("DataRate", StringValue ("15Mbps"));
434  p2p.SetChannelAttribute ("Delay", StringValue (aredLinkDelay));
435  devn2n3 = p2p.Install (n2n3);
436  // only backbone link has ARED queue disc
437  queueDiscs = tchRed.Install (devn2n3);
438 
439  p2p.SetQueue ("ns3::DropTailQueue");
440  p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
441  p2p.SetChannelAttribute ("Delay", StringValue ("4ms"));
442  devn3n4 = p2p.Install (n3n4);
443  tchPfifo.Install (devn3n4);
444 
445  p2p.SetQueue ("ns3::DropTailQueue");
446  p2p.SetDeviceAttribute ("DataRate", StringValue ("100Mbps"));
447  p2p.SetChannelAttribute ("Delay", StringValue ("5ms"));
448  devn3n5 = p2p.Install (n3n5);
449  tchPfifo.Install (devn3n5);
450  }
451 
452  NS_LOG_INFO ("Assign IP Addresses");
453  Ipv4AddressHelper ipv4;
454 
455  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
456  i0i2 = ipv4.Assign (devn0n2);
457 
458  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
459  i1i2 = ipv4.Assign (devn1n2);
460 
461  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
462  i2i3 = ipv4.Assign (devn2n3);
463 
464  ipv4.SetBase ("10.1.4.0", "255.255.255.0");
465  i3i4 = ipv4.Assign (devn3n4);
466 
467  ipv4.SetBase ("10.1.5.0", "255.255.255.0");
468  i3i5 = ipv4.Assign (devn3n5);
469 
470  // Set up the routing
472 
473  BuildAppsTest (aredTest);
474 
475  if (writePcap)
476  {
477  PointToPointHelper ptp;
478  std::stringstream stmp;
479  stmp << pathOut << "/ared";
480  ptp.EnablePcapAll (stmp.str ().c_str ());
481  }
482 
483  Ptr<FlowMonitor> flowmon;
484  if (flowMonitor)
485  {
486  FlowMonitorHelper flowmonHelper;
487  flowmon = flowmonHelper.InstallAll ();
488  }
489 
490  if (writeForPlot)
491  {
492  filePlotQueueDisc << pathOut << "/" << "ared-queue-disc.plotme";
493  filePlotQueueDiscAvg << pathOut << "/" << "ared-queue-disc_avg.plotme";
494 
495  remove (filePlotQueueDisc.str ().c_str ());
496  remove (filePlotQueueDiscAvg.str ().c_str ());
497  Ptr<QueueDisc> queue = queueDiscs.Get (0);
499  }
500 
502  Simulator::Run ();
503 
504  QueueDisc::Stats st = queueDiscs.Get (0)->GetStats ();
505 
508  {
509  std::cout << "There should be some unforced drops or marks" << std::endl;
510  exit (1);
511  }
512 
513  if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4 || aredTest == 13)
514  {
516  {
517  std::cout << "There should be some drops due to queue full" << std::endl;
518  exit (1);
519  }
520  }
521  else
522  {
524  {
525  std::cout << "There should be zero drops due to queue full" << std::endl;
526  exit (1);
527  }
528  }
529 
530  if (flowMonitor)
531  {
532  std::stringstream stmp;
533  stmp << pathOut << "/ared.flowmon";
534 
535  flowmon->SerializeToXmlFile (stmp.str ().c_str (), false, false);
536  }
537 
538  if (printAredStats)
539  {
540  std::cout << "*** ARED stats from Node 2 queue ***" << std::endl;
541  std::cout << st << std::endl;
542  }
543 
545 
546  return 0;
547 }
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:185
holds a vector of ns3::Application pointers.
an Inet address class
static Ipv4Address GetAny(void)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
QueueDiscContainer Install(NetDeviceContainer c)
holds a vector of std::pair of Ptr<Ipv4> and interface index.
static void PopulateRoutingTables(void)
Build a routing database and initialize the routing tables of the nodes in the simulation.
Hold variables of type string.
Definition: string.h:41
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:175
NodeContainer n3n5
NetDeviceContainer Install(NodeContainer c)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
Ipv4InterfaceContainer i3i5
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
Definition: queue-disc.cc:523
void SetQueue(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
Each point to point net device must have a queue to pass packets through.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:361
Ipv4InterfaceContainer i1i2
Ipv4InterfaceContainer i3i4
static void Run(void)
Run the simulation.
Definition: simulator.cc:170
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
double avgQueueDiscSize
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
cmd
Definition: second.py:35
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
static constexpr const char * UNFORCED_DROP
Early probability drops.
std::stringstream filePlotQueueDiscAvg
uint16_t port
Definition: dsdv-manet.cc:45
a polymophic address class
Definition: address.h:90
NodeContainer n3n4
Holds a vector of ns3::QueueDisc pointers.
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
Definition: names.cc:768
Class for representing data rates.
Definition: data-rate.h:88
double client_start_time
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:370
double sink_stop_time
void EnablePcapAll(std::string prefix, bool promiscuous=false)
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created ...
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1390
void BuildAppsTest(uint32_t test)
AttributeValue implementation for Time.
Definition: nstime.h:1132
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
Definition: uinteger.h:44
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
Definition: queue-disc.cc:110
LOG_INFO and above.
Definition: log.h:107
holds a vector of ns3::NetDevice pointers
uint32_t checkTimes
Build a set of QueueDisc objects.
const Stats & GetStats(void)
Retrieve all the collected statistics.
Definition: queue-disc.cc:421
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Parse command-line arguments.
Definition: command-line.h:212
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:134
double sink_start_time
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.
Definition: queue-disc.cc:152
static constexpr const char * UNFORCED_MARK
Early probability marks.
NodeContainer n2n3
Helper to enable IP flow monitoring on a set of Nodes.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1579
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:193
Ipv4InterfaceContainer i0i2
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
double client_stop_time
double global_start_time
AttributeValue implementation for Address.
Definition: address.h:278
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add the given number of internal queues (of the given type and with the given...
AttributeValue implementation for DataRate.
Definition: data-rate.h:242
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:178
void SerializeToXmlFile(std::string fileName, bool enableHistograms, bool enableProbes)
Same as SerializeToXmlStream, but writes to a file instead.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1070
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:812
std::stringstream filePlotQueueDisc
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
NodeContainer n0n2
This class can be used to hold variables of floating point type such as &#39;double&#39; or &#39;float&#39;...
Definition: double.h:41
double global_stop_time
void CheckQueueDiscSize(Ptr< QueueDisc > queue)
NodeContainer n1n2
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Ipv4InterfaceContainer i2i3
static constexpr const char * INTERNAL_QUEUE_DROP
Packet dropped by an internal queue.
Definition: queue-disc.h:516
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.