It tests sending packets over a LoRa physical channel between multiple devices and the resulting possible outcomes. More...
Public Member Functions | |
PhyConnectivityTest () | |
Default constructor. | |
~PhyConnectivityTest () override | |
Destructor. | |
void | Interference (Ptr< const Packet > packet, uint32_t node) |
Callback for tracing LostPacketBecauseInterference. | |
bool | IsSamePacket (Ptr< Packet > packet1, Ptr< Packet > packet2) |
Compare two packets to check if they are equal. | |
void | ReceivedPacket (Ptr< const Packet > packet, uint32_t node) |
Callback for tracing ReceivedPacket. | |
void | Reset () |
Reset counters and end devices' PHYs for new sub test case. | |
void | UnderSensitivity (Ptr< const Packet > packet, uint32_t node) |
Callback for tracing LostPacketBecauseUnderSensitivity. | |
void | WrongFrequency (Ptr< const Packet > packet, uint32_t node) |
Callback for tracing LostPacketBecauseWrongFrequency. | |
void | WrongSf (Ptr< const Packet > packet, uint32_t node) |
Callback for tracing LostPacketBecauseWrongSpreadingFactor. | |
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. | |
Private Attributes | |
Ptr< LoraChannel > | channel |
The LoRa channel used for tests. | |
Ptr< SimpleEndDeviceLoraPhy > | edPhy1 |
The first end device's PHY layer used in tests. | |
Ptr< SimpleEndDeviceLoraPhy > | edPhy2 |
The second end device's PHY layer used in tests. | |
Ptr< SimpleEndDeviceLoraPhy > | edPhy3 |
The third end device's PHY layer used in tests. | |
int | m_interferenceCalls = 0 |
Counter for LostPacketBecauseInterference calls. | |
Ptr< Packet > | m_latestReceivedPacket |
Pointer to track the last received packet. | |
int | m_receivedPacketCalls = 0 |
Counter for ReceivedPacket calls. | |
int | m_underSensitivityCalls = 0 |
Counter for LostPacketBecauseUnderSensitivity calls. | |
int | m_wrongFrequencyCalls = 0 |
Counter for LostPacketBecauseWrongFrequency calls. | |
int | m_wrongSfCalls = 0 |
Counter for LostPacketBecauseWrongSpreadingFactor calls. | |
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. | |
It tests sending packets over a LoRa physical channel between multiple devices and the resulting possible outcomes.
Definition at line 1103 of file lorawan-test-suite.cc.
PhyConnectivityTest::PhyConnectivityTest | ( | ) |
Default constructor.
Definition at line 1181 of file lorawan-test-suite.cc.
|
override |
Destructor.
Definition at line 1187 of file lorawan-test-suite.cc.
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1339 of file lorawan-test-suite.cc.
References ns3::Create(), ns3::Simulator::Destroy(), ns3::DynamicCast(), edPhy1, edPhy2, edPhy3, ns3::Hours(), IsSamePacket(), m_interferenceCalls, m_latestReceivedPacket, m_receivedPacketCalls, m_underSensitivityCalls, m_wrongFrequencyCalls, m_wrongSfCalls, NS_LOG_DEBUG, NS_TEST_EXPECT_MSG_EQ, Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), ns3::lorawan::LoraTxParameters::sf, and ns3::Simulator::Stop().
Callback for tracing LostPacketBecauseInterference.
packet | The packet lost. |
node | The receiver node id if any, 0 otherwise. |
Definition at line 1210 of file lorawan-test-suite.cc.
References m_interferenceCalls, and NS_LOG_FUNCTION.
Referenced by Reset().
Compare two packets to check if they are equal.
packet1 | A first packet. |
packet2 | A second packet. |
Definition at line 1234 of file lorawan-test-suite.cc.
Referenced by DoRun().
Callback for tracing ReceivedPacket.
packet | The packet received. |
node | The receiver node id if any, 0 otherwise. |
Definition at line 1192 of file lorawan-test-suite.cc.
References m_latestReceivedPacket, m_receivedPacketCalls, and NS_LOG_FUNCTION.
Referenced by Reset().
void PhyConnectivityTest::Reset | ( | ) |
Reset counters and end devices' PHYs for new sub test case.
Definition at line 1240 of file lorawan-test-suite.cc.
References channel, ns3::CreateObject(), edPhy1, edPhy2, edPhy3, Interference(), m_interferenceCalls, m_receivedPacketCalls, m_underSensitivityCalls, m_wrongFrequencyCalls, m_wrongSfCalls, ns3::MakeCallback(), ReceivedPacket(), UnderSensitivity(), WrongFrequency(), and WrongSf().
Referenced by DoRun().
Callback for tracing LostPacketBecauseUnderSensitivity.
packet | The packet lost. |
node | The receiver node id if any, 0 otherwise. |
Definition at line 1202 of file lorawan-test-suite.cc.
References m_underSensitivityCalls, and NS_LOG_FUNCTION.
Referenced by Reset().
Callback for tracing LostPacketBecauseWrongFrequency.
packet | The packet lost. |
node | The receiver node id if any, 0 otherwise. |
Definition at line 1226 of file lorawan-test-suite.cc.
References m_wrongFrequencyCalls, and NS_LOG_FUNCTION.
Referenced by Reset().
Callback for tracing LostPacketBecauseWrongSpreadingFactor.
packet | The packet lost. |
node | The receiver node id if any, 0 otherwise. |
Definition at line 1218 of file lorawan-test-suite.cc.
References m_wrongSfCalls, and NS_LOG_FUNCTION.
Referenced by Reset().
|
private |
The LoRa channel used for tests.
Definition at line 1167 of file lorawan-test-suite.cc.
Referenced by Reset().
|
private |
The first end device's PHY layer used in tests.
Definition at line 1168 of file lorawan-test-suite.cc.
|
private |
The second end device's PHY layer used in tests.
Definition at line 1169 of file lorawan-test-suite.cc.
|
private |
The third end device's PHY layer used in tests.
Definition at line 1170 of file lorawan-test-suite.cc.
|
private |
Counter for LostPacketBecauseInterference calls.
Definition at line 1175 of file lorawan-test-suite.cc.
Referenced by DoRun(), Interference(), and Reset().
Pointer to track the last received packet.
Definition at line 1172 of file lorawan-test-suite.cc.
Referenced by DoRun(), and ReceivedPacket().
|
private |
Counter for ReceivedPacket calls.
Definition at line 1173 of file lorawan-test-suite.cc.
Referenced by DoRun(), ReceivedPacket(), and Reset().
|
private |
Counter for LostPacketBecauseUnderSensitivity calls.
Definition at line 1174 of file lorawan-test-suite.cc.
Referenced by DoRun(), Reset(), and UnderSensitivity().
|
private |
Counter for LostPacketBecauseWrongFrequency calls.
Definition at line 1177 of file lorawan-test-suite.cc.
Referenced by DoRun(), Reset(), and WrongFrequency().
|
private |
Counter for LostPacketBecauseWrongSpreadingFactor calls.
Definition at line 1176 of file lorawan-test-suite.cc.