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"    55   virtual void AddHeader (
void);
    56   virtual bool Mark(
void);
   103   virtual void DoRun (
void);
   127   : 
TestCase (
"Sanity check on the functionality of Adaptive RED")
   135   uint32_t modeSize = 1;  
   138   uint32_t qSize = 300;
   148       minTh = minTh * modeSize;
   149       maxTh = maxTh * modeSize;
   150       qSize = qSize * modeSize;
   154                          "Verify that we can actually set the attribute MinTh");
   156                          "Verify that we can actually set the attribute MaxTh");
   158                          true, 
"Verify that we can actually set the attribute MaxSize");
   160                          "Verify that we can actually set the attribute QW");
   165                          "There should be zero unforced drops");
   169   queue = CreateObject<RedQueueDisc> ();
   171                          "Verify that we can actually set the attribute MinTh");
   173                          "Verify that we can actually set the attribute MaxTh");
   175                          true, 
"Verify that we can actually set the attribute MaxSize");
   177                          "Verify that we can actually set the attribute QW");
   179                          "Verify that we can actually set the attribute LinkBandwidth");
   180   queue->Initialize ();
   182   st = queue->GetStats ();
   184                          "There should be some unforced drops");
   188   queue = CreateObject<RedQueueDisc> ();
   190                          "Verify that we can actually set the attribute MinTh");
   192                          "Verify that we can actually set the attribute MaxTh");
   194                          true, 
"Verify that we can actually set the attribute MaxSize");
   196                          "Verify that we can actually set the attribute QW");
   197   queue->Initialize ();
   199   st = queue->GetStats ();
   201                          "There should be zero unforced drops");
   205   queue = CreateObject<RedQueueDisc> ();
   207                          "Verify that we can actually set the attribute MinTh");
   209                          "Verify that we can actually set the attribute MaxTh");
   211                          true, 
"Verify that we can actually set the attribute MaxSize");
   213                          "Verify that we can actually set the attribute QW");
   215                          "Verify that we can actually set the attribute LinkBandwidth");
   216   queue->Initialize ();
   218   st = queue->GetStats ();
   220                          "There should be some unforced drops");
   224   queue = CreateObject<RedQueueDisc> ();
   226                          "Verify that we can actually set the attribute MinTh");
   228                          "Verify that we can actually set the attribute MaxTh");
   230                          true, 
"Verify that we can actually set the attribute MaxSize");
   232                          "Verify that we can actually set the attribute QW");
   233   queue->Initialize ();
   235   st = queue->GetStats ();
   241   queue = CreateObject<RedQueueDisc> ();
   243                          "Verify that we can actually set the attribute MinTh");
   245                          "Verify that we can actually set the attribute MaxTh");
   247                          true, 
"Verify that we can actually set the attribute MaxSize");
   249                          "Verify that we can actually set the attribute QW");
   251                          "Verify that we can actually set the attribute LinkBandwidth");
   252   queue->Initialize ();
   254   st = queue->GetStats ();
   260   queue = CreateObject<RedQueueDisc> ();
   262                          "Verify that we can actually set the attribute MinTh");
   264                          "Verify that we can actually set the attribute MaxTh");
   266                          true, 
"Verify that we can actually set the attribute MaxSize");
   267   queue->Initialize ();
   269   st = queue->GetStats ();
   271                          "There should be some unforced drops");
   275   queue = CreateObject<RedQueueDisc> ();
   277                          "Verify that we can actually set the attribute MinTh");
   279                          "Verify that we can actually set the attribute MaxTh");
   281                          true, 
"Verify that we can actually set the attribute MaxSize");
   283                          "Verify that we can actually set the attribute LinkBandwidth");
   284   queue->Initialize ();
   286   st = queue->GetStats ();
   288                          "There should be zero unforced drops");
   292   queue = CreateObject<RedQueueDisc> ();
   293   minTh = 5 * modeSize;
   294   maxTh = 15 * modeSize;
   296                          "Verify that we can actually set the attribute MinTh");
   298                          "Verify that we can actually set the attribute MaxTh");
   300                          true, 
"Verify that we can actually set the attribute MaxSize");
   302                          "Verify that we can actually set the attribute QW");
   304                          "Verify that we can actually set the attribute LInterm");
   305   queue->Initialize ();
   309   st = queue->GetStats ();
   312                          "There should be some unforced drops");
   316   queue = CreateObject<RedQueueDisc> ();
   318                          true, 
"Verify that we can actually set the attribute MaxSize");
   320                          "Verify that we can actually set the attribute LInterm");
   322                          "Verify that we can actually set the attribute ARED");
   323   queue->Initialize ();
   327   st = queue->GetStats ();
   336   for (uint32_t i = 0; i < nPkt; i++)
   338       queue->
Enqueue (Create<AredQueueDiscTestItem> (Create<Packet> (size), dest));
   347   for (uint32_t i = 0; i < nPkt; i++)
   358   Simulator::Destroy ();
 Structure that keeps the queue disc statistics. 
virtual ~AredQueueDiscTestItem()
Simulation virtual time values and global simulation resolution. 
  AttributeValue implementation for Boolean. 
Class for representing queue sizes. 
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline. 
QueueSizeUnit
Enumeration of the operating modes of queues. 
Ared Queue Disc Test Suite. 
Ared Queue Disc Test Item. 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors. 
QueueDiscItem is the abstract base class for items that are stored in a queue disc. 
a polymophic address class 
Class for representing data rates. 
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
void RunAredDiscTest(QueueSizeUnit mode)
Run ARED queue disc test function. 
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason. 
Use number of packets for queue size. 
virtual void AddHeader(void)
Add the header to the packet. 
const Stats & GetStats(void)
Retrieve all the collected statistics. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
Ared Queue Disc Test Case. 
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not. 
  AttributeValue implementation for DataRate. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
This test suite implements a Unit Test. 
uint32_t pktSize
packet size used for the simulation (in bytes) 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
AredQueueDiscTestSuite g_aredQueueDiscTestSuite
the test suite 
Use number of bytes for queue size. 
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one. 
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.