Test the correct allocation of DIRECT transmissions in the contention access period (CAP) of the superframe (Slotted CSMA-CA algorithm). More...
Public Member Functions | |
LrWpanSlottedCsmacaTestCase () | |
~LrWpanSlottedCsmacaTestCase () override | |
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 | DoRun () override |
Implementation to actually run this TestCase. | |
Static Private Member Functions | |
static void | DataIndicationCoordinator (LrWpanSlottedCsmacaTestCase *testcase, Ptr< LrWpanNetDevice > dev, McpsDataIndicationParams params, Ptr< Packet > p) |
Function called when McpsDataIndication is hit. | |
static void | IncomingSuperframeStatus (LrWpanSlottedCsmacaTestCase *testcase, Ptr< LrWpanNetDevice > dev, SuperframeStatus oldValue, SuperframeStatus newValue) |
Function called on each Superframe status change (CAP|CFP|INACTIVE). | |
static void | StartConfirm (LrWpanSlottedCsmacaTestCase *testcase, Ptr< LrWpanNetDevice > dev, MlmeStartConfirmParams params) |
Function called when MlmeStartConfirm is hit. | |
static void | TransactionCost (LrWpanSlottedCsmacaTestCase *testcase, Ptr< LrWpanNetDevice > dev, uint32_t trans) |
Function called to indicated the calculated transaction cost in slotted CSMA-CA. | |
static void | TransEndIndication (LrWpanSlottedCsmacaTestCase *testcase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params) |
Function called when McpsDataConfirm is hit. | |
Private Attributes | |
Time | m_apBoundary |
Indicates the time after the calculation of the transaction cost (A boundary of an Active Period in the CAP) | |
Time | m_sentTime |
Indicates the time after a successful transmission. | |
Time | m_startCap |
The time of the start of the Contention Access Period (CAP). | |
uint32_t | m_transCost |
The current transaction cost in symbols. | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
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 correct allocation of DIRECT transmissions in the contention access period (CAP) of the superframe (Slotted CSMA-CA algorithm).
Definition at line 33 of file lr-wpan-slotted-csmaca-test.cc.
LrWpanSlottedCsmacaTestCase::LrWpanSlottedCsmacaTestCase | ( | ) |
Definition at line 101 of file lr-wpan-slotted-csmaca-test.cc.
References m_transCost.
|
override |
Definition at line 107 of file lr-wpan-slotted-csmaca-test.cc.
|
staticprivate |
Function called when McpsDataIndication is hit.
testcase | The TestCase. |
dev | The LrWpanNetDevice. |
params | The McpsDataIndication parameters. |
p | The received packet. |
Definition at line 126 of file lr-wpan-slotted-csmaca-test.cc.
References ns3::Simulator::Now(), NS_LOG_UNCOND, and ns3::Time::S.
Referenced by DoRun().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 167 of file lr-wpan-slotted-csmaca-test.cc.
References ns3::Time::As(), ns3::Create(), ns3::CreateObject(), DataIndicationCoordinator(), ns3::Simulator::Destroy(), ns3::Time::GetMicroSeconds(), IncomingSuperframeStatus(), m_apBoundary, ns3::lrwpan::McpsDataRequestParams::m_dstAddr, ns3::lrwpan::McpsDataRequestParams::m_dstAddrMode, ns3::lrwpan::McpsDataRequestParams::m_dstPanId, ns3::lrwpan::McpsDataRequestParams::m_msduHandle, m_sentTime, ns3::lrwpan::McpsDataRequestParams::m_srcAddrMode, m_startCap, m_transCost, ns3::MakeBoundCallback(), ns3::lrwpan::LrWpanMac::McpsDataRequest(), ns3::lrwpan::LrWpanMac::MlmeStartRequest(), NS_LOG_UNCOND, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Time::S, ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), ns3::lrwpan::SHORT_ADDR, StartConfirm(), ns3::Simulator::Stop(), TransactionCost(), and TransEndIndication().
|
staticprivate |
Function called on each Superframe status change (CAP|CFP|INACTIVE).
testcase | The TestCase. |
dev | The LrWpanNetDevice. |
oldValue | The previous superframe status. |
newValue | THe new superframe status. |
Definition at line 144 of file lr-wpan-slotted-csmaca-test.cc.
References m_startCap, ns3::Simulator::Now(), NS_LOG_UNCOND, and ns3::Time::S.
Referenced by DoRun().
|
staticprivate |
Function called when MlmeStartConfirm is hit.
testcase | The TestCase. |
dev | The LrWpanNetDevice. |
params | The MlmeStartConfirm parameters. |
Definition at line 136 of file lr-wpan-slotted-csmaca-test.cc.
References ns3::Simulator::Now(), NS_LOG_UNCOND, and ns3::Time::S.
Referenced by DoRun().
|
staticprivate |
Function called to indicated the calculated transaction cost in slotted CSMA-CA.
testcase | The TestCase. |
dev | The LrWpanNetDevice. |
trans | The transaction cost in symbols. |
Definition at line 157 of file lr-wpan-slotted-csmaca-test.cc.
References m_apBoundary, m_transCost, ns3::Simulator::Now(), NS_LOG_UNCOND, and ns3::Time::S.
Referenced by DoRun().
|
staticprivate |
Function called when McpsDataConfirm is hit.
testcase | The TestCase. |
dev | The LrWpanNetDevice. |
params | The McpsDataConfirm parameters. |
Definition at line 112 of file lr-wpan-slotted-csmaca-test.cc.
References m_sentTime, ns3::Simulator::Now(), and NS_LOG_UNCOND.
Referenced by DoRun().
|
private |
Indicates the time after the calculation of the transaction cost (A boundary of an Active Period in the CAP)
Definition at line 95 of file lr-wpan-slotted-csmaca-test.cc.
Referenced by DoRun(), and TransactionCost().
|
private |
Indicates the time after a successful transmission.
Definition at line 97 of file lr-wpan-slotted-csmaca-test.cc.
Referenced by DoRun(), and TransEndIndication().
|
private |
The time of the start of the Contention Access Period (CAP).
Definition at line 94 of file lr-wpan-slotted-csmaca-test.cc.
Referenced by DoRun(), and IncomingSuperframeStatus().
|
private |
The current transaction cost in symbols.
Definition at line 98 of file lr-wpan-slotted-csmaca-test.cc.
Referenced by LrWpanSlottedCsmacaTestCase(), DoRun(), and TransactionCost().