22 #include "ns3/core-module.h"
23 #include "ns3/network-module.h"
24 #include "ns3/internet-module.h"
25 #include "ns3/point-to-point-module.h"
26 #include "ns3/applications-module.h"
27 #include "ns3/traffic-control-module.h"
36 virtual void DoRun (
void);
43 :
TestCase (
"Sanity check on automatically set parameters of ARED")
51 uint32_t modeSize = 1;
55 "Verify that we can actually set the attribute Mode");
60 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
66 double minTh = 70 * modeSize;
67 double maxTh = 150 * modeSize;
68 uint32_t qSize = 300 * modeSize;
73 "Verify that we can actually set the attribute Mode");
75 "Verify that we can actually set the attribute MinTh");
77 "Verify that we can actually set the attribute MaxTh");
79 "Verify that we can actually set the attribute QueueLimit");
81 "Verify that we can actually set the attribute QW");
90 queue = CreateObject<RedQueueDisc> ();
92 "Verify that we can actually set the attribute Mode");
94 "Verify that we can actually set the attribute MinTh");
96 "Verify that we can actually set the attribute MaxTh");
98 "Verify that we can actually set the attribute QueueLimit");
100 "Verify that we can actually set the attribute QW");
102 "Verify that we can actually set the attribute LinkBandwidth");
105 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
111 queue = CreateObject<RedQueueDisc> ();
113 "Verify that we can actually set the attribute Mode");
115 "Verify that we can actually set the attribute MinTh");
117 "Verify that we can actually set the attribute MaxTh");
119 "Verify that we can actually set the attribute QueueLimit");
121 "Verify that we can actually set the attribute QW");
124 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
130 queue = CreateObject<RedQueueDisc> ();
132 "Verify that we can actually set the attribute Mode");
134 "Verify that we can actually set the attribute MinTh");
136 "Verify that we can actually set the attribute MaxTh");
138 "Verify that we can actually set the attribute QueueLimit");
140 "Verify that we can actually set the attribute QW");
142 "Verify that we can actually set the attribute LinkBandwidth");
145 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
151 queue = CreateObject<RedQueueDisc> ();
153 "Verify that we can actually set the attribute Mode");
155 "Verify that we can actually set the attribute MinTh");
157 "Verify that we can actually set the attribute MaxTh");
159 "Verify that we can actually set the attribute QueueLimit");
161 "Verify that we can actually set the attribute QW");
164 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
170 queue = CreateObject<RedQueueDisc> ();
172 "Verify that we can actually set the attribute Mode");
174 "Verify that we can actually set the attribute MinTh");
176 "Verify that we can actually set the attribute MaxTh");
178 "Verify that we can actually set the attribute QueueLimit");
180 "Verify that we can actually set the attribute QW");
182 "Verify that we can actually set the attribute LinkBandwidth");
185 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
191 queue = CreateObject<RedQueueDisc> ();
193 "Verify that we can actually set the attribute Mode");
195 "Verify that we can actually set the attribute MinTh");
197 "Verify that we can actually set the attribute MaxTh");
199 "Verify that we can actually set the attribute QueueLimit");
200 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
203 "Verify that we can actually set the attribute MeanPktSize");
207 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
214 queue = CreateObject<RedQueueDisc> ();
216 "Verify that we can actually set the attribute Mode");
218 "Verify that we can actually set the attribute MinTh");
220 "Verify that we can actually set the attribute MaxTh");
222 "Verify that we can actually set the attribute QueueLimit");
224 "Verify that we can actually set the attribute LinkBandwidth");
225 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
228 "Verify that we can actually set the attribute MeanPktSize");
232 st = StaticCast<RedQueueDisc> (queue)->GetStats ();
242 for (uint32_t i = 0; i < nPkt; i++)
244 queue->
Enqueue (Create<Ipv4QueueDiscItem> (Create<Packet> (size), dest, 0, ipHeader));
253 Simulator::Destroy ();
262 virtual void DoRun (
void);
268 :
TestCase (
"Sanity check on adaptive parameter of ARED")
275 uint32_t pktSize = 1000;
276 uint32_t modeSize = 1;
277 std::string aredLinkDataRate =
"1.5Mbps";
278 std::string aredLinkDelay =
"20ms";
311 GlobalValue::Bind (
"ChecksumEnabled",
BooleanValue (
false));
313 uint32_t meanPktSize = 1000;
318 "Verify that we can actually set the attribute Mode");
322 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
327 uint32_t qSize = 25 * modeSize;
357 p2p.
SetQueue (
"ns3::DropTailQueue");
363 p2p.
SetQueue (
"ns3::DropTailQueue");
369 p2p.
SetQueue (
"ns3::DropTailQueue");
374 queueDiscs = tchRed.
Install (devn2n3);
376 p2p.
SetQueue (
"ns3::DropTailQueue");
382 p2p.
SetQueue (
"ns3::DropTailQueue");
389 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
390 i0i2 = ipv4.
Assign (devn0n2);
391 ipv4.
SetBase (
"10.1.2.0",
"255.255.255.0");
392 i1i2 = ipv4.
Assign (devn1n2);
393 ipv4.
SetBase (
"10.1.3.0",
"255.255.255.0");
394 i2i3 = ipv4.
Assign (devn2n3);
395 ipv4.
SetBase (
"10.1.4.0",
"255.255.255.0");
396 i3i4 = ipv4.
Assign (devn3n4);
397 ipv4.
SetBase (
"10.1.5.0",
"255.255.255.0");
398 i3i5 = ipv4.
Assign (devn3n5);
401 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
404 uint16_t
port = 50000;
443 Simulator::Stop (
Seconds (sink_stop_time));
450 Simulator::Destroy ();
458 Simulator::Destroy ();
holds a vector of ns3::Application pointers.
AdaptiveRedQueueDiscTestCase()
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Boolean.
QueueDiscContainer Install(NetDeviceContainer c)
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Hold variables of type string.
NetDeviceContainer Install(NodeContainer c)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
Ipv4InterfaceContainer i3i5
void SetQueue(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
Each point to point net device must have a queue to pass packets through.
Ipv4InterfaceContainer i1i2
Ipv4InterfaceContainer i3i4
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void Enqueue(Ptr< RedQueueDisc > queue, uint32_t size, uint32_t nPkt)
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
AredQueueDiscTestSuite g_aredQueueDiscTestSuite
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void AddPacketFilter(uint16_t handle, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add a packet filter (of the given type and with the given attributes) to the ...
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
a polymophic address class
Holds a vector of ns3::QueueDisc pointers.
Class for representing data rates.
void RunAdaptiveRedDiscTest(StringValue mode)
Ptr< QueueDisc > Get(uint32_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
uint32_t forcedDrop
Forced drops, qavg > max threshold.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
AttributeValue implementation for Time.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Hold an unsigned integer type.
uint32_t qLimDrop
Drops due to queue limits.
holds a vector of ns3::NetDevice pointers
Build a set of QueueDisc objects.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
uint32_t GetSerializedSize(void) const
Get the number of bytes needed to serialize the underlying Address Typically, this is GetLength () + ...
keep track of a set of node pointers.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
AutoRedQueueDiscTestCase()
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Queue::QueueMode GetMode(void)
Get the encapsulation mode of this queue.
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
void RunAutoRedDiscTest(StringValue mode)
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
Ipv4InterfaceContainer i0i2
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
AttributeValue implementation for Address.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add the given number of internal queues (of the given type and with the given...
AttributeValue implementation for DataRate.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
virtual void DoRun(void)
Implementation to actually run this TestCase.
This test suite implements a Unit Test.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Ipv4InterfaceContainer i2i3
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
uint32_t unforcedDrop
Early probability drops.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const