24 #include "ns3/red-queue-disc.h"
25 #include "ns3/packet.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/string.h"
28 #include "ns3/double.h"
30 #include "ns3/simulator.h"
51 virtual void AddHeader (
void);
52 virtual bool Mark(
void);
72 m_ecnCapablePacket (ecnCapable)
105 virtual void DoRun (
void);
123 :
TestCase (
"Sanity check on the red queue implementation")
132 uint32_t modeSize = 1;
140 "Verify that we can actually set the attribute MinTh");
142 "Verify that we can actually set the attribute MaxTh");
144 true,
"Verify that we can actually set the attribute MaxSize");
146 "Verify that we can actually set the attribute QW");
155 queue->
SetTh (minTh * modeSize, maxTh * modeSize);
171 queue->
Enqueue (Create<RedQueueDiscTestItem> (p1, dest,
false));
173 queue->
Enqueue (Create<RedQueueDiscTestItem> (p2, dest,
false));
175 queue->
Enqueue (Create<RedQueueDiscTestItem> (p3, dest,
false));
176 queue->
Enqueue (Create<RedQueueDiscTestItem> (p4, dest,
false));
177 queue->
Enqueue (Create<RedQueueDiscTestItem> (p5, dest,
false));
178 queue->
Enqueue (Create<RedQueueDiscTestItem> (p6, dest,
false));
179 queue->
Enqueue (Create<RedQueueDiscTestItem> (p7, dest,
false));
180 queue->
Enqueue (Create<RedQueueDiscTestItem> (p8, dest,
false));
211 queue = CreateObject<RedQueueDisc> ();
212 minTh = 70 * modeSize;
213 maxTh = 150 * modeSize;
214 qSize = 300 * modeSize;
216 "Verify that we can actually set the attribute MinTh");
218 "Verify that we can actually set the attribute MaxTh");
220 true,
"Verify that we can actually set the attribute MaxSize");
225 "There should be zero unforced drops");
227 "There should be zero forced dropps");
229 "There should be zero drops due to queue limit");
245 queue = CreateObject<RedQueueDisc> ();
247 "Verify that we can actually set the attribute MinTh");
249 "Verify that we can actually set the attribute MaxTh");
251 true,
"Verify that we can actually set the attribute MaxSize");
253 "Verify that we can actually set the attribute QW");
264 maxTh = 100 * modeSize;
265 queue = CreateObject<RedQueueDisc> ();
267 "Verify that we can actually set the attribute MinTh");
269 "Verify that we can actually set the attribute MaxTh");
271 true,
"Verify that we can actually set the attribute MaxSize");
273 "Verify that we can actually set the attribute QW");
284 maxTh = 150 * modeSize;
285 queue = CreateObject<RedQueueDisc> ();
287 "Verify that we can actually set the attribute MinTh");
289 "Verify that we can actually set the attribute MaxTh");
291 true,
"Verify that we can actually set the attribute MaxSize");
293 "Verify that we can actually set the attribute QW");
295 "Verify that we can actually set the attribute LInterm");
306 queue = CreateObject<RedQueueDisc> ();
308 "Verify that we can actually set the attribute MinTh");
310 "Verify that we can actually set the attribute MaxTh");
312 true,
"Verify that we can actually set the attribute MaxSize");
314 "Verify that we can actually set the attribute QW");
316 "Verify that we can actually set the attribute Gentle");
327 queue = CreateObject<RedQueueDisc> ();
329 "Verify that we can actually set the attribute MinTh");
331 "Verify that we can actually set the attribute MaxTh");
333 true,
"Verify that we can actually set the attribute MaxSize");
335 "Verify that we can actually set the attribute QW");
337 "Verify that we can actually set the attribute Wait");
348 queue = CreateObject<RedQueueDisc> ();
349 minTh = 30 * modeSize;
350 maxTh = 90 * modeSize;
352 "Verify that we can actually set the attribute MinTh");
354 "Verify that we can actually set the attribute MaxTh");
356 true,
"Verify that we can actually set the attribute MaxSize");
358 "Verify that we can actually set the attribute QW");
360 "Verify that we can actually set the attribute LInterm");
362 "Verify that we can actually set the attribute Gentle");
364 "Verify that we can actually set the attribute UseECN");
370 "There should be some unforced drops");
372 "There should be no unforced marks");
376 queue = CreateObject<RedQueueDisc> ();
378 "Verify that we can actually set the attribute MinTh");
380 "Verify that we can actually set the attribute MaxTh");
382 true,
"Verify that we can actually set the attribute MaxSize");
384 "Verify that we can actually set the attribute QW");
386 "Verify that we can actually set the attribute LInterm");
388 "Verify that we can actually set the attribute Gentle");
390 "Verify that we can actually set the attribute UseECN");
396 "There should be some unforced drops");
398 "There should be no unforced marks");
402 queue = CreateObject<RedQueueDisc> ();
404 "Verify that we can actually set the attribute MinTh");
406 "Verify that we can actually set the attribute MaxTh");
408 true,
"Verify that we can actually set the attribute MaxSize");
410 "Verify that we can actually set the attribute QW");
412 "Verify that we can actually set the attribute LInterm");
414 "Verify that we can actually set the attribute Gentle");
416 "Verify that we can actually set the attribute UseECN");
422 "There should be no unforced drops");
424 "There should be some unforced marks");
428 queue = CreateObject<RedQueueDisc> ();
429 minTh = 30 * modeSize;
430 maxTh = 90 * modeSize;
432 "Verify that we can actually set the attribute MinTh");
434 "Verify that we can actually set the attribute MaxTh");
436 true,
"Verify that we can actually set the attribute MaxSize");
438 "Verify that we can actually set the attribute QW");
440 "Verify that we can actually set the attribute LInterm");
442 "Verify that we can actually set the attribute Gentle");
451 queue = CreateObject<RedQueueDisc> ();
453 "Verify that we can actually set the attribute MinTh");
455 "Verify that we can actually set the attribute MaxTh");
457 true,
"Verify that we can actually set the attribute MaxSize");
459 "Verify that we can actually set the attribute QW");
461 "Verify that we can actually set the attribute LInterm");
463 "Verify that we can actually set the attribute Gentle");
465 "Verify that we can actually set the attribute FengAdaptive");
470 NS_TEST_EXPECT_MSG_LT (drop.test12, drop.test11,
"Test 12 should have less drops due to probability mark than test 11");
474 queue = CreateObject<RedQueueDisc> ();
475 minTh = 30 * modeSize;
476 maxTh = 90 * modeSize;
478 "Verify that we can actually set the attribute MinTh");
480 "Verify that we can actually set the attribute MaxTh");
482 true,
"Verify that we can actually set the attribute MaxSize");
484 "Verify that we can actually set the attribute QW");
486 "Verify that we can actually set the attribute LInterm");
488 "Verify that we can actually set the attribute Gentle");
490 "Verify that we can actually set the attribute NLRED");
495 NS_TEST_EXPECT_MSG_LT (drop.test13, drop.test11,
"Test 13 should have less drops due to probability mark than test 11");
503 for (uint32_t i = 0; i < nPkt; i++)
505 queue->
Enqueue (Create<RedQueueDiscTestItem> (Create<Packet> (size), dest, ecnCapable));
514 Simulator::Destroy ();