Tests that a ReceiveErrorModel discards the packet and fires PhyRxDrop. More...
Public Member Functions | |
| SimpleNetDeviceErrorModelTestCase () | |
| 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 | PhyDrop (Ptr< const Packet > p) |
| PhyRxDrop trace sink. | |
| bool | Rx (Ptr< NetDevice > d, Ptr< const Packet > p, uint16_t proto, const Address &from) |
| Receive callback counting delivered packets. | |
Private Attributes | |
| uint32_t | m_deliveries {0} |
| Number of packets delivered to the callback. | |
| uint32_t | m_phyDrops {0} |
| Number of PhyRxDrop events observed. | |
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. | |
Tests that a ReceiveErrorModel discards the packet and fires PhyRxDrop.
With a receive error model that corrupts every packet, a frame handed to the receiver must be dropped at the physical layer: the PhyRxDrop trace fires and the packet is never delivered to the receive callback. The control case (no error model) confirms the same frame is otherwise delivered.
Definition at line 131 of file simple-net-device-test.cc.
| SimpleNetDeviceErrorModelTestCase::SimpleNetDeviceErrorModelTestCase | ( | ) |
Definition at line 159 of file simple-net-device-test.cc.
References ns3::TestCase::TestCase().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 181 of file simple-net-device-test.cc.
References ns3::Mac48Address::Allocate(), ns3::Create(), ns3::ObjectFactory::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::RateErrorModel::ERROR_UNIT_PACKET, m_deliveries, m_phyDrops, ns3::MakeCallback(), NS_TEST_ASSERT_MSG_EQ, PhyDrop(), ns3::Simulator::Run(), Rx(), ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::SimpleNetDevice::Send().
PhyRxDrop trace sink.
| p | The dropped packet. |
Definition at line 165 of file simple-net-device-test.cc.
References m_phyDrops.
Referenced by DoRun().
|
private |
Receive callback counting delivered packets.
| d | The receiving device. |
| p | The received packet. |
| proto | The protocol number. |
| from | The source address. |
Definition at line 171 of file simple-net-device-test.cc.
References m_deliveries.
Referenced by DoRun().
|
private |
Number of packets delivered to the callback.
Definition at line 156 of file simple-net-device-test.cc.
|
private |
Number of PhyRxDrop events observed.
Definition at line 155 of file simple-net-device-test.cc.