AODV deferred route lookup test case (see Bug 772 ) More...
#include "bug-772.h"
Public Member Functions | |
Bug772ChainTest (const char *const prefix, const char *const proto, Time time, uint32_t size) | |
Create test case. | |
~Bug772ChainTest () override | |
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 | CheckResults () |
Compare traces with reference ones. | |
void | CreateDevices () |
Create devices, install TCP/IP stack and applications. | |
void | CreateNodes () |
Create test topology. | |
void | DoRun () override |
Go. | |
void | HandleRead (Ptr< Socket > socket) |
Receive data function. | |
void | SendData (Ptr< Socket > socket) |
Send data. | |
Private Attributes | |
NodeContainer * | m_nodes |
const uint16_t | m_port |
port number | |
const std::string | m_prefix |
PCAP file names prefix. | |
const std::string | m_proto |
Socket factory TID. | |
uint32_t | m_receivedPackets |
Received packet count. | |
Ptr< Socket > | m_recvSocket |
Receiving socket. | |
Ptr< Socket > | m_sendSocket |
Transmitting socket. | |
const uint32_t | m_size |
Chain size. | |
const double | m_step |
Chain step, meters. | |
const Time | m_time |
Total simulation time. | |
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... | |
Static Public Attributes inherited from ns3::TestCase | |
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 |
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. | |
AODV deferred route lookup test case (see Bug 772 )
UDP packet transfers are delayed while a route is found and then while ARP completes. Eight packets should be sent, queued until the path becomes functional, and then delivered.
Bug772ChainTest::Bug772ChainTest | ( | const char *const | prefix, |
const char *const | proto, | ||
Time | time, | ||
uint32_t | size ) |
Create test case.
prefix | Unique file names prefix |
proto | ns3::UdpSocketFactory or ns3::TcpSocketFactory |
size | Number of nodes in the chain |
time | Simulation time |
Definition at line 38 of file bug-772.cc.
|
override |
Definition at line 54 of file bug-772.cc.
References m_nodes.
|
private |
Compare traces with reference ones.
Definition at line 200 of file bug-772.cc.
References m_receivedPackets, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun().
|
private |
Create devices, install TCP/IP stack and applications.
Definition at line 124 of file bug-772.cc.
References ns3::AodvHelper::AssignStreams(), ns3::InternetStackHelper::AssignStreams(), ns3::WifiHelper::AssignStreams(), ns3::YansWifiChannelHelper::AssignStreams(), ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::YansWifiChannelHelper::Create(), ns3::Socket::CreateSocket(), ns3::YansWifiChannelHelper::Default(), ns3::WifiPhyHelper::DisablePreambleDetectionModel(), ns3::NodeContainer::Get(), ns3::Ipv4Address::GetAny(), ns3::Node::GetId(), ns3::Socket::GetNode(), HandleRead(), ns3::InternetStackHelper::Install(), ns3::Socket::Listen(), ns3::TypeId::LookupByName(), m_nodes, m_port, m_proto, m_recvSocket, m_sendSocket, m_size, ns3::MakeCallback(), NS_TEST_ASSERT_MSG_EQ, ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), SendData(), ns3::WifiPhyHelper::Set(), ns3::Socket::SetAllowBroadcast(), ns3::YansWifiPhyHelper::SetChannel(), ns3::WifiPhyHelper::SetErrorRateModel(), ns3::Socket::SetRecvCallback(), ns3::InternetStackHelper::SetRoutingHelper(), ns3::WifiMacHelper::SetType(), ns3::Socket::ShutdownSend(), and ns3::WIFI_STANDARD_80211a.
Referenced by DoRun().
|
private |
Create test topology.
Definition at line 101 of file bug-772.cc.
References ns3::NodeContainer::Create(), m_nodes, m_size, and m_step.
Referenced by DoRun().
|
overrideprivatevirtual |
Go.
Implements ns3::TestCase.
Definition at line 80 of file bug-772.cc.
References CheckResults(), CreateDevices(), CreateNodes(), ns3::Simulator::Destroy(), m_nodes, m_time, ns3::Simulator::Run(), ns3::Seconds(), ns3::Config::SetDefault(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), and ns3::Simulator::Stop().
Receive data function.
socket | the socket to receive from |
Definition at line 74 of file bug-772.cc.
References m_receivedPackets.
Referenced by CreateDevices().
Send data.
socket | the sending socket |
Definition at line 60 of file bug-772.cc.
References ns3::Create(), m_time, ns3::Simulator::Now(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), and SendData().
Referenced by CreateDevices(), and SendData().
|
private |
Definition at line 44 of file bug-772.h.
Referenced by ~Bug772ChainTest(), CreateDevices(), CreateNodes(), and DoRun().
|
private |
|
private |
|
private |
|
private |
Received packet count.
Definition at line 79 of file bug-772.h.
Referenced by CheckResults(), and HandleRead().
|
private |
Chain size.
Definition at line 53 of file bug-772.h.
Referenced by CreateDevices(), and CreateNodes().
|
private |
|
private |
Total simulation time.
Definition at line 51 of file bug-772.h.
Referenced by DoRun(), and SendData().