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

This test case tests channel access assignments which is done by StartSch and StopSch method of WaveNetDevice. More...

+ Inheritance diagram for ChannelAccessTestCase:

Public Member Functions

 ChannelAccessTestCase (void)
 
virtual ~ChannelAccessTestCase (void)
 
- Public Member Functions inherited from ns3::TestCase
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 

Private Member Functions

virtual void DoRun (void)
 Implementation to actually run this TestCase. More...
 
bool Receive (Ptr< NetDevice > dev, Ptr< const Packet > pkt, uint16_t mode, const Address &sender)
 Receive function. More...
 
void SendX (uint32_t channel, uint32_t receiverId)
 Send X function. More...
 
void TestAlternating (SchInfo &info, bool shouldSucceed)
 Test aternating function. More...
 
void TestAlternatingAfter (uint32_t channelNumber, bool isAccessAssigned)
 Test alternating after function. More...
 
void TestContinuous (SchInfo &info, bool shouldSucceed)
 Test continuous function. More...
 
void TestContinuousAfter (uint32_t channelNumber, bool isAccessAssigned)
 Test continuous after function. More...
 
void TestExtended (SchInfo &info, bool shouldSucceed)
 Test extended function. More...
 
void TestExtendedAfter (uint32_t channelNumber, bool isAccessAssigned)
 Test extended after function. More...
 

Private Attributes

NetDeviceContainer m_devices
 the devices More...
 
uint32_t m_received
 received More...
 
Ptr< WaveNetDevicem_sender
 sender 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

This test case tests channel access assignments which is done by StartSch and StopSch method of WaveNetDevice.

channel access assignments include ContinuousAccess, ExtendedAccess, and AlternatingAccess. The results of this test case depend on the implementation of ChannelScheduler In this case, the results depend on class "DefaultChannelScheduler".

Definition at line 534 of file mac-extension-test-suite.cc.

Constructor & Destructor Documentation

◆ ChannelAccessTestCase()

ChannelAccessTestCase::ChannelAccessTestCase ( void  )

Definition at line 600 of file mac-extension-test-suite.cc.

◆ ~ChannelAccessTestCase()

ChannelAccessTestCase::~ChannelAccessTestCase ( void  )
virtual

Definition at line 604 of file mac-extension-test-suite.cc.

Member Function Documentation

◆ DoRun()

void ChannelAccessTestCase::DoRun ( void  )
privatevirtual

◆ Receive()

bool ChannelAccessTestCase::Receive ( Ptr< NetDevice dev,
Ptr< const Packet pkt,
uint16_t  mode,
const Address sender 
)
private

Receive function.

Parameters
devthe device
pktthe packet
modethe mode
senderthe sender address
Returns
true if successful

Definition at line 677 of file mac-extension-test-suite.cc.

References ns3::Packet::CopyData(), data, ns3::Node::GetId(), ns3::NetDevice::GetNode(), ns3::Packet::GetSize(), m_received, NS_TEST_EXPECT_MSG_EQ, and ns3::TimeStep().

Referenced by DoRun().

◆ SendX()

void ChannelAccessTestCase::SendX ( uint32_t  channel,
uint32_t  receiverId 
)
private

Send X function.

Parameters
channelthe channel number
receiverId

Definition at line 647 of file mac-extension-test-suite.cc.

References third::channel, data, ns3::Time::GetTimeStep(), m_sender, ns3::Now(), and ns3::WaveNetDevice::SendX().

Referenced by DoRun().

◆ TestAlternating()

void ChannelAccessTestCase::TestAlternating ( SchInfo info,
bool  shouldSucceed 
)
private

Test aternating function.

Parameters
infothe schedule info
shouldSucceedtrue if it should succeed

Definition at line 634 of file mac-extension-test-suite.cc.

References m_sender, ns3::Now(), NS_TEST_EXPECT_MSG_EQ, and ns3::WaveNetDevice::StartSch().

Referenced by DoRun().

◆ TestAlternatingAfter()

void ChannelAccessTestCase::TestAlternatingAfter ( uint32_t  channelNumber,
bool  isAccessAssigned 
)
private

Test alternating after function.

Parameters
channelNumberthe channel number
isAccessAssignedtrue if access assigned

Definition at line 640 of file mac-extension-test-suite.cc.

References ns3::WaveNetDevice::GetChannelScheduler(), m_sender, ns3::Now(), and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

◆ TestContinuous()

void ChannelAccessTestCase::TestContinuous ( SchInfo info,
bool  shouldSucceed 
)
private

Test continuous function.

Parameters
infothe schedule info
shouldSucceedtrue if it should succeed

Definition at line 609 of file mac-extension-test-suite.cc.

References m_sender, ns3::Now(), NS_TEST_EXPECT_MSG_EQ, and ns3::WaveNetDevice::StartSch().

Referenced by DoRun().

◆ TestContinuousAfter()

void ChannelAccessTestCase::TestContinuousAfter ( uint32_t  channelNumber,
bool  isAccessAssigned 
)
private

Test continuous after function.

Parameters
channelNumberthe channel number
isAccessAssignedtrue if access assigned

Definition at line 615 of file mac-extension-test-suite.cc.

References ns3::WaveNetDevice::GetChannelScheduler(), m_sender, ns3::Now(), and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

◆ TestExtended()

void ChannelAccessTestCase::TestExtended ( SchInfo info,
bool  shouldSucceed 
)
private

Test extended function.

Parameters
infothe schedule info
shouldSucceedtrue if it should succeed

Definition at line 621 of file mac-extension-test-suite.cc.

References m_sender, ns3::Now(), NS_TEST_EXPECT_MSG_EQ, and ns3::WaveNetDevice::StartSch().

Referenced by DoRun().

◆ TestExtendedAfter()

void ChannelAccessTestCase::TestExtendedAfter ( uint32_t  channelNumber,
bool  isAccessAssigned 
)
private

Test extended after function.

Parameters
channelNumberthe channel number
isAccessAssignedtrue if access assigned

Definition at line 627 of file mac-extension-test-suite.cc.

References ns3::WaveNetDevice::GetChannelScheduler(), m_sender, ns3::Now(), and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

Member Data Documentation

◆ m_devices

NetDeviceContainer ChannelAccessTestCase::m_devices
private

the devices

Definition at line 595 of file mac-extension-test-suite.cc.

Referenced by DoRun().

◆ m_received

uint32_t ChannelAccessTestCase::m_received
private

received

Definition at line 597 of file mac-extension-test-suite.cc.

Referenced by DoRun(), and Receive().

◆ m_sender

Ptr<WaveNetDevice> ChannelAccessTestCase::m_sender
private

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