TestCase to check calls to GlobalRoutingProtocol API. More...
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 |
| TestCase & | operator= (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< Ipv6Route > | m_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. | |
| 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. | |
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.
| 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().
|
override |
Definition at line 2685 of file global-routing-test-suite.cc.
|
private |
Checks the Path taken by packets by calling RouteInput() and RouteOutput() APIs of GlobalRoutingProtocol.
This mimics how Ipv4L3Protocol calls these APIs.
| pathNodes | Vector of nodes in the path. This includes the source node,Intermediate nextHop nodes and the destination node. |
| path | Vector 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().
|
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().
|
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().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
| packet | Packet to be locally delivered |
| header | IPv6 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().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
| packet | Packet to be locally delivered |
| header | IPv6 header of the packet |
| iif | Ingress Interface index |
Definition at line 2657 of file global-routing-test-suite.cc.
References NS_LOG_DEBUG.
Referenced by GlobalRoutingv6ProtocolTestCase().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
| idev | The ingress netdevice |
| rtentry | The route entry |
| p | The packet |
| header | The 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().
|
private |
Error callback.
Definition at line 2641 of file global-routing-test-suite.cc.
Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().
Route to be tested.
Definition at line 2637 of file global-routing-test-suite.cc.
Referenced by CheckPath(), and MyUnicastCallback().
|
private |
Local delivery callback.
Definition at line 2640 of file global-routing-test-suite.cc.
Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().
|
private |
Multicast forward callback.
Definition at line 2639 of file global-routing-test-suite.cc.
Referenced by CheckPath().
|
private |
Unicast forward callback.
Definition at line 2638 of file global-routing-test-suite.cc.
Referenced by GlobalRoutingv6ProtocolTestCase(), and CheckPath().
|
private |
Nodes used in the test.
Definition at line 2636 of file global-routing-test-suite.cc.