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

Implements a test case to evaluate the transmission process of multiple Wi-Fi MAC Layer MPDUs. More...

+ Inheritance diagram for WifiTxStatsHelperTest:
+ Collaboration diagram for WifiTxStatsHelperTest:

Public Types

enum  TestOption : uint8_t { SINGLE_LINK_NON_QOS , MULTI_LINK_QOS }
 Option for the test. 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

 WifiTxStatsHelperTest (const std::string &testName, TestOption option)
 Constructor.
 
void Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, Watt_u txPower)
 Callback invoked when PHY starts transmission of a PSDU, used to record TX start time and TX duration.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void CheckResults (const WifiTxStatsHelper &wifiTxStats)
 Check correctness of test.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 

Private Attributes

std::map< uint8_t, uint32_tm_aifsns
 Map of AIFSNs, indexed per link (for MULTI_LINK_QOS case only)
 
std::map< uint8_t, Timem_aifss
 Map of AIFSs, indexed per link (for MULTI_LINK_QOS case only)
 
std::map< uint8_t, uint32_tm_cwMins
 Map of CW Mins, indexed per link.
 
Time m_difs
 DIFS time (for SINGLE_LINK_NON_QOS case only)
 
std::map< uint8_t, std::vector< Time > > m_durations
 Map of vector of MPDU durations, indexed per link.
 
TestOption m_option
 Test option.
 
Time m_sifs
 SIFS time.
 
Time m_slot
 slot time
 
int64_t m_streamNumber
 Random variable stream number.
 
std::map< uint8_t, std::vector< Time > > m_txStartTimes
 Map of independently obtain vector of PhyTxBegin trace, indexed per link.
 
NodeContainer m_wifiApNode
 NodeContainer for AP.
 
NodeContainer m_wifiStaNodes
 NodeContainer for STAs.
 

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 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.
 

Detailed Description

Implements a test case to evaluate the transmission process of multiple Wi-Fi MAC Layer MPDUs.

The testcase has two options. 1) SINGLE_LINK_NON_QOS: test the handling of regular ACKs. 2) MULTI_LINK_QOS: test the handling of MPDU aggregation, Block ACKs, and Multi-Link Operation.

To observe the operation of WifiTxStatsHelper, the test can be run from the command line as follows:

NS_LOG="WifiTxStatsHelper=level_info|prefix_all" ./ns3 run 'test-runner
--suite=wifi-tx-stats-helper'
#define NS_LOG(level, msg)
This macro allows you to log an arbitrary message at a specific log level.
Every class exported by the ns3 library is enclosed in the ns3 namespace.

Definition at line 55 of file wifi-tx-stats-helper-test.cc.

Member Enumeration Documentation

◆ TestOption

Option for the test.

Enumerator
SINGLE_LINK_NON_QOS 
MULTI_LINK_QOS 

Definition at line 61 of file wifi-tx-stats-helper-test.cc.

Constructor & Destructor Documentation

◆ WifiTxStatsHelperTest()

WifiTxStatsHelperTest::WifiTxStatsHelperTest ( const std::string & testName,
TestOption option )

Constructor.

Parameters
testNameTest name
optionTest option

Definition at line 116 of file wifi-tx-stats-helper-test.cc.

Member Function Documentation

◆ CheckResults()

void WifiTxStatsHelperTest::CheckResults ( const WifiTxStatsHelper & wifiTxStats)
private

Check correctness of test.

Parameters
wifiTxStatsReference to the helper

Definition at line 502 of file wifi-tx-stats-helper-test.cc.

References ns3::WifiTxStatsHelper::GetFailureRecords(), ns3::WifiTxStatsHelper::GetFailures(), ns3::WifiTxStatsHelper::GetFailuresByNodeDevice(), ns3::WifiTxStatsHelper::GetRetransmissions(), ns3::WifiTxStatsHelper::GetRetransmissionsByNodeDevice(), ns3::WifiTxStatsHelper::GetSuccesses(), ns3::WifiTxStatsHelper::GetSuccessesByNodeDevice(), ns3::WifiTxStatsHelper::GetSuccessesByNodeDeviceLink(), ns3::WifiTxStatsHelper::GetSuccessRecords(), m_aifss, m_cwMins, m_difs, m_durations, m_option, m_sifs, m_slot, m_txStartTimes, ns3::NanoSeconds(), NS_LOG_INFO, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_GT_OR_EQ, NS_TEST_ASSERT_MSG_LT_OR_EQ, SINGLE_LINK_NON_QOS, ns3::SINGLE_LINK_OP_ID, and ns3::Time::US.

Referenced by DoRun().

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

◆ DoRun()

◆ DoSetup()

void WifiTxStatsHelperTest::DoSetup ( )
overrideprivatevirtual

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 145 of file wifi-tx-stats-helper-test.cc.

References ns3::NodeContainer::Create(), ns3::CreateObject(), ns3::PacketSocketHelper::Install(), m_wifiApNode, m_wifiStaNodes, ns3::RngSeedManager::SetRun(), and ns3::RngSeedManager::SetSeed().

+ Here is the call graph for this function:

◆ Transmit()

void WifiTxStatsHelperTest::Transmit ( std::string context,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
Watt_u txPower )

Callback invoked when PHY starts transmission of a PSDU, used to record TX start time and TX duration.

Parameters
contextthe context
psduMapthe PSDU map
txVectorthe TX vector
txPowerthe tx power in Watts

Definition at line 124 of file wifi-tx-stats-helper-test.cc.

References ns3::WifiPhy::CalculateTxDuration(), m_durations, m_txStartTimes, ns3::Simulator::Now(), ns3::WIFI_PHY_BAND_5GHZ, and ns3::WIFI_PHY_BAND_6GHZ.

Referenced by DoRun().

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

Member Data Documentation

◆ m_aifsns

std::map<uint8_t, uint32_t> WifiTxStatsHelperTest::m_aifsns
private

Map of AIFSNs, indexed per link (for MULTI_LINK_QOS case only)

Definition at line 103 of file wifi-tx-stats-helper-test.cc.

Referenced by DoRun().

◆ m_aifss

std::map<uint8_t, Time> WifiTxStatsHelperTest::m_aifss
private

Map of AIFSs, indexed per link (for MULTI_LINK_QOS case only)

Definition at line 105 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_cwMins

std::map<uint8_t, uint32_t> WifiTxStatsHelperTest::m_cwMins
private

Map of CW Mins, indexed per link.

Definition at line 101 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_difs

Time WifiTxStatsHelperTest::m_difs
private

DIFS time (for SINGLE_LINK_NON_QOS case only)

Definition at line 96 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_durations

std::map<uint8_t, std::vector<Time> > WifiTxStatsHelperTest::m_durations
private

Map of vector of MPDU durations, indexed per link.

Definition at line 100 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and Transmit().

◆ m_option

TestOption WifiTxStatsHelperTest::m_option
private

Test option.

Definition at line 89 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_sifs

Time WifiTxStatsHelperTest::m_sifs
private

SIFS time.

Definition at line 93 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_slot

Time WifiTxStatsHelperTest::m_slot
private

slot time

Definition at line 94 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_streamNumber

int64_t WifiTxStatsHelperTest::m_streamNumber
private

Random variable stream number.

Definition at line 92 of file wifi-tx-stats-helper-test.cc.

Referenced by DoRun().

◆ m_txStartTimes

std::map<uint8_t, std::vector<Time> > WifiTxStatsHelperTest::m_txStartTimes
private

Map of independently obtain vector of PhyTxBegin trace, indexed per link.

Definition at line 97 of file wifi-tx-stats-helper-test.cc.

Referenced by CheckResults(), and Transmit().

◆ m_wifiApNode

NodeContainer WifiTxStatsHelperTest::m_wifiApNode
private

NodeContainer for AP.

Definition at line 90 of file wifi-tx-stats-helper-test.cc.

Referenced by DoRun(), and DoSetup().

◆ m_wifiStaNodes

NodeContainer WifiTxStatsHelperTest::m_wifiStaNodes
private

NodeContainer for STAs.

Definition at line 91 of file wifi-tx-stats-helper-test.cc.

Referenced by DoRun(), and DoSetup().


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