#include "bug780-test.h"
Public Member Functions | |
Bug780Test () | |
~Bug780Test () override | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | CreateNodes () |
Create & configure test network. More... | |
void | DoRun () override |
Implementation to actually run this TestCase. More... | |
void | Receive (Ptr< Socket > socket) |
Receive echo reply. More... | |
void | SendPing () |
Send one ping. More... | |
Private Attributes | |
uint16_t | m_recvCount |
Received ECHO Reply counter. More... | |
uint16_t | m_seq |
Sequence number. More... | |
Ptr< Socket > | m_socket |
Socket. More... | |
const Time | m_time |
Total simulation time. More... | |
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... | |
TestCase * | GetParent () const |
Get the parent of this TestCase. More... | |
bool | IsStatusFailure () const |
Check if any tests failed. More... | |
bool | IsStatusSuccess () 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 () const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure () 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... | |
See Bug 780
Definition at line 40 of file bug780-test.h.
ns3::olsr::Bug780Test::Bug780Test | ( | ) |
Definition at line 47 of file bug780-test.cc.
|
override |
Definition at line 55 of file bug780-test.cc.
|
private |
Create & configure test network.
Definition at line 75 of file bug780-test.cc.
References ns3::Ipv4AddressHelper::Assign(), ns3::Socket::Bind(), ns3::SimpleChannel::BlackList(), ns3::Socket::Connect(), ns3::NodeContainer::Create(), ns3::Socket::CreateSocket(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::Ipv4InterfaceContainer::GetAddress(), ns3::Ipv4Address::GetAny(), ns3::SimpleNetDeviceHelper::Install(), nsclick-simple-lan::internet, ns3::TypeId::LookupByName(), m_socket, ns3::MakeCallback(), NS_TEST_EXPECT_MSG_EQ, Receive(), ns3::Simulator::Schedule(), ns3::Seconds(), SendPing(), ns3::ObjectBase::SetAttribute(), ns3::Ipv4AddressHelper::SetBase(), ns3::SimpleNetDeviceHelper::SetChannelAttribute(), ns3::SimpleNetDeviceHelper::SetDeviceAttribute(), and ns3::Socket::SetRecvCallback().
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 60 of file bug780-test.cc.
References CreateNodes(), ns3::Simulator::Destroy(), m_recvCount, m_time, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), and ns3::Simulator::Stop().
Receive echo reply.
socket | the socket |
Definition at line 149 of file bug780-test.cc.
References ns3::InetSocketAddress::ConvertFrom(), ns3::InetSocketAddress::GetPort(), ns3::Socket::GetRxAvailable(), ns3::Icmpv4Header::GetType(), ns3::Icmpv4Header::ICMPV4_ECHO_REPLY, nsclick-simple-lan::ipv4, ns3::InetSocketAddress::IsMatchingType(), m_recvCount, m_socket, NS_ASSERT, ns3::Socket::RecvFrom(), and ns3::Packet::RemoveHeader().
Referenced by CreateNodes().
|
private |
Send one ping.
Definition at line 120 of file bug780-test.cc.
References ns3::Packet::AddHeader(), ns3::Node::ChecksumEnabled(), ns3::Icmpv4Header::EnableChecksum(), ns3::Icmpv4Header::ICMPV4_ECHO, m_seq, m_socket, m_time, ns3::Simulator::Now(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::Socket::Send(), ns3::Icmpv4Header::SetCode(), ns3::Icmpv4Echo::SetData(), ns3::Icmpv4Echo::SetIdentifier(), ns3::Icmpv4Echo::SetSequenceNumber(), and ns3::Icmpv4Header::SetType().
Referenced by CreateNodes().
|
private |
Received ECHO Reply counter.
Definition at line 64 of file bug780-test.h.
|
private |
Definition at line 60 of file bug780-test.h.
Referenced by CreateNodes(), Receive(), and SendPing().
|
private |
Total simulation time.
Definition at line 48 of file bug780-test.h.
Referenced by DoRun(), and SendPing().