10#include "ns3/double.h"
12#include "ns3/packet.h"
13#include "ns3/red-queue-disc.h"
14#include "ns3/simulator.h"
15#include "ns3/string.h"
17#include "ns3/uinteger.h"
82 void DoRun()
override;
107 :
TestCase(
"Sanity check on the functionality of Adaptive RED")
124 if (mode == QueueSizeUnit::BYTES)
128 minTh = minTh * modeSize;
129 maxTh = maxTh * modeSize;
130 qSize = qSize * modeSize;
135 "Verify that we can actually set the attribute MinTh");
138 "Verify that we can actually set the attribute MaxTh");
142 "Verify that we can actually set the attribute MaxSize");
145 "Verify that we can actually set the attribute QW");
151 "There should be zero unforced drops");
157 "Verify that we can actually set the attribute MinTh");
160 "Verify that we can actually set the attribute MaxTh");
164 "Verify that we can actually set the attribute MaxSize");
167 "Verify that we can actually set the attribute QW");
171 "Verify that we can actually set the attribute LinkBandwidth");
174 st = queue->GetStats();
177 "There should be some unforced drops");
183 "Verify that we can actually set the attribute MinTh");
186 "Verify that we can actually set the attribute MaxTh");
190 "Verify that we can actually set the attribute MaxSize");
193 "Verify that we can actually set the attribute QW");
196 st = queue->GetStats();
199 "There should be zero unforced drops");
205 "Verify that we can actually set the attribute MinTh");
208 "Verify that we can actually set the attribute MaxTh");
212 "Verify that we can actually set the attribute MaxSize");
215 "Verify that we can actually set the attribute QW");
219 "Verify that we can actually set the attribute LinkBandwidth");
222 st = queue->GetStats();
225 "There should be some unforced drops");
231 "Verify that we can actually set the attribute MinTh");
234 "Verify that we can actually set the attribute MaxTh");
238 "Verify that we can actually set the attribute MaxSize");
241 "Verify that we can actually set the attribute QW");
244 st = queue->GetStats();
252 "Verify that we can actually set the attribute MinTh");
255 "Verify that we can actually set the attribute MaxTh");
259 "Verify that we can actually set the attribute MaxSize");
262 "Verify that we can actually set the attribute QW");
266 "Verify that we can actually set the attribute LinkBandwidth");
269 st = queue->GetStats();
278 "Verify that we can actually set the attribute MinTh");
281 "Verify that we can actually set the attribute MaxTh");
285 "Verify that we can actually set the attribute MaxSize");
288 st = queue->GetStats();
291 "There should be some unforced drops");
298 "Verify that we can actually set the attribute MinTh");
301 "Verify that we can actually set the attribute MaxTh");
305 "Verify that we can actually set the attribute MaxSize");
309 "Verify that we can actually set the attribute LinkBandwidth");
312 st = queue->GetStats();
315 "There should be zero unforced drops");
319 minTh = 5 * modeSize;
320 maxTh = 15 * modeSize;
323 "Verify that we can actually set the attribute MinTh");
326 "Verify that we can actually set the attribute MaxTh");
330 "Verify that we can actually set the attribute MaxSize");
333 "Verify that we can actually set the attribute QW");
336 "Verify that we can actually set the attribute LInterm");
341 st = queue->GetStats();
345 "There should be some unforced drops");
352 "Verify that we can actually set the attribute MaxSize");
355 "Verify that we can actually set the attribute LInterm");
358 "Verify that we can actually set the attribute ARED");
363 st = queue->GetStats();
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
Class for representing data rates.
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.
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, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Simulation virtual time values and global simulation resolution.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
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)