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