A Discrete-Event Network Simulator
API
codel-queue-disc-test-suite.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 ResiliNets, ITTC, University of Kansas
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Truc Anh N Nguyen <trucanh524@gmail.com>
18 * Modified by: Pasquale Imputato <p.imputato@gmail.com>
19 *
20 */
21
22#include "ns3/codel-queue-disc.h"
23#include "ns3/double.h"
24#include "ns3/log.h"
25#include "ns3/packet.h"
26#include "ns3/simulator.h"
27#include "ns3/string.h"
28#include "ns3/test.h"
29#include "ns3/uinteger.h"
30
31using namespace ns3;
32
33// The following code borrowed from Linux codel.h, for unit testing
34#define REC_INV_SQRT_BITS_ns3 (8 * sizeof(uint16_t))
35/* or sizeof_in_bits(rec_inv_sqrt) */
36/* needed shift to get a Q0.32 number from rec_inv_sqrt */
37#define REC_INV_SQRT_SHIFT_ns3 (32 - REC_INV_SQRT_BITS_ns3)
38
39static uint16_t
40_codel_Newton_step(uint16_t rec_inv_sqrt, uint32_t count)
41{
42 uint32_t invsqrt = ((uint32_t)rec_inv_sqrt) << REC_INV_SQRT_SHIFT_ns3;
43 uint32_t invsqrt2 = ((uint64_t)invsqrt * invsqrt) >> 32;
44 uint64_t val = (3LL << 32) - ((uint64_t)count * invsqrt2);
45
46 val >>= 2; /* avoid overflow in following multiply */
47 val = (val * invsqrt) >> (32 - 2 + 1);
48 return static_cast<uint16_t>(val >> REC_INV_SQRT_SHIFT_ns3);
49}
50
51static uint32_t
53{
54 return (uint32_t)(((uint64_t)val * ep_ro) >> 32);
55}
56
57// End Linux borrow
58
66{
67 public:
75 CodelQueueDiscTestItem(Ptr<Packet> p, const Address& addr, bool ecnCapable);
76 ~CodelQueueDiscTestItem() override;
77
78 // Delete default constructor, copy constructor and assignment operator to avoid misuse
82
83 void AddHeader() override;
84 bool Mark() override;
85
86 private:
88};
89
91 : QueueDiscItem(p, addr, ecnCapable),
92 m_ecnCapablePacket(ecnCapable)
93{
94}
95
97{
98}
99
100void
102{
103}
104
105bool
107{
109 {
110 return true;
111 }
112 return false;
113}
114
122{
123 public:
130 void DoRun() override;
131
132 private:
134};
135
137 : TestCase("Basic enqueue and dequeue operations, and attribute setting")
138{
139 m_mode = mode;
140}
141
142void
144{
145 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
146
147 uint32_t pktSize = 1000;
148 uint32_t modeSize = 0;
149
150 Address dest;
151
152 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("MinBytes", UintegerValue(pktSize)),
153 true,
154 "Verify that we can actually set the attribute MinBytes");
155 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("Interval", StringValue("50ms")),
156 true,
157 "Verify that we can actually set the attribute Interval");
158 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("Target", StringValue("4ms")),
159 true,
160 "Verify that we can actually set the attribute Target");
161
163 {
164 modeSize = pktSize;
165 }
166 else if (m_mode == QueueSizeUnit::PACKETS)
167 {
168 modeSize = 1;
169 }
171 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 1500))),
172 true,
173 "Verify that we can actually set the attribute MaxSize");
174 queue->Initialize();
175
176 Ptr<Packet> p1;
177 Ptr<Packet> p2;
178 Ptr<Packet> p3;
179 Ptr<Packet> p4;
180 Ptr<Packet> p5;
181 Ptr<Packet> p6;
182 p1 = Create<Packet>(pktSize);
183 p2 = Create<Packet>(pktSize);
184 p3 = Create<Packet>(pktSize);
185 p4 = Create<Packet>(pktSize);
186 p5 = Create<Packet>(pktSize);
187 p6 = Create<Packet>(pktSize);
188
189 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
190 0 * modeSize,
191 "There should be no packets in queue");
192 queue->Enqueue(Create<CodelQueueDiscTestItem>(p1, dest, false));
193 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
194 1 * modeSize,
195 "There should be one packet in queue");
196 queue->Enqueue(Create<CodelQueueDiscTestItem>(p2, dest, false));
197 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
198 2 * modeSize,
199 "There should be two packets in queue");
200 queue->Enqueue(Create<CodelQueueDiscTestItem>(p3, dest, false));
201 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
202 3 * modeSize,
203 "There should be three packets in queue");
204 queue->Enqueue(Create<CodelQueueDiscTestItem>(p4, dest, false));
205 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
206 4 * modeSize,
207 "There should be four packets in queue");
208 queue->Enqueue(Create<CodelQueueDiscTestItem>(p5, dest, false));
209 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
210 5 * modeSize,
211 "There should be five packets in queue");
212 queue->Enqueue(Create<CodelQueueDiscTestItem>(p6, dest, false));
213 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
214 6 * modeSize,
215 "There should be six packets in queue");
216
217 NS_TEST_ASSERT_MSG_EQ(queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::OVERLIMIT_DROP),
218 0,
219 "There should be no packets being dropped due to full queue");
220
222
223 item = queue->Dequeue();
224 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the first packet");
225 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
226 5 * modeSize,
227 "There should be five packets in queue");
228 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(), p1->GetUid(), "was this the first packet ?");
229
230 item = queue->Dequeue();
231 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the second packet");
232 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
233 4 * modeSize,
234 "There should be four packets in queue");
235 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(),
236 p2->GetUid(),
237 "Was this the second packet ?");
238
239 item = queue->Dequeue();
240 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the third packet");
241 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
242 3 * modeSize,
243 "There should be three packets in queue");
244 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(), p3->GetUid(), "Was this the third packet ?");
245
246 item = queue->Dequeue();
247 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the forth packet");
248 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
249 2 * modeSize,
250 "There should be two packets in queue");
251 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(),
252 p4->GetUid(),
253 "Was this the fourth packet ?");
254
255 item = queue->Dequeue();
256 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the fifth packet");
257 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
258 1 * modeSize,
259 "There should be one packet in queue");
260 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(), p5->GetUid(), "Was this the fifth packet ?");
261
262 item = queue->Dequeue();
263 NS_TEST_ASSERT_MSG_NE(item, nullptr, "I want to remove the last packet");
264 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
265 0 * modeSize,
266 "There should be zero packet in queue");
267 NS_TEST_ASSERT_MSG_EQ(item->GetPacket()->GetUid(), p6->GetUid(), "Was this the sixth packet ?");
268
269 item = queue->Dequeue();
270 NS_TEST_ASSERT_MSG_EQ(item, nullptr, "There are really no packets in queue");
271
273 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP),
274 0,
275 "There should be no packet drops according to CoDel algorithm");
276}
277
285{
286 public:
293 void DoRun() override;
294
295 private:
302 void Enqueue(Ptr<CoDelQueueDisc> queue, uint32_t size, uint32_t nPkt);
304};
305
307 : TestCase("Basic overflow behavior")
308{
309 m_mode = mode;
310}
311
312void
314{
315 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
316 uint32_t pktSize = 1000;
317 uint32_t modeSize = 0;
318
319 Address dest;
320
322 {
323 modeSize = pktSize;
324 }
325 else if (m_mode == QueueSizeUnit::PACKETS)
326 {
327 modeSize = 1;
328 }
329
330 Ptr<Packet> p1;
331 Ptr<Packet> p2;
332 Ptr<Packet> p3;
333 p1 = Create<Packet>(pktSize);
334 p2 = Create<Packet>(pktSize);
335 p3 = Create<Packet>(pktSize);
336
338 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
339 true,
340 "Verify that we can actually set the attribute MaxSize");
341 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("MinBytes", UintegerValue(pktSize)),
342 true,
343 "Verify that we can actually set the attribute MinBytes");
344
345 queue->Initialize();
346
347 Enqueue(queue, pktSize, 500);
348 queue->Enqueue(Create<CodelQueueDiscTestItem>(p1, dest, false));
349 queue->Enqueue(Create<CodelQueueDiscTestItem>(p2, dest, false));
350 queue->Enqueue(Create<CodelQueueDiscTestItem>(p3, dest, false));
351
352 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
353 500 * modeSize,
354 "There should be 500 packets in queue");
355 NS_TEST_ASSERT_MSG_EQ(queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::OVERLIMIT_DROP),
356 3,
357 "There should be three packets being dropped due to full queue");
358}
359
360void
362{
363 Address dest;
364 for (uint32_t i = 0; i < nPkt; i++)
365 {
366 queue->Enqueue(Create<CodelQueueDiscTestItem>(Create<Packet>(size), dest, false));
367 }
368}
369
377{
378 public:
380 void DoRun() override;
381};
382
384 : TestCase("NewtonStep arithmetic unit test")
385{
386}
387
388void
390{
391 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
392
393 // Spot check a few points in the expected operational range of
394 // CoDelQueueDisc's m_count and m_recInvSqrt variables
395 uint16_t result;
396 for (uint16_t recInvSqrt = 0xff; recInvSqrt > 0; recInvSqrt /= 2)
397 {
398 for (uint32_t count = 1; count < 0xff; count *= 2)
399 {
400 result = queue->NewtonStep(recInvSqrt, count);
401 // Test that ns-3 value is exactly the same as the Linux value
402 NS_TEST_ASSERT_MSG_EQ(_codel_Newton_step(recInvSqrt, count),
403 result,
404 "ns-3 NewtonStep() fails to match Linux equivalent");
405 }
406 }
407}
408
416{
417 public:
419 void DoRun() override;
427 uint32_t _codel_control_law(uint32_t t, uint32_t interval, uint32_t recInvSqrt);
428};
429
431 : TestCase("ControlLaw arithmetic unit test")
432{
433}
434
435// The following code borrowed from Linux codel.h,
436// except the addition of queue parameter
439{
440 return t + _reciprocal_scale(interval, recInvSqrt << REC_INV_SQRT_SHIFT_ns3);
441}
442
443// End Linux borrrow
444
445void
447{
448 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
449
450 // Check a few points within the operational range of ControlLaw
451 uint32_t interval = queue->Time2CoDel(MilliSeconds(100));
452
453 uint32_t codelTimeVal;
454 for (Time timeVal = Seconds(0); timeVal <= Seconds(20); timeVal += MilliSeconds(100))
455 {
456 for (uint16_t recInvSqrt = 0xff; recInvSqrt > 0; recInvSqrt /= 2)
457 {
458 codelTimeVal = queue->Time2CoDel(timeVal);
459 uint32_t ns3Result = queue->ControlLaw(codelTimeVal, interval, recInvSqrt);
460 uint32_t linuxResult = _codel_control_law(codelTimeVal, interval, recInvSqrt);
461 NS_TEST_ASSERT_MSG_EQ(ns3Result,
462 linuxResult,
463 "Linux result for ControlLaw should equal ns-3 result");
464 }
465 }
466}
467
475{
476 public:
483 void DoRun() override;
484
485 private:
492 void Enqueue(Ptr<CoDelQueueDisc> queue, uint32_t size, uint32_t nPkt);
497 void Dequeue(Ptr<CoDelQueueDisc> queue, uint32_t modeSize);
503 void DropNextTracer(uint32_t oldVal, uint32_t newVal);
506};
507
509 : TestCase("Basic drop operations")
510{
511 m_mode = mode;
512 m_dropNextCount = 0;
513}
514
515void
517{
519}
520
521void
523{
524 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
525 uint32_t pktSize = 1000;
526 uint32_t modeSize = 0;
527
529 {
530 modeSize = pktSize;
531 }
532 else if (m_mode == QueueSizeUnit::PACKETS)
533 {
534 modeSize = 1;
535 }
536
538 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
539 true,
540 "Verify that we can actually set the attribute MaxSize");
541
542 queue->Initialize();
543
544 Enqueue(queue, pktSize, 20);
545 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
546 20 * modeSize,
547 "There should be 20 packets in queue.");
548
549 // Although the first dequeue occurs with a sojourn time above target
550 // the dequeue should be successful in this interval
551 Time waitUntilFirstDequeue = 2 * queue->GetTarget();
552 Simulator::Schedule(waitUntilFirstDequeue,
554 this,
555 queue,
556 modeSize);
557
558 // This dequeue should cause a drop
559 Time waitUntilSecondDequeue = waitUntilFirstDequeue + 2 * queue->GetInterval();
560 Simulator::Schedule(waitUntilSecondDequeue,
562 this,
563 queue,
564 modeSize);
565
566 // Although we are in dropping state, it's not time for next drop
567 // the dequeue should not cause a drop
568 Simulator::Schedule(waitUntilSecondDequeue,
570 this,
571 queue,
572 modeSize);
573
574 // In dropping time and it's time for next drop
575 // the dequeue should cause additional packet drops
576 Simulator::Schedule(waitUntilSecondDequeue * 2,
578 this,
579 queue,
580 modeSize);
581
582 Simulator::Run();
583 Simulator::Destroy();
584}
585
586void
588{
589 Address dest;
590 for (uint32_t i = 0; i < nPkt; i++)
591 {
592 queue->Enqueue(Create<CodelQueueDiscTestItem>(Create<Packet>(size), dest, false));
593 }
594}
595
596void
598{
599 uint32_t initialDropCount =
600 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
601 uint32_t initialQSize = queue->GetCurrentSize().GetValue();
602 uint32_t initialDropNext = queue->GetDropNext();
603 Time currentTime = Simulator::Now();
604 uint32_t currentDropCount = 0;
605
606 if (initialDropCount > 0 && currentTime.GetMicroSeconds() >= initialDropNext)
607 {
608 queue->TraceConnectWithoutContext(
609 "DropNext",
611 }
612
613 if (initialQSize != 0)
614 {
615 Ptr<QueueDiscItem> item = queue->Dequeue();
616 if (initialDropCount == 0 && currentTime > queue->GetTarget())
617 {
618 if (currentTime < queue->GetInterval())
619 {
620 currentDropCount =
621 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
622 NS_TEST_EXPECT_MSG_EQ(currentDropCount,
623 0,
624 "We are not in dropping state."
625 "Sojourn time has just gone above target from below."
626 "Hence, there should be no packet drops");
627 NS_TEST_EXPECT_MSG_EQ(queue->GetCurrentSize().GetValue(),
628 initialQSize - modeSize,
629 "There should be 1 packet dequeued.");
630 }
631 else if (currentTime >= queue->GetInterval())
632 {
633 currentDropCount =
634 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
635 NS_TEST_EXPECT_MSG_EQ(queue->GetCurrentSize().GetValue(),
636 initialQSize - 2 * modeSize,
637 "Sojourn time has been above target for at least interval."
638 "We enter the dropping state, perform initial packet drop, "
639 "and dequeue the next."
640 "So there should be 2 more packets dequeued.");
641 NS_TEST_EXPECT_MSG_EQ(currentDropCount, 1, "There should be 1 packet drop");
642 }
643 }
644 else if (initialDropCount > 0)
645 { // In dropping state
646 if (currentTime.GetMicroSeconds() < initialDropNext)
647 {
648 currentDropCount =
649 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
650 NS_TEST_EXPECT_MSG_EQ(queue->GetCurrentSize().GetValue(),
651 initialQSize - modeSize,
652 "We are in dropping state."
653 "Sojourn is still above target."
654 "However, it's not time for next drop."
655 "So there should be only 1 more packet dequeued");
656
658 currentDropCount,
659 1,
660 "There should still be only 1 packet drop from the last dequeue");
661 }
662 else if (currentTime.GetMicroSeconds() >= initialDropNext)
663 {
664 currentDropCount =
665 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
666 NS_TEST_EXPECT_MSG_EQ(queue->GetCurrentSize().GetValue(),
667 initialQSize - (m_dropNextCount + 1) * modeSize,
668 "We are in dropping state."
669 "It's time for next drop."
670 "The number of packets dequeued equals to the number of "
671 "times m_dropNext is updated plus initial dequeue");
672 NS_TEST_EXPECT_MSG_EQ(currentDropCount,
673 1 + m_dropNextCount,
674 "The number of drops equals to the number of times "
675 "m_dropNext is updated plus 1 from last dequeue");
676 }
677 }
678 }
679}
680
688{
689 public:
696 void DoRun() override;
697
698 private:
706 void Enqueue(Ptr<CoDelQueueDisc> queue, uint32_t size, uint32_t nPkt, bool ecnCapable);
712 void Dequeue(Ptr<CoDelQueueDisc> queue, uint32_t modeSize, uint32_t testCase);
718 void DropNextTracer(uint32_t oldVal, uint32_t newVal);
723};
724
726 : TestCase("Basic mark operations")
727{
728 m_mode = mode;
729 m_dropNextCount = 0;
730}
731
732void
734{
736}
737
738void
740{
741 // Test is divided into 4 sub test cases:
742 // 1) Packets are not ECN capable.
743 // 2) Packets are ECN capable but marking due to exceeding CE threshold disabled
744 // 3) Some packets are ECN capable, with CE threshold set to 2ms.
745 // 4) Packets are ECN capable and CE threshold set to 2ms
746
747 // Test case 1
748 Ptr<CoDelQueueDisc> queue = CreateObject<CoDelQueueDisc>();
749 uint32_t pktSize = 1000;
750 uint32_t modeSize = 0;
753
755 {
756 modeSize = pktSize;
757 }
758 else if (m_mode == QueueSizeUnit::PACKETS)
759 {
760 modeSize = 1;
761 }
762
764 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
765 true,
766 "Verify that we can actually set the attribute MaxSize");
767 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("UseEcn", BooleanValue(true)),
768 true,
769 "Verify that we can actually set the attribute UseEcn");
770
771 queue->Initialize();
772
773 // Not-ECT traffic to induce packet drop
774 Enqueue(queue, pktSize, 20, false);
775 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
776 20 * modeSize,
777 "There should be 20 packets in queue.");
778
779 // Although the first dequeue occurs with a sojourn time above target
780 // there should not be any dropped packets in this interval
781 Time waitUntilFirstDequeue = 2 * queue->GetTarget();
782 Simulator::Schedule(waitUntilFirstDequeue,
784 this,
785 queue,
786 modeSize,
787 1);
788
789 // This dequeue should cause a packet to be dropped
790 Time waitUntilSecondDequeue = waitUntilFirstDequeue + 2 * queue->GetInterval();
791 Simulator::Schedule(waitUntilSecondDequeue,
793 this,
794 queue,
795 modeSize,
796 1);
797
798 Simulator::Run();
799 Simulator::Destroy();
800
801 // Test case 2, queue with ECN capable traffic for marking of packets instead of dropping
802 queue = CreateObject<CoDelQueueDisc>();
804 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
805 true,
806 "Verify that we can actually set the attribute MaxSize");
807 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("UseEcn", BooleanValue(true)),
808 true,
809 "Verify that we can actually set the attribute UseEcn");
810
811 queue->Initialize();
812
813 // ECN capable traffic to induce packets to be marked
814 Enqueue(queue, pktSize, 20, true);
815 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
816 20 * modeSize,
817 "There should be 20 packets in queue.");
818
819 // Although the first dequeue occurs with a sojourn time above target
820 // there should not be any target exceeded marked packets in this interval
821 Simulator::Schedule(waitUntilFirstDequeue,
823 this,
824 queue,
825 modeSize,
826 2);
827
828 // This dequeue should cause a packet to be marked
829 Simulator::Schedule(waitUntilSecondDequeue,
831 this,
832 queue,
833 modeSize,
834 2);
835
836 // Although we are in dropping state, it's not time for next packet to be target exceeded marked
837 // the dequeue should not cause a packet to be target exceeded marked
838 Simulator::Schedule(waitUntilSecondDequeue,
840 this,
841 queue,
842 modeSize,
843 2);
844
845 // In dropping time and it's time for next packet to be target exceeded marked
846 // the dequeue should cause additional packet to be target exceeded marked
847 Simulator::Schedule(waitUntilSecondDequeue * 2,
849 this,
850 queue,
851 modeSize,
852 2);
853
854 Simulator::Run();
855 Simulator::Destroy();
856
857 // Test case 3, some packets are ECN capable, with CE threshold set to 2ms
858 queue = CreateObject<CoDelQueueDisc>();
860 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
861 true,
862 "Verify that we can actually set the attribute MaxSize");
863 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("UseEcn", BooleanValue(true)),
864 true,
865 "Verify that we can actually set the attribute UseEcn");
866 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("CeThreshold", TimeValue(MilliSeconds(2))),
867 true,
868 "Verify that we can actually set the attribute CeThreshold");
869
870 queue->Initialize();
871
872 // First 3 packets in the queue are ecnCapable
873 Enqueue(queue, pktSize, 3, true);
874 // Rest of the packet are not ecnCapable
875 Enqueue(queue, pktSize, 17, false);
876 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
877 20 * modeSize,
878 "There should be 20 packets in queue.");
879
880 // Although the first dequeue occurs with a sojourn time above target
881 // there should not be any target exceeded marked packets in this interval
882 Simulator::Schedule(waitUntilFirstDequeue,
884 this,
885 queue,
886 modeSize,
887 3);
888
889 // This dequeue should cause a packet to be marked
890 Simulator::Schedule(waitUntilSecondDequeue,
892 this,
893 queue,
894 modeSize,
895 3);
896
897 // Although we are in dropping state, it's not time for next packet to be target exceeded marked
898 // the dequeue should not cause a packet to be target exceeded marked
899 Simulator::Schedule(waitUntilSecondDequeue,
901 this,
902 queue,
903 modeSize,
904 3);
905
906 // In dropping time and it's time for next packet to be dropped as packets are not ECN capable
907 // the dequeue should cause packet to be dropped
908 Simulator::Schedule(waitUntilSecondDequeue * 2,
910 this,
911 queue,
912 modeSize,
913 3);
914
915 Simulator::Run();
916 Simulator::Destroy();
917
918 // Test case 4, queue with ECN capable traffic and CeThreshold set for marking of packets
919 // instead of dropping
920 queue = CreateObject<CoDelQueueDisc>();
922 queue->SetAttributeFailSafe("MaxSize", QueueSizeValue(QueueSize(m_mode, modeSize * 500))),
923 true,
924 "Verify that we can actually set the attribute MaxSize");
925 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("UseEcn", BooleanValue(true)),
926 true,
927 "Verify that we can actually set the attribute UseEcn");
928 NS_TEST_ASSERT_MSG_EQ(queue->SetAttributeFailSafe("CeThreshold", TimeValue(MilliSeconds(2))),
929 true,
930 "Verify that we can actually set the attribute CeThreshold");
931
932 queue->Initialize();
933
934 // ECN capable traffic to induce packets to be marked
935 Enqueue(queue, pktSize, 20, true);
936 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
937 20 * modeSize,
938 "There should be 20 packets in queue.");
939
940 // The first dequeue occurs with a sojourn time below CE threshold
941 // there should not any be CE threshold exceeded marked packets
942 Simulator::Schedule(MilliSeconds(1),
944 this,
945 queue,
946 modeSize,
947 4);
948
949 // Sojourn time above CE threshold so this dequeue should cause a packet to be CE thershold
950 // exceeded marked
951 Simulator::Schedule(MilliSeconds(3),
953 this,
954 queue,
955 modeSize,
956 4);
957
958 // the dequeue should cause a packet to be CE threshold exceeded marked
959 Simulator::Schedule(waitUntilFirstDequeue,
961 this,
962 queue,
963 modeSize,
964 4);
965
966 // In dropping time and it's time for next packet to be dropped but because of using ECN, packet
967 // should be marked
968 Simulator::Schedule(waitUntilSecondDequeue,
970 this,
971 queue,
972 modeSize,
973 4);
974
975 Simulator::Run();
976 Simulator::Destroy();
977}
978
979void
981 uint32_t size,
982 uint32_t nPkt,
983 bool ecnCapable)
984{
985 Address dest;
986 for (uint32_t i = 0; i < nPkt; i++)
987 {
988 queue->Enqueue(Create<CodelQueueDiscTestItem>(Create<Packet>(size), dest, ecnCapable));
989 }
990}
991
992void
994{
995 uint32_t initialTargetMarkCount =
996 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
997 uint32_t initialCeThreshMarkCount =
998 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
999 uint32_t initialQSize = queue->GetCurrentSize().GetValue();
1000 uint32_t initialDropNext = queue->GetDropNext();
1001 Time currentTime = Simulator::Now();
1002 uint32_t currentDropCount = 0;
1003 uint32_t currentTargetMarkCount = 0;
1004 uint32_t currentCeThreshMarkCount = 0;
1005
1006 if (initialTargetMarkCount > 0 && currentTime.GetMicroSeconds() >= initialDropNext &&
1007 testCase == 3)
1008 {
1009 queue->TraceConnectWithoutContext(
1010 "DropNext",
1012 }
1013
1014 if (initialQSize != 0)
1015 {
1016 Ptr<QueueDiscItem> item = queue->Dequeue();
1017 if (testCase == 1)
1018 {
1019 currentDropCount =
1020 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1021 if (currentDropCount == 1)
1022 {
1023 nPacketsBeforeFirstDrop = initialQSize;
1024 }
1025 }
1026 else if (testCase == 2)
1027 {
1028 if (initialTargetMarkCount == 0 && currentTime > queue->GetTarget())
1029 {
1030 if (currentTime < queue->GetInterval())
1031 {
1032 currentDropCount =
1033 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1034 currentTargetMarkCount =
1035 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1036 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1037 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1038 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1039 initialQSize - modeSize,
1040 "There should be 1 packet dequeued.");
1041 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1042 0,
1043 "There should not be any packet drops");
1045 currentTargetMarkCount,
1046 0,
1047 "We are not in dropping state."
1048 "Sojourn time has just gone above target from below."
1049 "Hence, there should be no target exceeded marked packets");
1051 currentCeThreshMarkCount,
1052 0,
1053 "Marking due to CE threshold is disabled"
1054 "Hence, there should not be any CE threshold exceeded marked packet");
1055 }
1056 else if (currentTime >= queue->GetInterval())
1057 {
1058 currentDropCount =
1059 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1060 currentTargetMarkCount =
1061 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1062 nPacketsBeforeFirstMark = initialQSize;
1063 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1064 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1066 queue->GetCurrentSize().GetValue(),
1067 initialQSize - modeSize,
1068 "Sojourn time has been above target for at least interval."
1069 "We enter the dropping state and perform initial packet marking"
1070 "So there should be only 1 more packet dequeued.");
1071 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1072 0,
1073 "There should not be any packet drops");
1074 NS_TEST_ASSERT_MSG_EQ(currentTargetMarkCount,
1075 1,
1076 "There should be 1 target exceeded marked packet");
1078 currentCeThreshMarkCount,
1079 0,
1080 "There should not be any CE threshold exceeded marked packet");
1081 }
1082 }
1083 else if (initialTargetMarkCount > 0)
1084 { // In dropping state
1085 if (currentTime.GetMicroSeconds() < initialDropNext)
1086 {
1087 currentDropCount =
1088 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1089 currentTargetMarkCount =
1090 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1091 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1092 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1093 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1094 initialQSize - modeSize,
1095 "We are in dropping state."
1096 "Sojourn is still above target."
1097 "However, it's not time for next target exceeded mark."
1098 "So there should be only 1 more packet dequeued");
1099 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1100 0,
1101 "There should not be any packet drops");
1102 NS_TEST_ASSERT_MSG_EQ(currentTargetMarkCount,
1103 1,
1104 "There should still be only 1 target exceeded marked "
1105 "packet from the last dequeue");
1107 currentCeThreshMarkCount,
1108 0,
1109 "There should not be any CE threshold exceeded marked packet");
1110 }
1111 else if (currentTime.GetMicroSeconds() >= initialDropNext)
1112 {
1113 currentDropCount =
1114 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1115 currentTargetMarkCount =
1116 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1117 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1118 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1119 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1120 initialQSize - modeSize,
1121 "We are in dropping state."
1122 "It's time for packet to be marked"
1123 "So there should be only 1 more packet dequeued");
1124 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1125 0,
1126 "There should not be any packet drops");
1127 NS_TEST_ASSERT_MSG_EQ(currentTargetMarkCount,
1128 2,
1129 "There should 2 target exceeded marked packet");
1133 "Number of packets in the queue before drop should be equal"
1134 "to number of packets in the queue before first mark as the behavior "
1135 "untill packet N should be the same.");
1137 currentCeThreshMarkCount,
1138 0,
1139 "There should not be any CE threshold exceeded marked packet");
1140 }
1141 }
1142 }
1143 else if (testCase == 3)
1144 {
1145 if (initialTargetMarkCount == 0 && currentTime > queue->GetTarget())
1146 {
1147 if (currentTime < queue->GetInterval())
1148 {
1149 currentDropCount =
1150 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1151 currentTargetMarkCount =
1152 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1153 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1154 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1155 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1156 initialQSize - modeSize,
1157 "There should be 1 packet dequeued.");
1158 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1159 0,
1160 "There should not be any packet drops");
1162 currentTargetMarkCount,
1163 0,
1164 "We are not in dropping state."
1165 "Sojourn time has just gone above target from below."
1166 "Hence, there should be no target exceeded marked packets");
1168 currentCeThreshMarkCount,
1169 1,
1170 "Sojourn time has gone above CE threshold."
1171 "Hence, there should be 1 CE threshold exceeded marked packet");
1172 }
1173 else if (currentTime >= queue->GetInterval())
1174 {
1175 currentDropCount =
1176 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1177 currentTargetMarkCount =
1178 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1179 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1180 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1182 queue->GetCurrentSize().GetValue(),
1183 initialQSize - modeSize,
1184 "Sojourn time has been above target for at least interval."
1185 "We enter the dropping state and perform initial packet marking"
1186 "So there should be only 1 more packet dequeued.");
1187 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1188 0,
1189 "There should not be any packet drops");
1190 NS_TEST_ASSERT_MSG_EQ(currentTargetMarkCount,
1191 1,
1192 "There should be 1 target exceeded marked packet");
1193 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1194 1,
1195 "There should be 1 CE threshold exceeded marked packets");
1196 }
1197 }
1198 else if (initialTargetMarkCount > 0)
1199 { // In dropping state
1200 if (currentTime.GetMicroSeconds() < initialDropNext)
1201 {
1202 currentDropCount =
1203 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1204 currentTargetMarkCount =
1205 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1206 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1207 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1208 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1209 initialQSize - modeSize,
1210 "We are in dropping state."
1211 "Sojourn is still above target."
1212 "However, it's not time for next target exceeded mark."
1213 "So there should be only 1 more packet dequeued");
1214 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1215 0,
1216 "There should not be any packet drops");
1217 NS_TEST_ASSERT_MSG_EQ(currentTargetMarkCount,
1218 1,
1219 "There should still be only 1 target exceeded marked "
1220 "packet from the last dequeue");
1221 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1222 2,
1223 "There should be 2 CE threshold exceeded marked packets");
1224 }
1225 else if (currentTime.GetMicroSeconds() >= initialDropNext)
1226 {
1227 currentDropCount =
1228 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1229 currentTargetMarkCount =
1230 queue->GetStats().GetNMarkedPackets(CoDelQueueDisc::TARGET_EXCEEDED_MARK);
1231 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1232 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1234 queue->GetCurrentSize().GetValue(),
1235 initialQSize - (m_dropNextCount + 1) * modeSize,
1236 "We are in dropping state."
1237 "It's time for packet to be dropped as packets are not ecnCapable"
1238 "The number of packets dequeued equals to the number of times m_dropNext "
1239 "is updated plus initial dequeue");
1241 currentDropCount,
1243 "The number of drops equals to the number of times m_dropNext is updated");
1245 currentTargetMarkCount,
1246 1,
1247 "There should still be only 1 target exceeded marked packet");
1248 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1249 2,
1250 "There should still be 2 CE threshold exceeded marked "
1251 "packet as packets are not ecnCapable");
1252 }
1253 }
1254 }
1255 else if (testCase == 4)
1256 {
1257 if (currentTime < queue->GetTarget())
1258 {
1259 if (initialCeThreshMarkCount == 0 && currentTime < MilliSeconds(2))
1260 {
1261 currentDropCount =
1262 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1263 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1264 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1265 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1266 initialQSize - modeSize,
1267 "There should be 1 packet dequeued.");
1268 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1269 0,
1270 "There should not be any packet drops");
1272 currentCeThreshMarkCount,
1273 0,
1274 "Sojourn time has not gone above CE threshold."
1275 "Hence, there should not be any CE threshold exceeded marked packet");
1276 }
1277 else
1278 {
1279 currentDropCount =
1280 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1281 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1282 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1283 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1284 initialQSize - modeSize,
1285 "There should be only 1 more packet dequeued.");
1286 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1287 0,
1288 "There should not be any packet drops");
1289 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1290 1,
1291 "Sojourn time has gone above CE threshold."
1292 "There should be 1 CE threshold exceeded marked packet");
1293 }
1294 }
1295 else if (initialCeThreshMarkCount > 0 && currentTime < queue->GetInterval())
1296 {
1297 if (initialCeThreshMarkCount < 2)
1298 {
1299 currentDropCount =
1300 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1301 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1302 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1303 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1304 initialQSize - modeSize,
1305 "There should be only 1 more packet dequeued.");
1306 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1307 0,
1308 "There should not be any packet drops");
1309 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1310 2,
1311 "There should be 2 CE threshold exceeded marked packets");
1312 }
1313 else
1314 { // In dropping state
1315 currentDropCount =
1316 queue->GetStats().GetNDroppedPackets(CoDelQueueDisc::TARGET_EXCEEDED_DROP);
1317 currentCeThreshMarkCount = queue->GetStats().GetNMarkedPackets(
1318 CoDelQueueDisc::CE_THRESHOLD_EXCEEDED_MARK);
1319 NS_TEST_ASSERT_MSG_EQ(queue->GetCurrentSize().GetValue(),
1320 initialQSize - modeSize,
1321 "There should be only 1 more packet dequeued.");
1322 NS_TEST_ASSERT_MSG_EQ(currentDropCount,
1323 0,
1324 "There should not be any packet drops");
1325 NS_TEST_ASSERT_MSG_EQ(currentCeThreshMarkCount,
1326 3,
1327 "There should be 3 CE threshold exceeded marked packet");
1328 }
1329 }
1330 }
1331 }
1332}
1333
1341{
1342 public:
1344 : TestSuite("codel-queue-disc", UNIT)
1345 {
1346 // Test 1: simple enqueue/dequeue with no drops
1349 // Test 2: enqueue with drops due to queue overflow
1352 // Test 3: test NewtonStep() against explicit port of Linux implementation
1353 AddTestCase(new CoDelQueueDiscNewtonStepTest(), TestCase::QUICK);
1354 // Test 4: test ControlLaw() against explicit port of Linux implementation
1355 AddTestCase(new CoDelQueueDiscControlLawTest(), TestCase::QUICK);
1356 // Test 5: enqueue/dequeue with drops according to CoDel algorithm
1359 // Test 6: enqueue/dequeue with marks according to CoDel algorithm
1362 }
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.
void DoRun() override
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.
void DoRun() override
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.
void DoRun() override
Implementation to actually run this TestCase.
CoDelQueueDiscBasicMark(QueueSizeUnit mode)
Constructor.
Test 2: enqueue with drops due to queue overflow.
CoDelQueueDiscBasicOverflow(QueueSizeUnit mode)
Constructor.
void DoRun() override
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.
void DoRun() override
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.
void DoRun() override
Implementation to actually run this TestCase.
CoDel Queue Disc Test Suite.
Codel Queue Disc Test Item.
void AddHeader() override
Add the header to the packet.
bool Mark() override
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
bool m_ecnCapablePacket
ECN capable packet?
CodelQueueDiscTestItem & operator=(const CodelQueueDiscTestItem &)=delete
CodelQueueDiscTestItem(const CodelQueueDiscTestItem &)=delete
CodelQueueDiscTestItem()=delete
a polymophic address class
Definition: address.h:92
AttributeValue implementation for Boolean.
Definition: boolean.h:37
uint64_t GetUid() const
Returns the packet's Uid.
Definition: packet.cc:412
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition: queue-item.h:133
Class for representing queue sizes.
Definition: queue-size.h:96
AttributeValue implementation for QueueSize.
Hold variables of type string.
Definition: string.h:42
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1265
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:412
AttributeValue implementation for Time.
Definition: nstime.h:1425
Hold an unsigned integer type.
Definition: uinteger.h:45
#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.
Definition: queue-size.h:44
@ BYTES
Use number of bytes for queue size.
Definition: queue-size.h:46
@ PACKETS
Use number of packets for queue size.
Definition: queue-size.h:45
Time Now()
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:296
#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.
Definition: test.h:144
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:251
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition: test.h:564
CoDelQueueDiscTestSuite g_coDelQueueTestSuite
the test suite
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:691
uint32_t pktSize
packet size used for the simulation (in bytes)