| 
	      
		 A Discrete-Event Network Simulator 
		
	       | 
	      
	      
		API
	       | 
	    
	  
	
	
       
 
Go to the documentation of this file.
   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");
 
  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");
 
  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");
 
  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");
 
  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");
 
  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");
 
  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");
 
  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");
 
  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");
 
  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 ();
 
  
 
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
 
AttributeValue implementation for DataRate.
 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
 
AttributeValue implementation for Boolean.
 
Structure that keeps the queue disc statistics.
 
Ared Queue Disc Test Suite.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.
 
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
 
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
 
@ PACKETS
Use number of packets for queue size.
 
AredQueueDiscTestSuite g_aredQueueDiscTestSuite
the test suite
 
This class can be used to hold variables of floating point type such as 'double' or 'float'.
 
virtual void AddHeader(void)
Add the header to the packet.
 
Class for representing data rates.
 
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
 
a polymophic address class
 
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
 
uint32_t GetNDroppedPackets(std::string reason) const
Get the number of packets dropped for the given reason.
 
void RunAredDiscTest(QueueSizeUnit mode)
Run ARED queue disc test function.
 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
 
Simulation virtual time values and global simulation resolution.
 
virtual ~AredQueueDiscTestItem()
 
@ UNIT
This test suite implements a Unit Test.
 
Ared Queue Disc Test Item.
 
Time Seconds(double value)
Construct a Time in the indicated unit.
 
uint32_t pktSize
packet size used for the simulation (in bytes)
 
@ BYTES
Use number of bytes for queue size.
 
QueueSizeUnit
Enumeration of the operating modes of queues.
 
virtual void DoRun(void)
Implementation to actually run this TestCase.
 
const Stats & GetStats(void)
Retrieve all the collected statistics.
 
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
 
Class for representing queue sizes.
 
Ared Queue Disc Test Case.
 
void EnqueueWithDelay(Ptr< RedQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue with delay function.
 
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
 
void Enqueue(Ptr< RedQueueDisc > queue, uint32_t size, uint32_t nPkt)
Enqueue function.
 
AredQueueDiscTestItem(const AredQueueDiscTestItem &)
Copy constructor Disable default implementation to avoid misuse.