From b902ded5dc904a7e9f3b4a2e44956dadf82e02a5 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Mon, 12 Jun 2023 12:58:38 +0200 Subject: [PATCH] wifi: Add header file for wifi EMLSR test --- src/wifi/test/wifi-emlsr-test.cc | 518 +---------------------------- src/wifi/test/wifi-emlsr-test.h | 554 +++++++++++++++++++++++++++++++ 2 files changed, 556 insertions(+), 516 deletions(-) create mode 100644 src/wifi/test/wifi-emlsr-test.h diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index db69d7d6d..ecd9418b1 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -17,6 +17,8 @@ * Author: Stefano Avallone */ +#include "wifi-emlsr-test.h" + #include "ns3/ap-wifi-mac.h" #include "ns3/attribute-container.h" #include "ns3/boolean.h" @@ -25,7 +27,6 @@ #include "ns3/eht-configuration.h" #include "ns3/emlsr-manager.h" #include "ns3/he-frame-exchange-manager.h" -#include "ns3/header-serialization-test.h" #include "ns3/log.h" #include "ns3/mgt-headers.h" #include "ns3/mobility-helper.h" @@ -43,7 +44,6 @@ #include "ns3/sta-wifi-mac.h" #include "ns3/string.h" #include "ns3/wifi-net-device.h" -#include "ns3/wifi-ppdu.h" #include "ns3/wifi-psdu.h" #include @@ -55,25 +55,6 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiEmlsrTest"); -/** - * \ingroup wifi-test - * \ingroup tests - * - * \brief Test EML Operating Mode Notification frame serialization and deserialization - */ -class EmlOperatingModeNotificationTest : public HeaderSerializationTestCase -{ - public: - /** - * Constructor - */ - EmlOperatingModeNotificationTest(); - ~EmlOperatingModeNotificationTest() override = default; - - private: - void DoRun() override; -}; - EmlOperatingModeNotificationTest::EmlOperatingModeNotificationTest() : HeaderSerializationTestCase( "Check serialization and deserialization of the EML Operating Mode Notification frame") @@ -122,142 +103,6 @@ EmlOperatingModeNotificationTest::DoRun() "Unexpected EMLSR Transition Delay"); } -/** - * \ingroup wifi-test - * \ingroup tests - * - * \brief Base class for EMLSR Operations tests - * - * This base class setups and configures one AP MLD, a variable number of non-AP MLDs with - * EMLSR activated and a variable number of non-AP MLD with EMLSR deactivated. Every MLD has - * three links, each operating on a distinct PHY band (2.4 GHz, 5 GHz and 6 GHz). Therefore, - * it is expected that three links are setup by the non-AP MLD(s). The values for the Padding - * Delay, the Transition Delay and the Transition Timeout are provided as argument to the - * constructor of this class, along with the IDs of the links on which EMLSR mode must be - * enabled for the non-AP MLDs (this information is used to set the EmlsrLinkSet attribute - * of the DefaultEmlsrManager installed on the non-AP MLDs). - */ -class EmlsrOperationsTestBase : public TestCase -{ - public: - /** - * Constructor - * - * \param name The name of the new TestCase created - */ - EmlsrOperationsTestBase(const std::string& name); - ~EmlsrOperationsTestBase() override = default; - - /// Enumeration for traffic directions - enum TrafficDirection : uint8_t - { - DOWNLINK = 0, - UPLINK - }; - - protected: - /** - * Callback invoked when a FEM passes PSDUs to the PHY. - * - * \param mac the MAC transmitting the PSDUs - * \param phyId the ID of the PHY transmitting the PSDUs - * \param psduMap the PSDU map - * \param txVector the TX vector - * \param txPowerW the tx power in Watts - */ - virtual void Transmit(Ptr mac, - uint8_t phyId, - WifiConstPsduMap psduMap, - WifiTxVector txVector, - double txPowerW); - - /** - * \param dir the traffic direction (downlink/uplink) - * \param staId the index (starting at 0) of the non-AP MLD generating/receiving packets - * \param count the number of packets to generate - * \param pktSize the size of the packets to generate - * \return an application generating the given number packets of the given size from/to the - * AP MLD to/from the given non-AP MLD - */ - Ptr GetApplication(TrafficDirection dir, - std::size_t staId, - std::size_t count, - std::size_t pktSize) const; - - /** - * Check whether QoS data unicast transmissions addressed to the given destination on the - * given link are blocked or unblocked for the given reason on the given device. - * - * \param mac the MAC of the given device - * \param dest the MAC address of the given destination - * \param linkId the ID of the given link - * \param reason the reason for blocking transmissions to test - * \param blocked whether transmissions are blocked for the given reason - * \param description text indicating when this check is performed - * \param testUnblockedForOtherReasons whether to test if transmissions are unblocked for - * all the reasons other than the one provided - */ - void CheckBlockedLink(Ptr mac, - Mac48Address dest, - uint8_t linkId, - WifiQueueBlockedReason reason, - bool blocked, - std::string description, - bool testUnblockedForOtherReasons = true); - - void DoSetup() override; - - /// Information about transmitted frames - struct FrameInfo - { - Time startTx; ///< TX start time - WifiConstPsduMap psduMap; ///< transmitted PSDU map - WifiTxVector txVector; ///< TXVECTOR - uint8_t linkId; ///< link ID - uint8_t phyId; ///< ID of the transmitting PHY - }; - - uint8_t m_mainPhyId{0}; //!< ID of the main PHY - std::set m_linksToEnableEmlsrOn; /**< IDs of the links on which EMLSR mode has to - be enabled */ - std::size_t m_nEmlsrStations{1}; ///< number of stations to create that activate EMLSR - std::size_t m_nNonEmlsrStations{0}; /**< number of stations to create that do not - activate EMLSR */ - Time m_transitionTimeout{MicroSeconds(128)}; ///< Transition Timeout advertised by the AP MLD - std::vector