8#include "ns3/drop-tail-queue.h"
10#include "ns3/ipv4-queue-disc-item.h"
11#include "ns3/ipv6-queue-disc-item.h"
12#include "ns3/object-factory.h"
13#include "ns3/pfifo-fast-queue-disc.h"
14#include "ns3/pointer.h"
15#include "ns3/simulator.h"
16#include "ns3/socket.h"
17#include "ns3/string.h"
34 void DoRun()
override;
46 :
TestCase(
"Test TOS-based prioritization")
66 p->AddPacketTag(priorityTag);
72 "enqueued to unexpected band");
81 for (uint16_t i = 0; i < 3; i++)
84 bool ok = queue->SetAttributeFailSafe(
"MaxSize",
StringValue(
"1000p"));
86 queueDisc->AddInternalQueue(queue);
124 void DoRun()
override;
136 :
TestCase(
"Test DSCP-based prioritization")
156 p->AddPacketTag(priorityTag);
159 queue->Enqueue(item);
162 "enqueued to unexpected band");
171 for (uint16_t i = 0; i < 3; i++)
174 bool ok = queue->SetAttributeFailSafe(
"MaxSize",
StringValue(
"1000p"));
176 queueDisc->AddInternalQueue(queue);
219 void DoRun()
override;
248 p->AddPacketTag(priorityTag);
251 queue->Enqueue(item);
265 queueDisc->AddInternalQueue(band0);
266 queueDisc->AddInternalQueue(band1);
267 queueDisc->AddInternalQueue(band2);
278 "unexpected queue depth");
281 "unexpected queue depth");
284 "unexpected queue depth");
293 "unexpected queue depth");
296 "unexpected queue depth");
299 "unexpected queue depth");
317 void DoRun()
override;
321 :
TestCase(
"Test queue with no priority tag")
334 for (uint16_t i = 0; i < 3; i++)
337 bool ok = queue->SetAttributeFailSafe(
"MaxSize",
StringValue(
"1000p"));
339 queueDisc->AddInternalQueue(queue);
343 "unexpected queue depth");
350 queueDisc->Enqueue(item);
353 "unexpected queue depth");
354 p =
Create<Packet>(
reinterpret_cast<const uint8_t*
>(
"hello, world"), 12);
356 queueDisc->Enqueue(item);
359 "unexpected queue depth");
361 auto buf =
new uint8_t[100];
367 p->CopyData(buf, 100);
369 queueDisc->Enqueue(item);
372 "unexpected queue depth");
This class tests that each possible DSCP is enqueued in the right band.
PfifoFastQueueDiscDscpPrioritization()
void TestDscpValue(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp, uint32_t band)
Enqueue a packet and checks that it's added to the proper band.
void DoRun() override
Implementation to actually run this TestCase.
~PfifoFastQueueDiscDscpPrioritization() override
This class tests that packets without a priority tag are handled by placing them into band 1.
PfifoFastQueueDiscNoPriority()
void DoRun() override
Implementation to actually run this TestCase.
~PfifoFastQueueDiscNoPriority() override
This class tests that each band is txqueuelen deep.
void DoRun() override
Implementation to actually run this TestCase.
PfifoFastQueueDiscOverflow()
void AddPacket(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp)
Enqueue a packet.
~PfifoFastQueueDiscOverflow() override
PfifoFast queue disc test suite.
PfifoFastQueueDiscTestSuite()
This class tests that each possible TOS is enqueued in the right band.
PfifoFastQueueDiscTosPrioritization()
~PfifoFastQueueDiscTosPrioritization() override
void DoRun() override
Implementation to actually run this TestCase.
void TestTosValue(Ptr< PfifoFastQueueDisc > queue, uint8_t tos, uint32_t band)
Enqueue a packet and checks that it's added to the proper band.
a polymophic address class
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static uint8_t IpTos2Priority(uint8_t ipTos)
Return the priority corresponding to a given TOS value.
indicates whether the socket has a priority set.
void SetPriority(uint8_t priority)
Set the tag's priority.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > CreateObjectWithAttributes(Args... args)
Allocate an Object on the heap and initialize with a set of attributes.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static PfifoFastQueueDiscTestSuite g_pfifoFastQueueTestSuite
Do not forget to allocate an instance of this TestSuite.