A Discrete-Event Network Simulator
API
cobalt-queue-disc-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 NITK Surathkal
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Ported to ns-3 by: Vignesh Kannan <vignesh2496@gmail.com>
19  * Harsh Lara <harshapplefan@gmail.com>
20  * Jendaipou Palmei <jendaipoupalmei@gmail.com>
21  * Shefali Gupta <shefaligups11@gmail.com>
22  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
23  */
24 
25 #include "ns3/test.h"
26 #include "ns3/cobalt-queue-disc.h"
27 #include "ns3/packet.h"
28 #include "ns3/uinteger.h"
29 #include "ns3/string.h"
30 #include "ns3/double.h"
31 #include "ns3/log.h"
32 #include "ns3/simulator.h"
33 
34 using namespace ns3;
42 {
43 public:
52  CobaltQueueDiscTestItem (Ptr<Packet> p, const Address & addr,uint16_t protocol, bool ecnCapable);
53  virtual ~CobaltQueueDiscTestItem ();
54  virtual void AddHeader (void);
55  virtual bool Mark (void);
56 
57 private:
71 };
72 
73 CobaltQueueDiscTestItem::CobaltQueueDiscTestItem (Ptr<Packet> p, const Address & addr,uint16_t protocol, bool ecnCapable)
74  : QueueDiscItem (p, addr, ecnCapable),
75  m_ecnCapablePacket (ecnCapable)
76 {
77 }
78 
80 {
81 }
82 
83 void
85 {
86 }
87 
88 bool
90 {
92  {
93  return true;
94  }
95  return false;
96 }
97 
105 {
106 public:
113  virtual void DoRun (void);
114 
123 private:
125 };
126 
128  : TestCase ("Basic enqueue and dequeue operations, and attribute setting" + std::to_string (mode))
129 {
130  m_mode = mode;
131 }
132 
133 void
135 {
136  Ptr<CobaltQueueDisc> queue = CreateObject<CobaltQueueDisc> ();
137 
138  uint32_t pktSize = 1000;
139  uint32_t modeSize = 0;
140 
141  Address dest;
142 
143  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Interval", StringValue ("50ms")), true,
144  "Verify that we can actually set the attribute Interval");
145  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Target", StringValue ("4ms")), true,
146  "Verify that we can actually set the attribute Target");
147  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
148  "Disable Blue enhancement");
149 
151  {
152  modeSize = pktSize;
153  }
154  else if (m_mode == QueueSizeUnit::PACKETS)
155  {
156  modeSize = 1;
157  }
158  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 1500))),
159  true, "Verify that we can actually set the attribute MaxSize");
160  queue->Initialize ();
161 
162  Ptr<Packet> p1, p2, p3, p4, p5, p6;
163  p1 = Create<Packet> (pktSize);
164  p2 = Create<Packet> (pktSize);
165  p3 = Create<Packet> (pktSize);
166  p4 = Create<Packet> (pktSize);
167  p5 = Create<Packet> (pktSize);
168  p6 = Create<Packet> (pktSize);
169 
170  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in queue");
171  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p1, dest,0, false));
172  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
173  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p2, dest,0, false));
174  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
175  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p3, dest,0, false));
176  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
177  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p4, dest,0, false));
178  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
179  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p5, dest,0, false));
180  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
181  queue->Enqueue (Create<CobaltQueueDiscTestItem> (p6, dest,0, false));
182  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 6 * modeSize, "There should be six packets in queue");
183 
184  NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "There should be no packets being dropped due to full queue");
185 
186  Ptr<QueueDiscItem> item;
187 
188  item = queue->Dequeue ();
189  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
190  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 5 * modeSize, "There should be five packets in queue");
191  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
192 
193  item = queue->Dequeue ();
194  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
195  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in queue");
196  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
197 
198  item = queue->Dequeue ();
199  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
200  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in queue");
201  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
202 
203  item = queue->Dequeue ();
204  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the forth packet");
205  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in queue");
206  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
207 
208  item = queue->Dequeue ();
209  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the fifth packet");
210  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in queue");
211  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p5->GetUid (), "Was this the fifth packet ?");
212 
213  item = queue->Dequeue ();
214  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the last packet");
215  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in queue");
216  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p6->GetUid (), "Was this the sixth packet ?");
217 
218  item = queue->Dequeue ();
219  NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "There are really no packets in queue");
220 
221  NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should be no packet drops according to Cobalt algorithm");
222 }
223 
231 {
232 public:
234  virtual void DoRun (void);
241  void Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt);
246  void RunDropTest (QueueSizeUnit mode);
255  void EnqueueWithDelay (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt);
256 
257 };
258 
260  : TestCase ("Drop tests verification for both packets and bytes mode")
261 {
262 }
263 
264 void
266 
267 {
268  uint32_t pktSize = 1500;
269  uint32_t modeSize = 0;
270  Ptr<CobaltQueueDisc> queue = CreateObject<CobaltQueueDisc> ();
271 
272  if (mode == QueueSizeUnit::BYTES)
273  {
274  modeSize = pktSize;
275  }
276  else if (mode == QueueSizeUnit::PACKETS)
277  {
278  modeSize = 1;
279  }
280 
281  queue = CreateObject<CobaltQueueDisc> ();
282  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, modeSize * 100))),
283  true, "Verify that we can actually set the attribute MaxSize");
284  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
285  "Disable Blue enhancement");
286  queue->Initialize ();
287 
288  if (mode == QueueSizeUnit::BYTES)
289  {
290  EnqueueWithDelay (queue, pktSize, 200);
291  }
292  else
293  {
294  EnqueueWithDelay (queue, 1, 200);
295  }
296 
297  Simulator::Stop (Seconds (8.0));
298  Simulator::Run ();
299 
300  QueueDisc::Stats st = queue->GetStats ();
301 
302 // The Pdrop value should increase, from it's default value of zero
303  NS_TEST_EXPECT_MSG_NE (queue->GetPdrop (), 0, "Pdrop should be non-zero");
304  NS_TEST_EXPECT_MSG_NE (st.GetNDroppedPackets (CobaltQueueDisc::OVERLIMIT_DROP), 0, "Drops due to queue overflow should be non-zero");
305 }
306 
307 void
309 {
310  Address dest;
311  double delay = 0.01; // enqueue packets with delay
312  for (uint32_t i = 0; i < nPkt; i++)
313  {
314  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &CobaltQueueDiscDropTest::Enqueue, this, queue, size, 1);
315  }
316 }
317 
318 void
319 CobaltQueueDiscDropTest::Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt)
320 {
321  Address dest;
322  for (uint32_t i = 0; i < nPkt; i++)
323  {
324  queue->Enqueue (Create<CobaltQueueDiscTestItem> (Create<Packet> (size), dest, 0, true));
325  }
326 }
327 
328 void
330 {
333  Simulator::Destroy ();
334 }
335 
343 {
344 public:
351  virtual void DoRun (void);
352 
353 private:
361  void Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt, bool ecnCapable);
368  void Dequeue (Ptr<CobaltQueueDisc> queue, uint32_t modeSize, uint32_t testCase);
374  void DropNextTracer (int64_t oldVal, int64_t newVal);
376  uint32_t m_dropNextCount;
379 };
380 
382  : TestCase ("Basic mark operations")
383 {
384  m_mode = mode;
385  m_dropNextCount = 0;
386 }
387 
388 void
389 CobaltQueueDiscMarkTest::DropNextTracer (int64_t oldVal, int64_t newVal)
390 {
391  NS_UNUSED (oldVal);
392  NS_UNUSED (newVal);
393  m_dropNextCount++;
394 }
395 
396 void
398 {
399  // Test is divided into 3 sub test cases:
400  // 1) Packets are not ECN capable.
401  // 2) Packets are ECN capable.
402  // 3) Some packets are ECN capable.
403 
404  // Test case 1
405  Ptr<CobaltQueueDisc> queue = CreateObject<CobaltQueueDisc> ();
406  uint32_t pktSize = 1000;
407  uint32_t modeSize = 0;
410 
412  {
413  modeSize = pktSize;
414  }
415  else if (m_mode == QueueSizeUnit::PACKETS)
416  {
417  modeSize = 1;
418  }
419 
420  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
421  true, "Verify that we can actually set the attribute MaxSize");
422  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (false)),
423  true, "Verify that we can actually set the attribute UseEcn");
424  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
425  "Disable Blue enhancement");
426  queue->Initialize ();
427 
428  // Not-ECT traffic to induce packet drop
429  Enqueue (queue, pktSize, 20, false);
430  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
431 
432  // Although the first dequeue occurs with a sojourn time above target
433  // there should not be any dropped packets in this interval
434  Time waitUntilFirstDequeue = 2 * queue->GetTarget ();
435  Simulator::Schedule (waitUntilFirstDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 1);
436 
437  // This dequeue should cause a packet to be dropped
438  Time waitUntilSecondDequeue = waitUntilFirstDequeue + 2 * queue->GetInterval ();
439  Simulator::Schedule (waitUntilSecondDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 1);
440 
441  Simulator::Run ();
442  Simulator::Destroy ();
443 
444  // Test case 2, queue with ECN capable traffic for marking of packets instead of dropping
445  queue = CreateObject<CobaltQueueDisc> ();
446  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
447  true, "Verify that we can actually set the attribute MaxSize");
448  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
449  true, "Verify that we can actually set the attribute UseEcn");
450  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
451  "Disable Blue enhancement");
452  queue->Initialize ();
453 
454  // ECN capable traffic
455  Enqueue (queue, pktSize, 20, true);
456  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
457 
458  // Although the first dequeue occurs with a sojourn time above target
459  // there should not be any marked packets in this interval
460  Simulator::Schedule (waitUntilFirstDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 2);
461 
462  // This dequeue should cause a packet to be marked
463  Simulator::Schedule (waitUntilSecondDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 2);
464 
465  // This dequeue should cause a packet to be marked as dropnext is equal to current time
466  Simulator::Schedule (waitUntilSecondDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 2);
467 
468  // In dropping phase and it's time for next packet to be marked
469  // the dequeue should cause additional packet to be marked
470  Simulator::Schedule (waitUntilSecondDequeue * 2, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 2);
471 
472  Simulator::Run ();
473  Simulator::Destroy ();
474 
475  // Test case 3, some packets are ECN capable
476  queue = CreateObject<CobaltQueueDisc> ();
477  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (m_mode, modeSize * 500))),
478  true, "Verify that we can actually set the attribute MaxSize");
479  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
480  true, "Verify that we can actually set the attribute UseEcn");
481  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
482  "Disable Blue enhancement");
483  queue->Initialize ();
484 
485  // First 3 packets in the queue are ecnCapable
486  Enqueue (queue, pktSize, 3, true);
487  // Rest of the packet are not ecnCapable
488  Enqueue (queue, pktSize, 17, false);
489  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 20 * modeSize, "There should be 20 packets in queue.");
490 
491  // Although the first dequeue occurs with a sojourn time above target
492  // there should not be any marked packets in this interval
493  Simulator::Schedule (waitUntilFirstDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 3);
494 
495  // This dequeue should cause a packet to be marked
496  Simulator::Schedule (waitUntilSecondDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 3);
497 
498  // This dequeue should cause a packet to be marked as dropnext is equal to current time
499  Simulator::Schedule (waitUntilSecondDequeue, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 3);
500 
501  // In dropping phase and it's time for next packet to be dropped as packets are not ECN capable
502  // the dequeue should cause packet to be dropped
503  Simulator::Schedule (waitUntilSecondDequeue * 2, &CobaltQueueDiscMarkTest::Dequeue, this, queue, modeSize, 3);
504 
505  Simulator::Run ();
506  Simulator::Destroy ();
507 }
508 
509 void
510 CobaltQueueDiscMarkTest::Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt, bool ecnCapable)
511 {
512  Address dest;
513  for (uint32_t i = 0; i < nPkt; i++)
514  {
515  queue->Enqueue (Create<CobaltQueueDiscTestItem> (Create<Packet> (size), dest, 0, ecnCapable));
516  }
517 }
518 
519 void
520 CobaltQueueDiscMarkTest::Dequeue (Ptr<CobaltQueueDisc> queue, uint32_t modeSize, uint32_t testCase)
521 {
522  uint32_t initialMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
523  uint32_t initialQSize = queue->GetCurrentSize ().GetValue ();
524  uint32_t initialDropNext = queue->GetDropNext ();
525  Time currentTime = Simulator::Now ();
526  uint32_t currentDropCount = 0;
527  uint32_t currentMarkCount = 0;
528 
529  if (initialMarkCount > 0 && currentTime.GetNanoSeconds () > initialDropNext && testCase == 3)
530  {
532  }
533 
534  if (initialQSize != 0)
535  {
536  Ptr<QueueDiscItem> item = queue->Dequeue ();
537  if (testCase == 1)
538  {
539  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
540  if (currentDropCount != 0)
541  {
542  nPacketsBeforeFirstDrop = initialQSize;
543  }
544  }
545  if (testCase == 2)
546  {
547  if (initialMarkCount == 0 && currentTime > queue->GetTarget ())
548  {
549  if (currentTime < queue->GetInterval ())
550  {
551  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
552  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
553  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
554  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
555  NS_TEST_ASSERT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
556  "Sojourn time has just gone above target from below."
557  "Hence, there should be no marked packets");
558  }
559  else if (currentTime >= queue->GetInterval ())
560  {
561  nPacketsBeforeFirstMark = initialQSize;
562  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
563  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
564  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
565  "Sojourn time has been above target for at least interval."
566  "We enter the dropping state and perform initial packet marking"
567  "So there should be only 1 more packet dequeued.");
568  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
569  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 1, "There should be 1 marked packet");
570  }
571  }
572  else if (initialMarkCount > 0)
573  {
574  if (currentTime.GetNanoSeconds () <= initialDropNext)
575  {
576  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
577  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
578  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
579  "Sojourn is still above target."
580  "There should be only 1 more packet dequeued");
581  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
582  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 2, "There should be 2 marked packet as."
583  "current dropnext is equal to current time.");
584  }
585  else if (currentTime.GetNanoSeconds () > initialDropNext)
586  {
587  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
588  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
589  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
590  "It's time for packet to be marked"
591  "So there should be only 1 more packet dequeued");
592  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
593  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 3, "There should be 3 marked packet");
594  NS_TEST_EXPECT_MSG_EQ (nPacketsBeforeFirstDrop, nPacketsBeforeFirstMark, "Number of packets in the queue before drop should be equal"
595  "to number of packets in the queue before first mark as the behavior until packet N should be the same.");
596  }
597  }
598  }
599  else if (testCase == 3)
600  {
601  if (initialMarkCount == 0 && currentTime > queue->GetTarget ())
602  {
603  if (currentTime < queue->GetInterval ())
604  {
605  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
606  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
607  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "There should be 1 packet dequeued.");
608  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
609  NS_TEST_ASSERT_MSG_EQ (currentMarkCount, 0, "We are not in dropping state."
610  "Sojourn time has just gone above target from below."
611  "Hence, there should be no marked packets");
612  }
613  else if (currentTime >= queue->GetInterval ())
614  {
615  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
616  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
617  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize,
618  "Sojourn time has been above target for at least interval."
619  "We enter the dropping state and perform initial packet marking"
620  "So there should be only 1 more packet dequeued.");
621  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
622  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 1, "There should be 1 marked packet");
623  }
624  }
625  else if (initialMarkCount > 0)
626  {
627  if (currentTime.GetNanoSeconds () <= initialDropNext)
628  {
629  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
630  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
631  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - modeSize, "We are in dropping state."
632  "Sojourn is still above target."
633  "So there should be only 1 more packet dequeued");
634  NS_TEST_EXPECT_MSG_EQ (currentDropCount, 0, "There should not be any packet drops");
635  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 2, "There should be 2 marked packet"
636  "as dropnext is equal to current time");
637  }
638  else if (currentTime.GetNanoSeconds () > initialDropNext)
639  {
640  currentDropCount = queue->GetStats ().GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP);
641  currentMarkCount = queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::FORCED_MARK);
642  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), initialQSize - (m_dropNextCount + 1) * modeSize, "We are in dropping state."
643  "It's time for packet to be dropped as packets are not ecnCapable"
644  "The number of packets dequeued equals to the number of times m_dropNext is updated plus initial dequeue");
645  NS_TEST_EXPECT_MSG_EQ (currentDropCount, m_dropNextCount, "The number of drops equals to the number of times m_dropNext is updated");
646  NS_TEST_EXPECT_MSG_EQ (currentMarkCount, 2, "There should still be only 2 marked packet");
647  }
648  }
649  }
650  }
651 }
652 
660 {
661 public:
669 
670 private:
671  virtual void DoRun (void);
678  void Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt);
686  void EnqueueWithDelay (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt, Time delay);
692  void Dequeue (Ptr<CobaltQueueDisc> queue, uint32_t modeSize);
700  void DequeueWithDelay (Ptr<CobaltQueueDisc> queue, uint32_t modeSize, uint32_t nPkt, Time delay);
702 };
703 
705  : TestCase ("Test CE Threshold marking")
706 {
707  m_mode = mode;
708 }
709 
711 {
712 }
713 
714 void
716 {
717  Address dest;
718  for (uint32_t i = 0; i < nPkt; i++)
719  {
720  queue->Enqueue (Create<CobaltQueueDiscTestItem> (Create<Packet> (size), dest, 0, true));
721  }
722 }
723 
724 void
726 {
727  for (uint32_t i = 0; i < nPkt; i++)
728  {
729  Simulator::Schedule (Time (Seconds ((i + 1) * delay.GetSeconds ())), &CobaltQueueDiscCeThresholdTest::Enqueue, this, queue, size, 1);
730  }
731 }
732 
733 void
735 {
736  Ptr<QueueDiscItem> item = queue->Dequeue ();
737 
738  if (Simulator::Now () > MilliSeconds (11) && Simulator::Now () < MilliSeconds (28))
739  {
740  NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::CE_THRESHOLD_EXCEEDED_MARK), 1, "There should be only 1 packet"
741  "mark, the delay between the enqueueing of the packets decreased after the"
742  "1st mark (packet enqueued at 11ms) and increased for the packet enqueued after 20.6ms."
743  "Queue delay remains below or equal to 1ms for the packet enqueued before 28ms");
744  }
745  if (Simulator::Now () > MilliSeconds (31) )
746  {
747  NS_TEST_EXPECT_MSG_EQ (queue->GetStats ().GetNMarkedPackets (CobaltQueueDisc::CE_THRESHOLD_EXCEEDED_MARK), 3, "There should be 3 packet"
748  "marks, the delay between the enqueueing of the packets decreased after 1st mark"
749  "(packet enqueued at 11ms) and increased for the packet enqueued after 20.6ms."
750  "Queue delay remains below 1ms for the packets enqueued before 28ms and increases"
751  "for the packets enqueued after 28ms.");
752  }
753 }
754 
755 void
756 CobaltQueueDiscCeThresholdTest::DequeueWithDelay (Ptr<CobaltQueueDisc> queue, uint32_t modeSize, uint32_t nPkt, Time delay)
757 {
758  for (uint32_t i = 0; i < nPkt; i++)
759  {
760  Simulator::Schedule (Time (Seconds ((i + 1) * delay.GetSeconds ())), &CobaltQueueDiscCeThresholdTest::Dequeue, this, queue, modeSize);
761  }
762 }
763 
764 void
766 {
767  Ptr<CobaltQueueDisc> queue = CreateObject<CobaltQueueDisc> ();
768  uint32_t pktSize = 1000;
769  uint32_t modeSize = 0;
770 
772  {
773  modeSize = pktSize;
774  }
775  else if (m_mode == QueueSizeUnit::PACKETS)
776  {
777  modeSize = 1;
778  }
779 
780  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
781  true, "Verify that we can actually set the attribute UseEcn");
782  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("CeThreshold", TimeValue (MilliSeconds (1))),
783  true, "Verify that we can actually set the attribute UseEcn");
784  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
785  "Disable Blue enhancement");
786  queue->Initialize ();
787 
788  // Enqueue 11 packets every 1ms
789  EnqueueWithDelay (queue, pktSize, 11, MilliSeconds (1));
790 
791  // With every dequeue, queue delay increases by 0.1ms as packet enqueues every 1ms while dequeues at 1.1ms
792  // so at 11th dequeue, the dequeued packet should be marked.
793  Time dequeueInterval = MicroSeconds (1100);
794  DequeueWithDelay (queue, modeSize, 11, dequeueInterval);
795 
796  // First mark occured for the packet enqueued at 11ms, ideally TCP would decrease sending rate
797  // which can be simulated by increasing interval between subsequent enqueues, so packets are now enqueued with a delay 1.2ms.
798  Time waitUntilFirstMark = MilliSeconds(11);
799  Simulator::Schedule (waitUntilFirstMark, &CobaltQueueDiscCeThresholdTest::EnqueueWithDelay, this, queue, pktSize, 9, MicroSeconds (1200));
800 
801  // Keep dequeueing with the same delay
802  Simulator::Schedule (waitUntilFirstMark, &CobaltQueueDiscCeThresholdTest::DequeueWithDelay, this, queue, modeSize, 9, dequeueInterval);
803 
804  // Queue delay becomes 0.2ms for the packet enqueued at 20.6ms, time to decrease interval between subsequent enqueues,
805  // as ideally TCP would again start increasing sending rate
806  Time waitUntilDecreasingEnqueueDelay = waitUntilFirstMark + MilliSeconds(9);
807  Simulator::Schedule (waitUntilDecreasingEnqueueDelay, &CobaltQueueDiscCeThresholdTest::EnqueueWithDelay, this, queue, pktSize, 10, MilliSeconds (1));
808 
809  // Keep dequeueing with the same delay
810  Simulator::Schedule (waitUntilFirstMark, &CobaltQueueDiscCeThresholdTest::DequeueWithDelay, this, queue, modeSize, 10, dequeueInterval);
811 
812  Simulator::Run ();
813  Simulator::Destroy ();
814 }
815 
816 
830 {
831 public:
839 
840 private:
841  virtual void DoRun (void);
848  void Enqueue (Ptr<CobaltQueueDisc> queue, uint32_t size, uint32_t nPkt);
853  void Dequeue (Ptr<CobaltQueueDisc> queue);
860  void DequeueWithDelay (Ptr<CobaltQueueDisc> queue, uint32_t nPkt, Time delay);
862 };
863 
865  : TestCase ("Enhanced Blue tests verification for both packets and bytes mode")
866 {
867  m_mode = mode;
868 }
869 
871 {
872 }
873 
874 void
876 
877 {
878  uint32_t pktSize = 1500;
879  uint32_t modeSize = 0;
880  Ptr<CobaltQueueDisc> queue = CreateObject<CobaltQueueDisc> ();
881 
883  {
884  modeSize = pktSize;
885  }
886  else if (m_mode == QueueSizeUnit::PACKETS)
887  {
888  modeSize = 1;
889  }
890  queue->Initialize ();
891  queue->AssignStreams (1);
892  Enqueue (queue, modeSize, 200);
893  DequeueWithDelay (queue, 100, MilliSeconds (10));
894 
895  Simulator::Stop (Seconds (8.0));
896  Simulator::Run ();
897 
898  QueueDisc::Stats st = queue->GetStats ();
899 
900  // The Pdrop value should increase, from it's default value of zero
901  NS_TEST_EXPECT_MSG_EQ (queue->GetPdrop (), 0.234375, "Pdrop should be increased by 1/256 for every packet whose sojourn time is above 400ms."
902  " From the 41st dequeue until the last one, sojourn time is above 400ms, so 60 packets have sojourn time above 400ms"
903  "hence Pdrop should be increased 60*(1/256) which is 0.234375");
904  NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 49, "There should a fixed number of drops (49 here)");
905  Simulator::Destroy ();
906 
907 
908  queue = CreateObject<CobaltQueueDisc> ();
909  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("UseEcn", BooleanValue (true)),
910  true, "Verify that we can actually set the attribute UseEcn");
911  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("BlueThreshold", TimeValue (Time::Max ())), true,
912  "Disable Blue enhancement");
913  queue->Initialize ();
914  Enqueue (queue, modeSize, 200);
915  DequeueWithDelay (queue, 100, MilliSeconds (10));
916 
917  Simulator::Stop (Seconds (8.0));
918  Simulator::Run ();
919 
920  st = queue->GetStats ();
921 
922  NS_TEST_EXPECT_MSG_EQ (queue->GetPdrop (), 0, "Pdrop should be zero");
923  NS_TEST_EXPECT_MSG_EQ (st.GetNDroppedPackets (CobaltQueueDisc::TARGET_EXCEEDED_DROP), 0, "There should not any dropped packets");
924  Simulator::Destroy ();
925 }
926 
927 void
929 {
930  Address dest;
931  for (uint32_t i = 0; i < nPkt; i++)
932  {
933  queue->Enqueue (Create<CobaltQueueDiscTestItem> (Create<Packet> (size), dest, 0, true));
934  }
935 }
936 
937 void
939 {
940  Ptr<QueueDiscItem> item = queue->Dequeue ();
941 }
942 
943 void
945 {
946  for (uint32_t i = 0; i < nPkt; i++)
947  {
948  Simulator::Schedule (Time (Seconds ((i + 1) * delay.GetSeconds ())), &CobaltQueueDiscEnhancedBlueTest::Dequeue, this, queue);
949  }
950 }
951 
952 
956 static class CobaltQueueDiscTestSuite : public TestSuite
957 {
958 public:
960  : TestSuite ("cobalt-queue-disc", UNIT)
961  {
962  // Test 1: simple enqueue/dequeue with no drops
963  AddTestCase (new CobaltQueueDiscBasicEnqueueDequeue (PACKETS), TestCase::QUICK);
964  AddTestCase (new CobaltQueueDiscBasicEnqueueDequeue (BYTES), TestCase::QUICK);
965  // Test 2: Drop test
966  AddTestCase (new CobaltQueueDiscDropTest (), TestCase::QUICK);
967  // Test 3: Mark test
968  AddTestCase (new CobaltQueueDiscMarkTest (PACKETS), TestCase::QUICK);
969  AddTestCase (new CobaltQueueDiscMarkTest (BYTES), TestCase::QUICK);
970  // Test 4: CE threshold marking test
971  AddTestCase (new CobaltQueueDiscCeThresholdTest (PACKETS), TestCase::QUICK);
972  AddTestCase (new CobaltQueueDiscCeThresholdTest (BYTES), TestCase::QUICK);
973  // Test 4: Blue enhancement test
974  AddTestCase (new CobaltQueueDiscEnhancedBlueTest (PACKETS), TestCase::QUICK);
975  AddTestCase (new CobaltQueueDiscEnhancedBlueTest (BYTES), TestCase::QUICK);
976  }
ns3::QueueDiscItem
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition: queue-item.h:148
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ns3::CobaltQueueDisc::GetPdrop
double GetPdrop() const
Get the drop probability of Blue.
Definition: cobalt-queue-disc.cc:162
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::QueueDisc::Stats
Structure that keeps the queue disc statistics.
Definition: queue-disc.h:186
CobaltQueueDiscMarkTest::Enqueue
void Enqueue(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt, bool ecnCapable)
Enqueue function.
Definition: cobalt-queue-disc-test-suite.cc:510
CobaltQueueDiscCeThresholdTest::CobaltQueueDiscCeThresholdTest
CobaltQueueDiscCeThresholdTest(QueueSizeUnit mode)
Constructor.
Definition: cobalt-queue-disc-test-suite.cc:704
CobaltQueueDiscBasicEnqueueDequeue
Test 1: simple enqueue/dequeue with no drops.
Definition: cobalt-queue-disc-test-suite.cc:105
CobaltQueueDiscCeThresholdTest::EnqueueWithDelay
void EnqueueWithDelay(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt, Time delay)
Enqueue with delay function.
Definition: cobalt-queue-disc-test-suite.cc:725
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ObjectBase::SetAttributeFailSafe
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
Definition: object-base.cc:205
CobaltQueueDiscDropTest::Enqueue
void Enqueue(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
Definition: cobalt-queue-disc-test-suite.cc:319
CobaltQueueDiscTestItem::Mark
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
Definition: cobalt-queue-disc-test-suite.cc:89
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
CobaltQueueDiscTestSuite::CobaltQueueDiscTestSuite
CobaltQueueDiscTestSuite()
Definition: cobalt-queue-disc-test-suite.cc:959
CobaltQueueDiscMarkTest::nPacketsBeforeFirstMark
uint32_t nPacketsBeforeFirstMark
Number of packets in the queue before first mark.
Definition: cobalt-queue-disc-test-suite.cc:378
ns3::QueueDisc::Enqueue
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Definition: queue-disc.cc:861
CobaltQueueDiscTestItem::m_ecnCapablePacket
bool m_ecnCapablePacket
ECN capable packet?
Definition: cobalt-queue-disc-test-suite.cc:70
CobaltQueueDiscTestItem::CobaltQueueDiscTestItem
CobaltQueueDiscTestItem(const CobaltQueueDiscTestItem &)
Copy constructor Disable default implementation to avoid misuse.
ns3::CobaltQueueDisc::GetTarget
Time GetTarget(void) const
Get the target queue delay.
Definition: cobalt-queue-disc.cc:213
CobaltQueueDiscEnhancedBlueTest::DequeueWithDelay
void DequeueWithDelay(Ptr< CobaltQueueDisc > queue, uint32_t nPkt, Time delay)
Dequeue with delay function.
Definition: cobalt-queue-disc-test-suite.cc:944
ns3::PACKETS
@ PACKETS
Use number of packets for queue size.
Definition: queue-size.h:44
CobaltQueueDiscCeThresholdTest::DequeueWithDelay
void DequeueWithDelay(Ptr< CobaltQueueDisc > queue, uint32_t modeSize, uint32_t nPkt, Time delay)
Dequeue with delay function.
Definition: cobalt-queue-disc-test-suite.cc:756
CobaltQueueDiscEnhancedBlueTest::m_mode
QueueSizeUnit m_mode
mode
Definition: cobalt-queue-disc-test-suite.cc:861
ns3::TestCase
encapsulates test code
Definition: test.h:1154
ns3::QueueSizeValue
Definition: queue-size.h:221
CobaltQueueDiscMarkTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: cobalt-queue-disc-test-suite.cc:397
CobaltQueueDiscMarkTest
Test 3: Cobalt Queue Disc ECN marking Test Item.
Definition: cobalt-queue-disc-test-suite.cc:343
ns3::Ptr< Packet >
CobaltQueueDiscEnhancedBlueTest::Dequeue
void Dequeue(Ptr< CobaltQueueDisc > queue)
Dequeue function.
Definition: cobalt-queue-disc-test-suite.cc:938
NS_TEST_EXPECT_MSG_NE
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
Definition: test.h:737
ns3::QueueDisc::Stats::GetNMarkedPackets
uint32_t GetNMarkedPackets(std::string reason) const
Get the number of packets marked for the given reason.
Definition: queue-disc.cc:152
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
CobaltQueueDiscMarkTest::CobaltQueueDiscMarkTest
CobaltQueueDiscMarkTest(QueueSizeUnit mode)
Constructor.
Definition: cobalt-queue-disc-test-suite.cc:381
CobaltQueueDiscDropTest::EnqueueWithDelay
void EnqueueWithDelay(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue the given number of packets, each of the given size, at different times.
Definition: cobalt-queue-disc-test-suite.cc:308
CobaltQueueDiscCeThresholdTest::Enqueue
void Enqueue(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
Definition: cobalt-queue-disc-test-suite.cc:715
CobaltQueueDiscMarkTest::m_dropNextCount
uint32_t m_dropNextCount
count the number of times m_dropNext is recalculated
Definition: cobalt-queue-disc-test-suite.cc:376
ns3::Address
a polymophic address class
Definition: address.h:91
CobaltQueueDiscEnhancedBlueTest
Test 5: Cobalt Queue Disc Enhanced Blue Test Item This test checks that the Blue Enhancement is worki...
Definition: cobalt-queue-disc-test-suite.cc:830
CobaltQueueDiscTestItem::~CobaltQueueDiscTestItem
virtual ~CobaltQueueDiscTestItem()
Definition: cobalt-queue-disc-test-suite.cc:79
ns3::CobaltQueueDisc::GetDropNext
int64_t GetDropNext(void) const
Get the time for next packet drop while in the dropping state.
Definition: cobalt-queue-disc.cc:225
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::QueueDisc::Stats::GetNDroppedPackets
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
Definition: queue-disc.cc:110
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
CobaltQueueDiscEnhancedBlueTest::CobaltQueueDiscEnhancedBlueTest
CobaltQueueDiscEnhancedBlueTest(QueueSizeUnit mode)
Constructor.
Definition: cobalt-queue-disc-test-suite.cc:864
g_cobaltQueueTestSuite
CobaltQueueDiscTestSuite g_cobaltQueueTestSuite
the test suite
CobaltQueueDiscEnhancedBlueTest::Enqueue
void Enqueue(Ptr< CobaltQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
Definition: cobalt-queue-disc-test-suite.cc:928
NS_TEST_EXPECT_MSG_EQ
#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:283
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
CobaltQueueDiscCeThresholdTest::~CobaltQueueDiscCeThresholdTest
virtual ~CobaltQueueDiscCeThresholdTest()
Definition: cobalt-queue-disc-test-suite.cc:710
ns3::QueueDisc::GetCurrentSize
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Definition: queue-disc.cc:523
ns3::Time::GetNanoSeconds
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:392
CobaltQueueDiscMarkTest::Dequeue
void Dequeue(Ptr< CobaltQueueDisc > queue, uint32_t modeSize, uint32_t testCase)
Dequeue function.
Definition: cobalt-queue-disc-test-suite.cc:520
CobaltQueueDiscCeThresholdTest::m_mode
QueueSizeUnit m_mode
mode
Definition: cobalt-queue-disc-test-suite.cc:701
CobaltQueueDiscMarkTest::DropNextTracer
void DropNextTracer(int64_t oldVal, int64_t newVal)
Drop next tracer function.
Definition: cobalt-queue-disc-test-suite.cc:389
CobaltQueueDiscDropTest::CobaltQueueDiscDropTest
CobaltQueueDiscDropTest()
Definition: cobalt-queue-disc-test-suite.cc:259
ns3::MakeCallback
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...
Definition: callback.h:1642
ns3::QueueDisc::Dequeue
Ptr< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any,...
Definition: queue-disc.cc:896
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
CobaltQueueDiscTestItem::CobaltQueueDiscTestItem
CobaltQueueDiscTestItem()
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
CobaltQueueDiscDropTest
Test 2: Cobalt Queue Disc Drop Test Item.
Definition: cobalt-queue-disc-test-suite.cc:231
NS_TEST_ASSERT_MSG_EQ
#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:166
ns3::QueueItem::GetPacket
Ptr< Packet > GetPacket(void) const
Definition: queue-item.cc:42
ns3::CobaltQueueDisc::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: cobalt-queue-disc.cc:173
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1353
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
pktSize
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:86
ns3::BYTES
@ BYTES
Use number of bytes for queue size.
Definition: queue-size.h:45
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
CobaltQueueDiscCeThresholdTest
Test 4: Cobalt Queue Disc CE Threshold marking Test Item.
Definition: cobalt-queue-disc-test-suite.cc:660
ns3::QueueSizeUnit
QueueSizeUnit
Enumeration of the operating modes of queues.
Definition: queue-size.h:43
CobaltQueueDiscDropTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: cobalt-queue-disc-test-suite.cc:329
CobaltQueueDiscCeThresholdTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: cobalt-queue-disc-test-suite.cc:765
CobaltQueueDiscMarkTest::m_mode
QueueSizeUnit m_mode
mode
Definition: cobalt-queue-disc-test-suite.cc:375
ns3::ObjectBase::TraceConnectWithoutContext
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
CobaltQueueDiscTestItem::AddHeader
virtual void AddHeader(void)
Add the header to the packet.
Definition: cobalt-queue-disc-test-suite.cc:84
ns3::QueueDisc::GetStats
const Stats & GetStats(void)
Retrieve all the collected statistics.
Definition: queue-disc.cc:421
ns3::QueueSize::GetValue
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:175
CobaltQueueDiscTestItem
Cobalt Queue Disc Test Item.
Definition: cobalt-queue-disc-test-suite.cc:42
CobaltQueueDiscTestSuite
The COBALT queue disc test suite.
Definition: cobalt-queue-disc-test-suite.cc:957
CobaltQueueDiscEnhancedBlueTest::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: cobalt-queue-disc-test-suite.cc:875
ns3::Object::Initialize
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
Max
#define Max(a, b)
Definition: aarf-wifi-manager.cc:26
ns3::QueueSize
Class for representing queue sizes.
Definition: queue-size.h:95
CobaltQueueDiscBasicEnqueueDequeue::m_mode
QueueSizeUnit m_mode
Queue test size function.
Definition: cobalt-queue-disc-test-suite.cc:124
CobaltQueueDiscDropTest::RunDropTest
void RunDropTest(QueueSizeUnit mode)
Run Cobalt test function.
Definition: cobalt-queue-disc-test-suite.cc:265
CobaltQueueDiscCeThresholdTest::Dequeue
void Dequeue(Ptr< CobaltQueueDisc > queue, uint32_t modeSize)
Dequeue function.
Definition: cobalt-queue-disc-test-suite.cc:734
ns3::Time::GetSeconds
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
CobaltQueueDiscMarkTest::nPacketsBeforeFirstDrop
uint32_t nPacketsBeforeFirstDrop
Number of packets in the queue before first drop.
Definition: cobalt-queue-disc-test-suite.cc:377
CobaltQueueDiscBasicEnqueueDequeue::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: cobalt-queue-disc-test-suite.cc:134
CobaltQueueDiscEnhancedBlueTest::~CobaltQueueDiscEnhancedBlueTest
virtual ~CobaltQueueDiscEnhancedBlueTest()
Definition: cobalt-queue-disc-test-suite.cc:870
ns3::Packet::GetUid
uint64_t GetUid(void) const
Returns the packet's Uid.
Definition: packet.cc:390
ns3::CobaltQueueDisc::GetInterval
Time GetInterval(void) const
Get the interval.
Definition: cobalt-queue-disc.cc:219
CobaltQueueDiscBasicEnqueueDequeue::CobaltQueueDiscBasicEnqueueDequeue
CobaltQueueDiscBasicEnqueueDequeue(QueueSizeUnit mode)
Constructor.
Definition: cobalt-queue-disc-test-suite.cc:127