10#include "ns3/double.h"
11#include "ns3/fifo-queue-disc.h"
13#include "ns3/object-factory.h"
14#include "ns3/packet.h"
16#include "ns3/simulator.h"
17#include "ns3/string.h"
19#include "ns3/uinteger.h"
80 void DoRun()
override;
98 :
TestCase(
"Sanity check on the fifo queue disc implementation")
105 std::vector<uint64_t> uids;
109 uint32_t modeSize = (q->GetMaxSize().GetUnit() == QueueSizeUnit::PACKETS ? 1 :
pktSize);
110 uint32_t numPackets = qSize / modeSize;
115 for (
uint32_t i = 1; i <= numPackets; i++)
118 uids.push_back(p->GetUid());
122 "There should be " << i <<
" packet(s) in there");
128 "There should be no room for another packet");
131 for (
uint32_t i = 1; i <= numPackets; i++)
136 (numPackets - i) * modeSize,
137 "There should be " << numPackets - i <<
" packet(s) in there");
140 "was this the right packet?");
160 "Verify that the queue disc has no internal queue");
163 queue->SetAttributeFailSafe(
"MaxSize",
166 "Verify that we can actually set the attribute MaxSize");
177 "Verify that the queue disc has no internal queue");
182 queue->SetAttributeFailSafe(
"MaxSize",
185 "Verify that we can actually set the attribute MaxSize");
194 "Verify that the queue disc has no internal queue");
197 factory.
SetTypeId(
"ns3::DropTailQueue<QueueDiscItem>");
198 if (mode == QueueSizeUnit::PACKETS)
204 factory.
Set(
"MaxSize",
218 "Verify that the queue disc has no internal queue");
224 "Verify that the queue disc got an internal queue");
228 if (mode == QueueSizeUnit::PACKETS)
231 iq->SetAttributeFailSafe(
"MaxSize",
234 "Verify that we can actually set the attribute MaxSize on the internal queue");
239 iq->SetAttributeFailSafe(
243 "Verify that we can actually set the attribute MaxSize on the internal queue");
Fifo Queue Disc Test Case.
void RunFifoTest(QueueSizeUnit mode)
Run test function.
void DoRun() override
Implementation to actually run this TestCase.
void DoRunFifoTest(Ptr< FifoQueueDisc > q, uint32_t qSize, uint32_t pktSize)
Run test function.
Fifo Queue Disc Test Item.
void AddHeader() override
Add the header to the packet.
FifoQueueDiscTestItem()=delete
~FifoQueueDiscTestItem() override
FifoQueueDiscTestItem(const FifoQueueDiscTestItem &)=delete
FifoQueueDiscTestItem & operator=(const FifoQueueDiscTestItem &)=delete
bool Mark() override
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
Fifo Queue Disc Test Suite.
a polymophic address class
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Introspection did not find any typical Config paths.
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
QueueSizeUnit
Enumeration of the operating modes of queues.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
FifoQueueDiscTestSuite g_fifoQueueTestSuite
the test suite
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t pktSize
packet size used for the simulation (in bytes)