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

Test the implementation of GCR Block Ack. More...

#include "wifi-gcr-test.h"

+ Inheritance diagram for GcrBaTest:
+ Collaboration diagram for GcrBaTest:

Classes

struct  GcrBaParameters
 Parameters for GCR-BA tests. More...
 

Public Member Functions

 GcrBaTest (const std::string &testName, const GcrParameters &commonParams, const GcrBaParameters &gcrBaParams)
 Constructor.
 
 ~GcrBaTest () override=default
 
- Public Member Functions inherited from GcrTestBase
 GcrTestBase (const std::string &testName, const GcrParameters &params)
 Constructor.
 
 ~GcrTestBase () override=default
 
- 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 () override
 Check results at the end of the test run.
 
void ConfigureGcrManager (WifiMacHelper &macHelper) override
 Configure the GCR manager for the test.
 
void NotifyTxopTerminated (Time startTime, Time duration, uint8_t linkId) override
 Callback invoked when a TXOP is terminated.
 
void PacketGenerated (std::string context, Ptr< const Packet > p, const Address &adr) override
 Callback invoked when a packet is generated by the packet socket client.
 
void Receive (std::string context, Ptr< const Packet > p, const Address &adr) override
 Callback invoked when packet is received by the packet socket server.
 
void Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
 Callback invoked when a FEM passes PSDUs to the PHY.
 

Private Attributes

uint16_t m_firstTxSeq
 sequence number of the first in-flight groupcast MPDU
 
GcrBaParameters m_gcrBaParams
 GCR-BA parameters for the test to run.
 
int m_lastTxSeq
 sequence number of the last in-flight groupcast MPDU
 
uint8_t m_nTxBlockAck
 number of Block Ack Response frames sent to the AP
 
uint8_t m_nTxGcrBar
 number of GCR Block Ack Request frames sent by the AP
 
uint8_t m_nTxGcrBarsInCurrentTxop
 number of GCR BAR frames transmitted by the AP in the current TXOP
 
std::vector< uint8_t > m_nTxGcrBarsPerTxop
 number of GCR BAR frames transmitted by the AP per TXOP (only takes into account TXOPs with BARs transmitted)
 
uint8_t m_nTxGcrBlockAck
 number of GCR Block Ack Response frames sent to the AP
 

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 GcrTestBase
void DoRun () override
 Implementation to actually run this TestCase.
 
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
 
virtual bool IsUsingAmpduOrSmpdu () const
 Function to indicate whether A-MPDU or S-MPDU is currently being used.
 
virtual void PhyRx (std::string context, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
 Callback invoked when a packet is successfully received by the PHY.
 
- 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.
 
- Protected Attributes inherited from GcrTestBase
Ptr< ListErrorModelm_apErrorModel
 error rate model to corrupt frames sent to the AP
 
Ptr< ApWifiMacm_apWifiMac
 AP wifi MAC.
 
std::vector< Ptr< ListErrorModel > > m_errorModels
 error rate models to corrupt packets (per STA)
 
uint16_t m_expectedMaxNumMpdusInPsdu
 expected maximum number of MPDUs in PSDUs
 
bool m_expectGcrUsed
 flag whether GCR is expected to be used during the test
 
Ptr< PacketSocketClientm_groupcastClient
 the packet socket client
 
uint8_t m_nTxAddbaReq
 number of transmitted ADDBA Request frames
 
uint8_t m_nTxAddbaResp
 number of transmitted ADDBA Response frames
 
uint8_t m_nTxApCts
 number of CTS-to-self frames sent by the AP
 
uint8_t m_nTxApRts
 number of RTS frames sent by the AP
 
uint8_t m_nTxCtsInCurrentTxop
 number of CTS-to-self frames transmitted by the AP in the current TXOP
 
uint8_t m_nTxDelba
 number of transmitted DELBA frames
 
uint8_t m_nTxGcrAddbaReq
 number of transmitted GCR ADDBA Request frames
 
uint8_t m_nTxGcrAddbaResp
 number of transmitted GCR ADDBA Response frames
 
uint8_t m_nTxGcrDelba
 number of transmitted GCR DELBA frames
 
uint8_t m_nTxGroupcastInCurrentTxop
 number of groupcast frames transmitted by the AP (including retries) in the current TXOP
 
uint8_t m_nTxRtsInCurrentTxop
 number of RTS frames transmitted by the AP in the current TXOP
 
uint16_t m_packets
 Number of generated groupcast packets by the application.
 
GcrParameters m_params
 parameters for the test to run
 
std::vector< uint16_t > m_phyRxPerSta
 count number of PSDUs successfully received by PHY of each STA
 
std::vector< std::vector< uint16_t > > m_rxGroupcastPerSta
 count groupcast packets received by the packet socket server of each STA and store TX attempt number for each received packet
 
std::vector< uint16_t > m_rxUnicastPerSta
 count unicast packets received by the packet socket server of each STA
 
std::vector< Ptr< StaWifiMac > > m_stasWifiMac
 STAs wifi MAC.
 
std::string m_testName
 name of the test
 
uint8_t m_totalTx
 total number of groupcast frames transmitted by the AP
 
std::vector< uint8_t > m_txCtsPerSta
 count number of CTS responses frames sent by each STA
 

Detailed Description

Test the implementation of GCR Block Ack.

GCR-BA tests consider an AP and multiple STAs (with different capabilities) using GCR-BA. During tests, besides frames that can be corrupted by the base class, transmitted MPDUs can be corrupted, either for all STAs or for a particular STA. These tests eventually corrupt Block Ack Requests and Block Acks frames.

Besides what is verified in the base class, it is checked that:

  • The expected amount of packets has been forwarded up to upper layer
  • When the GCR-BA service is used, the expected amount of Block Ack request and Block Acks frames have been received and they all contain the GCR group address
  • MPDUs are properly discarded when their lifetime expires, and TX window as well as receiver scoreboard are properly advanced if this occurs
  • When the GCR-BA service is used, the exchange of GCR Block Ack Request and GCR Block Acks frames might be spread over multiple TXOPs
  • A-MPDU is only used if TXOP limit duration permits it

Definition at line 330 of file wifi-gcr-test.h.

Constructor & Destructor Documentation

◆ GcrBaTest()

GcrBaTest::GcrBaTest ( const std::string & testName,
const GcrParameters & commonParams,
const GcrBaParameters & gcrBaParams )

Constructor.

Parameters
testNamethe name of the test
commonParamsthe common GCR parameters for the test to run
gcrBaParamsthe GCR-BA parameters for the test to run

Definition at line 1364 of file wifi-gcr-test.cc.

◆ ~GcrBaTest()

GcrBaTest::~GcrBaTest ( )
overridedefault

Member Function Documentation

◆ CheckResults()

◆ ConfigureGcrManager()

void GcrBaTest::ConfigureGcrManager ( WifiMacHelper & macHelper)
overrideprivatevirtual

Configure the GCR manager for the test.

Parameters
macHelperthe wifi mac helper

Implements GcrTestBase.

Definition at line 1650 of file wifi-gcr-test.cc.

References GcrTestBase::GcrParameters::gcrProtectionMode, GcrTestBase::m_params, and ns3::WifiMacHelper::SetGcrManager().

+ Here is the call graph for this function:

◆ NotifyTxopTerminated()

void GcrBaTest::NotifyTxopTerminated ( Time startTime,
Time duration,
uint8_t linkId )
overrideprivatevirtual

Callback invoked when a TXOP is terminated.

Parameters
startTimethe time TXOP started
durationthe duration of the TXOP
linkIdthe ID of the link that gained TXOP

Reimplemented from GcrTestBase.

Definition at line 1617 of file wifi-gcr-test.cc.

References m_nTxGcrBarsInCurrentTxop, m_nTxGcrBarsPerTxop, and GcrTestBase::NotifyTxopTerminated().

+ Here is the call graph for this function:

◆ PacketGenerated()

void GcrBaTest::PacketGenerated ( std::string context,
Ptr< const Packet > p,
const Address & adr )
overrideprivatevirtual

Callback invoked when a packet is generated by the packet socket client.

Parameters
contextthe context
pthe packet
adrthe address

Reimplemented from GcrTestBase.

Definition at line 1379 of file wifi-gcr-test.cc.

References GcrTestBase::GcrParameters::ctsFramesToCorrupt, GcrTestBase::m_params, GcrTestBase::PacketGenerated(), and GcrTestBase::GcrParameters::rtsFramesToCorrupt.

+ Here is the call graph for this function:

◆ Receive()

void GcrBaTest::Receive ( std::string context,
Ptr< const Packet > p,
const Address & adr )
overrideprivatevirtual

Callback invoked when packet is received by the packet socket server.

Parameters
contextthe context
pthe packet
adrthe address

Implements GcrTestBase.

Definition at line 1628 of file wifi-gcr-test.cc.

References ConvertContextToNodeId(), ns3::PacketSocketAddress::ConvertFrom(), ns3::Time::IsZero(), GcrTestBase::m_expectedMaxNumMpdusInPsdu, m_lastTxSeq, GcrTestBase::m_params, GcrTestBase::m_rxGroupcastPerSta, GcrTestBase::m_rxUnicastPerSta, GcrTestBase::m_totalTx, ns3::MicroSeconds(), NS_LOG_INFO, GcrTestBase::GcrParameters::stas, and GcrTestBase::GcrParameters::txopLimit.

+ Here is the call graph for this function:

◆ Transmit()

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

Callback invoked when a FEM passes PSDUs to the PHY.

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

Reimplemented from GcrTestBase.

Definition at line 1389 of file wifi-gcr-test.cc.

References GcrBaTest::GcrBaParameters::barsToCorrupt, GcrBaTest::GcrBaParameters::blockAcksToCorrupt, ConvertContextToNodeId(), GcrTestBase::GcrParameters::expectedDroppedGroupcastMpdus, ns3::CtrlBAckRequestHeader::GetStartingSequence(), ns3::CtrlBAckRequestHeader::IsGcr(), ns3::CtrlBAckResponseHeader::IsGcr(), ns3::CtrlBAckResponseHeader::IsPacketReceived(), ns3::Time::IsZero(), GcrTestBase::m_apErrorModel, GcrTestBase::m_errorModels, GcrTestBase::m_expectedMaxNumMpdusInPsdu, GcrTestBase::m_expectGcrUsed, m_firstTxSeq, m_gcrBaParams, m_lastTxSeq, m_nTxBlockAck, m_nTxGcrBar, m_nTxGcrBarsInCurrentTxop, m_nTxGcrBlockAck, GcrTestBase::m_params, GcrTestBase::m_rxGroupcastPerSta, GcrTestBase::m_stasWifiMac, GcrTestBase::m_totalTx, ns3::MicroSeconds(), GcrTestBase::GcrParameters::mpdusToCorruptPerPsdu, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_INFO, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_NE, GcrTestBase::GcrParameters::numGroupcastPackets, GcrTestBase::GcrParameters::numUnicastPackets, ns3::ListErrorModel::SetList(), GcrTestBase::GcrParameters::startGroupcast, GcrTestBase::GcrParameters::startUnicast, GcrTestBase::GcrParameters::stas, GcrTestBase::Transmit(), and GcrTestBase::GcrParameters::txopLimit.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_firstTxSeq

uint16_t GcrBaTest::m_firstTxSeq
private

sequence number of the first in-flight groupcast MPDU

Definition at line 373 of file wifi-gcr-test.h.

Referenced by Transmit().

◆ m_gcrBaParams

GcrBaParameters GcrBaTest::m_gcrBaParams
private

GCR-BA parameters for the test to run.

Definition at line 368 of file wifi-gcr-test.h.

Referenced by CheckResults(), and Transmit().

◆ m_lastTxSeq

int GcrBaTest::m_lastTxSeq
private

sequence number of the last in-flight groupcast MPDU

Definition at line 374 of file wifi-gcr-test.h.

Referenced by Receive(), and Transmit().

◆ m_nTxBlockAck

uint8_t GcrBaTest::m_nTxBlockAck
private

number of Block Ack Response frames sent to the AP

Definition at line 372 of file wifi-gcr-test.h.

Referenced by CheckResults(), and Transmit().

◆ m_nTxGcrBar

uint8_t GcrBaTest::m_nTxGcrBar
private

number of GCR Block Ack Request frames sent by the AP

Definition at line 370 of file wifi-gcr-test.h.

Referenced by CheckResults(), and Transmit().

◆ m_nTxGcrBarsInCurrentTxop

uint8_t GcrBaTest::m_nTxGcrBarsInCurrentTxop
private

number of GCR BAR frames transmitted by the AP in the current TXOP

Definition at line 379 of file wifi-gcr-test.h.

Referenced by NotifyTxopTerminated(), and Transmit().

◆ m_nTxGcrBarsPerTxop

std::vector<uint8_t> GcrBaTest::m_nTxGcrBarsPerTxop
private

number of GCR BAR frames transmitted by the AP per TXOP (only takes into account TXOPs with BARs transmitted)

Definition at line 377 of file wifi-gcr-test.h.

Referenced by CheckResults(), and NotifyTxopTerminated().

◆ m_nTxGcrBlockAck

uint8_t GcrBaTest::m_nTxGcrBlockAck
private

number of GCR Block Ack Response frames sent to the AP

Definition at line 371 of file wifi-gcr-test.h.

Referenced by CheckResults(), and Transmit().


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