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

Test retransmit procedure. More...

+ Inheritance diagram for WifiRetransmitTest:
+ Collaboration diagram for WifiRetransmitTest:

Classes

struct  Events
 Actions and checks to perform upon the transmission of each frame. More...
 
struct  Params
 Parameters for this test. More...
 

Public Member Functions

 WifiRetransmitTest (const Params &params)
 Constructor.
 
void Transmit (uint8_t phyId, 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 Member Functions

void CheckValues (const std::map< uint16_t, uint32_t > &seqNoRetryCountMap, std::size_t qsrc, uint8_t linkId, std::optional< std::size_t > qsrcOther)
 Check the retry count of the MPDUs stored in the STA MAC queue, the CW and the QSRC of the given link upon transmitting a PSDU.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
Ptr< PacketSocketClientGetApplication (std::size_t count, std::size_t pktSize) const
 
void SetEvents ()
 Set the list of events to expect in this test run.
 

Private Attributes

NetDeviceContainer m_apDevice
 container for AP's NetDevice
 
Ptr< ListErrorModelm_apErrorModel
 error model to install on the AP
 
bool m_baEstablished {false}
 whether BA agreement has been established
 
std::list< Events >::const_iterator m_eventIt
 iterator over the list of events
 
std::list< Eventsm_events
 list of events for a test run
 
const uint32_t m_frameRetryLimit {4}
 frame retry limit
 
bool m_incrRetryCountUnderBa
 whether retry count is incremented under block ack
 
std::size_t m_nLinks
 number of links for the devices
 
bool m_pifsRecovery
 whether to use PIFS recovery
 
const std::size_t m_pktSize {1000}
 size in bytes of generated packets
 
Ptr< StaWifiMacm_staMac
 MAC of the non-AP STA.
 
const Time m_txopLimit {MicroSeconds(4768)}
 TXOP limit.
 
PacketSocketAddress m_ulSocket
 packet socket address for UL traffic
 
bool m_useBarAfterBaTimeout
 whether to send a BAR after a missed BlockAck
 
bool m_useRts
 whether RTS is used to protect frame transmissions
 

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

Retransmit procedures are tested for all the combinations of the following options:

  • RTS/CTS is used or not
  • Retry count is/is not incremented for MPDUs that are part of a block ack agreement
  • After a BlockAck timeout, a BlockAckReq or data frames are transmitted
  • PIFS recovery is used or not

Two data frames are generated at a non-AP STA. The first transmission attempt fails, thus retry count (if the IncrementRetryCountUnderBa attribute is set to true) and QSRC are incremented. Two more data frames are generated, thus the second attempt (performed in a second TXOP) includes four data frames. Two of the four data frames (one generated in the first round and one generated in the second round) are corrupted, but the transmission is successful, thus the retry counts are left unchanged and the QSRC is reset. Then, we keep transmitting the two remaining MPDUs until the retry count of the MPDU generated in the first round reaches the retry limit and hence it is discarded (if the IncrementRetryCountUnderBa attribute is set to true). A BlockAckReq is then transmitted to advance the recipient window. Such BlockAckReq is dropped multiple times; every time, the retry count of the remaining MPDU is unchanged and the QSRC increases. When the QSRC exceeds the frame retry limit, the QSRC is reset to 0 and the remaining data frame is not dropped.

Note that the above attempts are all performed in the second TXOP because failures occur on non-initial PPDUs, hence PIFS recovery or backoff procedure is invoked. This test verifies that QSRC is unchanged in the former case and incremented in the latter case.

In case of multi-link devices, the first TXOP is carried out on link 0 and the second TXOP on link 1. It is checked that QSRC and CW are updated on the link on which the TXOP is carried out.

Definition at line 70 of file wifi-retransmit-test.cc.

Constructor & Destructor Documentation

◆ WifiRetransmitTest()

WifiRetransmitTest::WifiRetransmitTest ( const Params & params)

Constructor.

Parameters
paramsparameters for the Wi-Fi TXOP test

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

Member Function Documentation

◆ CheckValues()

void WifiRetransmitTest::CheckValues ( const std::map< uint16_t, uint32_t > & seqNoRetryCountMap,
std::size_t qsrc,
uint8_t linkId,
std::optional< std::size_t > qsrcOther )
private

Check the retry count of the MPDUs stored in the STA MAC queue, the CW and the QSRC of the given link upon transmitting a PSDU.

Parameters
seqNoRetryCountMap(sequence number, retry count) pair for the MPDUs that are expected to be in the STA MAC queue
qsrcthe expected QSRC for the BE AC
linkIdthe ID of the given link
qsrcOtherthe expected QSRC for the BE AC on the other link, in case of MLDs

Definition at line 297 of file wifi-retransmit-test.cc.

References ns3::AC_BE, ns3::Mac48Address::ConvertFrom(), ns3::NetDeviceContainer::Get(), m_apDevice, m_eventIt, m_events, m_nLinks, m_staMac, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, ns3::WIFI_QOSDATA_QUEUE, and ns3::WIFI_UNICAST.

Referenced by SetEvents().

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

◆ DoRun()

void WifiRetransmitTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 649 of file wifi-retransmit-test.cc.

References ns3::Node::AddApplication(), ns3::Simulator::Destroy(), GetApplication(), m_eventIt, m_events, m_pktSize, m_staMac, ns3::MilliSeconds(), NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ DoSetup()

void WifiRetransmitTest::DoSetup ( )
overrideprivatevirtual

◆ GetApplication()

Ptr< PacketSocketClient > WifiRetransmitTest::GetApplication ( std::size_t count,
std::size_t pktSize ) const
private
Parameters
countthe number of packets to generate
pktSizethe size of the packets to generate
Returns
an application generating the given number of packets of the given size from the non-AP STA to the AP

Definition at line 666 of file wifi-retransmit-test.cc.

References ns3::CreateObject(), m_ulSocket, ns3::MicroSeconds(), pktSize, and ns3::Seconds().

Referenced by DoRun(), and SetEvents().

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

◆ SetEvents()

void WifiRetransmitTest::SetEvents ( )
private

Set the list of events to expect in this test run.

Definition at line 404 of file wifi-retransmit-test.cc.

References ns3::WifiPhy::CalculateTxDuration(), CheckValues(), GetApplication(), m_apErrorModel, m_eventIt, m_events, m_frameRetryLimit, m_incrRetryCountUnderBa, m_nLinks, m_pifsRecovery, m_pktSize, m_staMac, m_useBarAfterBaTimeout, m_useRts, ns3::PeekPointer(), ns3::Simulator::Schedule(), ns3::ListErrorModel::SetList(), ns3::WIFI_MAC_CTL_BACKREQ, ns3::WIFI_MAC_CTL_BACKRESP, ns3::WIFI_MAC_CTL_CTS, ns3::WIFI_MAC_CTL_RTS, and ns3::WIFI_MAC_QOSDATA.

Referenced by DoSetup().

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

◆ Transmit()

void WifiRetransmitTest::Transmit ( uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )

Callback invoked when PHY receives a PSDU to transmit.

Parameters
phyIdthe ID of the PHY transmitting the PSDUs
psduMapthe PSDU map
txVectorthe TX vector
txPowerWthe tx power in Watts

Definition at line 357 of file wifi-retransmit-test.cc.

References m_baEstablished, m_eventIt, m_events, NS_LOG_INFO, NS_TEST_EXPECT_MSG_EQ, and ns3::PeekPointer().

Referenced by DoSetup().

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

Member Data Documentation

◆ m_apDevice

NetDeviceContainer WifiRetransmitTest::m_apDevice
private

container for AP's NetDevice

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

Referenced by CheckValues(), and DoSetup().

◆ m_apErrorModel

Ptr<ListErrorModel> WifiRetransmitTest::m_apErrorModel
private

error model to install on the AP

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

Referenced by DoSetup(), and SetEvents().

◆ m_baEstablished

bool WifiRetransmitTest::m_baEstablished {false}
private

whether BA agreement has been established

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

Referenced by DoSetup(), and Transmit().

◆ m_eventIt

std::list<Events>::const_iterator WifiRetransmitTest::m_eventIt
private

iterator over the list of events

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

Referenced by CheckValues(), DoRun(), SetEvents(), and Transmit().

◆ m_events

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

list of events for a test run

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

Referenced by CheckValues(), DoRun(), SetEvents(), and Transmit().

◆ m_frameRetryLimit

const uint32_t WifiRetransmitTest::m_frameRetryLimit {4}
private

frame retry limit

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

Referenced by DoSetup(), and SetEvents().

◆ m_incrRetryCountUnderBa

bool WifiRetransmitTest::m_incrRetryCountUnderBa
private

whether retry count is incremented under block ack

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

Referenced by DoSetup(), and SetEvents().

◆ m_nLinks

std::size_t WifiRetransmitTest::m_nLinks
private

number of links for the devices

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

Referenced by CheckValues(), DoSetup(), and SetEvents().

◆ m_pifsRecovery

bool WifiRetransmitTest::m_pifsRecovery
private

whether to use PIFS recovery

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

Referenced by DoSetup(), and SetEvents().

◆ m_pktSize

const std::size_t WifiRetransmitTest::m_pktSize {1000}
private

size in bytes of generated packets

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

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

◆ m_staMac

Ptr<StaWifiMac> WifiRetransmitTest::m_staMac
private

MAC of the non-AP STA.

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

Referenced by CheckValues(), DoRun(), DoSetup(), and SetEvents().

◆ m_txopLimit

const Time WifiRetransmitTest::m_txopLimit {MicroSeconds(4768)}
private

TXOP limit.

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

Referenced by DoSetup().

◆ m_ulSocket

PacketSocketAddress WifiRetransmitTest::m_ulSocket
private

packet socket address for UL traffic

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

Referenced by DoSetup(), and GetApplication().

◆ m_useBarAfterBaTimeout

bool WifiRetransmitTest::m_useBarAfterBaTimeout
private

whether to send a BAR after a missed BlockAck

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

Referenced by DoSetup(), and SetEvents().

◆ m_useRts

bool WifiRetransmitTest::m_useRts
private

whether RTS is used to protect frame transmissions

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

Referenced by DoSetup(), and SetEvents().


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