23 #include "ns3/uinteger.h" 
   24 #include "ns3/pointer.h" 
   25 #include "ns3/string.h" 
   26 #include "ns3/double.h" 
   28 #include "ns3/simulator.h" 
   29 #include "ns3/node-container.h" 
   30 #include "ns3/traffic-control-layer.h" 
   31 #include "ns3/traffic-control-helper.h" 
   32 #include "ns3/simple-net-device.h" 
   33 #include "ns3/simple-channel.h" 
   34 #include "ns3/drop-tail-queue.h" 
   35 #include "ns3/net-device-queue-interface.h" 
   36 #include "ns3/config.h" 
   55   virtual void AddHeader (
void);
 
   56   virtual bool Mark(
void);
 
  110   virtual void DoRun (
void);
 
  142   : 
TestCase (
"Test the operation of the flow control mechanism"),
 
  155   for (uint16_t i = 0; i < nPackets; i++)
 
  157       tc->
Send (n->
GetDevice (0), Create<QueueDiscTestItem> (Create<Packet> (1000)));
 
  199       queue = CreateObjectWithAttributes<DropTailQueue<Packet> > (
"MaxSize", 
StringValue (
"5p"));
 
  203       queue = CreateObjectWithAttributes<DropTailQueue<Packet> > (
"MaxSize", 
StringValue (
"5000B"));
 
  208   txDev = CreateObjectWithAttributes<SimpleNetDevice> (
"TxQueue", 
PointerValue (queue),
 
  210   rxDev = CreateObject<SimpleNetDevice> ();
 
  215   rxDev->SetChannel (channel1);
 
  224                       this, n.
Get (0), 10);
 
  237                           this, txDev, 5, 
"There must be 5 packets in the device queue after 1ms");
 
  239                           this, txDev, 
true, 
"The device queue must be stopped after 1ms");
 
  241                           this, txDev, 4, 
"There must be 4 packets in the queue disc after 1ms");
 
  245                           this, txDev, 5, 
"There must be 5 packets in the device queue after 9ms");
 
  247                           this, txDev, 
true, 
"The device queue must be stopped after 9ms");
 
  249                           this, txDev, 3, 
"There must be 3 packets in the queue disc after 9ms");
 
  253                           this, txDev, 5, 
"There must be 5 packets in the device queue after 17ms");
 
  255                           this, txDev, 
true, 
"The device queue must be stopped after 17ms");
 
  257                           this, txDev, 2, 
"There must be 2 packets in the queue disc after 17ms");
 
  261                           this, txDev, 5, 
"There must be 5 packets in the device queue after 25ms");
 
  263                           this, txDev, 
true, 
"The device queue must be stopped after 25ms");
 
  265                           this, txDev, 1, 
"There must be 1 packet in the queue disc after 25ms");
 
  269                           this, txDev, 5, 
"There must be 5 packets in the device queue after 33ms");
 
  271                           this, txDev, 
true, 
"The device queue must be stopped after 33ms");
 
  273                           this, txDev, 0, 
"The queue disc must be empty after 33ms");
 
  277                           this, txDev, 4, 
"There must be 4 packets in the device queue after 41ms");
 
  279                           this, txDev, 
false, 
"The device queue must not be stopped after 41ms");
 
  281                           this, txDev, 0, 
"The queue disc must be empty after 41ms");
 
  285                           this, txDev, 0, 
"The device queue must be empty after 81ms");
 
  287                           this, txDev, 
false, 
"The device queue must not be stopped after 81ms");
 
  289                           this, txDev, 0, 
"The queue disc must be empty after 81ms");
 
  302                           this, txDev, 3, 
"There must be 3 packets in the device queue after 1ms");
 
  304                           this, txDev, 
true, 
"The device queue must be stopped after 1ms");
 
  306                           this, txDev, 6, 
"There must be 6 packets in the queue disc after 1ms");
 
  310                           this, txDev, 3, 
"There must be 3 packets in the device queue after 9ms");
 
  312                           this, txDev, 
true, 
"The device queue must be stopped after 9ms");
 
  314                           this, txDev, 5, 
"There must be 5 packets in the queue disc after 9ms");
 
  318                           this, txDev, 3, 
"There must be 3 packets in the device queue after 17ms");
 
  320                           this, txDev, 
true, 
"The device queue must be stopped after 17ms");
 
  322                           this, txDev, 4, 
"There must be 4 packets in the queue disc after 17ms");
 
  326                           this, txDev, 3, 
"There must be 3 packets in the device queue after 25ms");
 
  328                           this, txDev, 
true, 
"The device queue must be stopped after 25ms");
 
  330                           this, txDev, 3, 
"There must be 3 packets in the queue disc after 25ms");
 
  334                           this, txDev, 3, 
"There must be 3 packets in the device queue after 33ms");
 
  336                           this, txDev, 
true, 
"The device queue must be stopped after 33ms");
 
  338                           this, txDev, 2, 
"There must be 2 packets in the queue disc after 33ms");
 
  342                           this, txDev, 3, 
"There must be 3 packets in the device queue after 41ms");
 
  344                           this, txDev, 
true, 
"The device queue must be stopped after 41ms");
 
  346                           this, txDev, 1, 
"There must be 1 packet in the queue disc after 41ms");
 
  350                           this, txDev, 3, 
"There must be 3 packets in the device queue after 49ms");
 
  352                           this, txDev, 
true, 
"The device queue must be stopped after 49ms");
 
  354                           this, txDev, 0, 
"The queue disc must be empty after 49ms");
 
  358                           this, txDev, 2, 
"There must be 2 packets in the device queue after 57ms");
 
  360                           this, txDev, 
false, 
"The device queue must not be stopped after 57ms");
 
  362                           this, txDev, 0, 
"The queue disc must be empty after 57ms");
 
  366                           this, txDev, 0, 
"The device queue must be empty after 81ms");
 
  368                           this, txDev, 
false, 
"The device queue must not be stopped after 81ms");
 
  370                           this, txDev, 0, 
"The queue disc must be empty after 81ms");
 
  374   Simulator::Destroy ();
 
QueueSizeUnit m_type
the test type 
 
Simulation virtual time values and global simulation resolution. 
 
QueueDiscContainer Install(NetDeviceContainer c)
 
void CheckPacketsInDeviceQueue(Ptr< NetDevice > dev, uint16_t nPackets, const char *msg)
Check if the device queue stores the expected number of packets. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
Hold variables of type string. 
 
Introspection did not find any typical Config paths. 
 
QueueSizeUnit
Enumeration of the operating modes of queues. 
 
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together. 
 
virtual Ptr< Node > GetNode(void) const =0
 
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
 
QueueDiscItem is the abstract base class for items that are stored in a queue disc. 
 
This test suite implements a Unit Test. 
 
bool GetAttributeFailSafe(std::string name, AttributeValue &value) const 
Get the value of an attribute without raising erros. 
 
void CheckPacketsInQueueDisc(Ptr< NetDevice > dev, uint16_t nPackets, const char *msg)
Check if the queue disc stores the expected number of packets. 
 
Class for representing data rates. 
 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
 
virtual bool SetMtu(const uint16_t mtu)
 
Use number of packets for queue size. 
 
Ptr< NetDevice > GetDevice(uint32_t index) const 
Retrieve the index-th NetDevice associated to this node. 
 
Build a set of QueueDisc objects. 
 
Network device transmission queue interface. 
 
void CheckDeviceQueueStopped(Ptr< NetDevice > dev, bool value, const char *msg)
Check if the device queue is in the expected status (stopped or not) 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
keep track of a set of node pointers. 
 
Hold objects of type Ptr. 
 
virtual void AddHeader(void)
Add the header to the packet. 
 
TcFlowControlTestCase(QueueSizeUnit tt)
Constructor. 
 
virtual void Send(Ptr< NetDevice > device, Ptr< QueueDiscItem > item)
Called from upper layer to queue a packet for the transmission. 
 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
 
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification...
 
virtual Ptr< QueueDisc > GetRootQueueDiscOnDevice(Ptr< NetDevice > device) const 
This method can be used to get the root queue disc installed on a device. 
 
virtual ~TcFlowControlTestCase()
 
AttributeValue implementation for DataRate. 
 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
virtual ~QueueDiscTestItem()
 
Ptr< NetDeviceQueue > GetTxQueue(uint8_t i) const 
Get the i-th transmission queue of the device. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
TcFlowControlTestSuite g_tcFlowControlTestSuite
the test suite 
 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
 
Traffic Control Flow Control Test Case. 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
Traffic Control Flow Control Test Suite. 
 
void SendPackets(Ptr< Node > n, uint16_t nPackets)
Instruct a node to send a specified number of packets. 
 
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device. 
 
Use number of bytes for queue size.