It tests the correct execution of the ADR backoff procedure of LoRaWAN devices. More...
Public Member Functions | |
| AdrBackoffTest () | |
| Default constructor. | |
| ~AdrBackoffTest () override | |
| Destructor. | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| Caller graph was not generated because of its size. | |
| 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 simulation and device MAC layer, use before test sub-cases. | |
| void | ScheduleRx1Downlink (Time after) |
| Create and schedule the PHY reception of a downlink transmission configured for the LoRaWAN MAC first reception window. | |
| void | SendUplink (Time after, LoraFrameHeader &fhdr) |
| Create and send an empty app payload unconfirmed frame through the MAC layer to increment of the FCnt and ADRACKCnt and eventually activate the ADR backoff procedure configurations of the MAC layer. | |
Private Attributes | |
| Ptr< ClassAEndDeviceLorawanMac > | m_mac |
| The end device's MAC layer used in tests. | |
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... | |
| 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. | |
It tests the correct execution of the ADR backoff procedure of LoRaWAN devices.
(See, LoRaWAN L2 1.0.4 Specifications (2020), Section 4.3.1.1)
Definition at line 2430 of file lorawan-test-suite.cc.
| AdrBackoffTest::AdrBackoffTest | ( | ) |
Default constructor.
Definition at line 2473 of file lorawan-test-suite.cc.
References ns3::TestCase::TestCase().
|
override |
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 2546 of file lorawan-test-suite.cc.
References ns3::lorawan::EndDeviceLorawanMac::ADR_ACK_DELAY, ns3::lorawan::EndDeviceLorawanMac::ADR_ACK_LIMIT, ns3::Create(), ns3::lorawan::LoraFrameHeader::GetAdrAckReq(), ns3::lorawan::LoraFrameHeader::GetFCnt(), m_mac, ns3::Minutes(), NS_LOG_DEBUG, NS_TEST_EXPECT_MSG_EQ, Reset(), ScheduleRx1Downlink(), ns3::Seconds(), and SendUplink().
|
private |
This function resets the simulation and device MAC layer, use before test sub-cases.
Definition at line 2529 of file lorawan-test-suite.cc.
References ns3::CreateObject(), ns3::Simulator::Destroy(), 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 |
Create and schedule the PHY reception of a downlink transmission configured for the LoRaWAN MAC first reception window.
This is used to test resetting the ADR backoff procedure.
It constrains the device to a single uplink channel to force-out the first reception window frequency. The downlink spreading factor is taken from the current MAC configuration.
| after | Delay to schedule the packet after (must target the first reception window) |
Definition at line 2500 of file lorawan-test-suite.cc.
References ns3::Create(), ns3::lorawan::DOWN, ns3::DynamicCast(), m_mac, ns3::MilliSeconds(), ns3::Simulator::Schedule(), ns3::lorawan::LoraFrameHeader::SetAsDownlink(), ns3::lorawan::LorawanMacHeader::SetFType(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), and ns3::lorawan::LorawanMacHeader::UNCONFIRMED_DATA_DOWN.
Referenced by DoRun().
|
private |
Create and send an empty app payload unconfirmed frame through the MAC layer to increment of the FCnt and ADRACKCnt and eventually activate the ADR backoff procedure configurations of the MAC layer.
The packet is sent after a delay (simulated time is fast-forwarded to the event) such that the device does not incur any duty-cycle limitation. The sent packet FHDR is returned as argument for validation purposes.
| after | Delay to schedule the packet after to avoid duty-cycle limitations |
| fhdr | [out] FHDR of the constructed frame passed to PHY by the MAC |
Definition at line 2484 of file lorawan-test-suite.cc.
References ns3::Create(), m_mac, NS_LOG_LOGIC, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::lorawan::EndDeviceLorawanMac::Send(), and ns3::lorawan::LoraFrameHeader::SetAsUplink().
Referenced by DoRun().
|
private |
The end device's MAC layer used in tests.
Definition at line 2470 of file lorawan-test-suite.cc.
Referenced by ~AdrBackoffTest(), DoRun(), Reset(), ScheduleRx1Downlink(), and SendUplink().