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

Test the GenerateBackoffIfTxopWithoutTx and ProactiveBackoff attributes of the ChannelAccessManager. More...

+ Inheritance diagram for BackoffGenerationTest:
+ Collaboration diagram for BackoffGenerationTest:

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
 
TestCaseoperator= (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< ApWifiMacm_apMac
 AP wifi MAC.
 
Time m_assocReqPpduHdrDuration {0}
 Association Request PPDU header TX duration.
 
Time m_assocReqStartTxTime {0}
 Association Request start TX time.
 
Ptr< PacketSocketClientm_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< StaWifiMacm_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.
 
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 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.

Member Enumeration Documentation

◆ TestType

Tested attributes.

Enumerator
GEN_BACKOFF_IF_TXOP_NO_TX 
PROACTIVE_BACKOFF 

Definition at line 1580 of file channel-access-manager-test.cc.

Constructor & Destructor Documentation

◆ BackoffGenerationTest()

BackoffGenerationTest::BackoffGenerationTest ( TestType type)

Constructor.

Parameters
typethe test type

Definition at line 1642 of file channel-access-manager-test.cc.

References m_nExpectedGenBackoff, and m_proactiveBackoff.

Member Function Documentation

◆ BackoffGenerated()

void BackoffGenerationTest::BackoffGenerated ( AcIndex ac,
uint32_t backoff,
uint8_t linkId )
private

Callback invoked when a new backoff value is generated by the given AC on the station.

Parameters
acthe AC index
backoffthe generated backoff value
linkIdthe 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().

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

◆ DoRun()

void BackoffGenerationTest::DoRun ( )
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().

+ Here is the call graph for this function:

◆ DoSetup()

void BackoffGenerationTest::DoSetup ( )
overrideprivatevirtual

◆ GenerateInterference()

void BackoffGenerationTest::GenerateInterference ( )
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.

+ Here is the call graph for this function:

◆ MissedBackoff()

void BackoffGenerationTest::MissedBackoff ( )
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.

+ Here is the call graph for this function:

◆ Transmit()

void BackoffGenerationTest::Transmit ( WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )
private

Callback invoked when a FEM passes PSDUs to the PHY.

Parameters
psduMapthe PSDU map
txVectorthe TX vector
txPowerWthe 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().

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

Member Data Documentation

◆ m_apMac

Ptr<ApWifiMac> BackoffGenerationTest::m_apMac
private

AP wifi MAC.

Definition at line 1625 of file channel-access-manager-test.cc.

Referenced by BackoffGenerated(), DoSetup(), GenerateInterference(), and Transmit().

◆ m_assocReqPpduHdrDuration

Time BackoffGenerationTest::m_assocReqPpduHdrDuration {0}
private

Association Request PPDU header TX duration.

Definition at line 1636 of file channel-access-manager-test.cc.

Referenced by BackoffGenerated(), and Transmit().

◆ m_assocReqStartTxTime

Time BackoffGenerationTest::m_assocReqStartTxTime {0}
private

Association Request start TX time.

Definition at line 1635 of file channel-access-manager-test.cc.

Referenced by BackoffGenerated(), and Transmit().

◆ m_client

Ptr<PacketSocketClient> BackoffGenerationTest::m_client
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().

◆ m_generateBackoffIfTxopWithoutTx

bool BackoffGenerationTest::m_generateBackoffIfTxopWithoutTx
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().

◆ m_interferenceDuration

const Time BackoffGenerationTest::m_interferenceDuration {MicroSeconds(10)}
private

interference duration

Definition at line 1638 of file channel-access-manager-test.cc.

Referenced by GenerateInterference().

◆ m_nAcks

std::size_t BackoffGenerationTest::m_nAcks {0}
private

number of transmitted Ack frames

Definition at line 1637 of file channel-access-manager-test.cc.

Referenced by Transmit().

◆ m_nExpectedGenBackoff

std::size_t BackoffGenerationTest::m_nExpectedGenBackoff {0}
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().

◆ m_nextBackoffGen

EventId BackoffGenerationTest::m_nextBackoffGen
private

timer elapsing when next backoff value is expected to be generated

Definition at line 1633 of file channel-access-manager-test.cc.

◆ m_nGenBackoff

std::size_t BackoffGenerationTest::m_nGenBackoff {0}
private

number of generated backoff values

Definition at line 1631 of file channel-access-manager-test.cc.

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

◆ m_proactiveBackoff

bool BackoffGenerationTest::m_proactiveBackoff
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().

◆ m_staMac

Ptr<StaWifiMac> BackoffGenerationTest::m_staMac
private

MAC of the non-AP STA.

Definition at line 1626 of file channel-access-manager-test.cc.

Referenced by BackoffGenerated(), and DoSetup().

◆ m_tid

uint8_t BackoffGenerationTest::m_tid {6}
staticconstexprprivate

TID of generated packet.

Definition at line 1630 of file channel-access-manager-test.cc.

Referenced by DoSetup().


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