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

Check ICF reception while main PHY is switching. More...

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

+ Inheritance diagram for EmlsrIcfSentDuringMainPhySwitchTest:
+ Collaboration diagram for EmlsrIcfSentDuringMainPhySwitchTest:

Classes

struct  Events
 Actions and checks to perform upon the transmission of each frame. More...
 
struct  MainPhySwitchInfo
 Store information about a main PHY switch. More...
 

Public Types

enum  ChannelSwitchEnd : uint8_t {
  DURING_PREAMBLE_DETECTION = 0 , BEFORE_PHY_HDR_END , BEFORE_MAC_HDR_END , BEFORE_MAC_PAYLOAD_END ,
  BEFORE_PADDING_END , CSD_COUNT
}
 Enumeration indicating the duration of a main PHY channel switch compared to the ICF fields. 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

 EmlsrIcfSentDuringMainPhySwitchTest ()
 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 CheckInDeviceInterference (const std::string &testStr, uint8_t linkId, Time duration)
 Check that the in-device interference generated by a transmission of the given duration on the given link is tracked by all the PHY interfaces of all the PHYs but the PHY that is transmitting.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
void EmlsrLinkSwitchCb (uint8_t linkId, Ptr< WifiPhy > phy, bool connected)
 Callback connected to the EmlsrLinkSwitch trace source of the StaWifiMac of the EMLSR client.
 
void GenerateNoiseOnAllLinks (Ptr< WifiMac > mac, Time duration)
 Generate noise on all the links of the given MAC for the given time duration.
 
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.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
Ptr< PacketSocketClientGetApplication (TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
 
virtual void MainPhySwitchInfoCallback (std::size_t index, const EmlsrMainPhySwitchTrace &info)
 Callback connected to the EMLSR Manager MainPhySwitch trace source.
 
- 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

std::array< WifiSpectrumBandInfo, 3 > m_bands
 bands of the 3 frequency channels
 
ChannelSwitchEnd m_csdIndex
 index to iterate over channel switch durations
 
std::list< Eventsm_events
 list of events for a test run
 
const uint8_t m_linkIdForTid3 {2}
 ID of the link on which TID 3 is mapped.
 
std::size_t m_processedEvents {0}
 number of processed events
 
bool m_setupDone {false}
 whether association, BA, ... have been done
 
std::optional< MainPhySwitchInfom_switchFrom
 info for main PHY leaving a link
 
std::optional< MainPhySwitchInfom_switchTo
 info for main PHY connected to a link
 
uint8_t m_testIndex {0}
 index to iterate over test scenarios
 
std::string m_testStr
 test scenario description
 

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

Check ICF reception while main PHY is switching.

An AP MLD and an EMLSR client, both having 3 links, are considered in this test. Aux PHYs are not TX capable and do not switch links; the preferred link is link 0. In order to control link switches, a TID-to-Link mapping is configured so that TIDs 0 and 3 are mapped onto link 1 in the DL direction, while TID 0 is mapped to link 1 and TID 3 is mapped to link 2 in the UL direction. In this way, the AP MLD always requests channel access on link 1, while the EMLSR client requests channel access on link 1 or link 2, depending on the TID. This test consists in having the AP MLD and the EMLSR client gain channel access simultaneously: the AP MLD starts transmitting an ICF, while the main PHY starts switching to the link on which the EMLSR client gained channel access, which could be either the link on which the ICF is being transmitted or another one, depending on the TID of the MPDU the EMLSR client has to transmit.

The channel switch delay for the main PHY varies across test scenarios and is computed so that the channel switch terminates during one of the different steps of the reception of the ICF: during preamble detection period, before the PHY header end, before the MAC header end, before the padding start and after the padding start.

┌────────┬──────┬──────┬────────────────────┬───────┐
│PREAMBLE│  PHY │  MAC │    MAC PAYLOAD     │       │
│ DETECT │HEADER│HEADER│(COMMON & USER INFO)│PADDING│
└────────┴──────┴──────┴────────────────────┴───────┘

All the combinations of the following are tested:

  • main PHY switches to the same link as ICF or to another link
  • channel switch can be interrupted or not
  • MAC header reception information is available and can be used or not

In all the cases, we check that the EMLSR client responds to the ICF:

  • if the main PHY switches to the same link as the ICF, connecting the main PHY to the link is postponed until the end of the ICF
  • if the main PHY switches to another link, the UL TXOP does not start because it is detected that a frame which could be an ICF is being received on another link

At the end of the DL TXOP, it is checked that:

  • if the KeepMainPhyAfterDlTxop attribute of the AdvancedEmlsrManager is false, the main PHY switches back to the preferred link
  • if the KeepMainPhyAfterDlTxop attribute of the AdvancedEmlsrManager is true, the main PHY stays on the current link to start an UL TXOP, if the UL frame can be sent on the same link as the DL frame, or switches back to the preferred link, otherwise

At the end of the UL TXOP, the main PHY returns to the preferred link.

It is also checked that the in-device interference generated by every transmission of the EMLSR client is tracked by all the PHY interfaces of all the PHYs but the PHY that is transmitting for the entire duration of the transmission.

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

Member Enumeration Documentation

◆ ChannelSwitchEnd

Enumeration indicating the duration of a main PHY channel switch compared to the ICF fields.

Enumerator
DURING_PREAMBLE_DETECTION 
BEFORE_PHY_HDR_END 
BEFORE_MAC_HDR_END 
BEFORE_MAC_PAYLOAD_END 
BEFORE_PADDING_END 
CSD_COUNT 

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

Constructor & Destructor Documentation

◆ EmlsrIcfSentDuringMainPhySwitchTest()

EmlsrIcfSentDuringMainPhySwitchTest::EmlsrIcfSentDuringMainPhySwitchTest ( )

Member Function Documentation

◆ CheckInDeviceInterference()

void EmlsrIcfSentDuringMainPhySwitchTest::CheckInDeviceInterference ( const std::string & testStr,
uint8_t linkId,
Time duration )
protected

Check that the in-device interference generated by a transmission of the given duration on the given link is tracked by all the PHY interfaces of all the PHYs but the PHY that is transmitting.

Parameters
testStrthe test string
linkIdthe ID of the given link
durationthe duration of the transmission

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

References ns3::DbmToW(), ns3::PointerValue::Get(), ns3::InterferenceHelper::GetEnergyDuration(), m_bands, EmlsrOperationsTestBase::m_staMacs, m_testStr, and NS_TEST_EXPECT_MSG_EQ.

Referenced by RunOne().

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

◆ DoRun()

void EmlsrIcfSentDuringMainPhySwitchTest::DoRun ( )
overrideprotectedvirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 1213 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 EmlsrIcfSentDuringMainPhySwitchTest::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 ns3::TestCase.

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

References EmlsrOperationsTestBase::DoSetup(), EmlsrLinkSwitchCb(), m_bands, m_linkIdForTid3, EmlsrOperationsTestBase::m_staMacs, ns3::MakeCallback(), ns3::MicroSeconds(), and ns3::Config::SetDefault().

+ Here is the call graph for this function:

◆ EmlsrLinkSwitchCb()

void EmlsrIcfSentDuringMainPhySwitchTest::EmlsrLinkSwitchCb ( uint8_t linkId,
Ptr< WifiPhy > phy,
bool connected )
protected

Callback connected to the EmlsrLinkSwitch trace source of the StaWifiMac of the EMLSR client.

Parameters
linkIdthe ID of the link which the PHY is connected to/disconnected from
phya pointer to the PHY that is connected to/disconnected from the given link
connectedtrue if the PHY is connected, false if the PHY is disconnected

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

References EmlsrOperationsTestBase::m_mainPhyId, m_setupDone, EmlsrOperationsTestBase::m_staMacs, m_switchFrom, m_switchTo, ns3::Simulator::Now(), NS_LOG_DEBUG, and ns3::Time::US.

Referenced by DoSetup().

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

◆ GenerateNoiseOnAllLinks()

void EmlsrIcfSentDuringMainPhySwitchTest::GenerateNoiseOnAllLinks ( Ptr< WifiMac > mac,
Time duration )
protected

Generate noise on all the links of the given MAC for the given time duration.

This is used to align the EDCA backoff boundary on all the links for the given MAC.

Parameters
macthe given MAC
durationthe given duration

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

References ns3::Create(), ns3::DynamicCast(), and NS_TEST_ASSERT_MSG_NE.

Referenced by RunOne().

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

◆ RunOne()

void EmlsrIcfSentDuringMainPhySwitchTest::RunOne ( )
protected

◆ StartTraffic()

void EmlsrIcfSentDuringMainPhySwitchTest::StartTraffic ( )
overrideprivatevirtual

Start the generation of traffic (needs to be overridden)

Reimplemented from EmlsrOperationsTestBase.

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

References m_setupDone, and RunOne().

+ Here is the call graph for this function:

◆ Transmit()

void EmlsrIcfSentDuringMainPhySwitchTest::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 1167 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_bands

std::array<WifiSpectrumBandInfo, 3> EmlsrIcfSentDuringMainPhySwitchTest::m_bands
private

bands of the 3 frequency channels

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

Referenced by CheckInDeviceInterference(), and DoSetup().

◆ m_csdIndex

ChannelSwitchEnd EmlsrIcfSentDuringMainPhySwitchTest::m_csdIndex
private
Initial value:

index to iterate over channel switch durations

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

Referenced by RunOne().

◆ m_events

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

list of events for a test run

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

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

◆ m_linkIdForTid3

const uint8_t EmlsrIcfSentDuringMainPhySwitchTest::m_linkIdForTid3 {2}
private

ID of the link on which TID 3 is mapped.

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

Referenced by DoSetup(), and RunOne().

◆ m_processedEvents

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

number of processed events

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

Referenced by Transmit().

◆ m_setupDone

bool EmlsrIcfSentDuringMainPhySwitchTest::m_setupDone {false}
private

whether association, BA, ... have been done

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

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

◆ m_switchFrom

std::optional<MainPhySwitchInfo> EmlsrIcfSentDuringMainPhySwitchTest::m_switchFrom
private

info for main PHY leaving a link

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

Referenced by EmlsrLinkSwitchCb(), and RunOne().

◆ m_switchTo

std::optional<MainPhySwitchInfo> EmlsrIcfSentDuringMainPhySwitchTest::m_switchTo
private

info for main PHY connected to a link

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

Referenced by EmlsrLinkSwitchCb(), and RunOne().

◆ m_testIndex

uint8_t EmlsrIcfSentDuringMainPhySwitchTest::m_testIndex {0}
private

index to iterate over test scenarios

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

Referenced by RunOne().

◆ m_testStr

std::string EmlsrIcfSentDuringMainPhySwitchTest::m_testStr
private

test scenario description

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

Referenced by CheckInDeviceInterference(), and RunOne().


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