A Discrete-Event Network Simulator
API
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ChannelAccessManagerTest Class Reference

Dcf Manager Test. More...

+ Inheritance diagram for ChannelAccessManagerTest:

Public Member Functions

 ChannelAccessManagerTest ()
 
virtual void DoRun (void)
 Implementation to actually run this TestCase. More...
 
void NotifyAccessGranted (uint32_t i)
 Notify access granted function. More...
 
void NotifyChannelSwitching (uint32_t i)
 Notify channel switching function. More...
 
void NotifyCollision (uint32_t i)
 Notify collision function. More...
 
void NotifyInternalCollision (uint32_t i)
 Notify internal collision function. More...
 
- Public Member Functions inherited from ns3::TestCase
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 

Private Types

typedef std::vector< Ptr< TxopTest > > TxopTests
 the TXOP tests typedef More...
 

Private Member Functions

void AddAccessRequest (uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
 Add access function. More...
 
void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t from)
 Add access request with ack timeout. More...
 
void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime, uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from)
 Add access request with successful ack. More...
 
void AddAckTimeoutReset (uint64_t at)
 Add ack timeout reset function. More...
 
void AddCcaBusyEvt (uint64_t at, uint64_t duration)
 Add CCA busy event function. More...
 
void AddDcfState (uint32_t aifsn)
 Add DCF state function. More...
 
void AddNavReset (uint64_t at, uint64_t duration)
 Add NAV reset function. More...
 
void AddNavStart (uint64_t at, uint64_t duration)
 Add NAV start function. More...
 
void AddRxErrorEvt (uint64_t at, uint64_t duration)
 Add receive error event function. More...
 
void AddRxInsideSifsEvt (uint64_t at, uint64_t duration)
 Add receive inside SIFS event function. More...
 
void AddRxOkEvt (uint64_t at, uint64_t duration)
 Add expect collision function. More...
 
void AddRxStartEvt (uint64_t at, uint64_t duration)
 Add receive start event function. More...
 
void AddSwitchingEvt (uint64_t at, uint64_t duration)
 Add switching event function. More...
 
void AddTxEvt (uint64_t at, uint64_t duration)
 Add transmit event function. More...
 
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, Ptr< TxopTest > state)
 Add access request with successful ack. More...
 
void EndTest (void)
 End test function. More...
 
void ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from)
 Expect internal collision function. More...
 
void ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from)
 Expect internal collision function. More...
 
void StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue=20)
 Start test function. More...
 

Private Attributes

uint32_t m_ackTimeoutValue
 the ack timeout value More...
 
Ptr< ChannelAccessManagerm_ChannelAccessManager
 the DCF manager More...
 
Ptr< MacLowStubm_low
 the MAC low stubbed More...
 
TxopTests m_txop
 the TXOP More...
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1, EXTENSIVE = 2, TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCsse. More...
 
bool IsStatusFailure (void) const
 Check if any tests failed. More...
 
bool IsStatusSuccess (void) const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure (void) const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure (void) const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

Dcf Manager Test.

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

Member Typedef Documentation

◆ TxopTests

typedef std::vector<Ptr<TxopTest> > ChannelAccessManagerTest::TxopTests
private

the TXOP tests typedef

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

Constructor & Destructor Documentation

◆ ChannelAccessManagerTest()

ChannelAccessManagerTest::ChannelAccessManagerTest ( )

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

Member Function Documentation

◆ AddAccessRequest()

void ChannelAccessManagerTest::AddAccessRequest ( uint64_t  at,
uint64_t  txTime,
uint64_t  expectedGrantTime,
uint32_t  from 
)
private

Add access function.

Parameters
atthe event time
txTimethe transmit time
expectedGrantTimethe expected grant time
from

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

References AddAccessRequestWithSuccessfullAck(), and TxopTest::ExpectedCollision::at.

Referenced by DoRun().

◆ AddAccessRequestWithAckTimeout()

void ChannelAccessManagerTest::AddAccessRequestWithAckTimeout ( uint64_t  at,
uint64_t  txTime,
uint64_t  expectedGrantTime,
uint32_t  from 
)
private

Add access request with ack timeout.

Parameters
attime to schedule DoAccessRequest event
txTimeDoAccessRequest txTime
expectedGrantTimeDoAccessRequest expectedGrantTime
fromDoAccessRequest TxopTest

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

References TxopTest::ExpectedCollision::at, DoAccessRequest(), m_txop, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddAccessRequestWithSuccessfullAck()

void ChannelAccessManagerTest::AddAccessRequestWithSuccessfullAck ( uint64_t  at,
uint64_t  txTime,
uint64_t  expectedGrantTime,
uint32_t  ackDelay,
uint32_t  from 
)
private

Add access request with successful ack.

Parameters
attime to schedule DoAccessRequest event
txTimeDoAccessRequest txTime
expectedGrantTimeDoAccessRequest expectedGrantTime
ackDelayis delay of the ack after txEnd
fromDoAccessRequest TxopTest

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

References AddAckTimeoutReset(), TxopTest::ExpectedCollision::at, DoAccessRequest(), m_ackTimeoutValue, m_txop, ns3::MicroSeconds(), ns3::Now(), and NS_ASSERT.

Referenced by AddAccessRequest(), and DoRun().

◆ AddAckTimeoutReset()

void ChannelAccessManagerTest::AddAckTimeoutReset ( uint64_t  at)
private

Add ack timeout reset function.

Parameters
atthe event time

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by AddAccessRequestWithSuccessfullAck().

◆ AddCcaBusyEvt()

void ChannelAccessManagerTest::AddCcaBusyEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add CCA busy event function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddDcfState()

void ChannelAccessManagerTest::AddDcfState ( uint32_t  aifsn)
private

Add DCF state function.

Parameters
aifsnthe AIFSN

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

References ns3::ChannelAccessManager::Add(), m_ChannelAccessManager, m_txop, and ns3::Txop::SetAifsn().

Referenced by DoRun().

◆ AddNavReset()

void ChannelAccessManagerTest::AddNavReset ( uint64_t  at,
uint64_t  duration 
)
private

Add NAV reset function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddNavStart()

void ChannelAccessManagerTest::AddNavStart ( uint64_t  at,
uint64_t  duration 
)
private

Add NAV start function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddRxErrorEvt()

void ChannelAccessManagerTest::AddRxErrorEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add receive error event function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddRxInsideSifsEvt()

void ChannelAccessManagerTest::AddRxInsideSifsEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add receive inside SIFS event function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddRxOkEvt()

void ChannelAccessManagerTest::AddRxOkEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add expect collision function.

Parameters
at
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddRxStartEvt()

void ChannelAccessManagerTest::AddRxStartEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add receive start event function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddSwitchingEvt()

void ChannelAccessManagerTest::AddSwitchingEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add switching event function.

Parameters
atthe event time
durationthe duration

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

References TxopTest::ExpectedCollision::at, m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ AddTxEvt()

void ChannelAccessManagerTest::AddTxEvt ( uint64_t  at,
uint64_t  duration 
)
private

Add transmit event function.

Parameters
atthe event time
durationthe duration

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

References m_ChannelAccessManager, ns3::MicroSeconds(), and ns3::Now().

Referenced by DoRun().

◆ DoAccessRequest()

void ChannelAccessManagerTest::DoAccessRequest ( uint64_t  txTime,
uint64_t  expectedGrantTime,
Ptr< TxopTest state 
)
private

Add access request with successful ack.

Parameters
txTimeDoAccessRequest txTime
expectedGrantTimeDoAccessRequest expectedGrantTime
stateTxopTest

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

References m_ChannelAccessManager, TxopTest::QueueTx(), and ns3::ChannelAccessManager::RequestAccess().

Referenced by AddAccessRequestWithAckTimeout(), and AddAccessRequestWithSuccessfullAck().

◆ DoRun()

void ChannelAccessManagerTest::DoRun ( void  )
virtual

◆ EndTest()

void ChannelAccessManagerTest::EndTest ( void  )
private

◆ ExpectCollision()

void ChannelAccessManagerTest::ExpectCollision ( uint64_t  time,
uint32_t  nSlots,
uint32_t  from 
)
private

Expect internal collision function.

Parameters
timethe expectedtime
nSlotsthe number of slots
fromthe expected from

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

References TxopTest::ExpectedCollision::at, TxopTest::m_expectedCollision, m_txop, and TxopTest::ExpectedCollision::nSlots.

Referenced by DoRun().

◆ ExpectInternalCollision()

void ChannelAccessManagerTest::ExpectInternalCollision ( uint64_t  time,
uint32_t  nSlots,
uint32_t  from 
)
private

Expect internal collision function.

Parameters
timethe expectedtime
nSlotsthe number of slots
fromthe expected from

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

References TxopTest::ExpectedCollision::at, TxopTest::m_expectedInternalCollision, m_txop, and TxopTest::ExpectedCollision::nSlots.

Referenced by DoRun().

◆ NotifyAccessGranted()

void ChannelAccessManagerTest::NotifyAccessGranted ( uint32_t  i)

◆ NotifyChannelSwitching()

void ChannelAccessManagerTest::NotifyChannelSwitching ( uint32_t  i)

Notify channel switching function.

Parameters
ithe DCF state

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

References TxopTest::m_accessRequested, TxopTest::m_expectedGrants, m_txop, ns3::MicroSeconds(), ns3::Now(), and NS_TEST_EXPECT_MSG_EQ.

Referenced by TxopTest::NotifyChannelSwitching().

◆ NotifyCollision()

void ChannelAccessManagerTest::NotifyCollision ( uint32_t  i)

◆ NotifyInternalCollision()

void ChannelAccessManagerTest::NotifyInternalCollision ( uint32_t  i)

◆ StartTest()

void ChannelAccessManagerTest::StartTest ( uint64_t  slotTime,
uint64_t  sifs,
uint64_t  eifsNoDifsNoSifs,
uint32_t  ackTimeoutValue = 20 
)
private

Start test function.

Parameters
slotTimethe slot time
sifsthe SIFS
eifsNoDifsNoSifsthe EIFS no DIFS no SIFS
ackTimeoutValuethe ack timeout value

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

References m_ackTimeoutValue, m_ChannelAccessManager, m_low, ns3::MicroSeconds(), ns3::ChannelAccessManager::SetEifsNoDifs(), ns3::ChannelAccessManager::SetSifs(), ns3::ChannelAccessManager::SetSlot(), and ns3::ChannelAccessManager::SetupLow().

Referenced by DoRun().

Member Data Documentation

◆ m_ackTimeoutValue

uint32_t ChannelAccessManagerTest::m_ackTimeoutValue
private

the ack timeout value

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

Referenced by AddAccessRequestWithSuccessfullAck(), NotifyAccessGranted(), and StartTest().

◆ m_ChannelAccessManager

Ptr<ChannelAccessManager> ChannelAccessManagerTest::m_ChannelAccessManager
private

◆ m_low

Ptr<MacLowStub> ChannelAccessManagerTest::m_low
private

the MAC low stubbed

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

Referenced by EndTest(), and StartTest().

◆ m_txop

TxopTests ChannelAccessManagerTest::m_txop
private

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