A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
red-tests.cc
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 * Authors: Marcos Talau <talau@users.sourceforge.net>
16 * Duy Nguyen <duy@soe.ucsc.edu>
17 * Modified by: Pasquale Imputato <p.imputato@gmail.com>
18 *
19 */
20
21/**
22 * These validation tests are detailed in http://icir.org/floyd/papers/redsims.ps
23 *
24 * In this code the tests 1, 3, 4 and 5 refer to the tests corresponding to
25 * Figure 1, 3, 4, and 5 respectively from the document mentioned above.
26 */
27
28/** Network topology
29 *
30 * 10Mb/s, 2ms 10Mb/s, 4ms
31 * n0--------------| |---------------n4
32 * | 1.5Mbps/s, 20ms |
33 * n2------------------n3
34 * 10Mb/s, 3ms | | 10Mb/s, 5ms
35 * n1--------------| |---------------n5
36 *
37 *
38 */
39
40#include "ns3/applications-module.h"
41#include "ns3/core-module.h"
42#include "ns3/flow-monitor-helper.h"
43#include "ns3/internet-module.h"
44#include "ns3/network-module.h"
45#include "ns3/point-to-point-module.h"
46#include "ns3/traffic-control-module.h"
47
48using namespace ns3;
49
50NS_LOG_COMPONENT_DEFINE("RedTests");
51
52uint32_t checkTimes; //!< Number of times the queues have been checked.
53double avgQueueSize; //!< Average Queue size.
54
55// The times
56double global_start_time; //!< Global start time
57double global_stop_time; //!< Global stop time.
58double sink_start_time; //!< Sink start time.
59double sink_stop_time; //!< Sink stop time.
60double client_start_time; //!< Client start time.
61double client_stop_time; //!< Client stop time.
62
63NodeContainer n0n2; //!< Nodecontainer n0 + n2.
64NodeContainer n1n2; //!< Nodecontainer n1 + n2.
65NodeContainer n2n3; //!< Nodecontainer n2 + n3.
66NodeContainer n3n4; //!< Nodecontainer n3 + n4.
67NodeContainer n3n5; //!< Nodecontainer n3 + n5.
68
69Ipv4InterfaceContainer i0i2; //!< IPv4 interface container i0 + i2.
70Ipv4InterfaceContainer i1i2; //!< IPv4 interface container i1 + i2.
71Ipv4InterfaceContainer i2i3; //!< IPv4 interface container i2 + i3.
72Ipv4InterfaceContainer i3i4; //!< IPv4 interface container i3 + i4.
73Ipv4InterfaceContainer i3i5; //!< IPv4 interface container i3 + i5.
74
75std::stringstream filePlotQueue; //!< Output file name for queue size.
76std::stringstream filePlotQueueAvg; //!< Output file name for queue average.
77
78/**
79 * Check the queue size and write its stats to the output files.
80 *
81 * \param queue The queue to check.
82 */
83void
85{
86 uint32_t qSize = queue->GetCurrentSize().GetValue();
87
88 avgQueueSize += qSize;
89 checkTimes++;
90
91 // check queue size every 1/100 of a second
93
94 std::ofstream fPlotQueue(filePlotQueue.str(), std::ios::out | std::ios::app);
95 fPlotQueue << Simulator::Now().GetSeconds() << " " << qSize << std::endl;
96 fPlotQueue.close();
97
98 std::ofstream fPlotQueueAvg(filePlotQueueAvg.str(), std::ios::out | std::ios::app);
99 fPlotQueueAvg << Simulator::Now().GetSeconds() << " " << avgQueueSize / checkTimes << std::endl;
100 fPlotQueueAvg.close();
101}
102
103/**
104 * Setup the apps.
105 *
106 * \param test The test number.
107 */
108void
110{
111 if ((test == 1) || (test == 3))
112 {
113 // SINK is in the right side
114 uint16_t port = 50000;
116 PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", sinkLocalAddress);
117 ApplicationContainer sinkApp = sinkHelper.Install(n3n4.Get(1));
118 sinkApp.Start(Seconds(sink_start_time));
119 sinkApp.Stop(Seconds(sink_stop_time));
120
121 // Connection one
122 // Clients are in left side
123 /*
124 * Create the OnOff applications to send TCP to the server
125 * onoffhelper is a client that send data to TCP destination
126 */
127 OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
128 clientHelper1.SetAttribute("OnTime",
129 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
130 clientHelper1.SetAttribute("OffTime",
131 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
132 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
133 clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
134
135 ApplicationContainer clientApps1;
137 clientHelper1.SetAttribute("Remote", remoteAddress);
138 clientApps1.Add(clientHelper1.Install(n0n2.Get(0)));
139 clientApps1.Start(Seconds(client_start_time));
140 clientApps1.Stop(Seconds(client_stop_time));
141
142 // Connection two
143 OnOffHelper clientHelper2("ns3::TcpSocketFactory", Address());
144 clientHelper2.SetAttribute("OnTime",
145 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
146 clientHelper2.SetAttribute("OffTime",
147 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
148 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
149 clientHelper2.SetAttribute("PacketSize", UintegerValue(1000));
150
151 ApplicationContainer clientApps2;
152 clientHelper2.SetAttribute("Remote", remoteAddress);
153 clientApps2.Add(clientHelper2.Install(n1n2.Get(0)));
154 clientApps2.Start(Seconds(3.0));
155 clientApps2.Stop(Seconds(client_stop_time));
156 }
157 else // 4 or 5
158 {
159 // SINKs
160 // #1
161 uint16_t port1 = 50001;
162 Address sinkLocalAddress1(InetSocketAddress(Ipv4Address::GetAny(), port1));
163 PacketSinkHelper sinkHelper1("ns3::TcpSocketFactory", sinkLocalAddress1);
164 ApplicationContainer sinkApp1 = sinkHelper1.Install(n3n4.Get(1));
165 sinkApp1.Start(Seconds(sink_start_time));
166 sinkApp1.Stop(Seconds(sink_stop_time));
167 // #2
168 uint16_t port2 = 50002;
169 Address sinkLocalAddress2(InetSocketAddress(Ipv4Address::GetAny(), port2));
170 PacketSinkHelper sinkHelper2("ns3::TcpSocketFactory", sinkLocalAddress2);
171 ApplicationContainer sinkApp2 = sinkHelper2.Install(n3n5.Get(1));
172 sinkApp2.Start(Seconds(sink_start_time));
173 sinkApp2.Stop(Seconds(sink_stop_time));
174 // #3
175 uint16_t port3 = 50003;
176 Address sinkLocalAddress3(InetSocketAddress(Ipv4Address::GetAny(), port3));
177 PacketSinkHelper sinkHelper3("ns3::TcpSocketFactory", sinkLocalAddress3);
178 ApplicationContainer sinkApp3 = sinkHelper3.Install(n0n2.Get(0));
179 sinkApp3.Start(Seconds(sink_start_time));
180 sinkApp3.Stop(Seconds(sink_stop_time));
181 // #4
182 uint16_t port4 = 50004;
183 Address sinkLocalAddress4(InetSocketAddress(Ipv4Address::GetAny(), port4));
184 PacketSinkHelper sinkHelper4("ns3::TcpSocketFactory", sinkLocalAddress4);
185 ApplicationContainer sinkApp4 = sinkHelper4.Install(n1n2.Get(0));
186 sinkApp4.Start(Seconds(sink_start_time));
187 sinkApp4.Stop(Seconds(sink_stop_time));
188
189 // Connection #1
190 /*
191 * Create the OnOff applications to send TCP to the server
192 * onoffhelper is a client that send data to TCP destination
193 */
194 OnOffHelper clientHelper1("ns3::TcpSocketFactory", Address());
195 clientHelper1.SetAttribute("OnTime",
196 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
197 clientHelper1.SetAttribute("OffTime",
198 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
199 clientHelper1.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
200 clientHelper1.SetAttribute("PacketSize", UintegerValue(1000));
201
202 ApplicationContainer clientApps1;
203 AddressValue remoteAddress1(InetSocketAddress(i3i4.GetAddress(1), port1));
204 clientHelper1.SetAttribute("Remote", remoteAddress1);
205 clientApps1.Add(clientHelper1.Install(n0n2.Get(0)));
206 clientApps1.Start(Seconds(client_start_time));
207 clientApps1.Stop(Seconds(client_stop_time));
208
209 // Connection #2
210 OnOffHelper clientHelper2("ns3::TcpSocketFactory", Address());
211 clientHelper2.SetAttribute("OnTime",
212 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
213 clientHelper2.SetAttribute("OffTime",
214 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
215 clientHelper2.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
216 clientHelper2.SetAttribute("PacketSize", UintegerValue(1000));
217
218 ApplicationContainer clientApps2;
219 AddressValue remoteAddress2(InetSocketAddress(i3i5.GetAddress(1), port2));
220 clientHelper2.SetAttribute("Remote", remoteAddress2);
221 clientApps2.Add(clientHelper2.Install(n1n2.Get(0)));
222 clientApps2.Start(Seconds(2.0));
223 clientApps2.Stop(Seconds(client_stop_time));
224
225 // Connection #3
226 OnOffHelper clientHelper3("ns3::TcpSocketFactory", Address());
227 clientHelper3.SetAttribute("OnTime",
228 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
229 clientHelper3.SetAttribute("OffTime",
230 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
231 clientHelper3.SetAttribute("DataRate", DataRateValue(DataRate("10Mb/s")));
232 clientHelper3.SetAttribute("PacketSize", UintegerValue(1000));
233
234 ApplicationContainer clientApps3;
235 AddressValue remoteAddress3(InetSocketAddress(i0i2.GetAddress(0), port3));
236 clientHelper3.SetAttribute("Remote", remoteAddress3);
237 clientApps3.Add(clientHelper3.Install(n3n4.Get(1)));
238 clientApps3.Start(Seconds(3.5));
239 clientApps3.Stop(Seconds(client_stop_time));
240
241 // Connection #4
242 OnOffHelper clientHelper4("ns3::TcpSocketFactory", Address());
243 clientHelper4.SetAttribute("OnTime",
244 StringValue("ns3::ConstantRandomVariable[Constant=1]"));
245 clientHelper4.SetAttribute("OffTime",
246 StringValue("ns3::ConstantRandomVariable[Constant=0]"));
247 clientHelper4.SetAttribute("DataRate", DataRateValue(DataRate("40b/s")));
248 clientHelper4.SetAttribute("PacketSize", UintegerValue(5 * 8)); // telnet
249
250 ApplicationContainer clientApps4;
251 AddressValue remoteAddress4(InetSocketAddress(i1i2.GetAddress(0), port4));
252 clientHelper4.SetAttribute("Remote", remoteAddress4);
253 clientApps4.Add(clientHelper4.Install(n3n5.Get(1)));
254 clientApps4.Start(Seconds(1.0));
255 clientApps4.Stop(Seconds(client_stop_time));
256 }
257}
258
259int
260main(int argc, char* argv[])
261{
262 LogComponentEnable("RedQueueDisc", LOG_LEVEL_INFO);
263
264 uint32_t redTest;
265 std::string redLinkDataRate = "1.5Mbps";
266 std::string redLinkDelay = "20ms";
267
268 std::string pathOut;
269 bool writeForPlot = false;
270 bool writePcap = false;
271 bool flowMonitor = false;
272
273 bool printRedStats = true;
274
275 global_start_time = 0.0;
276 global_stop_time = 11;
281
282 // Configuration and command line parameter parsing
283 redTest = 1;
284 // Will only save in the directory if enable opts below
285 pathOut = "."; // Current directory
286 CommandLine cmd(__FILE__);
287 cmd.AddValue("testNumber", "Run test 1, 3, 4 or 5", redTest);
288 cmd.AddValue("pathOut",
289 "Path to save results from --writeForPlot/--writePcap/--writeFlowMonitor",
290 pathOut);
291 cmd.AddValue("writeForPlot", "Write results for plot (gnuplot)", writeForPlot);
292 cmd.AddValue("writePcap", "Write results in pcapfile", writePcap);
293 cmd.AddValue("writeFlowMonitor", "Enable Flow Monitor and write their results", flowMonitor);
294
295 cmd.Parse(argc, argv);
296 if ((redTest != 1) && (redTest != 3) && (redTest != 4) && (redTest != 5))
297 {
298 NS_ABORT_MSG("Invalid test number. Supported tests are 1, 3, 4 or 5");
299 }
300
301 NS_LOG_INFO("Create nodes");
303 c.Create(6);
304 Names::Add("N0", c.Get(0));
305 Names::Add("N1", c.Get(1));
306 Names::Add("N2", c.Get(2));
307 Names::Add("N3", c.Get(3));
308 Names::Add("N4", c.Get(4));
309 Names::Add("N5", c.Get(5));
310 n0n2 = NodeContainer(c.Get(0), c.Get(2));
311 n1n2 = NodeContainer(c.Get(1), c.Get(2));
312 n2n3 = NodeContainer(c.Get(2), c.Get(3));
313 n3n4 = NodeContainer(c.Get(3), c.Get(4));
314 n3n5 = NodeContainer(c.Get(3), c.Get(5));
315
316 Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpNewReno"));
317 // 42 = headers size
318 Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1000 - 42));
319 Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(1));
320 GlobalValue::Bind("ChecksumEnabled", BooleanValue(false));
321
322 uint32_t meanPktSize = 500;
323
324 // RED params
325 NS_LOG_INFO("Set RED params");
326 Config::SetDefault("ns3::RedQueueDisc::MaxSize", StringValue("1000p"));
327 Config::SetDefault("ns3::RedQueueDisc::MeanPktSize", UintegerValue(meanPktSize));
328 Config::SetDefault("ns3::RedQueueDisc::Wait", BooleanValue(true));
329 Config::SetDefault("ns3::RedQueueDisc::Gentle", BooleanValue(true));
330 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.002));
331 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(5));
332 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(15));
333
334 if (redTest == 3) // test like 1, but with bad params
335 {
336 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(10));
337 Config::SetDefault("ns3::RedQueueDisc::QW", DoubleValue(0.003));
338 }
339 else if (redTest == 5) // test 5, same of test 4, but in byte mode
340 {
341 Config::SetDefault("ns3::RedQueueDisc::MaxSize",
342 QueueSizeValue(QueueSize(QueueSizeUnit::BYTES, 1000 * meanPktSize)));
343 Config::SetDefault("ns3::RedQueueDisc::Ns1Compat", BooleanValue(true));
344 Config::SetDefault("ns3::RedQueueDisc::MinTh", DoubleValue(5 * meanPktSize));
345 Config::SetDefault("ns3::RedQueueDisc::MaxTh", DoubleValue(15 * meanPktSize));
346 }
347
348 NS_LOG_INFO("Install internet stack on all nodes.");
350 internet.Install(c);
351
352 TrafficControlHelper tchPfifo;
353 uint16_t handle = tchPfifo.SetRootQueueDisc("ns3::PfifoFastQueueDisc");
354 tchPfifo.AddInternalQueues(handle, 3, "ns3::DropTailQueue", "MaxSize", StringValue("1000p"));
355
357 tchRed.SetRootQueueDisc("ns3::RedQueueDisc",
358 "LinkBandwidth",
359 StringValue(redLinkDataRate),
360 "LinkDelay",
361 StringValue(redLinkDelay));
362
363 NS_LOG_INFO("Create channels");
365
366 p2p.SetQueue("ns3::DropTailQueue");
367 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
368 p2p.SetChannelAttribute("Delay", StringValue("2ms"));
369 NetDeviceContainer devn0n2 = p2p.Install(n0n2);
370 tchPfifo.Install(devn0n2);
371
372 p2p.SetQueue("ns3::DropTailQueue");
373 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
374 p2p.SetChannelAttribute("Delay", StringValue("3ms"));
375 NetDeviceContainer devn1n2 = p2p.Install(n1n2);
376 tchPfifo.Install(devn1n2);
377
378 p2p.SetQueue("ns3::DropTailQueue");
379 p2p.SetDeviceAttribute("DataRate", StringValue(redLinkDataRate));
380 p2p.SetChannelAttribute("Delay", StringValue(redLinkDelay));
381 NetDeviceContainer devn2n3 = p2p.Install(n2n3);
382 // only backbone link has RED queue disc
383 QueueDiscContainer queueDiscs = tchRed.Install(devn2n3);
384
385 p2p.SetQueue("ns3::DropTailQueue");
386 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
387 p2p.SetChannelAttribute("Delay", StringValue("4ms"));
388 NetDeviceContainer devn3n4 = p2p.Install(n3n4);
389 tchPfifo.Install(devn3n4);
390
391 p2p.SetQueue("ns3::DropTailQueue");
392 p2p.SetDeviceAttribute("DataRate", StringValue("10Mbps"));
393 p2p.SetChannelAttribute("Delay", StringValue("5ms"));
394 NetDeviceContainer devn3n5 = p2p.Install(n3n5);
395 tchPfifo.Install(devn3n5);
396
397 NS_LOG_INFO("Assign IP Addresses");
399
400 ipv4.SetBase("10.1.1.0", "255.255.255.0");
401 i0i2 = ipv4.Assign(devn0n2);
402
403 ipv4.SetBase("10.1.2.0", "255.255.255.0");
404 i1i2 = ipv4.Assign(devn1n2);
405
406 ipv4.SetBase("10.1.3.0", "255.255.255.0");
407 i2i3 = ipv4.Assign(devn2n3);
408
409 ipv4.SetBase("10.1.4.0", "255.255.255.0");
410 i3i4 = ipv4.Assign(devn3n4);
411
412 ipv4.SetBase("10.1.5.0", "255.255.255.0");
413 i3i5 = ipv4.Assign(devn3n5);
414
415 // Set up the routing
417
418 if (redTest == 5)
419 {
420 // like in ns2 test, r2 -> r1, have a queue in packet mode
421 Ptr<QueueDisc> queue = queueDiscs.Get(1);
422
423 queue->SetMaxSize(QueueSize("1000p"));
424 StaticCast<RedQueueDisc>(queue)->SetTh(5, 15);
425 }
426
427 BuildAppsTest(redTest);
428
429 if (writePcap)
430 {
432 std::stringstream stmp;
433 stmp << pathOut << "/red";
434 ptp.EnablePcapAll(stmp.str());
435 }
436
437 Ptr<FlowMonitor> flowmon;
438 if (flowMonitor)
439 {
440 FlowMonitorHelper flowmonHelper;
441 flowmon = flowmonHelper.InstallAll();
442 }
443
444 if (writeForPlot)
445 {
446 filePlotQueue << pathOut << "/"
447 << "red-queue.plotme";
448 filePlotQueueAvg << pathOut << "/"
449 << "red-queue_avg.plotme";
450
451 remove(filePlotQueue.str().c_str());
452 remove(filePlotQueueAvg.str().c_str());
453 Ptr<QueueDisc> queue = queueDiscs.Get(0);
455 }
456
459
460 if (flowMonitor)
461 {
462 std::stringstream stmp;
463 stmp << pathOut << "/red.flowmon";
464
465 flowmon->SerializeToXmlFile(stmp.str(), false, false);
466 }
467
468 if (printRedStats)
469 {
470 QueueDisc::Stats st = queueDiscs.Get(0)->GetStats();
471 std::cout << "*** RED stats from Node 2 queue disc ***" << std::endl;
472 std::cout << st << std::endl;
473
474 st = queueDiscs.Get(1)->GetStats();
475 std::cout << "*** RED stats from Node 3 queue disc ***" << std::endl;
476 std::cout << st << std::endl;
477 }
478
480
481 return 0;
482}
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.
const Stats & GetStats()
Retrieve all the collected statistics.
Definition: queue-disc.cc:412
Class for representing queue sizes.
Definition: queue-size.h:96
AttributeValue implementation for QueueSize.
Definition: queue-size.h:221
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
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
std::ofstream fPlotQueue
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:894
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#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:1319
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
Ipv4InterfaceContainer i0i2
IPv4 interface container i0 + i2.
Definition: red-tests.cc:69
double client_start_time
Client start time.
Definition: red-tests.cc:60
double sink_stop_time
Sink stop time.
Definition: red-tests.cc:59
double sink_start_time
Sink start time.
Definition: red-tests.cc:58
double global_stop_time
Global stop time.
Definition: red-tests.cc:57
NodeContainer n2n3
Nodecontainer n2 + n3.
Definition: red-tests.cc:65
double avgQueueSize
Average Queue size.
Definition: red-tests.cc:53
NodeContainer n1n2
Nodecontainer n1 + n2.
Definition: red-tests.cc:64
NodeContainer n3n4
Nodecontainer n3 + n4.
Definition: red-tests.cc:66
std::stringstream filePlotQueueAvg
Output file name for queue average.
Definition: red-tests.cc:76
void CheckQueueSize(Ptr< QueueDisc > queue)
Check the queue size and write its stats to the output files.
Definition: red-tests.cc:84
std::stringstream filePlotQueue
Output file name for queue size.
Definition: red-tests.cc:75
double global_start_time
Global start time.
Definition: red-tests.cc:56
Ipv4InterfaceContainer i1i2
IPv4 interface container i1 + i2.
Definition: red-tests.cc:70
Ipv4InterfaceContainer i3i4
IPv4 interface container i3 + i4.
Definition: red-tests.cc:72
NodeContainer n0n2
Nodecontainer n0 + n2.
Definition: red-tests.cc:63
double client_stop_time
Client stop time.
Definition: red-tests.cc:61
uint32_t checkTimes
Number of times the queues have been checked.
Definition: red-tests.cc:52
NodeContainer n3n5
Nodecontainer n3 + n5.
Definition: red-tests.cc:67
Ipv4InterfaceContainer i3i5
IPv4 interface container i3 + i5.
Definition: red-tests.cc:73
Ipv4InterfaceContainer i2i3
IPv4 interface container i2 + i3.
Definition: red-tests.cc:71
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:188