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