It tests the correct execution of the retransmissions in LoRaWAN devices. More...
Public Member Functions | |
| RetransmissionTest () | |
| Default constructor. | |
| ~RetransmissionTest () 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 | MacConfirmedTransmissionOutcome (uint8_t txCount, bool ack, Time firstAttempt, Ptr< Packet > packet) |
| Callback for tracing the outcome of MAC layer's confirmed packet retransmission and acknowledgement. | |
| void | MacSentNewPacket (Ptr< const Packet > packet) |
| Callback for tracing MAC layer SentNewPacket. | |
| void | PhyReceivedPacket (Ptr< const Packet > packet, uint32_t node) |
| Callback for tracing PHY layer ReceivedPacket. | |
| void | PhyStartSending (Ptr< const Packet > packet, uint32_t node) |
| Callback for tracing PHY layer StartSending. | |
| void | Reset () |
| This function resets the simulation and device MAC layer, use before test sub-cases. | |
| void | ScheduleRx1Downlink (Time after, bool ack=false) |
| Create and schedule the PHY reception of a downlink transmission configured for the LoRaWAN MAC first reception window. | |
| void | SendUplink (LoraFrameHeader &fhdr) |
| Create and send an empty app payload unconfirmed frame through the MAC layer NbTrans times. | |
Private Attributes | |
| Ptr< ClassAEndDeviceLorawanMac > | m_mac |
| The end device's MAC layer used in tests. | |
| int | m_macConfirmedTxOutcome = 0 |
| Counter for MacConfirmedTransmissionOutcome calls. | |
| int | m_macSentNewPacketCalls = 0 |
| Counter for MacSentNewPacket calls. | |
| uint8_t | m_numTransmissions = 0 |
| Number of confirmed packet transmissions. | |
| Ptr< Packet > | m_packet |
| Target packet for tracing. | |
| int | m_phyReceivedPacketCalls = 0 |
| Counter for PhyReceivedPacket calls. | |
| int | m_phyStartSendingCalls = 0 |
| Counter for PhyStartSending calls. | |
| bool | m_successfullyAcked = false |
| Acknowledgement of confirmed packet. | |
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 retransmissions in LoRaWAN devices.
(See, LoRaWAN L2 1.0.4 Specifications (2020), Section 4.3.1.3)
Definition at line 2645 of file lorawan-test-suite.cc.
| RetransmissionTest::RetransmissionTest | ( | ) |
Default constructor.
Definition at line 2733 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 2856 of file lorawan-test-suite.cc.
References ns3::lorawan::LorawanMacHeader::CONFIRMED_DATA_UP, ns3::Create(), ns3::lorawan::LoraFrameHeader::GetFCnt(), m_mac, m_macConfirmedTxOutcome, m_macSentNewPacketCalls, m_numTransmissions, m_phyReceivedPacketCalls, m_phyStartSendingCalls, m_successfullyAcked, ns3::MilliSeconds(), NS_LOG_DEBUG, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, Reset(), ns3::Simulator::Schedule(), ScheduleRx1Downlink(), ns3::Seconds(), ns3::lorawan::EndDeviceLorawanMac::Send(), SendUplink(), and ns3::lorawan::LorawanMacHeader::UNCONFIRMED_DATA_UP.
|
private |
Callback for tracing the outcome of MAC layer's confirmed packet retransmission and acknowledgement.
| txCount | Number of transmissions attempted during the process. |
| ack | Whether the retransmission process led to acknowledgement. |
| firstAttempt | Timestamp of the initial transmission attempt. |
| Packet | The packet being retransmitted. |
Definition at line 2797 of file lorawan-test-suite.cc.
References m_macConfirmedTxOutcome, m_numTransmissions, m_packet, and m_successfullyAcked.
Referenced by Reset().
Callback for tracing MAC layer SentNewPacket.
| Packet | The packet sent. |
Definition at line 2791 of file lorawan-test-suite.cc.
References m_macSentNewPacketCalls.
Referenced by Reset().
Callback for tracing PHY layer ReceivedPacket.
| Packet | The packet being received. |
| node | The sender node id if any, 0 otherwise. |
Definition at line 2817 of file lorawan-test-suite.cc.
References m_phyReceivedPacketCalls.
Referenced by Reset().
Callback for tracing PHY layer StartSending.
| Packet | The packet being sent. |
| node | The sender node id if any, 0 otherwise. |
Definition at line 2811 of file lorawan-test-suite.cc.
References m_phyStartSendingCalls.
Referenced by Reset().
|
private |
This function resets the simulation and device MAC layer, use before test sub-cases.
Definition at line 2823 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, m_macConfirmedTxOutcome, m_macSentNewPacketCalls, m_numTransmissions, m_phyReceivedPacketCalls, m_phyStartSendingCalls, m_successfullyAcked, MacConfirmedTransmissionOutcome(), MacSentNewPacket(), ns3::MakeCallback(), NS_TEST_EXPECT_MSG_NE, PhyReceivedPacket(), PhyStartSending(), 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 stopping the retransmission process.
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) |
| ack | Whether to set the ACK flag in the frame header |
Definition at line 2761 of file lorawan-test-suite.cc.
References ns3::Create(), ns3::lorawan::DOWN, ns3::DynamicCast(), m_mac, ns3::MilliSeconds(), ns3::Simulator::Schedule(), ns3::lorawan::LoraFrameHeader::SetAck(), 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 NbTrans times.
The sent packet FHDR is returned as argument for validation purposes.
| fhdr | [out] FHDR of the constructed frame passed to PHY by the MAC |
Definition at line 2744 of file lorawan-test-suite.cc.
References ns3::Create(), m_mac, m_packet, NS_LOG_LOGIC, ns3::Simulator::Run(), ns3::Simulator::ScheduleNow(), 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 2721 of file lorawan-test-suite.cc.
Referenced by ~RetransmissionTest(), DoRun(), Reset(), ScheduleRx1Downlink(), and SendUplink().
|
private |
Counter for MacConfirmedTransmissionOutcome calls.
Definition at line 2725 of file lorawan-test-suite.cc.
Referenced by DoRun(), MacConfirmedTransmissionOutcome(), and Reset().
|
private |
Counter for MacSentNewPacket calls.
Definition at line 2724 of file lorawan-test-suite.cc.
Referenced by DoRun(), MacSentNewPacket(), and Reset().
|
private |
Number of confirmed packet transmissions.
Definition at line 2729 of file lorawan-test-suite.cc.
Referenced by DoRun(), MacConfirmedTransmissionOutcome(), and Reset().
Target packet for tracing.
Definition at line 2722 of file lorawan-test-suite.cc.
Referenced by MacConfirmedTransmissionOutcome(), and SendUplink().
|
private |
Counter for PhyReceivedPacket calls.
Definition at line 2727 of file lorawan-test-suite.cc.
Referenced by DoRun(), PhyReceivedPacket(), and Reset().
|
private |
Counter for PhyStartSending calls.
Definition at line 2726 of file lorawan-test-suite.cc.
Referenced by DoRun(), PhyStartSending(), and Reset().
|
private |
Acknowledgement of confirmed packet.
Definition at line 2730 of file lorawan-test-suite.cc.
Referenced by DoRun(), MacConfirmedTransmissionOutcome(), and Reset().