|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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++)
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;
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 ();
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this 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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
QueueSize GetMaxSize(void) const
Get the maximum size of the queue disc.
FifoQueueDiscTestItem(const FifoQueueDiscTestItem &)
Copy constructor Disable default implementation to avoid misuse.
void DoRunFifoTest(Ptr< FifoQueueDisc > q, uint32_t qSize, uint32_t pktSize)
Run test function.
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
@ PACKETS
Use number of packets for queue size.
a polymophic address class
Fifo Queue Disc Test Case.
Instantiate subclasses of ns3::Object.
Introspection did not find any typical Config paths.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
QueueSizeUnit GetUnit() const
Get the underlying unit.
void AddInternalQueue(Ptr< InternalQueue > queue)
Add an internal queue to the tail of the list of queues.
std::size_t GetNInternalQueues(void) const
Get the number of internal queues.
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Fifo Queue Disc Test Suite.
Fifo Queue Disc Test Item.
Ptr< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any,...
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
Ptr< Packet > GetPacket(void) const
@ UNIT
This test suite implements a Unit Test.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
uint32_t pktSize
packet size used for the simulation (in bytes)
@ BYTES
Use number of bytes for queue size.
FifoQueueDiscTestSuite g_fifoQueueTestSuite
the test suite
QueueSizeUnit
Enumeration of the operating modes of queues.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
uint32_t GetValue() const
Get the underlying value.
virtual ~FifoQueueDiscTestItem()
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Ptr< InternalQueue > GetInternalQueue(std::size_t i) const
Get the i-th internal queue.
Class for representing queue sizes.
uint64_t GetUid(void) const
Returns the packet's Uid.
virtual void AddHeader(void)
Add the header to the packet.
void RunFifoTest(QueueSizeUnit mode)
Run test function.