A Discrete-Event Network Simulator
API
Ipv4DeduplicationTest Class Reference

IPv4 Deduplication Test. More...

+ Inheritance diagram for Ipv4DeduplicationTest:
+ Collaboration diagram for Ipv4DeduplicationTest:

Public Member Functions

 Ipv4DeduplicationTest (bool enable, Time expire=Seconds(1))
 
virtual void DoRun (void)
 Implementation to actually run this TestCase. More...
 
void DropPkt (const Ipv4Header &ipHeader, Ptr< const Packet > packet, Ipv4L3Protocol::DropReason reason, Ptr< Ipv4 > ipv4, uint32_t interface)
 Register dropped packet. More...
 
void ReceivePkt (Ptr< Socket > socket)
 Receive data. More...
 
- Public Member Functions inherited from ns3::TestCase
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName (void) const
 

Private Types

enum  MODE { ENABLED = 0, DISABLED, DEGENERATE }
 

Private Member Functions

void CheckDrops (const std::string &name)
 Check packet drops. More...
 
void CheckPackets (const std::string &name)
 Check packet receptions. More...
 
void DoSendData (Ptr< Socket > socket, std::string to)
 Send data. More...
 
void DoSendPacket (Ptr< Socket > socket, Ptr< Packet > packet, std::string to)
 Send data. More...
 
void SendData (Ptr< Socket > socket, std::string to)
 Send data. More...
 
void SendPacket (Ptr< Socket > socket, Ptr< Packet > packet, std::string to)
 Send data. More...
 

Static Private Member Functions

static std::string MakeName (bool enable, Time expire)
 

Private Attributes

std::map< std::string, uint32_t > m_dropCountMap
 
Time m_expire
 
MODE m_mode
 
std::map< std::string, uint32_t > m_packetCountMap
 

Static Private Attributes

static const Time DELAY = MilliSeconds (1)
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { 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. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCsse. More...
 
bool IsStatusFailure (void) const
 Check if any tests failed. More...
 
bool IsStatusSuccess (void) const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure (void) const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure (void) const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

Detailed Description

IPv4 Deduplication Test.

Tests topology:

   /---- B ----\

A -— | -— D -— E ---- C -—/

This test case counts the number of packets received and dropped at each node across the topology. Every node is configured to forward the multicast packet which originates at node A.

With RFC 6621 de-duplication enabled, one 1 packet is received while some number of duplicate relayed packets are dropped by RFC 6621 at each node.

When RFC6621 is disabled, the original packet has TTL = 4. Multiple packets are received at each node and several packets are dropped due to TTL expiry at each node.

Definition at line 87 of file ipv4-deduplication-test.cc.

Member Enumeration Documentation

◆ MODE

Enumerator
ENABLED 
DISABLED 
DEGENERATE 

Definition at line 132 of file ipv4-deduplication-test.cc.

Constructor & Destructor Documentation

◆ Ipv4DeduplicationTest()

Ipv4DeduplicationTest::Ipv4DeduplicationTest ( bool  enable,
Time  expire = Seconds (1) 
)

Definition at line 166 of file ipv4-deduplication-test.cc.

References DEGENERATE, DELAY, DISABLED, m_expire, and m_mode.

Member Function Documentation

◆ CheckDrops()

void Ipv4DeduplicationTest::CheckDrops ( const std::string &  name)
private

Check packet drops.

Parameters
nameNode name

Definition at line 437 of file ipv4-deduplication-test.cc.

References DEGENERATE, DISABLED, ENABLED, m_dropCountMap, m_mode, NS_TEST_ASSERT_MSG_NE, and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ CheckPackets()

void Ipv4DeduplicationTest::CheckPackets ( const std::string &  name)
private

Check packet receptions.

Parameters
nameNode name

Definition at line 405 of file ipv4-deduplication-test.cc.

References DEGENERATE, DISABLED, ENABLED, m_mode, m_packetCountMap, NS_TEST_ASSERT_MSG_NE, and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ DoRun()

◆ DoSendData()

void Ipv4DeduplicationTest::DoSendData ( Ptr< Socket socket,
std::string  to 
)
private

Send data.

Parameters
socketThe sending socket.
toDestination address.

Definition at line 218 of file ipv4-deduplication-test.cc.

References SendPacket().

Referenced by SendData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoSendPacket()

void Ipv4DeduplicationTest::DoSendPacket ( Ptr< Socket socket,
Ptr< Packet packet,
std::string  to 
)
private

Send data.

Parameters
socketThe sending socket.
packetThe packet to send.
toDestination address.

Definition at line 224 of file ipv4-deduplication-test.cc.

References NS_TEST_EXPECT_MSG_EQ, and ns3::Socket::SendTo().

Referenced by SendPacket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DropPkt()

void Ipv4DeduplicationTest::DropPkt ( const Ipv4Header ipHeader,
Ptr< const Packet packet,
Ipv4L3Protocol::DropReason  reason,
Ptr< Ipv4 ipv4,
uint32_t  interface 
)

Register dropped packet.

Parameters
[in]ipHeaderIP header
[in]packetPacket that was dropped
[in]reasonReason for dropping packet
[in]ipv4Ipv4 instance
[in]interfaceInterface number

Definition at line 195 of file ipv4-deduplication-test.cc.

References DEGENERATE, DISABLED, ENABLED, ns3::Ipv4::GetNetDevice(), m_dropCountMap, m_mode, and NS_TEST_EXPECT_MSG_EQ.

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeName()

std::string Ipv4DeduplicationTest::MakeName ( bool  enable,
Time  expire 
)
staticprivate

Definition at line 244 of file ipv4-deduplication-test.cc.

References DELAY, and ns3::Time::ToDouble().

+ Here is the call graph for this function:

◆ ReceivePkt()

void Ipv4DeduplicationTest::ReceivePkt ( Ptr< Socket socket)

Receive data.

Parameters
[in]socketThe receive socket.

Definition at line 181 of file ipv4-deduplication-test.cc.

References ns3::Socket::GetNode(), ns3::Socket::GetRxAvailable(), ns3::Packet::GetSize(), m_packetCountMap, max, NS_ASSERT, and ns3::Socket::Recv().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendData()

void Ipv4DeduplicationTest::SendData ( Ptr< Socket socket,
std::string  to 
)
private

Send data.

Parameters
socketThe sending socket.
toDestination address.

Definition at line 231 of file ipv4-deduplication-test.cc.

References DoSendData().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendPacket()

void Ipv4DeduplicationTest::SendPacket ( Ptr< Socket socket,
Ptr< Packet packet,
std::string  to 
)
private

Send data.

Parameters
socketThe sending socket.
packetThe packet to send.
toDestination address.

Definition at line 237 of file ipv4-deduplication-test.cc.

References DoSendPacket(), ns3::Node::GetId(), ns3::Socket::GetNode(), and ns3::MilliSeconds().

Referenced by DoSendData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ DELAY

const Time Ipv4DeduplicationTest::DELAY = MilliSeconds (1)
staticprivate

Definition at line 129 of file ipv4-deduplication-test.cc.

Referenced by DoRun(), Ipv4DeduplicationTest(), and MakeName().

◆ m_dropCountMap

std::map<std::string, uint32_t> Ipv4DeduplicationTest::m_dropCountMap
private

Definition at line 138 of file ipv4-deduplication-test.cc.

Referenced by CheckDrops(), and DropPkt().

◆ m_expire

Time Ipv4DeduplicationTest::m_expire
private

Definition at line 136 of file ipv4-deduplication-test.cc.

Referenced by DoRun(), and Ipv4DeduplicationTest().

◆ m_mode

MODE Ipv4DeduplicationTest::m_mode
private

◆ m_packetCountMap

std::map<std::string, uint32_t> Ipv4DeduplicationTest::m_packetCountMap
private

Definition at line 137 of file ipv4-deduplication-test.cc.

Referenced by CheckPackets(), DoRun(), and ReceivePkt().


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