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

Test transmission of broadcast and unicast frames with STAs in Power Save mode. More...

Inheritance diagram for WifiPsModeAttributesTest:
Collaboration diagram for WifiPsModeAttributesTest:

Classes

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

Public Member Functions

 WifiPsModeAttributesTest (bool enableEmlsr, bool staticSetup)
 Constructor.
void Transmit (Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, Watt_u txPower)
 Callback invoked when PHY receives a PSDU to transmit.
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
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.
Ptr< PacketSocketClientGetApplication (WifiDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
void InsertEvents ()
 Insert elements in the list of expected events (transmitted frames).
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 Attributes

Ptr< ApWifiMacm_apMac
 AP wifi MAC.
const std::array< std::string, N_LINKSm_channels
 frequency channels for the two links
bool m_checkTxPsdus {false}
 whether to check transmitted PSDUs against the inserted events
std::vector< PacketSocketAddressm_dlSockets
 packet socket addresses for DL traffic
Time m_duration {Seconds(0.5)}
 simulation duration
bool m_enableEmlsr
 whether to enable EMLSR on the DUT
std::list< Eventsm_events
 list of events for a test run
const Time m_listenAdvance {MicroSeconds(50)}
 the value for the ListenAdvance attribute
const std::string m_otherChannel {"{100, 20, BAND_5GHZ, 0}"}
 channel used to initialize the PHY of the DUT operating on the link that shall not be used for ML setup
const Time m_psmTimeout {MicroSeconds(100)}
 the PSM timeout
std::array< Ptr< StaWifiMac >, 2 > m_staMacs
 wifi MACs of the STAs
bool m_staticSetup
 whether static setup helper is used to configure association
const Time m_switchDelay {MicroSeconds(64)}
 channel switch, transition and padding delay
std::vector< PacketSocketAddressm_ulSockets
 packet socket addresses for UL traffic

Static Private Attributes

static constexpr double DUT_BEACON_JITTER = 0.6
 jitter for the initial Beacon frame sent on the link used by the DUT for association
static constexpr std::size_t DUT_INDEX = 0
 DUT index.
static constexpr std::size_t N_LINKS = 2
 number of links for ML devices
static constexpr double STA_BEACON_JITTER = 0.2
 jitter for the initial Beacon frame sent on the link used by the other STA for association
static constexpr std::size_t STA_INDEX = 1
 index of the other non-AP STA
static constexpr double WAIT_BEACON_SURPLUS = 0.1
 the time a STA listens for a Beacon is the percentage of the Beacon interval given by the sum of the beacon jitter and this surplus

Additional Inherited Members

Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...

Detailed Description

Test transmission of broadcast and unicast frames with STAs in Power Save mode.

This test considers an AP MLD having two links and two devices: a device under test (DUT), which is a 2-link non-AP MLD, and a single-link non-AP STA. The DUT can have EMLSR mode enabled or disabled on both links and static setup helper can be used or not. Both STAs affiliated with the DUT are switched to powersave mode after completing ML setup or enabling EMLSR mode.

It is verified that:

  • upon completion of association (EML OMN) procedure, both STAs affiliated with the DUT are in PS mode and their PHYs are in sleep state (except, in case static setup helper is not used, the PHY of the STA operating on the link that is not used for association, which is put to sleep after receiving the first Beacon frame)
  • while the AP MLD sends a PPDU to the other non-AP STA, a packet is enqueued at the DUT; the PHYs of both STAs affiliated with the DUT are awaken from sleep and the state of the PHY operating on the same link as the other non-AP STA is CCA_BUSY
  • when a non-null PSM timeout is configured, the PHY is kept in awake state for such interval after releasing (and not requesting again) the channel and after receiving a Beacon frame that does not indicate that the AP has pending frames for the DUT
  • if channel access is requested (to transmit a frame) during a PSM timeout, the latter is cancelled
  • when a non-null Listen Advance is configured, the STA wakes up such interval prior to the TBTT
                     1 frame queued
                         at DUT
                           │                   channel access
                     ┌───────────┐             granted, no TX,    1 frame queued
         ┌──────┐    │QoS Data to│           no channel request       at DUT
[link 0] │Beacon│    │ other STA │                   │                  │
─────────┴──────┴────┴─────▼─────┴┬───┬─────────────────────────────────▼───────────────────────
                           │CCA   │ACK│              │                  │
non-AP STA      |---sleep--│BUSY  └───┘              │------sleep-------│             │---------
on link 0                  │                                            │
non-AP STA -----sleep------│                      │----│                │                     │-
on link 1                  │                                            │
                           │                  PSM       Listen          PSM               PSM
                           │           ┌───┐timeout    Advance┌──────┐timeout      ┌───┐timeout
[link 1]                   │           │ACK│------│    │------│Beacon│---X         │ACK│------│
───────────────────────────▼─┬────────┬┴───┴──────────────────┴──────┴──▼┬────────┬┴───┴────────
                             │QoS Data│                                  │QoS Data│
                             │from DUT│                                  │from DUT│
                             └────────┘                                  └────────┘

Definition at line 2519 of file power-save-test.cc.

Constructor & Destructor Documentation

◆ WifiPsModeAttributesTest()

WifiPsModeAttributesTest::WifiPsModeAttributesTest ( bool enableEmlsr,
bool staticSetup )

Constructor.

Parameters
enableEmlsrwhether to enable EMLSR on the DUT
staticSetupwhether static setup helper is used to configure association

Definition at line 2622 of file power-save-test.cc.

References ns3::TestCase::TestCase(), m_enableEmlsr, and m_staticSetup.

Here is the call graph for this function:

Member Function Documentation

◆ DoRun()

void WifiPsModeAttributesTest::DoRun ( )
overrideprotectedvirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 3195 of file power-save-test.cc.

References ns3::Simulator::Destroy(), DUT_INDEX, InsertEvents(), m_duration, m_events, m_staMacs, m_staticSetup, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Simulator::Schedule(), and ns3::Simulator::Stop().

Here is the call graph for this function:

◆ DoSetup()

void WifiPsModeAttributesTest::DoSetup ( )
overrideprotectedvirtual

◆ GetApplication()

Ptr< PacketSocketClient > WifiPsModeAttributesTest::GetApplication ( WifiDirection dir,
std::size_t staId,
std::size_t count,
std::size_t pktSize,
uint8_t priority = 0 ) const
protected
Parameters
dirthe traffic direction (downlink/uplink)
staIdthe index of the non-AP MLD generating/receiving packets
countthe number of packets to generate
pktSizethe size of the packets to generate
priorityuser priority for generated packets
Returns
an application generating the given number packets of the given size from/to the AP MLD to/from the given non-AP MLD

Definition at line 2632 of file power-save-test.cc.

References ns3::CreateObject(), dir, ns3::DOWNLINK, m_dlSockets, m_duration, m_ulSockets, ns3::MicroSeconds(), and ns3::Simulator::Now().

Referenced by InsertEvents().

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

◆ InsertEvents()

void WifiPsModeAttributesTest::InsertEvents ( )
protected

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

Definition at line 2882 of file power-save-test.cc.

References ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration(), ns3::WifiPhy::CalculateTxDuration(), ns3::CCA_BUSY, dir, ns3::DOWNLINK, DUT_INDEX, GetApplication(), ns3::IDLE, m_apMac, m_checkTxPsdus, m_enableEmlsr, m_events, m_listenAdvance, m_psmTimeout, m_staMacs, m_staticSetup, ns3::Simulator::Now(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Schedule(), ns3::WifiStaticSetupHelper::SetStaticBlockAckPostInit(), ns3::SINGLE_LINK_OP_ID, ns3::SLEEP, STA_INDEX, ns3::UPLINK, ns3::WIFI_MAC_CTL_ACK, ns3::WIFI_MAC_CTL_CTS, ns3::WIFI_MAC_CTL_END, ns3::WIFI_MAC_CTL_RTS, ns3::WIFI_MAC_CTL_TRIGGER, ns3::WIFI_MAC_DATA_NULL, ns3::WIFI_MAC_MGT_ACTION, ns3::WIFI_MAC_MGT_BEACON, ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PM_POWERSAVE.

Referenced by DoRun().

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

◆ Transmit()

void WifiPsModeAttributesTest::Transmit ( Ptr< WifiMac > mac,
uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
Watt_u txPower )

Callback invoked when PHY receives a PSDU to transmit.

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

Definition at line 2834 of file power-save-test.cc.

References ns3::WifiMacHeader::GetTypeString(), m_checkTxPsdus, m_events, ns3::Simulator::Now(), NS_LOG_INFO, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, and ns3::Time::US.

Referenced by DoSetup().

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

Member Data Documentation

◆ DUT_BEACON_JITTER

double WifiPsModeAttributesTest::DUT_BEACON_JITTER = 0.6
staticconstexprprivate

jitter for the initial Beacon frame sent on the link used by the DUT for association

Definition at line 2598 of file power-save-test.cc.

Referenced by DoSetup().

◆ DUT_INDEX

std::size_t WifiPsModeAttributesTest::DUT_INDEX = 0
staticconstexprprivate

DUT index.

Definition at line 2610 of file power-save-test.cc.

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

◆ m_apMac

Ptr<ApWifiMac> WifiPsModeAttributesTest::m_apMac
private

AP wifi MAC.

Definition at line 2612 of file power-save-test.cc.

Referenced by DoSetup(), and InsertEvents().

◆ m_channels

const std::array<std::string, N_LINKS> WifiPsModeAttributesTest::m_channels
private
Initial value:
{"{42, 80, BAND_5GHZ, 0}",
"{23, 80, BAND_6GHZ, 0}"}

frequency channels for the two links

Definition at line 2592 of file power-save-test.cc.

Referenced by DoSetup().

◆ m_checkTxPsdus

bool WifiPsModeAttributesTest::m_checkTxPsdus {false}
private

whether to check transmitted PSDUs against the inserted events

Definition at line 2617 of file power-save-test.cc.

Referenced by InsertEvents(), and Transmit().

◆ m_dlSockets

std::vector<PacketSocketAddress> WifiPsModeAttributesTest::m_dlSockets
private

packet socket addresses for DL traffic

Definition at line 2614 of file power-save-test.cc.

Referenced by DoSetup(), and GetApplication().

◆ m_duration

Time WifiPsModeAttributesTest::m_duration {Seconds(0.5)}
private

simulation duration

Definition at line 2619 of file power-save-test.cc.

Referenced by DoRun(), DoSetup(), and GetApplication().

◆ m_enableEmlsr

bool WifiPsModeAttributesTest::m_enableEmlsr
private

whether to enable EMLSR on the DUT

Definition at line 2608 of file power-save-test.cc.

Referenced by WifiPsModeAttributesTest(), DoSetup(), and InsertEvents().

◆ m_events

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

list of events for a test run

Definition at line 2616 of file power-save-test.cc.

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

◆ m_listenAdvance

const Time WifiPsModeAttributesTest::m_listenAdvance {MicroSeconds(50)}
private

the value for the ListenAdvance attribute

Definition at line 2606 of file power-save-test.cc.

Referenced by InsertEvents().

◆ m_otherChannel

const std::string WifiPsModeAttributesTest::m_otherChannel {"{100, 20, BAND_5GHZ, 0}"}
private

channel used to initialize the PHY of the DUT operating on the link that shall not be used for ML setup

Definition at line 2596 of file power-save-test.cc.

Referenced by DoSetup().

◆ m_psmTimeout

const Time WifiPsModeAttributesTest::m_psmTimeout {MicroSeconds(100)}
private

the PSM timeout

Definition at line 2605 of file power-save-test.cc.

Referenced by InsertEvents().

◆ m_staMacs

std::array<Ptr<StaWifiMac>, 2> WifiPsModeAttributesTest::m_staMacs
private

wifi MACs of the STAs

Definition at line 2613 of file power-save-test.cc.

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

◆ m_staticSetup

bool WifiPsModeAttributesTest::m_staticSetup
private

whether static setup helper is used to configure association

Definition at line 2609 of file power-save-test.cc.

Referenced by WifiPsModeAttributesTest(), DoRun(), DoSetup(), and InsertEvents().

◆ m_switchDelay

const Time WifiPsModeAttributesTest::m_switchDelay {MicroSeconds(64)}
private

channel switch, transition and padding delay

Definition at line 2607 of file power-save-test.cc.

Referenced by DoSetup().

◆ m_ulSockets

std::vector<PacketSocketAddress> WifiPsModeAttributesTest::m_ulSockets
private

packet socket addresses for UL traffic

Definition at line 2615 of file power-save-test.cc.

Referenced by DoSetup(), and GetApplication().

◆ N_LINKS

std::size_t WifiPsModeAttributesTest::N_LINKS = 2
staticconstexprprivate

number of links for ML devices

Definition at line 2590 of file power-save-test.cc.

Referenced by DoSetup().

◆ STA_BEACON_JITTER

double WifiPsModeAttributesTest::STA_BEACON_JITTER = 0.2
staticconstexprprivate

jitter for the initial Beacon frame sent on the link used by the other STA for association

Definition at line 2600 of file power-save-test.cc.

Referenced by DoSetup().

◆ STA_INDEX

std::size_t WifiPsModeAttributesTest::STA_INDEX = 1
staticconstexprprivate

index of the other non-AP STA

Definition at line 2611 of file power-save-test.cc.

Referenced by DoSetup(), and InsertEvents().

◆ WAIT_BEACON_SURPLUS

double WifiPsModeAttributesTest::WAIT_BEACON_SURPLUS = 0.1
staticconstexprprivate

the time a STA listens for a Beacon is the percentage of the Beacon interval given by the sum of the beacon jitter and this surplus

Definition at line 2603 of file power-save-test.cc.

Referenced by DoSetup().


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