Test the GenerateBackoffIfTxopWithoutTx and ProactiveBackoff attributes of the ChannelAccessManager. More...
Public Types | |
enum | TestType : uint8_t { GEN_BACKOFF_IF_TXOP_NO_TX = 0 , PROACTIVE_BACKOFF } |
Tested attributes. 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 | |
BackoffGenerationTest (TestType type) | |
Constructor. | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | BackoffGenerated (AcIndex ac, uint32_t backoff, uint8_t linkId) |
Callback invoked when a new backoff value is generated by the given AC on the station. | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | DoSetup () override |
Implementation to do any local setup required for this TestCase. | |
void | GenerateInterference () |
Generate interference to make CCA busy. | |
void | MissedBackoff () |
Indicate that a new backoff value has not been generated as expected. | |
void | Transmit (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) |
Callback invoked when a FEM passes PSDUs to the PHY. | |
Private Attributes | |
Ptr< ApWifiMac > | m_apMac |
AP wifi MAC. | |
Time | m_assocReqPpduHdrDuration {0} |
Association Request PPDU header TX duration. | |
Time | m_assocReqStartTxTime {0} |
Association Request start TX time. | |
Ptr< PacketSocketClient > | m_client |
client to be installed on the AP after association | |
bool | m_generateBackoffIfTxopWithoutTx |
whether the GenerateBackoffIfTxopWithoutTx attribute is set to true | |
const Time | m_interferenceDuration {MicroSeconds(10)} |
interference duration | |
std::size_t | m_nAcks {0} |
number of transmitted Ack frames | |
std::size_t | m_nExpectedGenBackoff {0} |
expected total number of generated backoff values | |
EventId | m_nextBackoffGen |
timer elapsing when next backoff value is expected to be generated | |
std::size_t | m_nGenBackoff {0} |
number of generated backoff values | |
bool | m_proactiveBackoff |
whether the ProactiveBackoff attribute is set to true | |
Ptr< StaWifiMac > | m_staMac |
MAC of the non-AP STA. | |
Static Private Attributes | |
static constexpr uint8_t | m_tid {6} |
TID of generated packet. | |
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. | |
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. | |
Test the GenerateBackoffIfTxopWithoutTx and ProactiveBackoff attributes of the ChannelAccessManager.
The backoff values generated by the VO AC of the AP are checked.
The GenerateBackoffIfTxopWithoutTx test checks the generation of backoff values when the attribute is set to true. A QoS data frame is queued at the AP but the queue is blocked so that the frame is not transmitted. A backoff value is kept being generated as long as the frame is kept in the queue.
Backoff Last
Backoff Backoff Backoff value #3, backoff value #0 value #1 value #2 unblock queue value | ┌─────┐ | | | ┌─────┐ ┌────┐ | | ┌───┐ │Assoc│ | |Decrement| |Decrement| |Decrement│ADDBA│ │QoS │ | | │ACK│ │Resp │ |AIFS| backoff |slot| backoff |slot| backoff │ Req │. .│data│ | ──┬─────┬┴───┴──┴─────┴┬───┬────────────────────────────────────────────┴─────┴───┴────┴┬───┬── │Assoc│ │ACK│ │ACK│ │ Req │ └───┘ └───┘ └─────┘
The ProactiveBackoff test checks the generation of backoff values when the attribute is set to true. A noise is generated to trigger the generation of a new backoff value, provided that the backoff counter is zero.
Backoff Backoff Backoff Backoff value #0 value #1 value #2 value #3 | | ┌─────┐ | | | | ┌───┐ │Assoc│ | | | | │ACK│ │Resp │ |SIFS| noise | AIFS+backoff | noise | ─────────────┬─────┬┴───┴──┴─────┴┬───┬────────────────────────────────────────────────── │Assoc│ │ACK│ │ Req │ └───┘ └─────┘
Definition at line 1574 of file channel-access-manager-test.cc.
enum BackoffGenerationTest::TestType : uint8_t |
Tested attributes.
Enumerator | |
---|---|
GEN_BACKOFF_IF_TXOP_NO_TX | |
PROACTIVE_BACKOFF |
Definition at line 1580 of file channel-access-manager-test.cc.
BackoffGenerationTest::BackoffGenerationTest | ( | TestType | type | ) |
Constructor.
type | the test type |
Definition at line 1642 of file channel-access-manager-test.cc.
References m_nExpectedGenBackoff, and m_proactiveBackoff.
|
private |
Callback invoked when a new backoff value is generated by the given AC on the station.
ac | the AC index |
backoff | the generated backoff value |
linkId | the ID of the link for which the backoff value has been generated |
Definition at line 1845 of file channel-access-manager-test.cc.
References m_apMac, m_assocReqPpduHdrDuration, m_assocReqStartTxTime, m_generateBackoffIfTxopWithoutTx, m_nGenBackoff, m_proactiveBackoff, m_staMac, ns3::Simulator::Now(), NS_LOG_INFO, NS_TEST_ASSERT_MSG_GT, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_LT, and ns3::Simulator::Schedule().
Referenced by DoSetup().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1772 of file channel-access-manager-test.cc.
References ns3::Simulator::Destroy(), m_nExpectedGenBackoff, m_nGenBackoff, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Seconds(), and ns3::Simulator::Stop().
|
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 1654 of file channel-access-manager-test.cc.
References ns3::AC_VO, ns3::SpectrumWifiPhyHelper::AddChannel(), ns3::WifiHelper::AssignStreams(), BackoffGenerated(), ns3::CreateObject(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, ns3::DynamicCast(), ns3::PacketSocketHelper::Install(), m_apMac, m_client, m_generateBackoffIfTxopWithoutTx, m_proactiveBackoff, m_staMac, m_tid, ns3::MakeCallback(), ns3::Seconds(), ns3::WifiPhyHelper::Set(), ns3::Config::SetDefault(), ns3::WifiPhyHelper::SetPcapDataLinkType(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), ns3::PacketSocketAddress::SetSingleDevice(), ns3::SINGLE_LINK_OP_ID, Transmit(), ns3::WIFI_QOSDATA_QUEUE, and ns3::WIFI_STANDARD_80211be.
|
private |
Generate interference to make CCA busy.
Definition at line 1995 of file channel-access-manager-test.cc.
References ns3::Create(), ns3::DbmToW(), ns3::DynamicCast(), m_apMac, m_interferenceDuration, NS_LOG_FUNCTION, and ns3::SINGLE_LINK_OP_ID.
|
private |
Indicate that a new backoff value has not been generated as expected.
Definition at line 1986 of file channel-access-manager-test.cc.
References ns3::Simulator::Now(), NS_TEST_EXPECT_MSG_EQ, and ns3::Time::S.
|
private |
Callback invoked when a FEM passes PSDUs to the PHY.
psduMap | the PSDU map |
txVector | the TX vector |
txPowerW | the tx power in Watts |
Definition at line 1785 of file channel-access-manager-test.cc.
References ns3::Node::AddApplication(), ns3::WifiPhy::CalculatePhyPreambleAndHeaderDuration(), ns3::WifiPhy::CalculateTxDuration(), m_apMac, m_assocReqPpduHdrDuration, m_assocReqStartTxTime, m_client, m_nAcks, m_nExpectedGenBackoff, m_nGenBackoff, ns3::Time::MS, ns3::Simulator::Now(), NS_LOG_INFO, ns3::PeekPointer(), ns3::WifiActionHeader::Print(), ns3::Simulator::Schedule(), and ns3::SINGLE_LINK_OP_ID.
Referenced by DoSetup().
AP wifi MAC.
Definition at line 1625 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), DoSetup(), GenerateInterference(), and Transmit().
|
private |
Association Request PPDU header TX duration.
Definition at line 1636 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), and Transmit().
|
private |
Association Request start TX time.
Definition at line 1635 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), and Transmit().
|
private |
client to be installed on the AP after association
Definition at line 1639 of file channel-access-manager-test.cc.
Referenced by DoSetup(), and Transmit().
|
private |
whether the GenerateBackoffIfTxopWithoutTx attribute is set to true
Definition at line 1627 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), and DoSetup().
|
private |
interference duration
Definition at line 1638 of file channel-access-manager-test.cc.
Referenced by GenerateInterference().
|
private |
number of transmitted Ack frames
Definition at line 1637 of file channel-access-manager-test.cc.
Referenced by Transmit().
|
private |
expected total number of generated backoff values
Definition at line 1632 of file channel-access-manager-test.cc.
Referenced by BackoffGenerationTest(), DoRun(), and Transmit().
|
private |
timer elapsing when next backoff value is expected to be generated
Definition at line 1633 of file channel-access-manager-test.cc.
|
private |
number of generated backoff values
Definition at line 1631 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), DoRun(), and Transmit().
|
private |
whether the ProactiveBackoff attribute is set to true
Definition at line 1629 of file channel-access-manager-test.cc.
Referenced by BackoffGenerationTest(), BackoffGenerated(), and DoSetup().
|
private |
MAC of the non-AP STA.
Definition at line 1626 of file channel-access-manager-test.cc.
Referenced by BackoffGenerated(), and DoSetup().
|
staticconstexprprivate |
TID of generated packet.
Definition at line 1630 of file channel-access-manager-test.cc.
Referenced by DoSetup().