TestCase to check calls to GlobalRoutingProtocol API. More...
Public Member Functions | |
GlobalRoutingProtocolTestCase () | |
~GlobalRoutingProtocolTestCase () override | |
![]() | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | CheckPath (std::vector< Ptr< Node > > pathNodes, std::vector< Ipv4Address > 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 Ipv4Header &header, Socket::SocketErrno errno_) |
Callback function for RouteInput() API of GlobalRoutingProtocol. | |
void | MyLocalDeliverCallback (Ptr< const Packet > packet, const Ipv4Header &header, uint32_t iif) |
Callback function for RouteInput() API of GlobalRoutingProtocol. | |
void | MyUnicastCallback (Ptr< Ipv4Route > route, Ptr< const Packet > packet, const Ipv4Header &header) |
Callback function for RouteInput() API of GlobalRoutingProtocol. | |
Private Attributes | |
Ipv4RoutingProtocol::ErrorCallback | m_ecb |
Error callback. | |
Ptr< Ipv4Route > | m_lastRoute |
Route to be tested. | |
Ipv4RoutingProtocol::LocalDeliverCallback | m_lcb |
Local delivery callback. | |
Ipv4RoutingProtocol::MulticastForwardCallback | m_mcb |
Multicast forward callback. | |
Ipv4RoutingProtocol::UnicastForwardCallback | m_ucb |
Unicast forward callback. | |
NodeContainer | nodes |
Nodes used in the test. | |
Additional Inherited Members | |
![]() | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
![]() | |
static constexpr auto | QUICK = Duration::QUICK |
Deprecated test duration simple enums. | |
static constexpr auto | EXTENSIVE = Duration::EXTENSIVE |
static constexpr auto | TAKES_FOREVER = Duration::TAKES_FOREVER |
![]() | |
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 1406 of file ipv4-global-routing-test-suite.cc.
GlobalRoutingProtocolTestCase::GlobalRoutingProtocolTestCase | ( | ) |
Definition at line 1490 of file ipv4-global-routing-test-suite.cc.
References m_ecb, m_lcb, m_ucb, ns3::MakeCallback(), MyErrorCallback(), MyLocalDeliverCallback(), and MyUnicastCallback().
|
override |
Definition at line 1500 of file ipv4-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 1505 of file ipv4-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::Ipv4Header::SetDestination(), and ns3::Ipv4Header::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 1678 of file ipv4-global-routing-test-suite.cc.
References CheckPath(), ns3::Simulator::Destroy(), ns3::NodeContainer::Get(), nodes, ns3::Ipv4GlobalRoutingHelper::PopulateRoutingTables(), ns3::GlobalRouteManager::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 1558 of file ipv4-global-routing-test-suite.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Create(), ns3::CreateObject(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::BridgeHelper::Install(), ns3::SimpleNetDeviceHelper::Install(), nodes, and ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
packet | Packet to be locally delivered |
header | IPv4 header of the packet |
errno_ | Socket error number |
Definition at line 1481 of file ipv4-global-routing-test-suite.cc.
References NS_LOG_DEBUG, and NS_TEST_ASSERT_MSG_EQ.
Referenced by GlobalRoutingProtocolTestCase().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
packet | Packet to be locally delivered |
header | IPv4 header of the packet |
iif | Ingress Interface index |
Definition at line 1472 of file ipv4-global-routing-test-suite.cc.
References NS_LOG_DEBUG.
Referenced by GlobalRoutingProtocolTestCase().
|
private |
Callback function for RouteInput() API of GlobalRoutingProtocol.
route | Route to be used for forwarding |
packet | Packet to be forwarded |
header | IPv4 header of the packet |
Definition at line 1462 of file ipv4-global-routing-test-suite.cc.
References m_lastRoute, and NS_LOG_DEBUG.
Referenced by GlobalRoutingProtocolTestCase().
|
private |
Error callback.
Definition at line 1457 of file ipv4-global-routing-test-suite.cc.
Referenced by GlobalRoutingProtocolTestCase(), and CheckPath().
Route to be tested.
Definition at line 1453 of file ipv4-global-routing-test-suite.cc.
Referenced by CheckPath(), and MyUnicastCallback().
|
private |
Local delivery callback.
Definition at line 1456 of file ipv4-global-routing-test-suite.cc.
Referenced by GlobalRoutingProtocolTestCase(), and CheckPath().
|
private |
Multicast forward callback.
Definition at line 1455 of file ipv4-global-routing-test-suite.cc.
Referenced by CheckPath().
|
private |
Unicast forward callback.
Definition at line 1454 of file ipv4-global-routing-test-suite.cc.
Referenced by GlobalRoutingProtocolTestCase(), and CheckPath().
|
private |
Nodes used in the test.
Definition at line 1452 of file ipv4-global-routing-test-suite.cc.