23#include "ns3/red-queue-disc.h"
24#include "ns3/packet.h"
25#include "ns3/uinteger.h"
26#include "ns3/string.h"
27#include "ns3/double.h"
29#include "ns3/simulator.h"
62 virtual bool Mark(
void);
95 virtual void DoRun (
void);
119 :
TestCase (
"Sanity check on the functionality of Adaptive RED")
140 minTh = minTh * modeSize;
141 maxTh = maxTh * modeSize;
142 qSize = qSize * modeSize;
146 "Verify that we can actually set the attribute MinTh");
148 "Verify that we can actually set the attribute MaxTh");
150 true,
"Verify that we can actually set the attribute MaxSize");
152 "Verify that we can actually set the attribute QW");
153 queue->Initialize ();
157 "There should be zero unforced drops");
161 queue = CreateObject<RedQueueDisc> ();
163 "Verify that we can actually set the attribute MinTh");
165 "Verify that we can actually set the attribute MaxTh");
167 true,
"Verify that we can actually set the attribute MaxSize");
169 "Verify that we can actually set the attribute QW");
171 "Verify that we can actually set the attribute LinkBandwidth");
172 queue->Initialize ();
174 st = queue->GetStats ();
176 "There should be some unforced drops");
180 queue = CreateObject<RedQueueDisc> ();
182 "Verify that we can actually set the attribute MinTh");
184 "Verify that we can actually set the attribute MaxTh");
186 true,
"Verify that we can actually set the attribute MaxSize");
188 "Verify that we can actually set the attribute QW");
189 queue->Initialize ();
191 st = queue->GetStats ();
193 "There should be zero unforced drops");
197 queue = CreateObject<RedQueueDisc> ();
199 "Verify that we can actually set the attribute MinTh");
201 "Verify that we can actually set the attribute MaxTh");
203 true,
"Verify that we can actually set the attribute MaxSize");
205 "Verify that we can actually set the attribute QW");
207 "Verify that we can actually set the attribute LinkBandwidth");
208 queue->Initialize ();
210 st = queue->GetStats ();
212 "There should be some unforced drops");
216 queue = CreateObject<RedQueueDisc> ();
218 "Verify that we can actually set the attribute MinTh");
220 "Verify that we can actually set the attribute MaxTh");
222 true,
"Verify that we can actually set the attribute MaxSize");
224 "Verify that we can actually set the attribute QW");
225 queue->Initialize ();
227 st = queue->GetStats ();
233 queue = CreateObject<RedQueueDisc> ();
235 "Verify that we can actually set the attribute MinTh");
237 "Verify that we can actually set the attribute MaxTh");
239 true,
"Verify that we can actually set the attribute MaxSize");
241 "Verify that we can actually set the attribute QW");
243 "Verify that we can actually set the attribute LinkBandwidth");
244 queue->Initialize ();
246 st = queue->GetStats ();
252 queue = CreateObject<RedQueueDisc> ();
254 "Verify that we can actually set the attribute MinTh");
256 "Verify that we can actually set the attribute MaxTh");
258 true,
"Verify that we can actually set the attribute MaxSize");
259 queue->Initialize ();
261 st = queue->GetStats ();
263 "There should be some unforced drops");
267 queue = CreateObject<RedQueueDisc> ();
269 "Verify that we can actually set the attribute MinTh");
271 "Verify that we can actually set the attribute MaxTh");
273 true,
"Verify that we can actually set the attribute MaxSize");
275 "Verify that we can actually set the attribute LinkBandwidth");
276 queue->Initialize ();
278 st = queue->GetStats ();
280 "There should be zero unforced drops");
284 queue = CreateObject<RedQueueDisc> ();
285 minTh = 5 * modeSize;
286 maxTh = 15 * modeSize;
288 "Verify that we can actually set the attribute MinTh");
290 "Verify that we can actually set the attribute MaxTh");
292 true,
"Verify that we can actually set the attribute MaxSize");
294 "Verify that we can actually set the attribute QW");
296 "Verify that we can actually set the attribute LInterm");
297 queue->Initialize ();
301 st = queue->GetStats ();
304 "There should be some unforced drops");
308 queue = CreateObject<RedQueueDisc> ();
310 true,
"Verify that we can actually set the attribute MaxSize");
312 "Verify that we can actually set the attribute LInterm");
314 "Verify that we can actually set the attribute ARED");
315 queue->Initialize ();
319 st = queue->GetStats ();
330 queue->Enqueue (Create<AredQueueDiscTestItem> (Create<Packet> (size), dest));
350 Simulator::Destroy ();
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
Ared Queue Disc Test Case.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
Ared Queue Disc Test Item.
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
AredQueueDiscTestItem()=delete
virtual void AddHeader(void)
Add the header to the packet.
AredQueueDiscTestItem(const AredQueueDiscTestItem &)=delete
AredQueueDiscTestItem & operator=(const AredQueueDiscTestItem &)=delete
virtual ~AredQueueDiscTestItem()
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'.
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.
Simulation virtual time values and global simulation resolution.
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.
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)