ping basic tests More...
Inheritance diagram for PingTestCase:
Collaboration diagram for PingTestCase:Public Member Functions | |
| PingTestCase (std::string name, bool useIpv6) | |
| Constructor. | |
| void | CheckReportLoss (uint16_t expectedReportLoss) |
| Enable the check on Lost pings. | |
| void | CheckReportReceived (uint32_t expectedReportRx) |
| Enable the check on Rx pings. | |
| void | CheckReportTime (Time expectedTime) |
| Enable the check on average RTT. | |
| void | CheckReportTransmitted (uint32_t expectedReportTx) |
| Enable the check on Tx pings. | |
| void | CheckTraceRtt (uint32_t expectedRtt) |
| Enable the check on Rtt event count in Rtt trace source. | |
| void | CheckTraceTx (uint32_t expectedTx) |
| Enable the check on Tx pings counted in Tx trace source. | |
| void | SetCount (uint32_t count) |
| Set the number of pings to send. | |
| void | SetDestinationAddress (Address address) |
| Set the destination address (either IPv4 or IPv6). | |
| void | SetDropList (const std::list< uint32_t > &dropList) |
| Set the packet drop list on the Ping node's interface. | |
| void | SetInterval (Time interval) |
| Set the interval of pings. | |
| void | SetSimulatorStopTime (Time stopTime) |
| Set the Simulation stop time. | |
| void | SetSize (uint32_t size) |
| Set the size of pings. | |
| void | SetStartTime (Time startTime) |
| Set the PING start time. | |
| void | SetStopTime (Time stopTime) |
| Set the PING stop time. | |
Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| 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 | DoSetup () override |
| Implementation to do any local setup required for this TestCase. | |
| void | DoTeardown () override |
| Implementation to do any local setup required for this TestCase. | |
| void | DropTraceSink (uint16_t seq, Ping::DropReason reason) |
| Trace Drop events. | |
| void | ReportTraceSink (const Ping::PingReport &report) |
| Trace Report generation events. | |
| void | RttTraceSink (uint16_t seq, Time rttSample) |
| Trace RTT events. | |
| void | TxTraceSink (uint16_t seq, Ptr< Packet > p) |
| Trace TX events. | |
Private Attributes | |
| bool | m_checkReportLoss {false} |
| Set to true to check the Loss number. | |
| bool | m_checkReportReceived {false} |
| Set to true to check the Rx number. | |
| bool | m_checkReportTime {false} |
| Set to true to check the Time. | |
| bool | m_checkReportTransmitted {false} |
| Set to true to check the Tx number. | |
| bool | m_checkTraceRtt {false} |
| Set to true to check the Rtt number. | |
| bool | m_checkTraceTx {false} |
| Set to true to check the Tx number. | |
| uint32_t | m_countAttribute {0} |
| Number of pings to send. | |
| uint32_t | m_countTraceRtt {0} |
| Rtt trace counter. | |
| uint32_t | m_countTraceTx {0} |
| Tx trace counter. | |
| Address | m_destination {Ipv4Address("10.0.0.2")} |
| Destination address. | |
| NetDeviceContainer | m_devices |
| The NetDevices. | |
| std::list< uint32_t > | m_dropList |
| Drop first reply (true) | |
| uint16_t | m_expectedReportLoss {0} |
| Expected reported Loss. | |
| uint32_t | m_expectedReportRx {0} |
| Expected reported Rx. | |
| Time | m_expectedReportTime |
| Expected reported time. | |
| uint32_t | m_expectedReportTx {0} |
| Expected reported Tx. | |
| uint32_t | m_expectedTraceRtt {0} |
| Expected Rtt trace sink calls. | |
| uint32_t | m_expectedTraceTx {0} |
| Expected Tx trace sink calls. | |
| Time | m_interpacketInterval {Seconds(1.0)} |
| Time between pings. | |
| Ipv4InterfaceContainer | m_ipv4Interfaces |
| The IPv4 interfaces. | |
| Ipv6InterfaceContainer | m_ipv6Interfaces |
| The IPv6 interfaces. | |
| Time | m_lastTx |
| Last ping Tx time. | |
| uint32_t | m_mtu {1500} |
| Link MTU. | |
| NodeContainer | m_nodes |
| The simulation nodes. | |
| Time | m_simulatorStopTime {Seconds(6)} |
| Simulator stop time. | |
| uint32_t | m_sizeAttribute {56} |
| Size of pings. | |
| Time | m_startTime {Seconds(1)} |
| Start time. | |
| Time | m_stopTime {Seconds(5)} |
| Stop time. | |
| bool | m_useIpv6 {false} |
| Use IPv6 (true) or IPv4 (false) | |
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. | |
| void | AddTestCase (TestCase *testCase, TestDuration 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. | |
ping basic tests
Definition at line 88 of file ping-test.cc.
| PingTestCase::PingTestCase | ( | std::string | name, |
| bool | useIpv6 | ||
| ) |
Constructor.
| name | TestCase name. |
| useIpv6 | Use IPv6. |
Definition at line 270 of file ping-test.cc.
| void PingTestCase::CheckReportLoss | ( | uint16_t | expectedReportLoss | ) |
Enable the check on Lost pings.
| expectedReportLoss | Expected Lost. |
Definition at line 347 of file ping-test.cc.
References m_checkReportLoss, and m_expectedReportLoss.
| void PingTestCase::CheckReportReceived | ( | uint32_t | expectedReportRx | ) |
Enable the check on Rx pings.
| expectedReportRx | Expected Rx. |
Definition at line 340 of file ping-test.cc.
References m_checkReportReceived, and m_expectedReportRx.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:| void PingTestCase::CheckReportTime | ( | Time | expectedTime | ) |
Enable the check on average RTT.
| expectedTime | Expected RTT. |
Definition at line 354 of file ping-test.cc.
References m_checkReportTime, and m_expectedReportTime.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:| void PingTestCase::CheckReportTransmitted | ( | uint32_t | expectedReportTx | ) |
Enable the check on Tx pings.
| expectedReportTx | Expected Tx. |
Definition at line 333 of file ping-test.cc.
References m_checkReportTransmitted, and m_expectedReportTx.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:| void PingTestCase::CheckTraceRtt | ( | uint32_t | expectedRtt | ) |
Enable the check on Rtt event count in Rtt trace source.
| expectedRtt | Expected Rtt. |
Definition at line 468 of file ping-test.cc.
References m_checkTraceRtt, and m_expectedTraceRtt.
| void PingTestCase::CheckTraceTx | ( | uint32_t | expectedTx | ) |
Enable the check on Tx pings counted in Tx trace source.
| expectedTx | Expected Tx. |
Definition at line 461 of file ping-test.cc.
References m_checkTraceTx, and m_expectedTraceTx.
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 487 of file ping-test.cc.
References ns3::Node::AddApplication(), ns3::Ipv4Address::ConvertFrom(), ns3::Ipv6Address::ConvertFrom(), DropTraceSink(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::Ipv6InterfaceContainer::GetAddress(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::IsLinkLocalMulticast(), m_checkTraceRtt, m_checkTraceTx, m_countAttribute, m_countTraceRtt, m_countTraceTx, m_destination, m_devices, m_dropList, m_expectedTraceRtt, m_expectedTraceTx, m_interpacketInterval, m_ipv4Interfaces, m_ipv6Interfaces, m_nodes, m_simulatorStopTime, m_sizeAttribute, m_startTime, m_stopTime, m_useIpv6, ns3::MakeCallback(), NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_TEST_ASSERT_MSG_EQ, ns3::NeighborCacheHelper::PopulateNeighborCache(), ReportTraceSink(), RttTraceSink(), ns3::Simulator::Run(), ns3::Simulator::Stop(), and TxTraceSink().
Here is the call graph for this function:
|
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.
Reimplemented from ns3::TestCase.
Definition at line 277 of file ping-test.cc.
References ns3::Ipv4AddressHelper::Assign(), ns3::NodeContainer::Create(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::Object::GetObject(), ns3::SimpleNetDeviceHelper::Install(), ns3::InternetStackHelper::Install(), m_devices, m_ipv4Interfaces, m_ipv6Interfaces, m_mtu, m_nodes, m_useIpv6, ns3::MilliSeconds(), NS_LOG_FUNCTION, ns3::Ipv4AddressHelper::SetBase(), ns3::Ipv6AddressHelper::SetBase(), ns3::SimpleNetDeviceHelper::SetChannel(), ns3::SimpleNetDeviceHelper::SetDeviceAttribute(), ns3::InternetStackHelper::SetIpv4StackInstall(), ns3::InternetStackHelper::SetIpv6StackInstall(), and ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode().
Here is the call graph for this function:
|
overrideprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 327 of file ping-test.cc.
References ns3::Simulator::Destroy().
Here is the call graph for this function:
|
private |
Trace Drop events.
| seq | Sequence number. |
| reason | Drop reason. |
Definition at line 409 of file ping-test.cc.
References ns3::Ping::DROP_HOST_UNREACHABLE, ns3::Ping::DROP_NET_UNREACHABLE, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by DoRun().
Here is the caller graph for this function:
|
private |
Trace Report generation events.
| report | The report sample. |
Definition at line 427 of file ping-test.cc.
References ns3::Time::GetMicroSeconds(), m_checkReportLoss, m_checkReportReceived, m_checkReportTime, m_checkReportTransmitted, m_expectedReportLoss, m_expectedReportRx, m_expectedReportTime, m_expectedReportTx, ns3::Ping::PingReport::m_loss, ns3::Ping::PingReport::m_received, ns3::Ping::PingReport::m_rttMax, ns3::Ping::PingReport::m_rttMin, ns3::Ping::PingReport::m_transmitted, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, NS_TEST_ASSERT_MSG_EQ_TOL, and NS_TEST_ASSERT_MSG_GT_OR_EQ.
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Trace RTT events.
| seq | Sequence number. |
| rttSample | RTT sample. |
Definition at line 361 of file ping-test.cc.
References ns3::Time::As(), ns3::Time::GetSeconds(), m_countTraceRtt, m_sizeAttribute, m_useIpv6, ns3::Time::MS, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ_TOL.
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Set the number of pings to send.
| count | Number of pings to send. |
Definition at line 132 of file ping-test.cc.
References m_countAttribute.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:| void PingTestCase::SetDestinationAddress | ( | Address | address | ) |
Set the destination address (either IPv4 or IPv6).
| address | The destination address. |
Definition at line 481 of file ping-test.cc.
References m_destination.
|
inline |
Set the packet drop list on the Ping node's interface.
| dropList | packet drop list |
Definition at line 159 of file ping-test.cc.
References m_dropList.
|
inline |
Set the interval of pings.
| interval | Interval of pings. |
Definition at line 150 of file ping-test.cc.
References m_interpacketInterval.
| void PingTestCase::SetSimulatorStopTime | ( | Time | stopTime | ) |
Set the Simulation stop time.
| stopTime | The simulation stop time. |
Definition at line 475 of file ping-test.cc.
References m_simulatorStopTime, and stopTime.
|
inline |
Set the size of pings.
| size | Size of pings. |
Definition at line 141 of file ping-test.cc.
References m_sizeAttribute.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:
|
inline |
Set the PING start time.
| startTime | Ping start time. |
Definition at line 114 of file ping-test.cc.
References m_startTime.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:
|
inline |
Set the PING stop time.
| stopTime | Ping stop time. |
Definition at line 123 of file ping-test.cc.
References m_stopTime, and stopTime.
Referenced by PingTestSuite::PingTestSuite().
Here is the caller graph for this function:Trace TX events.
| seq | Sequence number. |
| p | Tx packet. |
Definition at line 391 of file ping-test.cc.
References m_countTraceTx, m_interpacketInterval, m_lastTx, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Seconds().
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Set to true to check the Loss number.
Definition at line 253 of file ping-test.cc.
Referenced by CheckReportLoss(), and ReportTraceSink().
|
private |
Set to true to check the Rx number.
Definition at line 252 of file ping-test.cc.
Referenced by CheckReportReceived(), and ReportTraceSink().
|
private |
Set to true to check the Time.
Definition at line 254 of file ping-test.cc.
Referenced by CheckReportTime(), and ReportTraceSink().
|
private |
Set to true to check the Tx number.
Definition at line 251 of file ping-test.cc.
Referenced by CheckReportTransmitted(), and ReportTraceSink().
|
private |
Set to true to check the Rtt number.
Definition at line 244 of file ping-test.cc.
Referenced by CheckTraceRtt(), and DoRun().
|
private |
Set to true to check the Tx number.
Definition at line 243 of file ping-test.cc.
Referenced by CheckTraceTx(), and DoRun().
|
private |
Number of pings to send.
Definition at line 234 of file ping-test.cc.
Referenced by DoRun(), and SetCount().
|
private |
Rtt trace counter.
Definition at line 241 of file ping-test.cc.
Referenced by DoRun(), and RttTraceSink().
|
private |
Tx trace counter.
Definition at line 240 of file ping-test.cc.
Referenced by DoRun(), and TxTraceSink().
|
private |
Destination address.
Definition at line 232 of file ping-test.cc.
Referenced by DoRun(), and SetDestinationAddress().
|
private |
|
private |
Drop first reply (true)
Definition at line 262 of file ping-test.cc.
Referenced by DoRun(), and SetDropList().
|
private |
Expected reported Loss.
Definition at line 248 of file ping-test.cc.
Referenced by CheckReportLoss(), and ReportTraceSink().
|
private |
Expected reported Rx.
Definition at line 247 of file ping-test.cc.
Referenced by CheckReportReceived(), and ReportTraceSink().
|
private |
Expected reported time.
Definition at line 249 of file ping-test.cc.
Referenced by CheckReportTime(), and ReportTraceSink().
|
private |
Expected reported Tx.
Definition at line 246 of file ping-test.cc.
Referenced by CheckReportTransmitted(), and ReportTraceSink().
|
private |
Expected Rtt trace sink calls.
Definition at line 238 of file ping-test.cc.
Referenced by CheckTraceRtt(), and DoRun().
|
private |
Expected Tx trace sink calls.
Definition at line 237 of file ping-test.cc.
Referenced by CheckTraceTx(), and DoRun().
|
private |
Time between pings.
Definition at line 260 of file ping-test.cc.
Referenced by DoRun(), SetInterval(), and TxTraceSink().
|
private |
The IPv4 interfaces.
Definition at line 265 of file ping-test.cc.
|
private |
The IPv6 interfaces.
Definition at line 266 of file ping-test.cc.
|
private |
|
private |
|
private |
The simulation nodes.
Definition at line 264 of file ping-test.cc.
|
private |
Simulator stop time.
Definition at line 258 of file ping-test.cc.
Referenced by DoRun(), and SetSimulatorStopTime().
|
private |
Size of pings.
Definition at line 235 of file ping-test.cc.
Referenced by DoRun(), RttTraceSink(), and SetSize().
|
private |
|
private |
|
private |
Use IPv6 (true) or IPv4 (false)
Definition at line 259 of file ping-test.cc.
Referenced by DoRun(), DoSetup(), and RttTraceSink().