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

Test that a new EMLSR TXOP finalizes the tracking of the previous TXOP. More...

Inheritance diagram for EmlsrStaleTxopEndTest:
Collaboration diagram for EmlsrStaleTxopEndTest:

Classes

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

Public Member Functions

 EmlsrStaleTxopEndTest ()
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
 Caller graph was not generated because of its size.
virtual ~TestCase ()
 Destructor.
std::string GetName () const
TestCase & operator= (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 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< PacketSocketClient > GetApplication (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.
TestCase * GetParent () 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 CheckQueuesAfterTakeover ()
 Check the AP MLD's blocked queues after the takeover of the ended TXOP: client 2's other link must be blocked, client 1's links must be released.
void InsertEvents ()
 Insert elements in the list of expected events (transmitted frames).
void StartTraffic () override
 Start the generation of traffic (needs to be overridden).

Private Attributes

std::list< Events > m_events
 list of events for the test run
bool m_trafficStarted {false}
 whether the traffic of the test run has started
const Time m_txopLimit {MicroSeconds(992)}
 TXOP limit for TXOP_AC: sized so that client 1's TXOP comprises two frame exchanges and its closing Ack announces unused protection that is shorter than a CF-End frame but longer than the TXOP end tracking window.

Static Private Attributes

static constexpr linkId_t AUX_LINK = 2
 EMLSR link on which the aux PHYs operate (6 GHz).
static constexpr uint8_t AUX_PHY_ID = 2
 ID of the aux PHY of the EMLSR clients operating on AUX_LINK.
static constexpr tid_t BG_STA_TID = 0
 TID of the background station's first packet.
static constexpr linkId_t MAIN_LINK = 1
 EMLSR link on which the main PHYs operate (5 GHz).
static constexpr uint8_t MAIN_PHY_ID = 1
 ID of the main PHY of the EMLSR clients (initially operating on MAIN_LINK).
static constexpr AcIndex TXOP_AC = AC_VI
 AC of TXOP_TID, whose TXOP limit is set.
static constexpr tid_t TXOP_TID = 5
 TID of the packets transmitted in the TXOPs under test and of the background station's second packet.

Additional Inherited Members

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...
Protected Attributes inherited from EmlsrOperationsTestBase
Ptr< ApWifiMac > m_apMac
 AP wifi MAC.
std::array< std::string, 3 > m_channelsStr
 array of strings defining the channels for the MLD links
std::vector< PacketSocketAddress > m_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< Time > m_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< Time > m_transitionDelay
 Transition Delay advertised by the non-AP MLD.
Time m_transitionTimeout {MicroSeconds(128)}
 Transition Timeout advertised by the AP MLD.
std::vector< FrameInfo > m_txPsdus
 transmitted PSDUs
std::vector< PacketSocketAddress > m_ulSockets
 packet socket address for UL traffic

Detailed Description

Test that a new EMLSR TXOP finalizes the tracking of the previous TXOP.

With a non-zero TXOP limit, the AP MLD keeps a pending TXOP end event for a short window after each frame exchange of an EMLSR client's UL TXOP, waiting to see whether the TXOP holder continues its TXOP. If a TXOP-opening frame from a different EMLSR client is received in that window, the tracked TXOP is over: the pending event must be finalized (the previous holder switches back to listening operation, so the blocking of its other links ends) and the start-of-TXOP processing must run for the new holder (its other links become blocked).

The AP MLD and the three non-AP MLDs are set up by the EMLSR test base class, with three links each (2.4 GHz, 5 GHz and 6 GHz). Two non-AP MLDs are EMLSR clients, with EMLSR mode enabled on link 1 (5 GHz), where their main PHY operates, and on link 2 (6 GHz), where their aux PHY operates; the third one does not enable EMLSR and acts as a background station that only transmits on link 2. Once the traffic of the test starts, no frame is transmitted on link 0. All the packets are generated at times such that:

  • client 1 runs a two-exchange TXOP on link 1, whose TXOP limit is sized so that the closing Ack still announces a few tens of microseconds of unused protection: not enough for another frame exchange (or a CF-End frame), but enough to keep the TXOP end event pending after the TXOP has actually terminated;
  • client 2, whose main PHY leaves link 1 during client 1's first frame exchange (an aux PHY gained a TXOP on link 2, where the background station's first packet kept the medium busy at the time client 1's TXOP started), transmits its packet on link 2 and switches the main PHY back to link 1, which was left unattended in the meantime: the main PHY misses the protection announced by client 1 on link 1;
  • the main PHY completes the switch around the end of client 1's TXOP and gains channel access a short AIFS later, inside the TXOP end tracking window: the RTS it transmits (the MediumSyncDelay timer is running after the switch) reaches the AP MLD while the TXOP end event for client 1's terminated TXOP is still pending;
  • the background station's second packet keeps link 2 busy in the meantime, so that client 2's second packet is transmitted by the main PHY on link 1.

The expected frame exchange sequence is depicted below (time flows left to right, consistently across links 1 and 2; frames transmitted by the AP MLD are above the time axes, frames transmitted by the stations below):

*                                                           ┌───┐
*                                                           │Ack│
*  [link 1]  ─────────────┬────────┬────────────────────────┴───┴────────────┬────────┬───────
*                         │QoS Data│                                         │QoS Data│
*                         │client 1│                                         │client 1│
*                         └────────┘                                         └────────┘
*
*                                    ┌───┐            ┌───┐                             ┌───┐
*                                    │Ack│            │CTS│                             │Ack│
*  [link 2]  ──┬────────┬────────────┴───┴─┬────────┬─┴───┴───────┬────────┬────────────┴───┴─
*              │QoS Data│                  │  RTS   │             │QoS Data│
*              │ bg STA │                  │client 2│             │client 2│
*              └────────┘                  └────────┘             └────────┘
*
*  (client 2's main PHY completes the switch back to link 1, having missed the protection
*  announced by client 1; the MediumSyncDelay timer is running:)
*
*    client 1's TXOP is over, but the      the AP MLD must have blocked client 2's
*    announced protection keeps the        link 2 and released client 1's links
*    TXOP end event pending                (both checked here)
*                           │                │
*                         ┌───┐            ┌───┐                  ┌───┐
*                         │Ack│            │CTS│                  │Ack│
*  [link 1]  ─────────────┴───┴─┬────────┬─┴───┴─┬────────┬───────┴───┴─
*                               │  RTS   │       │QoS Data│
*                               │client 2│       │client 2│
*                               └────────┘       └────────┘
*
*                                                           ┌───┐
*                                                           │Ack│
*  [link 2]  ──┬────────┬───────────────────────────────────┴───┴───────
*              │QoS Data│
*              │ bg STA │
*              └────────┘
* 

Association, Block Ack agreement establishment and EMLSR mode enabling are performed by the base class before the traffic of the test starts. The test checks the type and the transmitter (and, where relevant, the transmitting PHY) of every frame transmitted on each link against the sequence of that link (frames transmitted on distinct links at about the same time, such as the QoS Data frames of client 1 on link 1 and of client 2 on link 2, may occur in either order) and, upon transmission of the CTS in response to client 2's RTS on link 1, that the AP MLD has finalized the tracking of client 1's TXOP (transmissions to client 1 are no longer blocked as using another link, but are waiting for the transition delay) and has run the start-of-TXOP processing for client 2 (transmissions to client 2 on link 2 are blocked). If the AP MLD mistook the pending TXOP end event for an indication that client 1's TXOP is still ongoing, it would skip the start-of-TXOP processing for client 2 and this test would fail at that CTS, on the assert checking that transmissions to the EMLSR client the CTS is addressed to are blocked on the other links. With asserts disabled, the AP MLD blocks those transmissions anyway when sending the CTS, but it would not switch client 1 back to listening operation, and this test would fail on the checks that client 1 has been released.

Definition at line 130 of file wifi-emlsr-txop-end-tracking-test.cc.

Constructor & Destructor Documentation

◆ EmlsrStaleTxopEndTest()

Member Function Documentation

◆ CheckQueuesAfterTakeover()

void EmlsrStaleTxopEndTest::CheckQueuesAfterTakeover ( )
private

Check the AP MLD's blocked queues after the takeover of the ended TXOP: client 2's other link must be blocked, client 1's links must be released.

Definition at line 315 of file wifi-emlsr-txop-end-tracking-test.cc.

References AUX_LINK, EmlsrOperationsTestBase::CheckBlockedLink(), EmlsrOperationsTestBase::m_apMac, EmlsrOperationsTestBase::m_staMacs, MAIN_LINK, ns3::MicroSeconds(), ns3::Simulator::Schedule(), ns3::USING_OTHER_EMLSR_LINK, and ns3::WAITING_EMLSR_TRANSITION_DELAY.

Referenced by InsertEvents().

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

◆ DoRun()

void EmlsrStaleTxopEndTest::DoRun ( )
overrideprotectedvirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 557 of file wifi-emlsr-txop-end-tracking-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 EmlsrStaleTxopEndTest::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 231 of file wifi-emlsr-txop-end-tracking-test.cc.

References AUX_LINK, EmlsrOperationsTestBase::DoSetup(), EmlsrOperationsTestBase::m_apMac, EmlsrOperationsTestBase::m_nEmlsrStations, EmlsrOperationsTestBase::m_staMacs, m_txopLimit, MAIN_LINK, ns3::MicroSeconds(), and TXOP_AC.

Here is the call graph for this function:

◆ InsertEvents()

void EmlsrStaleTxopEndTest::InsertEvents ( )
private

Insert elements in the list of expected events (transmitted frames).

Definition at line 368 of file wifi-emlsr-txop-end-tracking-test.cc.

References AUX_LINK, AUX_PHY_ID, EmlsrOperationsTestBase::CheckBlockedLink(), CheckQueuesAfterTakeover(), EmlsrOperationsTestBase::GetApplication(), EmlsrOperationsTestBase::m_apMac, m_events, EmlsrOperationsTestBase::m_staMacs, MAIN_LINK, MAIN_PHY_ID, ns3::MicroSeconds(), ns3::Simulator::Schedule(), TXOP_TID, EmlsrOperationsTestBase::UPLINK, ns3::USING_OTHER_EMLSR_LINK, ns3::WIFI_MAC_CTL_ACK, ns3::WIFI_MAC_CTL_CTS, ns3::WIFI_MAC_CTL_RTS, and ns3::WIFI_MAC_QOSDATA.

Referenced by StartTraffic().

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

◆ StartTraffic()

void EmlsrStaleTxopEndTest::StartTraffic ( )
overrideprivatevirtual

Start the generation of traffic (needs to be overridden).

Reimplemented from EmlsrOperationsTestBase.

Definition at line 267 of file wifi-emlsr-txop-end-tracking-test.cc.

References BG_STA_TID, EmlsrOperationsTestBase::GetApplication(), InsertEvents(), EmlsrOperationsTestBase::m_apMac, EmlsrOperationsTestBase::m_staMacs, m_trafficStarted, MAIN_LINK, ns3::MicroSeconds(), ns3::Simulator::Schedule(), ns3::TID_NOT_MAPPED, TXOP_AC, TXOP_TID, EmlsrOperationsTestBase::UPLINK, and ns3::wifiAcList.

Here is the call graph for this function:

◆ Transmit()

void EmlsrStaleTxopEndTest::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 497 of file wifi-emlsr-txop-end-tracking-test.cc.

References ns3::WifiMacHeader::GetTypeString(), m_events, m_trafficStarted, ns3::Simulator::Now(), NS_TEST_ASSERT_MSG_EQ, EmlsrOperationsTestBase::Transmit(), and ns3::Time::US.

Here is the call graph for this function:

Member Data Documentation

◆ AUX_LINK

linkId_t EmlsrStaleTxopEndTest::AUX_LINK = 2
staticconstexprprivate

EMLSR link on which the aux PHYs operate (6 GHz).

Definition at line 190 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by EmlsrStaleTxopEndTest(), CheckQueuesAfterTakeover(), DoSetup(), and InsertEvents().

◆ AUX_PHY_ID

uint8_t EmlsrStaleTxopEndTest::AUX_PHY_ID = 2
staticconstexprprivate

ID of the aux PHY of the EMLSR clients operating on AUX_LINK.

Definition at line 194 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by InsertEvents().

◆ BG_STA_TID

tid_t EmlsrStaleTxopEndTest::BG_STA_TID = 0
staticconstexprprivate

TID of the background station's first packet.

Definition at line 201 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by EmlsrStaleTxopEndTest(), and StartTraffic().

◆ m_events

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

list of events for the test run

Definition at line 203 of file wifi-emlsr-txop-end-tracking-test.cc.

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

◆ m_trafficStarted

bool EmlsrStaleTxopEndTest::m_trafficStarted {false}
private

whether the traffic of the test run has started

Definition at line 204 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by StartTraffic(), and Transmit().

◆ m_txopLimit

const Time EmlsrStaleTxopEndTest::m_txopLimit {MicroSeconds(992)}
private

TXOP limit for TXOP_AC: sized so that client 1's TXOP comprises two frame exchanges and its closing Ack announces unused protection that is shorter than a CF-End frame but longer than the TXOP end tracking window.

Definition at line 208 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by DoSetup().

◆ MAIN_LINK

linkId_t EmlsrStaleTxopEndTest::MAIN_LINK = 1
staticconstexprprivate

EMLSR link on which the main PHYs operate (5 GHz).

Definition at line 188 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by EmlsrStaleTxopEndTest(), CheckQueuesAfterTakeover(), DoSetup(), InsertEvents(), and StartTraffic().

◆ MAIN_PHY_ID

uint8_t EmlsrStaleTxopEndTest::MAIN_PHY_ID = 1
staticconstexprprivate

ID of the main PHY of the EMLSR clients (initially operating on MAIN_LINK).

Definition at line 192 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by EmlsrStaleTxopEndTest(), and InsertEvents().

◆ TXOP_AC

AcIndex EmlsrStaleTxopEndTest::TXOP_AC = AC_VI
staticconstexprprivate

AC of TXOP_TID, whose TXOP limit is set.

Definition at line 199 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by DoSetup(), and StartTraffic().

◆ TXOP_TID

tid_t EmlsrStaleTxopEndTest::TXOP_TID = 5
staticconstexprprivate

TID of the packets transmitted in the TXOPs under test and of the background station's second packet.

Definition at line 197 of file wifi-emlsr-txop-end-tracking-test.cc.

Referenced by EmlsrStaleTxopEndTest(), InsertEvents(), and StartTraffic().


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