Base for device-level mesh-under tests. More...
Public Member Functions | |
| MeshUnderDeviceTestCase (std::string name) | |
| Constructor. | |
| 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 |
Protected Member Functions | |
| bool | CaptureSend (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, NetDevice::PacketType packetType) |
| Capture a frame the device re-broadcasts. | |
| bool | CaptureUp (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source) |
| Capture a locally delivered packet. | |
| void | DoTeardown () override |
| Implementation to do any local setup required for this TestCase. | |
| void | ScheduleInject (Time when, Ptr< Packet > packet) |
| Schedule the injection of a frame, as if received from the channel. | |
| void | SetupDevice (bool useMesh=true, bool forwardMesh=true) |
| Build the node, the underlying MockNetDevice and the 6LoWPAN device. | |
| 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. | |
Static Protected Member Functions | |
| static Ptr< Packet > | BuildMeshFrame (Mac16Address originator, Mac16Address finalDst, uint8_t hopsLeft, uint8_t seqNo) |
| Build a mesh frame (MESH + BC0 + uncompressed IPv6 payload). | |
Protected Attributes | |
| uint32_t | m_deliveredCount {0} |
| Packets delivered locally. | |
| Ptr< SixLowPanNetDevice > | m_dev |
| Device under test. | |
| Ptr< MockNetDevice > | m_mock |
| Underlying (mock) device. | |
| std::vector< Ptr< Packet > > | m_sentFrames |
| Frames re-broadcast by the device. | |
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... | |
Base for device-level mesh-under tests.
Builds a SixLowPanNetDevice over a MockNetDevice, injects mesh frames through the underlying device and captures both the frames the device re-broadcasts and the packets it delivers locally. Subclasses exercise the device public API end to end, verifying that the policy delegation preserves the historical device behavior.
Definition at line 180 of file sixlowpan-mesh-under-test-suite.cc.
|
inline |
Constructor.
| name | The test case name. |
Definition at line 187 of file sixlowpan-mesh-under-test-suite.cc.
References ns3::TestCase::TestCase().
Referenced by MeshUnderChainRelayTestCase::MeshUnderChainRelayTestCase(), MeshUnderDeviceDeliveryTestCase::MeshUnderDeviceDeliveryTestCase(), MeshUnderDeviceForwardTestCase::MeshUnderDeviceForwardTestCase(), MeshUnderDeviceHopLimitTestCase::MeshUnderDeviceHopLimitTestCase(), MeshUnderDeviceMisconfigTestCase::MeshUnderDeviceMisconfigTestCase(), and MeshUnderDeviceNoRelayTestCase::MeshUnderDeviceNoRelayTestCase().
|
inlinestaticprotected |
Build a mesh frame (MESH + BC0 + uncompressed IPv6 payload).
| originator | The MESH originator address. |
| finalDst | The MESH final destination address. |
| hopsLeft | The MESH hops-left value. |
| seqNo | The BC0 sequence number. |
Definition at line 230 of file sixlowpan-mesh-under-test-suite.cc.
References ns3::Create(), ns3::SixLowPanMesh::SetFinalDst(), ns3::SixLowPanMesh::SetHopsLeft(), ns3::SixLowPanMesh::SetOriginator(), and ns3::SixLowPanBc0::SetSequenceNumber().
Referenced by MeshUnderChainRelayTestCase::DoRun(), MeshUnderDeviceDeliveryTestCase::DoRun(), MeshUnderDeviceForwardTestCase::DoRun(), MeshUnderDeviceHopLimitTestCase::DoRun(), MeshUnderDeviceMisconfigTestCase::DoRun(), and MeshUnderDeviceNoRelayTestCase::DoRun().
|
inlineprotected |
Capture a frame the device re-broadcasts.
| device | The sending device. |
| Packet | The transmitted frame. |
| protocol | The protocol number. |
| source | The source address. |
| destination | The destination address. |
| packetType | The packet type. |
Definition at line 284 of file sixlowpan-mesh-under-test-suite.cc.
References m_sentFrames.
Referenced by SetupDevice().
|
inlineprotected |
Capture a locally delivered packet.
| device | The receiving device. |
| Packet | The delivered packet. |
| protocol | The protocol number. |
| source | The source address. |
Definition at line 303 of file sixlowpan-mesh-under-test-suite.cc.
References m_deliveredCount.
Referenced by SetupDevice().
|
inlineoverrideprotectedvirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 312 of file sixlowpan-mesh-under-test-suite.cc.
References ns3::Simulator::Destroy(), m_dev, and m_mock.
Referenced by MeshUnderChainRelayTestCase::DoTeardown().
Schedule the injection of a frame, as if received from the channel.
The event is scheduled with the node's context, as a channel would.
| when | The injection time. |
| Packet | The frame to inject. |
Definition at line 261 of file sixlowpan-mesh-under-test-suite.cc.
References m_mock, ns3::NetDevice::PACKET_BROADCAST, ns3::MockNetDevice::Receive(), and ns3::Simulator::ScheduleWithContext().
Referenced by MeshUnderChainRelayTestCase::DoRun(), MeshUnderDeviceDeliveryTestCase::DoRun(), MeshUnderDeviceForwardTestCase::DoRun(), MeshUnderDeviceHopLimitTestCase::DoRun(), MeshUnderDeviceMisconfigTestCase::DoRun(), and MeshUnderDeviceNoRelayTestCase::DoRun().
|
inlineprotected |
Build the node, the underlying MockNetDevice and the 6LoWPAN device.
The underlying device gets the MAC address 00:00:00:00:00:01, so the node's 16-bit mesh address is 00:01.
| useMesh | The device's UseMeshUnder attribute (mesh-under membership). |
| forwardMesh | The device's ForwardMesh attribute (relaying). |
Definition at line 202 of file sixlowpan-mesh-under-test-suite.cc.
References CaptureSend(), CaptureUp(), ns3::CreateObject(), m_dev, m_mock, and ns3::MakeCallback().
Referenced by MeshUnderChainRelayTestCase::DoRun(), MeshUnderDeviceDeliveryTestCase::DoRun(), MeshUnderDeviceForwardTestCase::DoRun(), MeshUnderDeviceHopLimitTestCase::DoRun(), MeshUnderDeviceMisconfigTestCase::DoRun(), and MeshUnderDeviceNoRelayTestCase::DoRun().
|
protected |
Packets delivered locally.
Definition at line 322 of file sixlowpan-mesh-under-test-suite.cc.
Referenced by CaptureUp(), MeshUnderChainRelayTestCase::DoRun(), MeshUnderDeviceDeliveryTestCase::DoRun(), MeshUnderDeviceForwardTestCase::DoRun(), MeshUnderDeviceHopLimitTestCase::DoRun(), MeshUnderDeviceMisconfigTestCase::DoRun(), and MeshUnderDeviceNoRelayTestCase::DoRun().
|
protected |
Device under test.
Definition at line 320 of file sixlowpan-mesh-under-test-suite.cc.
Referenced by MeshUnderDeviceMisconfigTestCase::DoRun(), DoTeardown(), and SetupDevice().
|
protected |
Underlying (mock) device.
Definition at line 319 of file sixlowpan-mesh-under-test-suite.cc.
Referenced by MeshUnderChainRelayTestCase::DoRun(), DoTeardown(), ScheduleInject(), and SetupDevice().
Frames re-broadcast by the device.
Definition at line 321 of file sixlowpan-mesh-under-test-suite.cc.
Referenced by CaptureSend(), MeshUnderDeviceDeliveryTestCase::DoRun(), MeshUnderDeviceForwardTestCase::DoRun(), MeshUnderDeviceHopLimitTestCase::DoRun(), MeshUnderDeviceMisconfigTestCase::DoRun(), and MeshUnderDeviceNoRelayTestCase::DoRun().