23 #include "ns3/fifo-queue-disc.h"
24 #include "ns3/queue.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"
31 #include "ns3/object-factory.h"
53 virtual void AddHeader (
void);
54 virtual bool Mark (
void);
101 virtual void DoRun (
void);
118 :
TestCase (
"Sanity check on the fifo queue disc implementation")
125 std::vector<uint64_t> uids;
130 uint32_t numPackets = qSize / modeSize;
135 for (uint32_t i = 1; i <= numPackets; i++)
137 p = Create<Packet> (pktSize);
138 uids.push_back (p->
GetUid ());
139 q->
Enqueue (Create<FifoQueueDiscTestItem> (p, dest));
145 false,
"There should be no room for another packet");
148 for (uint32_t i = 1; i <= numPackets; i++)
164 uint32_t numPackets = 10;
165 uint32_t pktSize = 1000;
169 queue = CreateObject<FifoQueueDisc> ();
175 true,
"Verify that we can actually set the attribute MaxSize");
183 queue = CreateObject<FifoQueueDisc> ();
191 true,
"Verify that we can actually set the attribute MaxSize");
197 queue = CreateObject<FifoQueueDisc> ();
202 factory.
SetTypeId (
"ns3::DropTailQueue<QueueDiscItem>");
219 queue = CreateObject<FifoQueueDisc> ();
233 true,
"Verify that we can actually set the attribute MaxSize on the internal queue");
239 true,
"Verify that we can actually set the attribute MaxSize on the internal queue");
250 Simulator::Destroy ();
Fifo Queue Disc Test Item.
Class for representing queue sizes.
FifoQueueDiscTestSuite g_fifoQueueTestSuite
the test suite
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Fifo Queue Disc Test Case.
void RunFifoTest(QueueSizeUnit mode)
Run test function.
QueueSizeUnit
Enumeration of the operating modes of queues.
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets, otherwise.
uint64_t GetUid(void) const
Returns the packet's Uid.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void DoRunFifoTest(Ptr< FifoQueueDisc > q, uint32_t qSize, uint32_t pktSize)
Run test function.
QueueSizeUnit GetUnit() const
Get the underlying unit.
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.
This test suite implements a Unit Test.
uint32_t GetValue() const
Get the underlying value.
a polymophic address class
Ptr< InternalQueue > GetInternalQueue(uint32_t i) const
Get the i-th internal queue.
uint32_t GetNInternalQueues(void) const
Get the number of internal queues.
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Use number of packets for queue size.
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification...
Ptr< QueueDiscItem > Dequeue(void)
Request the queue discipline to extract a packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Fifo Queue Disc Test Suite.
virtual void AddHeader(void)
Add the header to the packet.
Instantiate subclasses of ns3::Object.
Introspection did not find any typical Config paths.
virtual ~FifoQueueDiscTestItem()
Use number of bytes for queue size.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
Ptr< Packet > GetPacket(void) const