A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
adaptive-red-tests.cc
Go to the documentation of this file.
1
2/*
3 * Copyright (c) 2015 NITK Surathkal
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Author: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
8 *
9 */
10
11/**
12 * NOTE: These validation tests are same as provided in ns-2
13 * (ns/tcl/test/test-suite-adaptive-red.tcl)
14 *
15 * In this code, tests 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 and 15 refer to tests
16 * named red1, red1Adapt, red1ECN, fastlink, fastlinkECN, fastlinkAutowq, fastlinkAutothresh,
17 * fastlinkAdaptive, fastlinkAllAdapt, fastlinkAllAdaptECN, fastlinkAllAdapt1, longlink,
18 * longlinkAdapt and longlinkAdapt1, respectively in the ns-2 file
19 * mentioned above.
20 */
21
22/** Network topology for tests: 1, 2, 3 and 4
23 *
24 * 10Mb/s, 2ms 10Mb/s, 4ms
25 * n0--------------| |---------------n4
26 * | 1.5Mbps, 20ms |
27 * n2------------------n3
28 * 10Mb/s, 3ms | QueueLimit = 25 | 10Mb/s, 5ms
29 * n1--------------| |---------------n5
30 *
31 */
32
33/** Network topology for tests: 6, 7, 8, 9, 10, 11 and 12
34 *
35 * 100Mb/s, 2ms 100Mb/s, 4ms
36 * n0--------------| |---------------n4
37 * | 15Mbps, 20ms |
38 * n2------------------n3
39 * 100Mb/s, 3ms | QueueLimit = 1000 | 100Mb/s, 5ms
40 * n1--------------| |---------------n5
41 *
42 */
43
44/** Network topology for tests: 13, 14 and 15
45 *
46 * 10Mb/s, 0ms 10Mb/s, 2ms
47 * n0--------------| |---------------n4
48 * | 1.5Mbps, 100ms |
49 * n2------------------n3
50 * 10Mb/s, 1ms | QueueLimit = 100 | 10Mb/s, 3ms
51 * n1--------------| |---------------n5
52 *
53 */
54
55#include "ns3/applications-module.h"
56#include "ns3/core-module.h"
57#include "ns3/flow-monitor-helper.h"
58#include "ns3/internet-module.h"
59#include "ns3/network-module.h"
60#include "ns3/point-to-point-module.h"
61#include "ns3/traffic-control-module.h"
62
63using namespace ns3;
64
65NS_LOG_COMPONENT_DEFINE("AdaptiveRedTests");
66
67uint32_t checkTimes; //!< Number of times the queues have been checked.
68double avgQueueDiscSize; //!< Average QueueDisc size.
69
70// The times
71double global_start_time; //!< Global start time
72double global_stop_time; //!< Global stop time.
73double sink_start_time; //!< Sink start time.
74double sink_stop_time; //!< Sink stop time.
75double client_start_time; //!< Client start time.
76double client_stop_time; //!< Client stop time.
77
78NodeContainer n0n2; //!< Nodecontainer n0 + n2.
79NodeContainer n1n2; //!< Nodecontainer n1 + n2.
80NodeContainer n2n3; //!< Nodecontainer n2 + n3.
81NodeContainer n3n4; //!< Nodecontainer n3 + n4.
82NodeContainer n3n5; //!< Nodecontainer n3 + n5.
83
84Ipv4InterfaceContainer i0i2; //!< IPv4 interface container i0 + i2.
85Ipv4InterfaceContainer i1i2; //!< IPv4 interface container i1 + i2.
86Ipv4InterfaceContainer i2i3; //!< IPv4 interface container i2 + i3.
87Ipv4InterfaceContainer i3i4; //!< IPv4 interface container i3 + i4.
88Ipv4InterfaceContainer i3i5; //!< IPv4 interface container i3 + i5.
89
90std::stringstream filePlotQueueDisc; //!< Output file name for queue disc size.
91std::stringstream filePlotQueueDiscAvg; //!< Output file name for queue disc average.
92
93/**
94 * Check the queue disc size and write its stats to the output files.
95 *
96 * \param queue The queue to check.
97 */
98void
100{
101 uint32_t qSize = queue->GetCurrentSize().GetValue();
102
103 avgQueueDiscSize += qSize;
104 checkTimes++;
105
106 // check queue disc size every 1/100 of a second
108
109 std::ofstream fPlotQueueDisc(filePlotQueueDisc.str(), std::ios::out | std::ios::app);
110 fPlotQueueDisc << Simulator::Now().GetSeconds() << " " << qSize << std::endl;
111 fPlotQueueDisc.close();
112
113 std::ofstream fPlotQueueDiscAvg(filePlotQueueDiscAvg.str(), std::ios::out | std::ios::app);
114 fPlotQueueDiscAvg << Simulator::Now().GetSeconds() << " " << avgQueueDiscSize / checkTimes
115 << std::endl;
116 fPlotQueueDiscAvg.close();
117}
118
119/**
120 * Setup the apps.
121 *
122 * \param test The test number.
123 */
124void
126{
127 // SINK is in the right side
128 uint16_t port = 50000;
130 PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", sinkLocalAddress);
131 ApplicationContainer sinkApp = sinkHelper.Install(n3n4.Get(1));
132 sinkApp.Start(Seconds(sink_start_time));
133 sinkApp.Stop(Seconds(sink_stop_time));
134
135 // Connection one
136 // Clients are in left side
137 /*
138 * Create the OnOff applications to send TCP to the server
139 * onoffhelper is a client that send data to TCP destination
140 */
141 OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
142 clientHelper1.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
143 clientHelper1.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
144 clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
145
146 // Connection two
147 OnOffHelper clientHelper2("ns3::TcpSocketFactory", Address());
148 clientHelper2.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
149 clientHelper2.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
150 clientHelper2.SetAttribute("PacketSize", UintegerValue(1000));
151
152 if (test == 6 || test == 7 || test == 8 || test == 9 || test == 10 || test == 12)
153 {
154 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("100Mb/s")));
155 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("100Mb/s")));
156 }
157 else
158 {
159 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
160 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
161 }
162
163 ApplicationContainer clientApps1;
165 clientHelper1.SetAttribute("Remote", remoteAddress);
166 clientApps1.Add(clientHelper1.Install(n0n2.Get(0)));
167 clientApps1.Start(Seconds(client_start_time));
168 clientApps1.Stop(Seconds(client_stop_time));
169
170 ApplicationContainer clientApps2;
171 clientHelper2.SetAttribute("Remote", remoteAddress);
172 clientApps2.Add(clientHelper2.Install(n1n2.Get(0)));
173 clientApps2.Start(Seconds(client_start_time));
174 clientApps2.Stop(Seconds(client_stop_time));
175}
176
177int
178main(int argc, char* argv[])
179{
180 LogComponentEnable("RedQueueDisc", LOG_LEVEL_INFO);
181
182 uint32_t aredTest;
183 std::string aredLinkDataRate = "1.5Mbps";
184 std::string aredLinkDelay = "20ms";
185
186 std::string pathOut;
187 bool writeForPlot = false;
188 bool writePcap = false;
189 bool flowMonitor = false;
190
191 bool printAredStats = true;
192
193 global_start_time = 0.0;
196 global_stop_time = 7.0;
199
200 // Configuration and command line parameter parsing
201 aredTest = 1;
202 // Will only save in the directory if enable opts below
203 pathOut = "."; // Current directory
204 CommandLine cmd(__FILE__);
205 cmd.AddValue("testNumber",
206 "Run test 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14 or 15",
207 aredTest);
208 cmd.AddValue("pathOut",
209 "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor",
210 pathOut);
211 cmd.AddValue("writeForPlot", "Write results for plot (gnuplot)", writeForPlot);
212 cmd.AddValue("writePcap", "Write results in pcapfile", writePcap);
213 cmd.AddValue("writeFlowMonitor", "Enable Flow Monitor and write their results", flowMonitor);
214
215 cmd.Parse(argc, argv);
216 if ((aredTest < 1) || (aredTest == 5) || (aredTest > 15))
217 {
218 std::cout << "Invalid test number. Supported tests are 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, "
219 "13, 14 or 15"
220 << std::endl;
221 exit(1);
222 }
223
224 NS_LOG_INFO("Create nodes");
226 c.Create(6);
227 Names::Add("N0", c.Get(0));
228 Names::Add("N1", c.Get(1));
229 Names::Add("N2", c.Get(2));
230 Names::Add("N3", c.Get(3));
231 Names::Add("N4", c.Get(4));
232 Names::Add("N5", c.Get(5));
233 n0n2 = NodeContainer(c.Get(0), c.Get(2));
234 n1n2 = NodeContainer(c.Get(1), c.Get(2));
235 n2n3 = NodeContainer(c.Get(2), c.Get(3));
236 n3n4 = NodeContainer(c.Get(3), c.Get(4));
237 n3n5 = NodeContainer(c.Get(3), c.Get(5));
238
239 Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpNewReno"));
240 // 42 = headers size
241 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1000 - 42));
242 Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(1));
243 GlobalValue::Bind("ChecksumEnabled", BooleanValue(false));
244
245 uint32_t meanPktSize = 1000;
246
247 // RED params
248 NS_LOG_INFO("Set RED params");
249 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("1000p"));
250 Config::SetDefault("ns3::RedQueueDisc::MeanPktSize", UintegerValue(meanPktSize));
251 Config::SetDefault("ns3::RedQueueDisc::Wait", BooleanValue(true));
252 Config::SetDefault("ns3::RedQueueDisc::Gentle", BooleanValue(true));
253 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.002));
254 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(5));
255 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(15));
256
257 if (aredTest == 1) // test 1: red1
258 {
259 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
260 }
261 else if (aredTest == 2) // test 2: red1Adapt
262 {
263 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
264 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
265 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
266 }
267 else if (aredTest == 3) // test 3: red1ECN
268 {
269 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
270 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
271 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
272 }
273 else if (aredTest == 4) // test 4: red1AdaptECN
274 {
275 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
276 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
277 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("25p"));
278 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
279 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
280 }
281 else if (aredTest == 7) // test 7: fastlinkAutowq
282 {
283 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.0));
284 }
285 else if (aredTest == 8) // test 8: fastlinkAutothresh
286 {
287 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(0));
288 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(0));
289 }
290 else if (aredTest == 9) // test 9: fastlinkAdaptive
291 {
292 Config::SetDefault("ns3::RedQueueDisc::AdaptMaxP", BooleanValue(true));
293 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
294 }
295 else if (aredTest == 10) // test 10: fastlinkAllAdapt
296 {
297 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
298 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
299 }
300 else if (aredTest == 11) // test 11: fastlinkAllAdaptECN
301 {
302 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
303 Config::SetDefault("ns3::RedQueueDisc::UseHardDrop", BooleanValue(false));
304 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
305 Config::SetDefault("ns3::TcpSocketBase::UseEcn", StringValue("On"));
306 Config::SetDefault("ns3::RedQueueDisc::UseEcn", BooleanValue(true));
307 }
308 else if (aredTest == 12) // test 12: fastlinkAllAdapt1
309 {
310 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
311 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
312 Config::SetDefault("ns3::RedQueueDisc::TargetDelay", TimeValue(Seconds(0.2)));
313 }
314 else if (aredTest == 13) // test 13: longlink
315 {
316 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
317 }
318 else if (aredTest == 14) // test 14: longlinkAdapt
319 {
320 Config::SetDefault("ns3::RedQueueDisc::ARED", BooleanValue(true));
321 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
322 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
323 }
324 else if (aredTest == 15) // test 15: longlinkAdapt1
325 {
326 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(-1.0));
327 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(0));
328 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(0));
329 Config::SetDefault("ns3::RedQueueDisc::AdaptMaxP", BooleanValue(true));
330 Config::SetDefault("ns3::RedQueueDisc::LInterm", DoubleValue(10));
331 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("100p"));
332 }
333
334 NS_LOG_INFO("Install internet stack on all nodes.");
336 internet.Install(c);
337
338 TrafficControlHelper tchPfifo;
339 uint16_t handle = tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
340 tchPfifo.AddInternalQueues(handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue("1000p"));
341
343 tchRed.SetRootQueueDisc("ns3::RedQueueDisc",
344 "LinkBandwidth",
345 StringValue(aredLinkDataRate),
346 "LinkDelay",
347 StringValue(aredLinkDelay));
348
349 NS_LOG_INFO("Create channels");
351
352 NetDeviceContainer devn0n2;
353 NetDeviceContainer devn1n2;
354 NetDeviceContainer devn2n3;
355 NetDeviceContainer devn3n4;
356 NetDeviceContainer devn3n5;
357
358 QueueDiscContainer queueDiscs;
359
360 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4)
361 {
362 p2p.SetQueue("ns3::DropTailQueue");
363 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
364 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
365 devn0n2 = p2p.Install(n0n2);
366 tchPfifo.Install(devn0n2);
367
368 p2p.SetQueue("ns3::DropTailQueue");
369 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
370 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
371 devn1n2 = p2p.Install(n1n2);
372 tchPfifo.Install(devn1n2);
373
374 p2p.SetQueue("ns3::DropTailQueue");
375 p2p.SetDeviceAttribute("DataRate", StringValue(aredLinkDataRate));
376 p2p.SetChannelAttribute("Delay", StringValue(aredLinkDelay));
377 devn2n3 = p2p.Install(n2n3);
378 // only backbone link has ARED queue disc
379 queueDiscs = tchRed.Install(devn2n3);
380
381 p2p.SetQueue("ns3::DropTailQueue");
382 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
383 p2p.SetChannelAttribute("Delay", StringValue("4ms"));
384 devn3n4 = p2p.Install(n3n4);
385 tchPfifo.Install(devn3n4);
386
387 p2p.SetQueue("ns3::DropTailQueue");
388 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
389 p2p.SetChannelAttribute("Delay", StringValue("5ms"));
390 devn3n5 = p2p.Install(n3n5);
391 tchPfifo.Install(devn3n5);
392 }
393 else if (aredTest == 13 || aredTest == 14 || aredTest == 15)
394 {
395 p2p.SetQueue("ns3::DropTailQueue");
396 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
397 p2p.SetChannelAttribute("Delay", StringValue("0ms"));
398 devn0n2 = p2p.Install(n0n2);
399 tchPfifo.Install(devn0n2);
400
401 p2p.SetQueue("ns3::DropTailQueue");
402 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
403 p2p.SetChannelAttribute("Delay", StringValue("1ms"));
404 devn1n2 = p2p.Install(n1n2);
405 tchPfifo.Install(devn1n2);
406
407 p2p.SetQueue("ns3::DropTailQueue");
408 p2p.SetDeviceAttribute("DataRate", StringValue(aredLinkDataRate));
409 p2p.SetChannelAttribute("Delay", StringValue("100ms"));
410 devn2n3 = p2p.Install(n2n3);
411 // only backbone link has ARED queue disc
412 queueDiscs = tchRed.Install(devn2n3);
413
414 p2p.SetQueue("ns3::DropTailQueue");
415 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
416 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
417 devn3n4 = p2p.Install(n3n4);
418 tchPfifo.Install(devn3n4);
419
420 p2p.SetQueue("ns3::DropTailQueue");
421 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
422 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
423 devn3n5 = p2p.Install(n3n5);
424 tchPfifo.Install(devn3n5);
425 }
426 else if (aredTest == 6 || aredTest == 7 || aredTest == 8 || aredTest == 9 || aredTest == 10 ||
427 aredTest == 11 || aredTest == 12)
428 {
429 p2p.SetQueue("ns3::DropTailQueue");
430 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
431 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
432 devn0n2 = p2p.Install(n0n2);
433 tchPfifo.Install(devn0n2);
434
435 p2p.SetQueue("ns3::DropTailQueue");
436 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
437 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
438 devn1n2 = p2p.Install(n1n2);
439 tchPfifo.Install(devn1n2);
440
441 p2p.SetQueue("ns3::DropTailQueue");
442 p2p.SetDeviceAttribute("DataRate", StringValue("15Mbps"));
443 p2p.SetChannelAttribute("Delay", StringValue(aredLinkDelay));
444 devn2n3 = p2p.Install(n2n3);
445 // only backbone link has ARED queue disc
446 queueDiscs = tchRed.Install(devn2n3);
447
448 p2p.SetQueue("ns3::DropTailQueue");
449 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
450 p2p.SetChannelAttribute("Delay", StringValue("4ms"));
451 devn3n4 = p2p.Install(n3n4);
452 tchPfifo.Install(devn3n4);
453
454 p2p.SetQueue("ns3::DropTailQueue");
455 p2p.SetDeviceAttribute("DataRate", StringValue("100Mbps"));
456 p2p.SetChannelAttribute("Delay", StringValue("5ms"));
457 devn3n5 = p2p.Install(n3n5);
458 tchPfifo.Install(devn3n5);
459 }
460
461 NS_LOG_INFO("Assign IP Addresses");
463
464 ipv4.SetBase("10.1.1.0", "255.255.255.0");
465 i0i2 = ipv4.Assign(devn0n2);
466
467 ipv4.SetBase("10.1.2.0", "255.255.255.0");
468 i1i2 = ipv4.Assign(devn1n2);
469
470 ipv4.SetBase("10.1.3.0", "255.255.255.0");
471 i2i3 = ipv4.Assign(devn2n3);
472
473 ipv4.SetBase("10.1.4.0", "255.255.255.0");
474 i3i4 = ipv4.Assign(devn3n4);
475
476 ipv4.SetBase("10.1.5.0", "255.255.255.0");
477 i3i5 = ipv4.Assign(devn3n5);
478
479 // Set up the routing
481
482 BuildAppsTest(aredTest);
483
484 if (writePcap)
485 {
487 std::stringstream stmp;
488 stmp << pathOut << "/ared";
489 ptp.EnablePcapAll(stmp.str());
490 }
491
492 Ptr<FlowMonitor> flowmon;
493 if (flowMonitor)
494 {
495 FlowMonitorHelper flowmonHelper;
496 flowmon = flowmonHelper.InstallAll();
497 }
498
499 if (writeForPlot)
500 {
501 filePlotQueueDisc << pathOut << "/"
502 << "ared-queue-disc.plotme";
503 filePlotQueueDiscAvg << pathOut << "/"
504 << "ared-queue-disc_avg.plotme";
505
506 remove(filePlotQueueDisc.str().c_str());
507 remove(filePlotQueueDiscAvg.str().c_str());
508 Ptr<QueueDisc> queue = queueDiscs.Get(0);
510 }
511
514
515 QueueDisc::Stats st = queueDiscs.Get(0)->GetStats();
516
519 {
520 std::cout << "There should be some unforced drops or marks" << std::endl;
521 exit(1);
522 }
523
524 if (aredTest == 1 || aredTest == 2 || aredTest == 3 || aredTest == 4 || aredTest == 13)
525 {
527 {
528 std::cout << "There should be some drops due to queue full" << std::endl;
529 exit(1);
530 }
531 }
532 else
533 {
535 {
536 std::cout << "There should be zero drops due to queue full" << std::endl;
537 exit(1);
538 }
539 }
540
541 if (flowMonitor)
542 {
543 std::stringstream stmp;
544 stmp << pathOut << "/ared.flowmon";
545
546 flowmon->SerializeToXmlFile(stmp.str(), false, false);
547 }
548
549 if (printAredStats)
550 {
551 std::cout << "*** ARED stats from Node 2 queue ***" << std::endl;
552 std::cout << st << std::endl;
553 }
554
556
557 return 0;
558}
Ipv4InterfaceContainer i0i2
IPv4 interface container i0 + i2.
std::stringstream filePlotQueueDisc
Output file name for queue disc size.
double client_start_time
Client start time.
double sink_stop_time
Sink stop time.
double sink_start_time
Sink start time.
double global_stop_time
Global stop time.
std::stringstream filePlotQueueDiscAvg
Output file name for queue disc average.
NodeContainer n2n3
Nodecontainer n2 + n3.
void CheckQueueDiscSize(Ptr< QueueDisc > queue)
Check the queue disc size and write its stats to the output files.
NodeContainer n1n2
Nodecontainer n1 + n2.
double avgQueueDiscSize
Average QueueDisc size.
NodeContainer n3n4
Nodecontainer n3 + n4.
double global_start_time
Global start time.
Ipv4InterfaceContainer i1i2
IPv4 interface container i1 + i2.
Ipv4InterfaceContainer i3i4
IPv4 interface container i3 + i4.
NodeContainer n0n2
Nodecontainer n0 + n2.
double client_stop_time
Client stop time.
uint32_t checkTimes
Number of times the queues have been checked.
NodeContainer n3n5
Nodecontainer n3 + n5.
Ipv4InterfaceContainer i3i5
IPv4 interface container i3 + i5.
Ipv4InterfaceContainer i2i3
IPv4 interface container i2 + i3.
a polymophic address class
Definition address.h:90
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Parse command-line arguments.
Class for representing data rates.
Definition data-rate.h:78
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Helper to enable IP flow monitoring on a set of Nodes.
Ptr< FlowMonitor > InstallAll()
Enable flow monitoring on all nodes.
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...
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
Definition names.cc:764
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
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 ...
Build a set of PointToPointNetDevice objects.
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::QueueDisc pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
static constexpr const char * INTERNAL_QUEUE_DROP
Packet dropped by an internal queue.
Definition queue-disc.h:511
const Stats & GetStats()
Retrieve all the collected statistics.
static constexpr const char * UNFORCED_DROP
Early probability drops.
static constexpr const char * UNFORCED_MARK
Early probability marks.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:594
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Hold variables of type string.
Definition string.h:45
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, Args &&... args)
Helper function used to add the given number of internal queues (of the given type and with the given...
Hold an unsigned integer type.
Definition uinteger.h:34
uint16_t port
Definition dsdv-manet.cc:33
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:883
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition log.cc:291
@ LOG_LEVEL_INFO
LOG_INFO and above.
Definition log.h:93
-ns3 Test suite for the ns3 wrapper script
void BuildAppsTest()
Structure that keeps the queue disc statistics.
Definition queue-disc.h:177
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.