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"
94 void DoRun()
override;
119 :
TestCase(
"Sanity check on the functionality of Adaptive RED")
140 minTh = minTh * modeSize;
141 maxTh = maxTh * modeSize;
142 qSize = qSize * modeSize;
147 "Verify that we can actually set the attribute MinTh");
150 "Verify that we can actually set the attribute MaxTh");
154 "Verify that we can actually set the attribute MaxSize");
157 "Verify that we can actually set the attribute QW");
163 "There should be zero unforced drops");
166 queue = CreateObject<RedQueueDisc>();
169 "Verify that we can actually set the attribute MinTh");
172 "Verify that we can actually set the attribute MaxTh");
176 "Verify that we can actually set the attribute MaxSize");
179 "Verify that we can actually set the attribute QW");
183 "Verify that we can actually set the attribute LinkBandwidth");
186 st = queue->GetStats();
189 "There should be some unforced drops");
192 queue = CreateObject<RedQueueDisc>();
195 "Verify that we can actually set the attribute MinTh");
198 "Verify that we can actually set the attribute MaxTh");
202 "Verify that we can actually set the attribute MaxSize");
205 "Verify that we can actually set the attribute QW");
208 st = queue->GetStats();
211 "There should be zero unforced drops");
214 queue = CreateObject<RedQueueDisc>();
217 "Verify that we can actually set the attribute MinTh");
220 "Verify that we can actually set the attribute MaxTh");
224 "Verify that we can actually set the attribute MaxSize");
227 "Verify that we can actually set the attribute QW");
231 "Verify that we can actually set the attribute LinkBandwidth");
234 st = queue->GetStats();
237 "There should be some unforced drops");
240 queue = CreateObject<RedQueueDisc>();
243 "Verify that we can actually set the attribute MinTh");
246 "Verify that we can actually set the attribute MaxTh");
250 "Verify that we can actually set the attribute MaxSize");
253 "Verify that we can actually set the attribute QW");
256 st = queue->GetStats();
261 queue = CreateObject<RedQueueDisc>();
264 "Verify that we can actually set the attribute MinTh");
267 "Verify that we can actually set the attribute MaxTh");
271 "Verify that we can actually set the attribute MaxSize");
274 "Verify that we can actually set the attribute QW");
278 "Verify that we can actually set the attribute LinkBandwidth");
281 st = queue->GetStats();
287 queue = CreateObject<RedQueueDisc>();
290 "Verify that we can actually set the attribute MinTh");
293 "Verify that we can actually set the attribute MaxTh");
297 "Verify that we can actually set the attribute MaxSize");
300 st = queue->GetStats();
303 "There should be some unforced drops");
307 queue = CreateObject<RedQueueDisc>();
310 "Verify that we can actually set the attribute MinTh");
313 "Verify that we can actually set the attribute MaxTh");
317 "Verify that we can actually set the attribute MaxSize");
321 "Verify that we can actually set the attribute LinkBandwidth");
324 st = queue->GetStats();
327 "There should be zero unforced drops");
330 queue = CreateObject<RedQueueDisc>();
331 minTh = 5 * modeSize;
332 maxTh = 15 * modeSize;
335 "Verify that we can actually set the attribute MinTh");
338 "Verify that we can actually set the attribute MaxTh");
342 "Verify that we can actually set the attribute MaxSize");
345 "Verify that we can actually set the attribute QW");
348 "Verify that we can actually set the attribute LInterm");
353 st = queue->GetStats();
357 "There should be some unforced drops");
360 queue = CreateObject<RedQueueDisc>();
364 "Verify that we can actually set the attribute MaxSize");
367 "Verify that we can actually set the attribute LInterm");
370 "Verify that we can actually set the attribute ARED");
375 st = queue->GetStats();
386 queue->Enqueue(Create<AredQueueDiscTestItem>(Create<Packet>(size), dest));
397 Simulator::Schedule(
Time(
Seconds((i + 1) * delay)),
411 Simulator::Destroy();
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.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
QueueSizeUnit
Enumeration of the operating modes of queues.
@ BYTES
Use number of bytes for queue size.
@ PACKETS
Use number of packets for queue size.
#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.
AredQueueDiscTestSuite g_aredQueueDiscTestSuite
the test suite
Time Seconds(double value)
Construct a Time in the indicated unit.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
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)