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

Test TXOP rules. More...

+ Inheritance diagram for WifiTxopTest:
+ Collaboration diagram for WifiTxopTest:

Classes

struct  FrameInfo
 Information about transmitted frames. More...
 
struct  Params
 Parameters for this test. More...
 

Public Member Functions

 WifiTxopTest (const Params &params)
 Constructor.
 
void CheckResults ()
 Check correctness of transmitted frames.
 
void L7Receive (std::string context, Ptr< const Packet > p, const Address &addr)
 Function to trace packets received by the server application.
 
void Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
 Callback invoked when PHY receives a PSDU to transmit.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Types

enum  TrafficDirection : uint8_t { DOWNLINK = 0 , UPLINK }
 Enumeration for traffic directions. More...
 

Private Member Functions

void DoRun () override
 Implementation to actually run this TestCase.
 
Ptr< PacketSocketClientGetApplication (TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize) const
 

Private Attributes

bool m_apCorrupted
 whether the frame to be corrupted by the AP has been corrupted
 
NetDeviceContainer m_apDevices
 container for AP's NetDevice
 
Ptr< ListErrorModelm_apErrorModel
 error model to install on the AP
 
Time m_apTxopLimit
 TXOP limit for AP (AC BE)
 
std::vector< PacketSocketAddressm_dlSockets
 packet socket address for DL traffic
 
bool m_lengthBasedRtsCtsThresh
 whether to use length based RTS/CTS threshold
 
WifiMode m_mode
 wifi mode used to transmit data frames
 
bool m_nonHt
 whether to use 802.11a or 802.11ax
 
uint16_t m_nStations
 number of stations
 
std::size_t m_payloadSizeRtsOff
 size in bytes of packets not protected by RTS
 
std::size_t m_payloadSizeRtsOn
 size in bytes of packets protected by RTS
 
bool m_pifsRecovery
 whether to use PIFS recovery
 
bool m_protectedIfResponded
 whether a STA is protected if it responds to the AP
 
uint16_t m_received
 number of packets received by the stations
 
bool m_singleRtsPerTxop
 whether to use single RTS per TXOP
 
uint8_t m_staAifsn
 AIFSN for STAs (AC BE)
 
bool m_staCorrupted
 whether the frame to be corrupted by the STA has been corrupted
 
uint32_t m_staCwMax
 CWmax for STAs (AC BE)
 
uint32_t m_staCwMin
 CWmin for STAs (AC BE)
 
NetDeviceContainer m_staDevices
 container for stations' NetDevices
 
Ptr< ListErrorModelm_staErrorModel
 error model to install on a STA
 
Time m_startTime
 time when data frame exchanges start
 
Time m_staTxopLimit
 TXOP limit for STAs (AC BE)
 
std::vector< FrameInfom_txPsdus
 transmitted PSDUs
 
std::vector< PacketSocketAddressm_ulSockets
 packet socket address for UL traffic
 

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

Test TXOP rules.

A BSS consisting of an AP and 3 non-AP STAs is considered in this test. Both non-HT (802.11a) and HE devices are tested. Two TXOPs are simulated in this test:

  • In the first TXOP, the AP sends a QoS data frame to each of the three STAs. The Ack in response to the initial frame is corrupted, hence the AP terminates the TXOP and tries again when a new TXOP is gained. In the new TXOP, the initial frame sent to STA 1 is successfully received, while the second frame to STA 2 is corrupted. It is checked that the AP performs PIFS recovery or invokes backoff depending on the value of the PifsRecovery attribute. All QoS data frames transmitted have a length/duration that does not exceed the length/duration based RTS/CTS threshold, hence RTS/CTS is never used. After that a QoS data frame has been sent to every STA, the AP sends another QoS data frame to one of them; the size/duration of this frame exceeds the threshold, but, given that the STA has already sent a response to the AP in this TXOP, RTS/CTS is only used if the ProtectedIfResponded is false.
  • In the second TXOP, the AP sends a QoS data frame, in case of non-HT devices, or an A-MPDU consisting of 2 MPDUs, in case of HE devices, to each of the three STAs. All PSDUs transmitted have a length/duration that exceeds the length/duration based RTS/CTS threshold, hence RTS/CTS is used to protect every PSDU, unless the SingleRtsPerTxop attribute is set to true, in which case only the initial frame in the TXOP is protected by RTS/CTS.

Definition at line 61 of file wifi-txop-test.cc.

Member Enumeration Documentation

◆ TrafficDirection

enum WifiTxopTest::TrafficDirection : uint8_t
private

Enumeration for traffic directions.

Enumerator
DOWNLINK 
UPLINK 

Definition at line 111 of file wifi-txop-test.cc.

Constructor & Destructor Documentation

◆ WifiTxopTest()

WifiTxopTest::WifiTxopTest ( const Params & params)

Constructor.

Parameters
paramsparameters for the Wi-Fi TXOP test

Definition at line 167 of file wifi-txop-test.cc.

Member Function Documentation

◆ CheckResults()

◆ DoRun()

void WifiTxopTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 272 of file wifi-txop-test.cc.

References ns3::CreateObject(), ns3::WifiMode::GetDataRate(), m_lengthBasedRtsCtsThresh, m_mode, m_nonHt, m_nStations, m_payloadSizeRtsOn, m_pifsRecovery, m_singleRtsPerTxop, ns3::Seconds(), ns3::Config::SetDefault(), ns3::RngSeedManager::SetRun(), and ns3::RngSeedManager::SetSeed().

+ Here is the call graph for this function:

◆ GetApplication()

Ptr< PacketSocketClient > WifiTxopTest::GetApplication ( TrafficDirection dir,
std::size_t staId,
std::size_t count,
std::size_t pktSize ) const
private
Parameters
dirthe traffic direction (downlink/uplink)
staIdthe index (starting at 0) of the non-AP STA generating/receiving packets
countthe number of packets to generate
pktSizethe size of the packets to generate
Returns
an application generating the given number packets of the given size from/to the AP to/from the given non-AP STA

Definition at line 485 of file wifi-txop-test.cc.

References ns3::CreateObject(), dir, DOWNLINK, m_dlSockets, m_ulSockets, ns3::MicroSeconds(), pktSize, and ns3::Seconds().

Referenced by Transmit().

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

◆ L7Receive()

void WifiTxopTest::L7Receive ( std::string context,
Ptr< const Packet > p,
const Address & addr )

Function to trace packets received by the server application.

Parameters
contextthe context
pthe packet
addrthe address

Definition at line 193 of file wifi-txop-test.cc.

References m_payloadSizeRtsOff, and m_received.

◆ Transmit()

void WifiTxopTest::Transmit ( std::string context,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )

Callback invoked when PHY receives a PSDU to transmit.

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

Definition at line 202 of file wifi-txop-test.cc.

References ns3::WifiPhy::CalculateTxDuration(), DOWNLINK, ns3::NetDeviceContainer::Get(), GetApplication(), m_apCorrupted, m_apDevices, m_apErrorModel, m_nonHt, m_payloadSizeRtsOn, m_staCorrupted, m_staDevices, m_staErrorModel, m_startTime, m_txPsdus, ns3::Simulator::Now(), NS_LOG_INFO, ns3::ListErrorModel::SetList(), ns3::SU_STA_ID, and ns3::WIFI_PHY_BAND_5GHZ.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_apCorrupted

bool WifiTxopTest::m_apCorrupted
private

whether the frame to be corrupted by the AP has been corrupted

Definition at line 161 of file wifi-txop-test.cc.

Referenced by Transmit().

◆ m_apDevices

NetDeviceContainer WifiTxopTest::m_apDevices
private

container for AP's NetDevice

Definition at line 142 of file wifi-txop-test.cc.

Referenced by CheckResults(), and Transmit().

◆ m_apErrorModel

Ptr<ListErrorModel> WifiTxopTest::m_apErrorModel
private

error model to install on the AP

Definition at line 159 of file wifi-txop-test.cc.

Referenced by Transmit().

◆ m_apTxopLimit

Time WifiTxopTest::m_apTxopLimit
private

TXOP limit for AP (AC BE)

Definition at line 144 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_dlSockets

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

packet socket address for DL traffic

Definition at line 163 of file wifi-txop-test.cc.

Referenced by GetApplication().

◆ m_lengthBasedRtsCtsThresh

bool WifiTxopTest::m_lengthBasedRtsCtsThresh
private

whether to use length based RTS/CTS threshold

Definition at line 157 of file wifi-txop-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_mode

WifiMode WifiTxopTest::m_mode
private

wifi mode used to transmit data frames

Definition at line 154 of file wifi-txop-test.cc.

Referenced by DoRun().

◆ m_nonHt

bool WifiTxopTest::m_nonHt
private

whether to use 802.11a or 802.11ax

Definition at line 150 of file wifi-txop-test.cc.

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

◆ m_nStations

uint16_t WifiTxopTest::m_nStations
private

number of stations

Definition at line 140 of file wifi-txop-test.cc.

Referenced by DoRun().

◆ m_payloadSizeRtsOff

std::size_t WifiTxopTest::m_payloadSizeRtsOff
private

size in bytes of packets not protected by RTS

Definition at line 152 of file wifi-txop-test.cc.

Referenced by L7Receive().

◆ m_payloadSizeRtsOn

std::size_t WifiTxopTest::m_payloadSizeRtsOn
private

size in bytes of packets protected by RTS

Definition at line 151 of file wifi-txop-test.cc.

Referenced by DoRun(), and Transmit().

◆ m_pifsRecovery

bool WifiTxopTest::m_pifsRecovery
private

whether to use PIFS recovery

Definition at line 155 of file wifi-txop-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_protectedIfResponded

bool WifiTxopTest::m_protectedIfResponded
private

whether a STA is protected if it responds to the AP

Definition at line 158 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_received

uint16_t WifiTxopTest::m_received
private

number of packets received by the stations

Definition at line 149 of file wifi-txop-test.cc.

Referenced by CheckResults(), and L7Receive().

◆ m_singleRtsPerTxop

bool WifiTxopTest::m_singleRtsPerTxop
private

whether to use single RTS per TXOP

Definition at line 156 of file wifi-txop-test.cc.

Referenced by CheckResults(), and DoRun().

◆ m_staAifsn

uint8_t WifiTxopTest::m_staAifsn
private

AIFSN for STAs (AC BE)

Definition at line 145 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_staCorrupted

bool WifiTxopTest::m_staCorrupted
private

whether the frame to be corrupted by the STA has been corrupted

Definition at line 162 of file wifi-txop-test.cc.

Referenced by Transmit().

◆ m_staCwMax

uint32_t WifiTxopTest::m_staCwMax
private

CWmax for STAs (AC BE)

Definition at line 147 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_staCwMin

uint32_t WifiTxopTest::m_staCwMin
private

CWmin for STAs (AC BE)

Definition at line 146 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_staDevices

NetDeviceContainer WifiTxopTest::m_staDevices
private

container for stations' NetDevices

Definition at line 141 of file wifi-txop-test.cc.

Referenced by CheckResults(), and Transmit().

◆ m_staErrorModel

Ptr<ListErrorModel> WifiTxopTest::m_staErrorModel
private

error model to install on a STA

Definition at line 160 of file wifi-txop-test.cc.

Referenced by Transmit().

◆ m_startTime

Time WifiTxopTest::m_startTime
private

time when data frame exchanges start

Definition at line 153 of file wifi-txop-test.cc.

Referenced by Transmit().

◆ m_staTxopLimit

Time WifiTxopTest::m_staTxopLimit
private

TXOP limit for STAs (AC BE)

Definition at line 148 of file wifi-txop-test.cc.

Referenced by CheckResults().

◆ m_txPsdus

std::vector<FrameInfo> WifiTxopTest::m_txPsdus
private

transmitted PSDUs

Definition at line 143 of file wifi-txop-test.cc.

Referenced by CheckResults(), and Transmit().

◆ m_ulSockets

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

packet socket address for UL traffic

Definition at line 164 of file wifi-txop-test.cc.

Referenced by GetApplication().


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