diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index b027b9ca1..c1ec62094 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -17,9 +17,33 @@ * Author: Stefano Avallone */ +#include "ns3/ap-wifi-mac.h" +#include "ns3/attribute-container.h" +#include "ns3/boolean.h" +#include "ns3/config.h" +#include "ns3/eht-configuration.h" +#include "ns3/emlsr-manager.h" #include "ns3/header-serialization-test.h" #include "ns3/log.h" #include "ns3/mgt-headers.h" +#include "ns3/mobility-helper.h" +#include "ns3/multi-model-spectrum-channel.h" +#include "ns3/node-list.h" +#include "ns3/packet-socket-client.h" +#include "ns3/packet-socket-helper.h" +#include "ns3/packet-socket-server.h" +#include "ns3/rng-seed-manager.h" +#include "ns3/simulator.h" +#include "ns3/spectrum-wifi-helper.h" +#include "ns3/spectrum-wifi-phy.h" +#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 +#include using namespace ns3; @@ -92,6 +116,674 @@ 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; + + protected: + /** + * Callback invoked when a FEM passes PSDUs to the PHY. + * + * \param linkId the ID of the link transmitting the PSDUs + * \param context the context + * \param psduMap the PSDU map + * \param txVector the TX vector + * \param txPowerW the tx power in Watts + */ + virtual void Transmit(uint8_t linkId, + std::string context, + WifiConstPsduMap psduMap, + WifiTxVector txVector, + double txPowerW); + + 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 + }; + + 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