It tests the functionalities of LoRaWAN MAC commands received by devices. More...
Public Member Functions | |
MacCommandTest () | |
Default constructor. | |
~MacCommandTest () override | |
Destructor. | |
![]() | |
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. | |
void | Reset () |
This function resets the state of the MAC layer used for tests. | |
template<typename T , typename... Ts> | |
std::vector< Ptr< MacCommand > > | RunMacCommand (Ts &&... args) |
Have this class' MAC layer receive a downlink packet carrying the input MAC command. | |
Private Attributes | |
Ptr< ClassAEndDeviceLorawanMac > | m_mac |
The end device's MAC layer used in tests. | |
Additional Inherited Members | |
![]() | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
![]() | |
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 |
![]() | |
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. | |
It tests the functionalities of LoRaWAN MAC commands received by devices.
This means testing that (i) settings in the downlink MAC commands are correctly applied/rejected by the device, and that (ii) the correct answer (if expected) is produced by the device.
Definition at line 1603 of file lorawan-test-suite.cc.
MacCommandTest::MacCommandTest | ( | ) |
Default constructor.
Definition at line 1635 of file lorawan-test-suite.cc.
|
override |
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1691 of file lorawan-test-suite.cc.
References ns3::DynamicCast(), m_mac, NS_LOG_DEBUG, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_NE, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_NE, Reset(), and RunMacCommand().
|
private |
This function resets the state of the MAC layer used for tests.
Use it before each call of RunMacCommand. Otherwise, on consecutive calls the MAC layer will not send due to duty-cycle limitations.
Definition at line 1675 of file lorawan-test-suite.cc.
References ns3::CreateObject(), ns3::DynamicCast(), ns3::lorawan::LorawanMacHelper::ED_A, ns3::lorawan::LorawanMacHelper::EU, ns3::lorawan::LorawanMacHelper::Install(), m_mac, NS_TEST_EXPECT_MSG_NE, ns3::lorawan::LorawanMacHelper::SetDeviceType(), and ns3::lorawan::LorawanMacHelper::SetRegion().
Referenced by DoRun().
|
private |
Have this class' MAC layer receive a downlink packet carrying the input MAC command.
After, trigger a new empty uplink packet send that can then be used to examine the MAC command answers in the header.
T | [explicit] The type of MAC command to create. |
Ts | [deduced] Types of the constructor arguments. |
[in] | args | MAC command constructor arguments. |
Definition at line 1647 of file lorawan-test-suite.cc.
References ns3::lorawan::LoraFrameHeader::AddCommand(), ns3::Create(), ns3::DynamicCast(), ns3::lorawan::LoraFrameHeader::GetCommands(), m_mac, ns3::lorawan::LoraFrameHeader::SetAsDownlink(), ns3::lorawan::LoraFrameHeader::SetAsUplink(), ns3::lorawan::LorawanMacHeader::SetMType(), and ns3::lorawan::LorawanMacHeader::UNCONFIRMED_DATA_DOWN.
Referenced by DoRun().
|
private |
The end device's MAC layer used in tests.
Definition at line 1632 of file lorawan-test-suite.cc.
Referenced by ~MacCommandTest(), DoRun(), Reset(), and RunMacCommand().