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

TestCase to check calls to GlobalRoutingProtocol API. More...

Inheritance diagram for GlobalRoutingv6ProtocolTestCase:
Collaboration diagram for GlobalRoutingv6ProtocolTestCase:

Public Member Functions

 GlobalRoutingv6ProtocolTestCase ()
 ~GlobalRoutingv6ProtocolTestCase () override
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
TestCaseoperator= (const TestCase &)=delete

Private Member Functions

void CheckPath (std::vector< Ptr< Node > > pathNodes, std::vector< Ipv6Address > path)
 Checks the Path taken by packets by calling RouteInput() and RouteOutput() APIs of GlobalRoutingProtocol.
void DoRun () override
 Implementation to actually run this TestCase.
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
void MyErrorCallback (Ptr< const Packet > packet, const Ipv6Header &header, Socket::SocketErrno errno_)
 Callback function for RouteInput() API of GlobalRoutingProtocol.
void MyLocalDeliverCallback (Ptr< const Packet > packet, const Ipv6Header &header, uint32_t iif)
 Callback function for RouteInput() API of GlobalRoutingProtocol.
void MyUnicastCallback (Ptr< const NetDevice > idev, Ptr< Ipv6Route > rtentry, Ptr< const Packet > p, const Ipv6Header &header)
 Callback function for RouteInput() API of GlobalRoutingProtocol.

Private Attributes

Ipv6RoutingProtocol::ErrorCallback m_ecb
 Error callback.
Ptr< Ipv6Routem_lastRoute
 Route to be tested.
Ipv6RoutingProtocol::LocalDeliverCallback m_lcb
 Local delivery callback.
Ipv6RoutingProtocol::MulticastForwardCallback m_mcb
 Multicast forward callback.
Ipv6RoutingProtocol::UnicastForwardCallback m_ucb
 Unicast forward callback.
NodeContainer nodes
 Nodes used in the test.

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.
TestCaseGetParent () 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

TestCase to check calls to GlobalRoutingProtocol API.

This TestCase Checks the output returned by the GlobalRoutingProtocol API to Ipv4L3 Layer.

Definition at line 2587 of file global-routing-test-suite.cc.

Constructor & Destructor Documentation

◆ GlobalRoutingv6ProtocolTestCase()

GlobalRoutingv6ProtocolTestCase::GlobalRoutingv6ProtocolTestCase ( )

Definition at line 2675 of file global-routing-test-suite.cc.

References ns3::TestCase::TestCase(), m_ecb, m_lcb, m_ucb, ns3::MakeCallback(), MyErrorCallback(), MyLocalDeliverCallback(), and MyUnicastCallback().

Here is the call graph for this function:

◆ ~GlobalRoutingv6ProtocolTestCase()

GlobalRoutingv6ProtocolTestCase::~GlobalRoutingv6ProtocolTestCase ( )
override

Definition at line 2685 of file global-routing-test-suite.cc.

Member Function Documentation

◆ CheckPath()

void GlobalRoutingv6ProtocolTestCase::CheckPath ( std::vector< Ptr< Node > > pathNodes,
std::vector< Ipv6Address > path )
private

Checks the Path taken by packets by calling RouteInput() and RouteOutput() APIs of GlobalRoutingProtocol.

This mimics how Ipv4L3Protocol calls these APIs.

Parameters
pathNodesVector of nodes in the path. This includes the source node,Intermediate nextHop nodes and the destination node.
pathVector of Ipv4Addresses in the path. This includes the source egress IpAddress, destination ingress IpAddress and intermediate nextHop Node's ingress Ipaddress that we need to check.It does not include the egress addresses for intermediate nodes.

Definition at line 2690 of file global-routing-test-suite.cc.

References ns3::Create(), m_ecb, m_lastRoute, m_lcb, m_mcb, m_ucb, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_NE, ns3::Ipv6Header::SetDestination(), and ns3::Ipv6Header::SetSource().

Referenced by DoRun().

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

◆ DoRun()

void GlobalRoutingv6ProtocolTestCase::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 2864 of file global-routing-test-suite.cc.

References CheckPath(), ns3::Simulator::Destroy(), nodes, ns3::Ipv6GlobalRoutingHelper::PopulateRoutingTables(), ns3::GlobalRouteManager< T >::ResetRouterId(), ns3::Simulator::Run(), ns3::Seconds(), and ns3::Simulator::Stop().

Here is the call graph for this function:

◆ DoSetup()

void GlobalRoutingv6ProtocolTestCase::DoSetup ( )
overrideprivatevirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.

This test case is designed to test the overall functionality of the GlobalRoutingProtocol. It tests the calls to the GlobalRoutingProtocol's RouteOutput() and RouteInput() APIs. It mimics how Ipv4L3Protocol calls these APIs. The topology covers most of the cases that are expected to be handled by the GlobalRoutingProtocol.

Reimplemented from ns3::TestCase.

Definition at line 2744 of file global-routing-test-suite.cc.

References ns3::NetDeviceContainer::Add(), ns3::Ipv6AddressHelper::Assign(), ns3::CreateObject(), ns3::NetDeviceContainer::Get(), ns3::BridgeHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), nodes, ns3::Ipv6AddressHelper::SetBase(), and ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode().

Here is the call graph for this function:

◆ MyErrorCallback()

void GlobalRoutingv6ProtocolTestCase::MyErrorCallback ( Ptr< const Packet > packet,
const Ipv6Header & header,
Socket::SocketErrno errno_ )
private

Callback function for RouteInput() API of GlobalRoutingProtocol.

Parameters
packetPacket to be locally delivered
headerIPv6 header of the packet
errno_Socket error number

Definition at line 2666 of file global-routing-test-suite.cc.

References NS_LOG_DEBUG, and NS_TEST_ASSERT_MSG_EQ.

Referenced by GlobalRoutingv6ProtocolTestCase().

Here is the caller graph for this function:

◆ MyLocalDeliverCallback()

void GlobalRoutingv6ProtocolTestCase::MyLocalDeliverCallback ( Ptr< const Packet > packet,
const Ipv6Header & header,
uint32_t iif )
private

Callback function for RouteInput() API of GlobalRoutingProtocol.

Parameters
packetPacket to be locally delivered
headerIPv6 header of the packet
iifIngress Interface index

Definition at line 2657 of file global-routing-test-suite.cc.

References NS_LOG_DEBUG.

Referenced by GlobalRoutingv6ProtocolTestCase().

Here is the caller graph for this function:

◆ MyUnicastCallback()

void GlobalRoutingv6ProtocolTestCase::MyUnicastCallback ( Ptr< const NetDevice > idev,
Ptr< Ipv6Route > rtentry,
Ptr< const Packet > p,
const Ipv6Header & header )
private

Callback function for RouteInput() API of GlobalRoutingProtocol.

Parameters
idevThe ingress netdevice
rtentryThe route entry
pThe packet
headerThe IPv6 header of the packet

Definition at line 2646 of file global-routing-test-suite.cc.

References m_lastRoute, and NS_LOG_DEBUG.

Referenced by GlobalRoutingv6ProtocolTestCase().

Here is the caller graph for this function:

Member Data Documentation

◆ m_ecb

Ipv6RoutingProtocol::ErrorCallback GlobalRoutingv6ProtocolTestCase::m_ecb
private

Error callback.

Definition at line 2641 of file global-routing-test-suite.cc.

Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().

◆ m_lastRoute

Ptr<Ipv6Route> GlobalRoutingv6ProtocolTestCase::m_lastRoute
private

Route to be tested.

Definition at line 2637 of file global-routing-test-suite.cc.

Referenced by CheckPath(), and MyUnicastCallback().

◆ m_lcb

Ipv6RoutingProtocol::LocalDeliverCallback GlobalRoutingv6ProtocolTestCase::m_lcb
private

Local delivery callback.

Definition at line 2640 of file global-routing-test-suite.cc.

Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().

◆ m_mcb

Ipv6RoutingProtocol::MulticastForwardCallback GlobalRoutingv6ProtocolTestCase::m_mcb
private

Multicast forward callback.

Definition at line 2639 of file global-routing-test-suite.cc.

Referenced by CheckPath().

◆ m_ucb

Ipv6RoutingProtocol::UnicastForwardCallback GlobalRoutingv6ProtocolTestCase::m_ucb
private

Unicast forward callback.

Definition at line 2638 of file global-routing-test-suite.cc.

Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().

◆ nodes

NodeContainer GlobalRoutingv6ProtocolTestCase::nodes
private

Nodes used in the test.

Definition at line 2636 of file global-routing-test-suite.cc.

Referenced by DoRun(), and DoSetup().


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