Base class for GCR tests. More...
#include "wifi-gcr-test.h"
Classes | |
struct | GcrParameters |
Common parameters for GCR tests. More... | |
struct | StaInfo |
Information about GCR STAs. More... | |
Public Member Functions | |
GcrTestBase (const std::string &testName, const GcrParameters ¶ms) | |
Constructor. | |
~GcrTestBase () override=default | |
![]() | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Protected Member Functions | |
virtual void | CheckResults () |
Check results at the end of the test run. | |
virtual void | ConfigureGcrManager (WifiMacHelper &macHelper)=0 |
Configure the GCR manager for the test. | |
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 | NotifyTxopTerminated (Time startTime, Time duration, uint8_t linkId) |
Callback invoked when a TXOP is terminated. | |
virtual void | PacketGenerated (std::string context, Ptr< const Packet > p, const Address &adr) |
Callback invoked when a packet is generated by the packet socket client. | |
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. | |
virtual void | Receive (std::string context, Ptr< const Packet > p, const Address &adr)=0 |
Callback invoked when packet is received by the packet socket server. | |
virtual void | Transmit (std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) |
Callback invoked when a FEM passes PSDUs to the PHY. | |
![]() | |
TestCase (std::string name) | |
Constructor. | |
void | AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK) |
Add an individual child TestCase to this test suite. | |
TestCase * | GetParent () 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 | |
Ptr< ListErrorModel > | m_apErrorModel |
error rate model to corrupt frames sent to the AP | |
Ptr< ApWifiMac > | m_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< PacketSocketClient > | m_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 | |
Additional Inherited Members | |
![]() | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
![]() | |
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 |
Base class for GCR tests.
It considers an AP and multiple STAs (with different capabilities) using either GCR-UR or GCR-BA. The AP generates either multicast packets only or alternatively multicast and unicast packets.
The test eventually corrupts some MPDUs based on a provided list of groupcast MPDUs in a given PSDU (indices are starting from 1) that should not be successfully received by a given STA or by all STA (s). It may also corrupts specific frames, such as RTS/CTS or action frames that are used to establish or teardown Block Ack agreements. The latter is needed is needed for GCR-BA or for GCR-UR when A-MPDU is used.
It is checked that:
Definition at line 62 of file wifi-gcr-test.h.
GcrTestBase::GcrTestBase | ( | const std::string & | testName, |
const GcrParameters & | params ) |
Constructor.
testName | the name of the test |
params | the common GCR parameters for the test to run |
Definition at line 208 of file wifi-gcr-test.cc.
References m_expectGcrUsed, m_params, and GcrTestBase::GcrParameters::maxNumMpdusInPsdu.
|
overridedefault |
|
protectedvirtual |
Check results at the end of the test run.
Reimplemented in GcrBaTest, and GcrUrTest.
Definition at line 659 of file wifi-gcr-test.cc.
References GcrTestBase::GcrParameters::addbaReqsToCorrupt, GcrTestBase::GcrParameters::addbaRespsToCorrupt, GcrTestBase::GcrParameters::baInactivityTimeout, GcrTestBase::GcrParameters::ctsFramesToCorrupt, GcrTestBase::GcrParameters::gcrProtectionMode, m_apWifiMac, m_expectGcrUsed, m_nTxAddbaReq, m_nTxAddbaResp, m_nTxApCts, m_nTxApRts, m_nTxDelba, m_nTxGcrAddbaReq, m_nTxGcrAddbaResp, m_nTxGcrDelba, m_params, m_rxUnicastPerSta, m_totalTx, m_txCtsPerSta, GcrTestBase::GcrParameters::maxNumMpdusInPsdu, NS_LOG_FUNCTION, NS_TEST_EXPECT_MSG_EQ, GcrTestBase::GcrParameters::numGroupcastPackets, GcrTestBase::GcrParameters::numUnicastPackets, GcrTestBase::GcrParameters::packetSize, GcrTestBase::GcrParameters::rtsFramesToCorrupt, GcrTestBase::GcrParameters::rtsThreshold, and GcrTestBase::GcrParameters::stas.
Referenced by GcrBaTest::CheckResults(), GcrUrTest::CheckResults(), and DoRun().
|
protectedpure virtual |
|
overrideprotectedvirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1030 of file wifi-gcr-test.cc.
References CheckResults(), ns3::Simulator::Destroy(), GcrTestBase::GcrParameters::duration, m_params, m_testName, NS_LOG_FUNCTION, ns3::Simulator::Run(), and ns3::Simulator::Stop().
|
overrideprotectedvirtual |
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 740 of file wifi-gcr-test.cc.
References ns3::AC_BE, ns3::WifiHelper::AssignStreams(), GcrTestBase::GcrParameters::baInactivityTimeout, ConfigureGcrManager(), ns3::Config::Connect(), ns3::CreateObject(), ns3::YansWifiChannelHelper::Default(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, GcrTestBase::GcrParameters::duration, ns3::DynamicCast(), ns3::NetDeviceContainer::Get(), ns3::PointerValue::Get(), ns3::Mac48Address::GetMulticast(), ns3::PacketSocketHelper::Install(), m_apErrorModel, m_apWifiMac, m_errorModels, m_groupcastClient, m_params, m_phyRxPerSta, m_rxGroupcastPerSta, m_rxUnicastPerSta, m_stasWifiMac, m_testName, m_txCtsPerSta, ns3::MakeCallback(), GcrTestBase::GcrParameters::maxLifetime, GcrTestBase::GcrParameters::maxNumMpdusInPsdu, ns3::NanoSeconds(), NotifyTxopTerminated(), NS_LOG_FUNCTION, GcrTestBase::GcrParameters::numGroupcastPackets, GcrTestBase::GcrParameters::numUnicastPackets, PacketGenerated(), GcrTestBase::GcrParameters::packetSize, PhyRx(), Receive(), GcrTestBase::GcrParameters::rtsThreshold, ns3::Seconds(), ns3::SpectrumWifiPhyHelper::SetChannel(), ns3::YansWifiPhyHelper::SetChannel(), ns3::Config::SetDefault(), ns3::WifiPhyHelper::SetPcapDataLinkType(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), ns3::PacketSocketAddress::SetSingleDevice(), ns3::WifiMacHelper::SetType(), GcrTestBase::GcrParameters::startGroupcast, GcrTestBase::GcrParameters::startUnicast, GcrTestBase::GcrParameters::stas, Transmit(), GcrTestBase::GcrParameters::txopLimit, ns3::WIFI_PHY_BAND_5GHZ, ns3::WIFI_STANDARD_80211ac, ns3::WIFI_STANDARD_80211ax, ns3::WIFI_STANDARD_80211be, and ns3::WIFI_STANDARD_80211n.
|
protectedvirtual |
Function to indicate whether A-MPDU or S-MPDU is currently being used.
Reimplemented in GcrUrTest.
Definition at line 603 of file wifi-gcr-test.cc.
References m_params, GcrTestBase::GcrParameters::maxNumMpdusInPsdu, and GcrTestBase::GcrParameters::stas.
Referenced by GcrUrTest::IsUsingAmpduOrSmpdu(), and PhyRx().
|
protectedvirtual |
Callback invoked when a TXOP is terminated.
startTime | the time TXOP started |
duration | the duration of the TXOP |
linkId | the ID of the link that gained TXOP |
Reimplemented in GcrBaTest.
Definition at line 643 of file wifi-gcr-test.cc.
References m_nTxCtsInCurrentTxop, m_nTxGroupcastInCurrentTxop, m_nTxRtsInCurrentTxop, NS_LOG_INFO, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoSetup(), and GcrBaTest::NotifyTxopTerminated().
|
protectedvirtual |
Callback invoked when a packet is generated by the packet socket client.
context | the context |
p | the packet |
adr | the address |
Reimplemented in GcrBaTest, and GcrUrTest.
Definition at line 233 of file wifi-gcr-test.cc.
References m_expectedMaxNumMpdusInPsdu, m_groupcastClient, m_packets, ns3::MilliSeconds(), and ns3::Seconds().
Referenced by DoSetup(), GcrBaTest::PacketGenerated(), and GcrUrTest::PacketGenerated().
|
protectedvirtual |
Callback invoked when a packet is successfully received by the PHY.
context | the context |
p | the packet |
snr | the SNR (in linear scale) |
mode | the WiFi mode |
preamble | the preamble |
Definition at line 612 of file wifi-gcr-test.cc.
References ConvertContextToNodeId(), ns3::WifiMacHeader::GetAddr1(), ns3::WifiMacHeader::IsData(), ns3::Mac48Address::IsGroup(), IsUsingAmpduOrSmpdu(), m_params, m_phyRxPerSta, NS_ASSERT, GcrTestBase::GcrParameters::packetSize, packetSize, and GcrTestBase::GcrParameters::stas.
Referenced by DoSetup().
|
protectedvirtual |
Callback invoked when a FEM passes PSDUs to the PHY.
context | the context |
psduMap | the PSDU map |
txVector | the TX vector |
txPowerW | the tx power in Watts |
Reimplemented in GcrBaTest, and GcrUrTest.
Definition at line 247 of file wifi-gcr-test.cc.
References GcrTestBase::GcrParameters::addbaReqsToCorrupt, GcrTestBase::GcrParameters::addbaRespsToCorrupt, ns3::WifiActionHeader::BLOCK_ACK, ns3::WifiActionHeader::BLOCK_ACK_ADDBA_REQUEST, ns3::WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE, ns3::WifiActionHeader::BLOCK_ACK_DELBA, ConvertContextToNodeId(), GcrTestBase::GcrParameters::ctsFramesToCorrupt, ns3::WifiTxVector::GetChannelWidth(), ns3::MgtAddBaRequestHeader::GetGcrGroupAddress(), ns3::MgtAddBaResponseHeader::GetGcrGroupAddress(), ns3::MgtDelBaHeader::GetGcrGroupAddress(), ns3::WifiTxVector::GetGuardInterval(), ns3::WifiTxVector::GetModulationClass(), ns3::GetModulationClassForStandard(), ns3::WifiTxVector::GetNss(), m_apErrorModel, m_apWifiMac, m_errorModels, m_expectGcrUsed, m_nTxAddbaReq, m_nTxAddbaResp, m_nTxApCts, m_nTxApRts, m_nTxDelba, m_nTxGcrAddbaReq, m_nTxGcrAddbaResp, m_nTxGcrDelba, m_params, m_stasWifiMac, m_totalTx, m_txCtsPerSta, GcrTestBase::GcrParameters::mpdusToCorruptPerPsdu, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_INFO, NS_TEST_EXPECT_MSG_EQ, GcrTestBase::GcrParameters::numUnicastPackets, ns3::WifiActionHeader::Peek(), GcrTestBase::GcrParameters::rtsFramesToCorrupt, ns3::ListErrorModel::SetList(), GcrTestBase::GcrParameters::startGroupcast, GcrTestBase::GcrParameters::startUnicast, and GcrTestBase::GcrParameters::stas.
Referenced by DoSetup(), GcrBaTest::Transmit(), and GcrUrTest::Transmit().
|
protected |
error rate model to corrupt frames sent to the AP
Definition at line 202 of file wifi-gcr-test.h.
Referenced by DoSetup(), GcrBaTest::Transmit(), and Transmit().
AP wifi MAC.
Definition at line 200 of file wifi-gcr-test.h.
Referenced by GcrBaTest::CheckResults(), CheckResults(), DoSetup(), and Transmit().
|
protected |
error rate models to corrupt packets (per STA)
Definition at line 204 of file wifi-gcr-test.h.
Referenced by DoSetup(), GcrBaTest::Transmit(), and Transmit().
|
protected |
expected maximum number of MPDUs in PSDUs
Definition at line 198 of file wifi-gcr-test.h.
Referenced by GcrBaTest::CheckResults(), GcrUrTest::CheckResults(), PacketGenerated(), GcrBaTest::Receive(), GcrBaTest::Transmit(), and GcrUrTest::Transmit().
|
protected |
flag whether GCR is expected to be used during the test
Definition at line 197 of file wifi-gcr-test.h.
Referenced by GcrTestBase(), GcrBaTest::CheckResults(), CheckResults(), GcrUrTest::CheckResults(), GcrBaTest::Transmit(), Transmit(), and GcrUrTest::Transmit().
|
protected |
the packet socket client
Definition at line 205 of file wifi-gcr-test.h.
Referenced by DoSetup(), PacketGenerated(), and GcrUrTest::PacketGenerated().
|
protected |
number of transmitted ADDBA Request frames
Definition at line 227 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of transmitted ADDBA Response frames
Definition at line 228 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of CTS-to-self frames sent by the AP
Definition at line 211 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of RTS frames sent by the AP
Definition at line 210 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of CTS-to-self frames transmitted by the AP in the current TXOP
Definition at line 224 of file wifi-gcr-test.h.
Referenced by NotifyTxopTerminated(), and GcrUrTest::Transmit().
|
protected |
number of transmitted DELBA frames
Definition at line 229 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of transmitted GCR ADDBA Request frames
Definition at line 230 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of transmitted GCR ADDBA Response frames
Definition at line 231 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of transmitted GCR DELBA frames
Definition at line 232 of file wifi-gcr-test.h.
Referenced by CheckResults(), and Transmit().
|
protected |
number of groupcast frames transmitted by the AP (including retries) in the current TXOP
Definition at line 220 of file wifi-gcr-test.h.
Referenced by NotifyTxopTerminated(), and GcrUrTest::Transmit().
|
protected |
number of RTS frames transmitted by the AP in the current TXOP
Definition at line 223 of file wifi-gcr-test.h.
Referenced by NotifyTxopTerminated(), and GcrUrTest::Transmit().
|
protected |
Number of generated groupcast packets by the application.
Definition at line 207 of file wifi-gcr-test.h.
Referenced by PacketGenerated(), and GcrUrTest::PacketGenerated().
|
protected |
parameters for the test to run
Definition at line 196 of file wifi-gcr-test.h.
Referenced by GcrTestBase(), GcrBaTest::CheckResults(), CheckResults(), GcrUrTest::CheckResults(), GcrBaTest::ConfigureGcrManager(), GcrUrTest::ConfigureGcrManager(), DoRun(), DoSetup(), IsUsingAmpduOrSmpdu(), GcrUrTest::IsUsingAmpduOrSmpdu(), GcrBaTest::PacketGenerated(), PhyRx(), GcrBaTest::Receive(), GcrBaTest::Transmit(), Transmit(), and GcrUrTest::Transmit().
|
protected |
count number of PSDUs successfully received by PHY of each STA
Definition at line 209 of file wifi-gcr-test.h.
Referenced by GcrUrTest::CheckResults(), DoSetup(), and PhyRx().
|
protected |
count groupcast packets received by the packet socket server of each STA and store TX attempt number for each received packet
Definition at line 215 of file wifi-gcr-test.h.
Referenced by GcrBaTest::CheckResults(), GcrUrTest::CheckResults(), DoSetup(), GcrBaTest::Receive(), GcrUrTest::Receive(), and GcrBaTest::Transmit().
|
protected |
count unicast packets received by the packet socket server of each STA
Definition at line 217 of file wifi-gcr-test.h.
Referenced by CheckResults(), DoSetup(), and GcrBaTest::Receive().
|
protected |
STAs wifi MAC.
Definition at line 201 of file wifi-gcr-test.h.
Referenced by DoSetup(), GcrBaTest::Transmit(), and Transmit().
|
protected |
name of the test
Definition at line 195 of file wifi-gcr-test.h.
|
protected |
total number of groupcast frames transmitted by the AP
Definition at line 213 of file wifi-gcr-test.h.
Referenced by GcrBaTest::CheckResults(), CheckResults(), GcrBaTest::Receive(), GcrBaTest::Transmit(), and Transmit().
|
protected |
count number of CTS responses frames sent by each STA
Definition at line 212 of file wifi-gcr-test.h.
Referenced by CheckResults(), DoSetup(), and Transmit().