20#include "ns3/fcfs-wifi-queue-scheduler.h"
21#include "ns3/simulator.h"
23#include "ns3/wifi-mac-queue.h"
45 void DoRun()
override;
49 :
TestCase(
"Test DROP_OLDEST setting")
56 auto wifiMacQueue = CreateObject<WifiMacQueue>(
AC_BE);
57 wifiMacQueue->SetMaxSize(
QueueSize(
"5p"));
58 auto wifiMacScheduler = CreateObject<FcfsWifiQueueScheduler>();
59 wifiMacScheduler->SetAttribute(
"DropPolicy",
EnumValue(FcfsWifiQueueScheduler::DROP_OLDEST));
60 wifiMacScheduler->m_perAcInfo[
AC_BE].wifiMacQueue = wifiMacQueue;
61 wifiMacQueue->SetScheduler(wifiMacScheduler);
66 std::list<uint64_t> packetUids;
73 auto packet = Create<Packet>();
74 auto item = Create<WifiMpdu>(packet, header);
75 wifiMacQueue->Enqueue(item);
77 packetUids.push_back(packet->GetUid());
81 auto mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1);
84 "Queue has unexpected number of elements");
85 for (
auto packetUid : packetUids)
89 "Stored packet is not the expected one");
90 mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1, mpdu);
98 auto packet = Create<Packet>();
99 auto item = Create<WifiMpdu>(packet, header);
100 wifiMacQueue->Enqueue(item);
103 packetUids.pop_front();
104 packetUids.push_back(packet->GetUid());
107 mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1);
110 "Queue has unexpected number of elements");
111 for (
auto packetUid : packetUids)
115 "Stored packet is not the expected one");
116 mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1, mpdu);
119 wifiMacScheduler->Dispose();
120 Simulator::Destroy();
Test DROP_OLDEST setting.
WifiMacQueueDropOldestTest()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
Wifi MAC Queue Test Suite.
Hold variables of type enum.
Class for representing queue sizes.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiMacQueueTestSuite g_wifiMacQueueTestSuite
the test suite