24 #include "ns3/codel-queue-disc.h"
25 #include "ns3/packet.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/string.h"
28 #include "ns3/double.h"
30 #include "ns3/simulator.h"
35 #define REC_INV_SQRT_BITS_ns3 (8 * sizeof(uint16_t))
38 #define REC_INV_SQRT_SHIFT_ns3 (32 - REC_INV_SQRT_BITS_ns3)
43 uint32_t invsqrt2 = ((uint64_t)invsqrt * invsqrt) >> 32;
44 uint64_t val = (3LL << 32) - ((uint64_t)count * invsqrt2);
47 val = (val * invsqrt) >> (32 - 2 + 1);
53 return (uint32_t)(((uint64_t)val * ep_ro) >> 32);
79 virtual void AddHeader (
void);
80 virtual bool Mark(
void);
90 m_ecnCapablePacket (ecnCapable)
128 virtual void DoRun (
void);
135 :
TestCase (
"Basic enqueue and dequeue operations, and attribute setting")
146 uint32_t modeSize = 0;
151 "Verify that we can actually set the attribute MinBytes");
153 "Verify that we can actually set the attribute Interval");
155 "Verify that we can actually set the attribute Target");
166 true,
"Verify that we can actually set the attribute MaxSize");
167 queue->Initialize ();
177 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize,
"There should be no packets in queue");
178 queue->Enqueue (Create<CodelQueueDiscTestItem> (p1, dest,
false));
179 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize,
"There should be one packet in queue");
180 queue->Enqueue (Create<CodelQueueDiscTestItem> (p2, dest,
false));
181 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize,
"There should be two packets in queue");
182 queue->Enqueue (Create<CodelQueueDiscTestItem> (p3, dest,
false));
183 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize,
"There should be three packets in queue");
184 queue->Enqueue (Create<CodelQueueDiscTestItem> (p4, dest,
false));
185 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize,
"There should be four packets in queue");
186 queue->Enqueue (Create<CodelQueueDiscTestItem> (p5, dest,
false));
187 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize,
"There should be five packets in queue");
188 queue->Enqueue (Create<CodelQueueDiscTestItem> (p6, dest,
false));
189 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 6 * modeSize,
"There should be six packets in queue");
192 0,
"There should be no packets being dropped due to full queue");
196 item = queue->Dequeue ();
198 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 5 * modeSize,
"There should be five packets in queue");
201 item = queue->Dequeue ();
203 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 4 * modeSize,
"There should be four packets in queue");
206 item = queue->Dequeue ();
208 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 3 * modeSize,
"There should be three packets in queue");
211 item = queue->Dequeue ();
213 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 2 * modeSize,
"There should be two packets in queue");
216 item = queue->Dequeue ();
218 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 1 * modeSize,
"There should be one packet in queue");
221 item = queue->Dequeue ();
223 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 0 * modeSize,
"There should be zero packet in queue");
226 item = queue->Dequeue ();
229 NS_TEST_ASSERT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP), 0,
230 "There should be no packet drops according to CoDel algorithm");
248 virtual void DoRun (
void);
262 :
TestCase (
"Basic overflow behavior")
272 uint32_t modeSize = 0;
291 true,
"Verify that we can actually set the attribute MaxSize");
293 "Verify that we can actually set the attribute MinBytes");
295 queue->Initialize ();
298 queue->Enqueue (Create<CodelQueueDiscTestItem> (p1, dest,
false));
299 queue->Enqueue (Create<CodelQueueDiscTestItem> (p2, dest,
false));
300 queue->Enqueue (Create<CodelQueueDiscTestItem> (p3, dest,
false));
302 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize().GetValue (), 500 * modeSize,
"There should be 500 packets in queue");
304 3,
"There should be three packets being dropped due to full queue");
311 for (uint32_t i = 0; i < nPkt; i++)
313 queue->Enqueue (Create<CodelQueueDiscTestItem> (Create<Packet> (size), dest,
false));
327 virtual void DoRun (
void);
331 :
TestCase (
"NewtonStep arithmetic unit test")
343 for (uint16_t recInvSqrt = 0xff; recInvSqrt > 0; recInvSqrt /= 2)
345 for (uint32_t count = 1; count < 0xff; count *= 2)
347 result = queue->NewtonStep (recInvSqrt, count);
350 "ns-3 NewtonStep() fails to match Linux equivalent");
365 virtual void DoRun (
void);
377 :
TestCase (
"ControlLaw arithmetic unit test")
396 uint32_t interval = queue->Time2CoDel (
MilliSeconds (100));
398 uint32_t codelTimeVal;
401 for (uint16_t recInvSqrt = 0xff; recInvSqrt > 0; recInvSqrt /= 2)
403 codelTimeVal = queue->Time2CoDel (timeVal);
404 uint32_t ns3Result = queue->ControlLaw (codelTimeVal, interval, recInvSqrt);
406 NS_TEST_ASSERT_MSG_EQ (ns3Result, linuxResult,
"Linux result for ControlLaw should equal ns-3 result");
426 virtual void DoRun (
void);
452 :
TestCase (
"Basic drop operations")
469 uint32_t modeSize = 0;
481 true,
"Verify that we can actually set the attribute MaxSize");
483 queue->Initialize ();
486 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize,
"There should be 20 packets in queue.");
490 Time waitUntilFirstDequeue = 2 * queue->GetTarget ();
494 Time waitUntilSecondDequeue = waitUntilFirstDequeue + 2 * queue->GetInterval ();
506 Simulator::Destroy ();
513 for (uint32_t i = 0; i < nPkt; i++)
515 queue->Enqueue (Create<CodelQueueDiscTestItem> (Create<Packet> (size), dest,
false));
522 uint32_t initialDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
523 uint32_t initialQSize = queue->GetCurrentSize ().GetValue ();
524 uint32_t initialDropNext = queue->GetDropNext ();
526 uint32_t currentDropCount = 0;
528 if (initialDropCount > 0 && currentTime.
GetMicroSeconds () >= initialDropNext)
533 if (initialQSize != 0)
536 if (initialDropCount == 0 && currentTime > queue->GetTarget ())
538 if (currentTime < queue->GetInterval ())
540 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
542 "Sojourn time has just gone above target from below."
543 "Hence, there should be no packet drops");
544 NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be 1 packet dequeued.");
547 else if (currentTime >= queue->GetInterval ())
549 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
550 NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - 2 * modeSize,
"Sojourn time has been above target for at least interval."
551 "We enter the dropping state, perform initial packet drop, and dequeue the next."
552 "So there should be 2 more packets dequeued.");
556 else if (initialDropCount > 0)
560 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
561 NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"We are in dropping state."
562 "Sojourn is still above target."
563 "However, it's not time for next drop."
564 "So there should be only 1 more packet dequeued");
566 NS_TEST_EXPECT_MSG_EQ (currentDropCount, 1,
"There should still be only 1 packet drop from the last dequeue");
570 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
572 "It's time for next drop."
573 "The number of packets dequeued equals to the number of times m_dropNext is updated plus initial dequeue");
595 virtual void DoRun (
void);
625 :
TestCase (
"Basic mark operations")
649 uint32_t modeSize = 0;
663 true,
"Verify that we can actually set the attribute MaxSize");
665 true,
"Verify that we can actually set the attribute UseEcn");
667 queue->Initialize ();
671 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize,
"There should be 20 packets in queue.");
675 Time waitUntilFirstDequeue = 2 * queue->GetTarget ();
679 Time waitUntilSecondDequeue = waitUntilFirstDequeue + 2 * queue->GetInterval ();
683 Simulator::Destroy ();
686 queue = CreateObject<CoDelQueueDisc> ();
688 true,
"Verify that we can actually set the attribute MaxSize");
690 true,
"Verify that we can actually set the attribute UseEcn");
692 queue->Initialize ();
696 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize,
"There should be 20 packets in queue.");
714 Simulator::Destroy ();
717 queue = CreateObject<CoDelQueueDisc> ();
719 true,
"Verify that we can actually set the attribute MaxSize");
721 true,
"Verify that we can actually set the attribute UseEcn");
723 true,
"Verify that we can actually set the attribute CeThreshold");
725 queue->Initialize ();
731 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize,
"There should be 20 packets in queue.");
749 Simulator::Destroy ();
752 queue = CreateObject<CoDelQueueDisc> ();
754 true,
"Verify that we can actually set the attribute MaxSize");
756 true,
"Verify that we can actually set the attribute UseEcn");
758 true,
"Verify that we can actually set the attribute CeThreshold");
760 queue->Initialize ();
764 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize,
"There should be 20 packets in queue.");
780 Simulator::Destroy ();
787 for (uint32_t i = 0; i < nPkt; i++)
789 queue->Enqueue (Create<CodelQueueDiscTestItem> (Create<Packet> (size), dest, ecnCapable));
796 uint32_t initialTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
797 uint32_t initialCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
798 uint32_t initialQSize = queue->GetCurrentSize ().GetValue ();
799 uint32_t initialDropNext = queue->GetDropNext ();
801 uint32_t currentDropCount = 0;
802 uint32_t currentTargetMarkCount = 0;
803 uint32_t currentCeThreshMarkCount = 0;
805 if (initialTargetMarkCount > 0 && currentTime.
GetMicroSeconds () >= initialDropNext && testCase == 3)
810 if (initialQSize != 0)
815 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
816 if (currentDropCount == 1)
821 else if (testCase == 2)
823 if (initialTargetMarkCount == 0 && currentTime > queue->GetTarget ())
825 if (currentTime < queue->GetInterval ())
827 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
828 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
829 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
830 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be 1 packet dequeued.");
833 "Sojourn time has just gone above target from below."
834 "Hence, there should be no target exceeded marked packets");
836 "Hence, there should not be any CE threshold exceeded marked packet");
838 else if (currentTime >= queue->GetInterval ())
840 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
841 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
843 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
844 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"Sojourn time has been above target for at least interval."
845 "We enter the dropping state and perform initial packet marking"
846 "So there should be only 1 more packet dequeued.");
848 NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1,
"There should be 1 target exceeded marked packet");
849 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0,
"There should not be any CE threshold exceeded marked packet");
852 else if (initialTargetMarkCount > 0)
856 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
857 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
858 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
859 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"We are in dropping state."
860 "Sojourn is still above target."
861 "However, it's not time for next target exceeded mark."
862 "So there should be only 1 more packet dequeued");
864 NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1,
"There should still be only 1 target exceeded marked packet from the last dequeue");
865 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0,
"There should not be any CE threshold exceeded marked packet");
869 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
870 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
871 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
872 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"We are in dropping state."
873 "It's time for packet to be marked"
874 "So there should be only 1 more packet dequeued");
878 "to number of packets in the queue before first mark as the behavior untill packet N should be the same.");
879 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 0,
"There should not be any CE threshold exceeded marked packet");
883 else if (testCase == 3)
885 if (initialTargetMarkCount == 0 && currentTime > queue->GetTarget ())
887 if (currentTime < queue->GetInterval ())
889 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
890 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
891 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
892 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be 1 packet dequeued.");
895 "Sojourn time has just gone above target from below."
896 "Hence, there should be no target exceeded marked packets");
898 "Hence, there should be 1 CE threshold exceeded marked packet");
900 else if (currentTime >= queue->GetInterval ())
902 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
903 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
904 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
905 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"Sojourn time has been above target for at least interval."
906 "We enter the dropping state and perform initial packet marking"
907 "So there should be only 1 more packet dequeued.");
909 NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1,
"There should be 1 target exceeded marked packet");
910 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 1,
"There should be 1 CE threshold exceeded marked packets");
913 else if (initialTargetMarkCount > 0)
917 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
918 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
919 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
920 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"We are in dropping state."
921 "Sojourn is still above target."
922 "However, it's not time for next target exceeded mark."
923 "So there should be only 1 more packet dequeued");
925 NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1,
"There should still be only 1 target exceeded marked packet from the last dequeue");
926 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2,
"There should be 2 CE threshold exceeded marked packets");
930 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
931 currentTargetMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::TARGET_EXCEEDED_MARK);
932 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
934 "It's time for packet to be dropped as packets are not ecnCapable"
935 "The number of packets dequeued equals to the number of times m_dropNext is updated plus initial dequeue");
937 NS_TEST_ASSERT_MSG_EQ (currentTargetMarkCount, 1,
"There should still be only 1 target exceeded marked packet");
938 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2,
"There should still be 2 CE threshold exceeded marked packet as packets are not ecnCapable");
942 else if (testCase == 4)
944 if (currentTime < queue->GetTarget ())
946 if (initialCeThreshMarkCount == 0 && currentTime <
MilliSeconds (2))
948 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
949 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
950 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be 1 packet dequeued.");
953 "Hence, there should not be any CE threshold exceeded marked packet");
957 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
958 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
959 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be only 1 more packet dequeued.");
962 "There should be 1 CE threshold exceeded marked packet");
965 else if (initialCeThreshMarkCount > 0 && currentTime < queue->GetInterval ())
967 if (initialCeThreshMarkCount < 2)
969 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
970 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
971 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be only 1 more packet dequeued.");
973 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 2,
"There should be 2 CE threshold exceeded marked packets");
977 currentDropCount = queue->GetStats ().GetNDroppedPackets (CoDelQueueDisc::TARGET_EXCEEDED_DROP);
978 currentCeThreshMarkCount = queue->GetStats ().GetNMarkedPackets (CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
979 NS_TEST_ASSERT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
"There should be only 1 more packet dequeued.");
981 NS_TEST_ASSERT_MSG_EQ (currentCeThreshMarkCount, 3,
"There should be 3 CE threshold exceeded marked packet");
Test 5: enqueue/dequeue with drops according to CoDel algorithm.
uint32_t m_dropNextCount
count the number of times m_dropNext is recalculated
CoDelQueueDiscBasicDrop(QueueSizeUnit mode)
Constructor.
void Dequeue(Ptr< CoDelQueueDisc > queue, uint32_t modeSize)
Dequeue function.
void Enqueue(Ptr< CoDelQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DropNextTracer(uint32_t oldVal, uint32_t newVal)
Drop next tracer function.
Test 1: simple enqueue/dequeue with no drops.
CoDelQueueDiscBasicEnqueueDequeue(QueueSizeUnit mode)
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test 6: enqueue/dequeue with marks according to CoDel algorithm.
uint32_t nPacketsBeforeFirstMark
Number of packets in the queue before first mark.
void Enqueue(Ptr< CoDelQueueDisc > queue, uint32_t size, uint32_t nPkt, bool ecnCapable)
Enqueue function.
uint32_t m_dropNextCount
count the number of times m_dropNext is recalculated
void DropNextTracer(uint32_t oldVal, uint32_t newVal)
Drop next tracer function.
uint32_t nPacketsBeforeFirstDrop
Number of packets in the queue before first drop.
void Dequeue(Ptr< CoDelQueueDisc > queue, uint32_t modeSize, uint32_t testCase)
Dequeue function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
CoDelQueueDiscBasicMark(QueueSizeUnit mode)
Constructor.
Test 2: enqueue with drops due to queue overflow.
CoDelQueueDiscBasicOverflow(QueueSizeUnit mode)
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Enqueue(Ptr< CoDelQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
Test 4: ControlLaw unit test - test against explicit port of Linux implementation.
CoDelQueueDiscControlLawTest()
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t _codel_control_law(uint32_t t, uint32_t interval, uint32_t recInvSqrt)
Codel control law function.
Test 3: NewtonStep unit test - test against explicit port of Linux implementation.
virtual void DoRun(void)
Implementation to actually run this TestCase.
CoDelQueueDiscNewtonStepTest()
CoDel Queue Disc Test Suite.
CoDelQueueDiscTestSuite()
Codel Queue Disc Test Item.
virtual void AddHeader(void)
Add the header to the packet.
bool m_ecnCapablePacket
ECN capable packet?
virtual ~CodelQueueDiscTestItem()
CodelQueueDiscTestItem(const CodelQueueDiscTestItem &)=delete
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
a polymophic address class
AttributeValue implementation for Boolean.
uint64_t GetUid(void) const
Returns the packet's Uid.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
Simulation virtual time values and global simulation resolution.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
#define REC_INV_SQRT_SHIFT_ns3
static uint16_t _codel_Newton_step(uint16_t rec_inv_sqrt, uint32_t count)
static uint32_t _reciprocal_scale(uint32_t val, uint32_t ep_ro)
QueueSizeUnit
Enumeration of the operating modes of queues.
@ BYTES
Use number of bytes for queue size.
@ PACKETS
Use number of packets for queue size.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
CoDelQueueDiscTestSuite g_coDelQueueTestSuite
the test suite
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
uint32_t pktSize
packet size used for the simulation (in bytes)