21 #include "ns3/pfifo-fast-queue-disc.h"
22 #include "ns3/drop-tail-queue.h"
23 #include "ns3/ipv4-queue-disc-item.h"
24 #include "ns3/ipv6-queue-disc-item.h"
25 #include "ns3/ipv4-packet-filter.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/pointer.h"
29 #include "ns3/object-factory.h"
43 virtual void DoRun (
void);
49 :
TestCase (
"Test TOS-based prioritization")
63 ipHeader.SetTos (tos);
64 ipHeader.SetProtocol (6);
88 bool ok = filter->SetAttributeFailSafe (
"Mode",
EnumValue (PfifoFastIpv4PacketFilter::PF_MODE_TOS));
91 for (uint16_t i = 0; i < 3; i++)
130 virtual void DoRun (
void);
136 :
TestCase (
"Test DSCP-based prioritization")
150 ipHeader.SetProtocol (6);
151 ipHeader.SetDscp (dscp);
175 bool ok = filter->SetAttributeFailSafe (
"Mode",
EnumValue (PfifoFastIpv4PacketFilter::PF_MODE_DSCP));
178 for (uint16_t i = 0; i < 3; i++)
222 virtual void DoRun (
void);
241 ipHeader.SetProtocol (6);
242 ipHeader.SetDscp (dscp);
264 AddPacket (queueDisc, Ipv4Header::DSCP_AF42);
265 AddPacket (queueDisc, Ipv4Header::DSCP_AF42);
266 AddPacket (queueDisc, Ipv4Header::DSCP_AF13);
267 AddPacket (queueDisc, Ipv4Header::DSCP_AF13);
268 AddPacket (queueDisc, Ipv4Header::DSCP_AF11);
269 AddPacket (queueDisc, Ipv4Header::DSCP_AF11);
275 AddPacket (queueDisc, Ipv4Header::DSCP_AF42);
276 AddPacket (queueDisc, Ipv4Header::DSCP_AF13);
277 AddPacket (queueDisc, Ipv4Header::DSCP_AF11);
296 virtual void DoRun (
void);
300 :
TestCase (
"Test queue with non IP header")
315 for (uint16_t i = 0; i < 3; i++)
324 p = Create<Packet> ();
328 item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
331 p = Create<Packet> (
reinterpret_cast<const uint8_t*
> (
"hello, world"), 12);
332 item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
335 p = Create<Packet> (100);
336 uint8_t *buf =
new uint8_t[100];
338 for (uint32_t i = 0; i < 100; i++)
342 p->CopyData (buf, 100);
343 item = Create<Ipv6QueueDiscItem> (p, dest, 0, ipv6Header);
356 :
TestSuite (
"pfifo-fast-queue-disc", UNIT)
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Ptr< Queue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
This class tests that each possible TOS is enqueued in the right band.
void TestTosValue(Ptr< PfifoFastQueueDisc > queue, uint8_t tos, uint32_t band)
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
Ptr< Packet > CreatePacketWithTos(uint8_t tos)
virtual ~PfifoFastQueueDiscTosPrioritization()
a polymophic address class
This class tests that each band is txqueuelen deep.
PfifoFastQueueDiscTosPrioritization()
PfifoFastQueueDiscOverflow()
Hold variables of type enum.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
void TestDscpValue(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp, uint32_t band)
Hold an unsigned integer type.
void AddPacket(Ptr< PfifoFastQueueDisc > queue, Ipv4Header::DscpType dscp)
#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.
void AddInternalQueue(Ptr< Queue > queue)
Add an internal queue to the tail of the list of queues.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< Packet > CreatePacketWithDscp(Ipv4Header::DscpType dscp)
virtual ~PfifoFastQueueDiscDscpPrioritization()
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.
static PfifoFastQueueDiscTestSuite pfifoFastQueueTestSuite
virtual ~PfifoFastQueueDiscOverflow()
PfifoFastQueueDiscDscpPrioritization()
void AddPacketFilter(Ptr< PacketFilter > filter)
Add a packet filter to the tail of the list of filters used to classify packets.
This class tests that each possible DSCP is enqueued in the right band.
PfifoFastQueueDiscTestSuite()
void AddHeader(const Header &header)
Add header to this packet.
virtual void DoRun(void)
Implementation to actually run this TestCase.