24 #include "ns3/core-module.h"
25 #include "ns3/network-module.h"
26 #include "ns3/internet-module.h"
27 #include "ns3/point-to-point-module.h"
28 #include "ns3/applications-module.h"
29 #include "ns3/traffic-control-module.h"
38 virtual void AddHeader (
void);
64 virtual void DoRun (
void);
71 :
TestCase (
"Sanity check on the pie queue implementation")
80 uint32_t modeSize = 1;
86 "Verify that we can actually set the attribute Mode");
88 "Verify that we can actually set the attribute QueueLimit");
90 "Verify that we can actually set the attribute A");
92 "Verify that we can actually set the attribute B");
94 "Verify that we can actually set the attribute Tupdate");
96 "Verify that we can actually set the attribute Supdate");
98 "Verify that we can actually set the attribute DequeueThreshold");
100 "Verify that we can actually set the attribute QueueDelayReference");
102 "Verify that we can actually set the attribute MaxBurstAllowance");
106 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
114 p1 = Create<Packet> (pktSize);
115 p2 = Create<Packet> (pktSize);
116 p3 = Create<Packet> (pktSize);
117 p4 = Create<Packet> (pktSize);
118 p5 = Create<Packet> (pktSize);
119 p6 = Create<Packet> (pktSize);
120 p7 = Create<Packet> (pktSize);
121 p8 = Create<Packet> (pktSize);
125 queue->
Enqueue (Create<PieQueueDiscTestItem> (p1, dest, 0));
127 queue->
Enqueue (Create<PieQueueDiscTestItem> (p2, dest, 0));
129 queue->
Enqueue (Create<PieQueueDiscTestItem> (p3, dest, 0));
130 queue->
Enqueue (Create<PieQueueDiscTestItem> (p4, dest, 0));
131 queue->
Enqueue (Create<PieQueueDiscTestItem> (p5, dest, 0));
132 queue->
Enqueue (Create<PieQueueDiscTestItem> (p6, dest, 0));
133 queue->
Enqueue (Create<PieQueueDiscTestItem> (p7, dest, 0));
134 queue->
Enqueue (Create<PieQueueDiscTestItem> (p8, dest, 0));
147 NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (),
"Was this the second packet ?");
165 std::string pieLinkDataRate =
"1.5Mbps";
166 std::string pieLinkDelay =
"20ms";
199 GlobalValue::Bind (
"ChecksumEnabled",
BooleanValue (
false));
201 uint32_t meanPktSize = 1000;
204 "Verify that we can actually set the attribute Mode");
208 if (queue->
GetMode () == Queue::QUEUE_MODE_BYTES)
213 qSize = 100 * modeSize;
243 p2p.
SetQueue (
"ns3::DropTailQueue");
249 p2p.
SetQueue (
"ns3::DropTailQueue");
255 p2p.
SetQueue (
"ns3::DropTailQueue");
260 queueDiscs = tchPie.
Install (devn2n3);
262 p2p.
SetQueue (
"ns3::DropTailQueue");
268 p2p.
SetQueue (
"ns3::DropTailQueue");
275 ipv4.
SetBase (
"10.1.1.0",
"255.255.255.0");
276 i0i2 = ipv4.
Assign (devn0n2);
277 ipv4.
SetBase (
"10.1.2.0",
"255.255.255.0");
278 i1i2 = ipv4.
Assign (devn1n2);
279 ipv4.
SetBase (
"10.1.3.0",
"255.255.255.0");
280 i2i3 = ipv4.
Assign (devn2n3);
281 ipv4.
SetBase (
"10.1.4.0",
"255.255.255.0");
282 i3i4 = ipv4.
Assign (devn3n4);
283 ipv4.
SetBase (
"10.1.5.0",
"255.255.255.0");
284 i3i5 = ipv4.
Assign (devn3n5);
287 Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
290 uint16_t
port = 50000;
329 Simulator::Stop (
Seconds (sink_stop_time));
337 Simulator::Destroy ();
345 Simulator::Destroy ();
holds a vector of ns3::Application pointers.
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 and interface index.
uint32_t unforcedDrop
Early probability drops: proactive.
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. ...
void RunPieTest(StringValue mode)
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
uint64_t GetUid(void) const
Returns the packet's Uid.
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.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Build a set of PointToPointNetDevice objects.
This test suite implements a Unit Test.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Queue::QueueMode GetMode(void)
Get the encapsulation mode of this queue.
void SetQueueLimit(uint32_t lim)
Set the limit of the queue in bytes or packets.
a polymophic address class
Holds a vector of ns3::QueueDisc pointers.
Class for representing data rates.
Ptr< QueueDisc > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
uint32_t forcedDrop
Drops due to queue limit: reactive.
AttributeValue implementation for Time.
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
virtual void AddHeader(void)
Add the header to the packet.
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...
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
uint32_t GetQueueSize(void)
Get the current value of the queue in bytes or packets.
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal 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.
virtual ~PieQueueDiscTestItem()
Ptr< Node > Get(uint32_t i) const
Get the Ptr 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)
PieQueueDiscTestSuite g_pieQueueTestSuite
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.
void Enqueue(Ptr< PieQueueDisc > queue, uint32_t size, uint32_t nPkt)
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.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const