9#include "ns3/fcfs-wifi-queue-scheduler.h" 
   10#include "ns3/simulator.h" 
   12#include "ns3/wifi-mac-queue.h" 
   36    void DoRun() 
override;
 
 
   40    : 
TestCase(
"Test DROP_OLDEST setting")
 
 
   48    wifiMacQueue->SetMaxSize(
QueueSize(
"5p"));
 
   51    wifiMacScheduler->m_perAcInfo[
AC_BE].wifiMacQueue = wifiMacQueue;
 
   52    wifiMacQueue->SetScheduler(wifiMacScheduler);
 
   57    std::list<uint64_t> packetUids;
 
   66        wifiMacQueue->Enqueue(item);
 
   68        packetUids.push_back(packet->GetUid());
 
   72    auto mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1);
 
   75                          "Queue has unexpected number of elements");
 
   76    for (
auto packetUid : packetUids)
 
   80                              "Stored packet is not the expected one");
 
   81        mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1, mpdu);
 
   91    wifiMacQueue->Enqueue(item);
 
   94    packetUids.pop_front();
 
   95    packetUids.push_back(packet->GetUid());
 
   98    mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1);
 
  101                          "Queue has unexpected number of elements");
 
  102    for (
auto packetUid : packetUids)
 
  106                              "Stored packet is not the expected one");
 
  107        mpdu = wifiMacQueue->PeekByTidAndAddress(0, addr1, mpdu);
 
  110    wifiMacScheduler->Dispose();
 
 
  130    void DoRun() 
override;
 
 
  147    : 
TestCase(
"Test extraction of expired MPDUs from MAC queue container")
 
 
  163    elemIt->expiryTime = expiryTime;
 
  166        elemIt->inflights.emplace(0, mpdu);
 
  168    elemIt->deleter = [](
auto mpdu) {};
 
 
  229                              "Unexpected extracted MPDU");
 
  235                              "Unexpected extracted MPDU");
 
  254                              "Unexpected extracted MPDU");
 
  289        std::set<uint16_t> expectedSeqNo{5, 7, 8, 14, 17};
 
  290        std::set<uint16_t> actualSeqNo;
 
  292        std::transform(
first, last, std::inserter(actualSeqNo, actualSeqNo.end()), [](
auto& elem) {
 
  293            return elem.mpdu->GetHeader().GetSequenceNumber();
 
  298                              "Unexpected number of MPDUs extracted");
 
  300        for (
auto expectedIt = expectedSeqNo.begin(), actualIt = actualSeqNo.begin();
 
  301             expectedIt != expectedSeqNo.end();
 
  302             ++expectedIt, ++actualIt)
 
  320                              "There should be other MPDU(s) in container queue 1");
 
  323                              "Unexpected queued MPDU");
 
  327                              "There should be other MPDU(s) in container queue 1");
 
  330                              "Unexpected queued MPDU");
 
  334                              "There should be other MPDU(s) in container queue 1");
 
  337                              "Unexpected queued MPDU");
 
  341                              "There should be other MPDU(s) in container queue 1");
 
  344                              "Unexpected queued MPDU");
 
  348                              "There should be other MPDU(s) in container queue 1");
 
  351                              "Unexpected queued MPDU");
 
  355                              "There should be other MPDU(s) in container queue 1");
 
  358                              "Unexpected queued MPDU");
 
  362                              "There should be no other MPDU in container queue 1");
 
  371                              "There should be other MPDU(s) in container queue 2");
 
  374                              "Unexpected queued MPDU");
 
  378                              "There should be other MPDU(s) in container queue 2");
 
  381                              "Unexpected queued MPDU");
 
  385                              "There should be other MPDU(s) in container queue 2");
 
  388                              "Unexpected queued MPDU");
 
  392                              "There should be other MPDU(s) in container queue 2");
 
  395                              "Unexpected queued MPDU");
 
  399                              "There should be other MPDU(s) in container queue 2");
 
  402                              "Unexpected queued MPDU");
 
  406                              "There should be other MPDU(s) in container queue 2");
 
  409                              "Unexpected queued MPDU");
 
  413                              "There should be no other MPDU in container queue 2");
 
 
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.
static Mac48Address Allocate()
Allocate a new Mac48Address.
Class for representing queue sizes.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Class for the container used by WifiMacQueue.
const ContainerQueue & GetQueue(const WifiContainerQueueId &queueId) const
Get a const reference to the container queue identified by the given QueueId.
static WifiContainerQueueId GetQueueId(Ptr< const WifiMpdu > mpdu)
Return the QueueId identifying the container queue in which the given MPDU is (or is to be) enqueued.
std::pair< iterator, iterator > ExtractAllExpiredMpdus() const
Transfer non-inflight MPDUs with expired lifetime in all the container queues to the container queue ...
iterator insert(const_iterator pos, Ptr< WifiMpdu > item)
Insert the given item at the specified location in the container.
std::pair< iterator, iterator > ExtractExpiredMpdus(const WifiContainerQueueId &queueId) const
Transfer non-inflight MPDUs with expired lifetime in the container queue identified by the given Queu...
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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std:: tuple< WifiContainerQueueType, WifiReceiverAddressType, Mac48Address, std::optional< uint8_t > > WifiContainerQueueId
Tuple (queue type, receiver address type, Address, TID) identifying a container queue.
static WifiMacQueueTestSuite g_wifiMacQueueTestSuite
the test suite