A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
EmlsrSwitchMainPhyBackTest Class Reference

Switch main PHY back timer test. More...

#include "wifi-emlsr-link-switch-test.h"

+ Inheritance diagram for EmlsrSwitchMainPhyBackTest:
+ Collaboration diagram for EmlsrSwitchMainPhyBackTest:

Classes

struct  Events
 Actions and checks to perform upon the transmission of each frame. More...
 

Public Types

enum  TestScenario : uint8_t {
  RXSTART_WHILE_SWITCH_NO_INTERRUPT = 0 , RXSTART_WHILE_SWITCH_INTERRUPT , RXSTART_AFTER_SWITCH_HT_PPDU , NON_HT_PPDU_DONT_USE_MAC_HDR ,
  NON_HT_PPDU_USE_MAC_HDR , LONG_SWITCH_BACK_DELAY_DONT_USE_MAC_HDR , LONG_SWITCH_BACK_DELAY_USE_MAC_HDR , COUNT
}
 Enumeration indicating the tested scenario. More...
 
- Public Types inherited from EmlsrOperationsTestBase
enum  TrafficDirection : uint8_t { DOWNLINK = 0 , UPLINK }
 Enumeration for traffic directions. More...
 
- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 

Public Member Functions

 EmlsrSwitchMainPhyBackTest ()
 Constructor.
 
- Public Member Functions inherited from EmlsrOperationsTestBase
 EmlsrOperationsTestBase (const std::string &name)
 Constructor.
 
 ~EmlsrOperationsTestBase () override=default
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Protected Member Functions

void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
void InsertEventsForQosTid4 ()
 Insert events corresponding to the UL TXOP to transmit the QoS Data frame with TID 4.
 
void MainPhySwitchInfoCallback (std::size_t index, const EmlsrMainPhySwitchTrace &info) override
 Callback connected to the EMLSR Manager MainPhySwitch trace source.
 
void RunOne ()
 Runs a test case and invokes itself for the next test case.
 
void Transmit (Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
 Callback invoked when a FEM passes PSDUs to the PHY.
 
- Protected Member Functions inherited from EmlsrOperationsTestBase
void CheckAuxPhysSleepMode (Ptr< StaWifiMac > staMac, bool sleep)
 Check whether aux PHYs of the given device are in sleep mode/awake.
 
void CheckBlockedLink (Ptr< WifiMac > mac, Mac48Address dest, uint8_t linkId, WifiQueueBlockedReason reason, bool blocked, std::string description, bool testUnblockedForOtherReasons=true)
 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.
 
void CheckMainPhyTraceInfo (std::size_t index, std::string_view reason, const std::optional< uint8_t > &fromLinkId, uint8_t toLinkId, bool checkFromLinkId=true, bool checkToLinkId=true)
 Check information provided by the EMLSR Manager MainPhySwitch trace.
 
void CheckMsdTimerRunning (Ptr< StaWifiMac > staMac, uint8_t linkId, bool isRunning, const std::string &msg)
 Check whether the MediumSyncDelay timer is running on the given link of the given device.
 
Ptr< PacketSocketClientGetApplication (TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Private Member Functions

void StartTraffic () override
 Start the generation of traffic (needs to be overridden)
 

Private Attributes

Ptr< WifiMpdum_bcastFrame
 the broadcast frame sent by the AP MLD
 
bool m_dlPktDone {false}
 whether the DL packet has been generated
 
std::list< Eventsm_events
 list of events for a test run
 
Time m_expectedMainPhySwitchBackTime
 expected main PHY switch back time
 
const uint8_t m_linkIdForTid0 {1}
 ID of the link on which TID 0 is mapped.
 
const uint8_t m_linkIdForTid4 {0}
 ID of the link on which TID 4 is mapped.
 
std::size_t m_processedEvents {0}
 number of processed events
 
bool m_setupDone {false}
 whether association, BA, ... have been done
 
Time m_switchMainPhyBackDelay
 the switch main PHY back delay
 
uint8_t m_testIndex {0}
 index to iterate over test scenarios
 

Additional Inherited Members

- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- Protected Attributes inherited from EmlsrOperationsTestBase
Ptr< ApWifiMacm_apMac
 AP wifi MAC.
 
std::array< std::string, 3 > m_channelsStr
 array of strings defining the channels for the MLD links
 
std::vector< PacketSocketAddressm_dlSockets
 packet socket address for DL traffic
 
Time m_duration {0}
 simulation duration
 
std::vector< uint8_t > m_establishBaDl {}
 the TIDs for which BA needs to be established with the AP as originator
 
std::vector< uint8_t > m_establishBaUl {}
 the TIDs for which BA needs to be established with the AP as recipient
 
const std::array< FrequencyRange, 3 > m_freqRanges
 array of frequency ranges for MLD links
 
uint16_t m_lastAid {0}
 AID of last associated station.
 
std::set< uint8_t > m_linksToEnableEmlsrOn
 IDs of the links on which EMLSR mode has to be enabled.
 
uint8_t m_mainPhyId {0}
 ID of the main PHY.
 
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
 
std::size_t m_nPhysPerEmlsrDevice {3}
 number of PHYs per EMLSR client
 
std::vector< Timem_paddingDelay
 Padding Delay advertised by the non-AP MLD.
 
bool m_putAuxPhyToSleep {false}
 whether aux PHYs are put to sleep during DL/UL TXOPs
 
uint64_t m_rngRun {1}
 RNG run value.
 
uint32_t m_rngSeed {1}
 RNG seed value.
 
std::vector< Ptr< StaWifiMac > > m_staMacs
 MACs of the non-AP MLDs.
 
uint16_t m_startAid {1}
 first AID to allocate to stations
 
int64_t m_streamNo {5}
 RNG stream number.
 
std::map< std::size_t, std::shared_ptr< EmlsrMainPhySwitchTrace > > m_traceInfo
 EMLSR client ID-indexed map of trace info from last main PHY switch.
 
std::vector< Timem_transitionDelay
 Transition Delay advertised by the non-AP MLD.
 
Time m_transitionTimeout {MicroSeconds(128)}
 Transition Timeout advertised by the AP MLD.
 
std::vector< FrameInfom_txPsdus
 transmitted PSDUs
 
std::vector< PacketSocketAddressm_ulSockets
 packet socket address for UL traffic
 

Detailed Description

Switch main PHY back timer test.

An AP MLD and an EMLSR client, both having 3 links, are considered in this test. Aux PHYs are not TX capable, do not switch links and support up to the HT modulation class; the preferred link is link 2. In order to control link switches, a TID-to-Link mapping is configured so that TID 0 is mapped onto link 1 and TID 4 is mapped onto link 0 (for both DL and UL). In this test, the main PHY switches to link 1 to start an UL TXOP but, while the main PHY is switching or shortly after the channel switch ends, the AP MLD transmits a QoS Data broadcast frame on link 1 using a modulation supported by the aux PHYs. Different situations are tested and it is verified that the main PHY switches back to the preferred link as expected. Scenarios:

  • RXSTART_WHILE_SWITCH_NO_INTERRUPT: the AP MLD transmits an HT PPDU while the main PHY is switching; at the end of the PHY header reception (while the main PHY is still switching), the MAC of the EMLSR client receives the RX start notification, which indicates that the modulation is HT (hence the PPDU does not carry an ICF) and the PPDU duration exceeds the switch main PHY back delay. The EMLSR client decides to switch the main PHY back to the preferred link (with reason RX_END), but the actual main PHY switch is postponed until the ongoing channel switch terminates.
  • RXSTART_WHILE_SWITCH_INTERRUPT: same as previous scenario, except that the main PHY switch can be interrupted, hence the main PHY switches back to the preferred link as soon as the reception of the PHY header ends.
  • RXSTART_AFTER_SWITCH_HT_PPDU: the AP MLD transmits an HT PPDU some time after the main PHY starts switching to link 1; the delay is computed so that the RX START notification is sent after that the main PHY has completed the channel switch. When the main PHY completes the switch to link 1, it is determined that the PPDU being received (using HT modulation) cannot be an ICF, hence the main PHY is connected to link 1. Connecting the main PHY to link 1 triggers a CCA busy notification until the end of the PPDU (we assume this information is available from the PHY header decoded by the aux PHY), thus the main PHY switches back to the preferred link (with reason BUSY_END).
  • NON_HT_PPDU_DONT_USE_MAC_HDR: the AP MLD transmits a non-HT PPDU on link 1 (it does not really matter if the RX START notification is sent before or after the end of main PHY switch). When the main PHY completes the switch to link 1, it is detected that the aux PHY on link 1 is receiving a PPDU which may be an ICF (the modulation is non-HT), hence the main PHY is not connected to link 1 until the end of the PPDU reception (MAC header info is not used). At that time, it is detected that the PPDU does not contain an ICF, but it is determined that channel access can be gained before the end of the switch main PHY back timer, hence the main PHY stays on link 1 and transmits its unicast data frame. The start of the UL TXOP cancels the main PHY switch back timer and the main PHY switches back to the preferred link at the end of the TXOP.
  • NON_HT_PPDU_USE_MAC_HDR: same as previous scenario, except that the MAC header info can be used. After completing the channel switch, the main PHY is not connected to link 1 because the non-HT PPDU being received may be an ICF. When the MAC header info is notified, it is detected that the PPDU does not contain an ICF, channel access would not be gained before the end of the switch main PHY back timer and therefore the main PHY switches back to the preferred link (with reason RX_END).
  • LONG_SWITCH_BACK_DELAY_DONT_USE_MAC_HDR: same as the NON_HT_PPDU_DONT_USE_MAC_HDR scenario, except that the switch main PHY back delay is longer and exceeds the PPDU duration, but it is does not exceed the PPDU duration plus AIFS and the backoff slots. Therefore, at the end of the PPDU reception, it is determined that the backoff counter will not reach zero before the end of the switch main PHY back timer plus a channel switch delay and the main PHY switches back to the preferred link (with reason BACKOFF_END).
  • LONG_SWITCH_BACK_DELAY_USE_MAC_HDR: same as the NON_HT_PPDU_USE_MAC_HDR scenario, except that the switch main PHY back delay is longer and exceeds the PPDU duration, but it does not exceed the PPDU duration plus AIFS and the backoff slots. Therefore, at the end of the MAC header reception, it is determined that the backoff counter will not reach zero before the end of the switch main PHY back timer plus a channel switch delay and the main PHY switches back to the preferred link (with reason BACKOFF_END).

Except for the NON_HT_PPDU_DONT_USE_MAC_HDR case, in which the main PHY stays on link 1 and transmits a data frame, receives the Ack and switches back to the preferred link at the TXOP end, in all other cases the main PHY switches back to the preferred link without sending a frame on link 1. A few microseconds after starting the switch to the preferred link, a frame with TID 4 is queued. If interrupt switching is enabled, the switch to the preferred link is interrupted and the main PHY switches to link 0, where it transmits the data frame with TID 4 as soon as completing the switch. Afterwards, the main PHY switches back to the preferred link and, except for the NON_HT_PPDU_DONT_USE_MAC_HDR case, it switches to link 1 to transmit the queued frame with TID 0.

Definition at line 497 of file wifi-emlsr-link-switch-test.h.

Member Enumeration Documentation

◆ TestScenario

Enumeration indicating the tested scenario.

Enumerator
RXSTART_WHILE_SWITCH_NO_INTERRUPT 
RXSTART_WHILE_SWITCH_INTERRUPT 
RXSTART_AFTER_SWITCH_HT_PPDU 
NON_HT_PPDU_DONT_USE_MAC_HDR 
NON_HT_PPDU_USE_MAC_HDR 
LONG_SWITCH_BACK_DELAY_DONT_USE_MAC_HDR 
LONG_SWITCH_BACK_DELAY_USE_MAC_HDR 
COUNT 

Definition at line 506 of file wifi-emlsr-link-switch-test.h.

Constructor & Destructor Documentation

◆ EmlsrSwitchMainPhyBackTest()

Member Function Documentation

◆ DoRun()

void EmlsrSwitchMainPhyBackTest::DoRun ( )
overrideprotectedvirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 1638 of file wifi-emlsr-link-switch-test.cc.

References ns3::Simulator::Destroy(), EmlsrOperationsTestBase::m_duration, m_events, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ DoSetup()

void EmlsrSwitchMainPhyBackTest::DoSetup ( )
overrideprotectedvirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.

Reimplemented from EmlsrOperationsTestBase.

Definition at line 1564 of file wifi-emlsr-link-switch-test.cc.

References ns3::Create(), EmlsrOperationsTestBase::DoSetup(), ns3::Mac48Address::GetBroadcast(), EmlsrOperationsTestBase::m_apMac, m_bcastFrame, m_linkIdForTid0, m_linkIdForTid4, ns3::MicroSeconds(), ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetAddr2(), ns3::WifiMacHeader::SetAddr3(), ns3::Config::SetDefault(), ns3::WifiMacHeader::SetDsFrom(), ns3::WifiMacHeader::SetDsNotTo(), ns3::WifiMacHeader::SetQosTid(), and ns3::WIFI_MAC_QOSDATA.

+ Here is the call graph for this function:

◆ InsertEventsForQosTid4()

void EmlsrSwitchMainPhyBackTest::InsertEventsForQosTid4 ( )
protected

Insert events corresponding to the UL TXOP to transmit the QoS Data frame with TID 4.

Definition at line 1798 of file wifi-emlsr-link-switch-test.cc.

References COUNT, ns3::DynamicCast(), EmlsrOperationsTestBase::m_apMac, m_dlPktDone, m_events, m_linkIdForTid4, EmlsrOperationsTestBase::m_mainPhyId, EmlsrOperationsTestBase::m_staMacs, m_testIndex, ns3::MilliSeconds(), NON_HT_PPDU_DONT_USE_MAC_HDR, ns3::Simulator::Now(), NS_TEST_EXPECT_MSG_EQ, RunOne(), ns3::Simulator::Schedule(), ns3::WIFI_MAC_CTL_ACK, ns3::WIFI_MAC_CTL_END, and ns3::WIFI_MAC_QOSDATA.

Referenced by MainPhySwitchInfoCallback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MainPhySwitchInfoCallback()

void EmlsrSwitchMainPhyBackTest::MainPhySwitchInfoCallback ( std::size_t index,
const EmlsrMainPhySwitchTrace & info )
overrideprotectedvirtual

◆ RunOne()

void EmlsrSwitchMainPhyBackTest::RunOne ( )
protected

Runs a test case and invokes itself for the next test case.

Definition at line 1863 of file wifi-emlsr-link-switch-test.cc.

References ns3::AC_BE, ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration(), ns3::WifiPhy::CalculateTxDuration(), COUNT, ns3::DynamicCast(), EmlsrOperationsTestBase::GetApplication(), ns3::Mac48Address::GetBroadcast(), ns3::HtPhy::GetHtMcs0(), ns3::WifiTxVector::GetMode(), ns3::OfdmPhy::GetOfdmRate6Mbps(), LONG_SWITCH_BACK_DELAY_DONT_USE_MAC_HDR, LONG_SWITCH_BACK_DELAY_USE_MAC_HDR, EmlsrOperationsTestBase::m_apMac, m_bcastFrame, m_dlPktDone, m_events, m_expectedMainPhySwitchBackTime, m_linkIdForTid0, EmlsrOperationsTestBase::m_mainPhyId, EmlsrOperationsTestBase::m_staMacs, m_switchMainPhyBackDelay, m_testIndex, ns3::MicroSeconds(), ns3::MilliSeconds(), NON_HT_PPDU_DONT_USE_MAC_HDR, NON_HT_PPDU_USE_MAC_HDR, ns3::Simulator::Now(), NS_LOG_INFO, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, RunOne(), RXSTART_AFTER_SWITCH_HT_PPDU, RXSTART_WHILE_SWITCH_INTERRUPT, RXSTART_WHILE_SWITCH_NO_INTERRUPT, ns3::Simulator::Schedule(), ns3::SU_STA_ID, EmlsrOperationsTestBase::UPLINK, ns3::WIFI_MAC_CTL_ACK, and ns3::WIFI_MAC_QOSDATA.

Referenced by InsertEventsForQosTid4(), RunOne(), and StartTraffic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StartTraffic()

void EmlsrSwitchMainPhyBackTest::StartTraffic ( )
overrideprivatevirtual

Start the generation of traffic (needs to be overridden)

Reimplemented from EmlsrOperationsTestBase.

Definition at line 1631 of file wifi-emlsr-link-switch-test.cc.

References m_setupDone, and RunOne().

+ Here is the call graph for this function:

◆ Transmit()

void EmlsrSwitchMainPhyBackTest::Transmit ( Ptr< WifiMac > mac,
uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )
overrideprotectedvirtual

Callback invoked when a FEM passes PSDUs to the PHY.

Parameters
macthe MAC transmitting the PSDUs
phyIdthe ID of the PHY transmitting the PSDUs
psduMapthe PSDU map
txVectorthe TX vector
txPowerWthe tx power in Watts

Reimplemented from EmlsrOperationsTestBase.

Definition at line 1592 of file wifi-emlsr-link-switch-test.cc.

References m_events, m_processedEvents, m_setupDone, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, and EmlsrOperationsTestBase::Transmit().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_bcastFrame

Ptr<WifiMpdu> EmlsrSwitchMainPhyBackTest::m_bcastFrame
private

the broadcast frame sent by the AP MLD

Definition at line 565 of file wifi-emlsr-link-switch-test.h.

Referenced by DoSetup(), MainPhySwitchInfoCallback(), and RunOne().

◆ m_dlPktDone

bool EmlsrSwitchMainPhyBackTest::m_dlPktDone {false}
private

whether the DL packet has been generated

Definition at line 560 of file wifi-emlsr-link-switch-test.h.

Referenced by InsertEventsForQosTid4(), MainPhySwitchInfoCallback(), and RunOne().

◆ m_events

std::list<Events> EmlsrSwitchMainPhyBackTest::m_events
private

list of events for a test run

Definition at line 561 of file wifi-emlsr-link-switch-test.h.

Referenced by DoRun(), InsertEventsForQosTid4(), RunOne(), and Transmit().

◆ m_expectedMainPhySwitchBackTime

Time EmlsrSwitchMainPhyBackTest::m_expectedMainPhySwitchBackTime
private

expected main PHY switch back time

Definition at line 567 of file wifi-emlsr-link-switch-test.h.

Referenced by MainPhySwitchInfoCallback(), and RunOne().

◆ m_linkIdForTid0

const uint8_t EmlsrSwitchMainPhyBackTest::m_linkIdForTid0 {1}
private

ID of the link on which TID 0 is mapped.

Definition at line 563 of file wifi-emlsr-link-switch-test.h.

Referenced by DoSetup(), and RunOne().

◆ m_linkIdForTid4

const uint8_t EmlsrSwitchMainPhyBackTest::m_linkIdForTid4 {0}
private

ID of the link on which TID 4 is mapped.

Definition at line 564 of file wifi-emlsr-link-switch-test.h.

Referenced by DoSetup(), InsertEventsForQosTid4(), and MainPhySwitchInfoCallback().

◆ m_processedEvents

std::size_t EmlsrSwitchMainPhyBackTest::m_processedEvents {0}
private

number of processed events

Definition at line 562 of file wifi-emlsr-link-switch-test.h.

Referenced by Transmit().

◆ m_setupDone

bool EmlsrSwitchMainPhyBackTest::m_setupDone {false}
private

whether association, BA, ... have been done

Definition at line 559 of file wifi-emlsr-link-switch-test.h.

Referenced by MainPhySwitchInfoCallback(), StartTraffic(), and Transmit().

◆ m_switchMainPhyBackDelay

Time EmlsrSwitchMainPhyBackTest::m_switchMainPhyBackDelay
private

the switch main PHY back delay

Definition at line 566 of file wifi-emlsr-link-switch-test.h.

Referenced by MainPhySwitchInfoCallback(), and RunOne().

◆ m_testIndex

uint8_t EmlsrSwitchMainPhyBackTest::m_testIndex {0}
private

index to iterate over test scenarios

Definition at line 558 of file wifi-emlsr-link-switch-test.h.

Referenced by InsertEventsForQosTid4(), MainPhySwitchInfoCallback(), and RunOne().


The documentation for this class was generated from the following files: