A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
SimpleNetDeviceErrorModelTestCase Class Reference

Tests that a ReceiveErrorModel discards the packet and fires PhyRxDrop. More...

Inheritance diagram for SimpleNetDeviceErrorModelTestCase:
Collaboration diagram for SimpleNetDeviceErrorModelTestCase:

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ SimpleNetDeviceErrorModelTestCase()

SimpleNetDeviceErrorModelTestCase::SimpleNetDeviceErrorModelTestCase ( )

Definition at line 159 of file simple-net-device-test.cc.

References ns3::TestCase::TestCase().

Here is the call graph for this function:

Member Function Documentation

◆ DoRun()

void SimpleNetDeviceErrorModelTestCase::DoRun ( )
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().

Here is the call graph for this function:

◆ PhyDrop()

void SimpleNetDeviceErrorModelTestCase::PhyDrop ( Ptr< const Packet > p)
private

PhyRxDrop trace sink.

Parameters
pThe dropped packet.

Definition at line 165 of file simple-net-device-test.cc.

References m_phyDrops.

Referenced by DoRun().

Here is the caller graph for this function:

◆ Rx()

bool SimpleNetDeviceErrorModelTestCase::Rx ( Ptr< NetDevice > d,
Ptr< const Packet > p,
uint16_t proto,
const Address & from )
private

Receive callback counting delivered packets.

Parameters
dThe receiving device.
pThe received packet.
protoThe protocol number.
fromThe source address.
Returns
Always true (packet accepted).

Definition at line 171 of file simple-net-device-test.cc.

References m_deliveries.

Referenced by DoRun().

Here is the caller graph for this function:

Member Data Documentation

◆ m_deliveries

uint32_t SimpleNetDeviceErrorModelTestCase::m_deliveries {0}
private

Number of packets delivered to the callback.

Definition at line 156 of file simple-net-device-test.cc.

Referenced by DoRun(), and Rx().

◆ m_phyDrops

uint32_t SimpleNetDeviceErrorModelTestCase::m_phyDrops {0}
private

Number of PhyRxDrop events observed.

Definition at line 155 of file simple-net-device-test.cc.

Referenced by DoRun(), and PhyDrop().


The documentation for this class was generated from the following file: