21#include "ns3/double.h"
23#include "ns3/packet.h"
24#include "ns3/red-queue-disc.h"
25#include "ns3/simulator.h"
26#include "ns3/string.h"
28#include "ns3/uinteger.h"
93 void DoRun()
override;
118 :
TestCase(
"Sanity check on the functionality of Adaptive RED")
135 if (mode == QueueSizeUnit::BYTES)
139 minTh = minTh * modeSize;
140 maxTh = maxTh * modeSize;
141 qSize = qSize * modeSize;
146 "Verify that we can actually set the attribute MinTh");
149 "Verify that we can actually set the attribute MaxTh");
153 "Verify that we can actually set the attribute MaxSize");
156 "Verify that we can actually set the attribute QW");
162 "There should be zero unforced drops");
165 queue = CreateObject<RedQueueDisc>();
168 "Verify that we can actually set the attribute MinTh");
171 "Verify that we can actually set the attribute MaxTh");
175 "Verify that we can actually set the attribute MaxSize");
178 "Verify that we can actually set the attribute QW");
182 "Verify that we can actually set the attribute LinkBandwidth");
185 st = queue->GetStats();
188 "There should be some unforced drops");
191 queue = CreateObject<RedQueueDisc>();
194 "Verify that we can actually set the attribute MinTh");
197 "Verify that we can actually set the attribute MaxTh");
201 "Verify that we can actually set the attribute MaxSize");
204 "Verify that we can actually set the attribute QW");
207 st = queue->GetStats();
210 "There should be zero unforced drops");
213 queue = CreateObject<RedQueueDisc>();
216 "Verify that we can actually set the attribute MinTh");
219 "Verify that we can actually set the attribute MaxTh");
223 "Verify that we can actually set the attribute MaxSize");
226 "Verify that we can actually set the attribute QW");
230 "Verify that we can actually set the attribute LinkBandwidth");
233 st = queue->GetStats();
236 "There should be some unforced drops");
239 queue = CreateObject<RedQueueDisc>();
242 "Verify that we can actually set the attribute MinTh");
245 "Verify that we can actually set the attribute MaxTh");
249 "Verify that we can actually set the attribute MaxSize");
252 "Verify that we can actually set the attribute QW");
255 st = queue->GetStats();
260 queue = CreateObject<RedQueueDisc>();
263 "Verify that we can actually set the attribute MinTh");
266 "Verify that we can actually set the attribute MaxTh");
270 "Verify that we can actually set the attribute MaxSize");
273 "Verify that we can actually set the attribute QW");
277 "Verify that we can actually set the attribute LinkBandwidth");
280 st = queue->GetStats();
286 queue = CreateObject<RedQueueDisc>();
289 "Verify that we can actually set the attribute MinTh");
292 "Verify that we can actually set the attribute MaxTh");
296 "Verify that we can actually set the attribute MaxSize");
299 st = queue->GetStats();
302 "There should be some unforced drops");
306 queue = CreateObject<RedQueueDisc>();
309 "Verify that we can actually set the attribute MinTh");
312 "Verify that we can actually set the attribute MaxTh");
316 "Verify that we can actually set the attribute MaxSize");
320 "Verify that we can actually set the attribute LinkBandwidth");
323 st = queue->GetStats();
326 "There should be zero unforced drops");
329 queue = CreateObject<RedQueueDisc>();
330 minTh = 5 * modeSize;
331 maxTh = 15 * modeSize;
334 "Verify that we can actually set the attribute MinTh");
337 "Verify that we can actually set the attribute MaxTh");
341 "Verify that we can actually set the attribute MaxSize");
344 "Verify that we can actually set the attribute QW");
347 "Verify that we can actually set the attribute LInterm");
352 st = queue->GetStats();
356 "There should be some unforced drops");
359 queue = CreateObject<RedQueueDisc>();
363 "Verify that we can actually set the attribute MaxSize");
366 "Verify that we can actually set the attribute LInterm");
369 "Verify that we can actually set the attribute ARED");
374 st = queue->GetStats();
385 queue->Enqueue(Create<AredQueueDiscTestItem>(Create<Packet>(size), dest));
Ared Queue Disc Test Case.
void RunAredDiscTest(QueueSizeUnit mode)
Run ARED queue disc test function.
void Enqueue(Ptr< RedQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
void EnqueueWithDelay(Ptr< RedQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue with delay function.
void DoRun() override
Implementation to actually run this TestCase.
Ared Queue Disc Test Item.
AredQueueDiscTestItem()=delete
void AddHeader() override
Add the header to the packet.
AredQueueDiscTestItem(const AredQueueDiscTestItem &)=delete
AredQueueDiscTestItem & operator=(const AredQueueDiscTestItem &)=delete
bool Mark() override
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
~AredQueueDiscTestItem() override
Ared Queue Disc Test Suite.
a polymophic address class
AttributeValue implementation for Boolean.
Class for representing data rates.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
static constexpr const char * UNFORCED_DROP
Early probability drops.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
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.
QueueSizeUnit
Enumeration of the operating modes of queues.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#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_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
AredQueueDiscTestSuite g_aredQueueDiscTestSuite
the test suite
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Structure that keeps the queue disc statistics.
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
uint32_t pktSize
packet size used for the simulation (in bytes)