AODV chain regression test. More...
#include "aodv-regression.h"
Inheritance diagram for ChainRegressionTest:
Collaboration diagram for ChainRegressionTest:Public Member Functions | |
| ChainRegressionTest (const char *const prefix, Time time=Seconds(10), uint32_t size=5, Time arpAliveTimeout=Seconds(120)) | |
| Create test case. | |
| ~ChainRegressionTest () 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 | SendPing () |
| Send one ping. | |
Private Attributes | |
| const Time | m_arpAliveTimeout |
| ARP alive timeout. | |
| NodeContainer * | m_nodes |
| const std::string | m_prefix |
| PCAP file names prefix. | |
| uint16_t | m_seq |
| Sequence number. | |
| const uint32_t | m_size |
| Chain size. | |
| Ptr< Socket > | m_socket |
| Socket. | |
| const double | m_step |
| Chain step, meters. | |
| const Time | m_time |
| Total simulation time. | |
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. | |
AODV chain regression test.
This script creates 1-dimensional grid topology and then ping last node from the first one:
[10.1.1.1] <– step --> [10.1.1.2] <– step --> [10.1.1.3] <– step --> [10.1.1.4] <– step --> [10.1.1.5]
Each node can hear only his right and his left neighbor, if they exist. When one third of total time expired, central node moves away. After this, node 3 doesn't hear any packets from other nodes and nobody hears his packets. We want to demonstrate in this script 1) route establishing 2) broken link detection both from layer 2 information and hello messages.
Expected packets time diagram.
1 2 3 4 5
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1,
hop=0, ID=1, org_seqno=1) src = 10.1.1.1
|<------|------>| | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1,
hop=1, ID=1, org_seqno=1) src = 10.1.1.2 | |<------|------>| | RREQ
(orig 10.1.1.1, dst 10.1.1.5, G=1, U=1, hop=2, ID=1, org_seqno=1) src = 10.1.1.3 | |
|<------|------>| RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1, hop=3, ID=1, org_seqno=1) src
= 10.1.1.4 | | | |<------|------> ARP request. Who has 10.1.1.4? Tell 10.1.1.5 |
| | |======>| ARP reply | | | |<======| RREP
(orig 10.1.1.1, dst 10.1.1.5, hop=0, dst_seqno=0) src=10.1.1.5 | | |<------|------>| ARP
request. Who has 10.1.1.3? Tell 10.1.1.4 | | |======>| | ARP reply | |
|<======| | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=1, dst_seqno=0) src=10.1.1.4 |
|<------|------>| | ARP request. Who has 10.1.1.2? Tell 10.1.1.3 | |======>| | |
ARP reply | |<======| | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=2,
dst_seqno=0) src=10.1.1.3
|<------|------>| | | ARP request. Who has 10.1.1.1? Tell 10.1.1.2
|======>| | | | ARP reply
|<======| | | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=3,
dst_seqno=0) src=10.1.1.2
<-------|------>| | | | ARP request. Who has 10.1.1.2? Tell 10.1.1.1
|<======| | | |
|======>| | | | ICMP (ping) request 0 from 10.1.1.1 to 10.1.1.5;
src=10.1.1.1 next_hop=10.1.1.2
|<------|------>| | | ARP request. Who has 10.1.1.3? Tell 10.1.1.2
| |<======| | | ARP reply
| |======>| | | ICMP (ping) request 0 from 10.1.1.1 to 10.1.1.5;
src=10.1.1.2 next_hop=10.1.1.3 | |<------|------>| | ARP request. Who
has 10.1.1.4? Tell 10.1.1.3 | | |<======| | ARP reply | | |======>|
| ICMP (ping) request 0 from 10.1.1.1 to 10.1.1.5; src=10.1.1.3 next_hop=10.1.1.4 | |
|<------|------>| ARP request. Who has 10.1.1.5? Tell 10.1.1.4 | | | |<======|
ARP reply | | | |======>| ICMP (ping) request 0; src=10.1.1.4
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 0; src=10.1.1.5
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 0; src=10.1.1.4
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 0; src=10.1.1.3
next_hop=10.1.1.2
|<======| | | | ICMP (ping) reply 0; src=10.1.1.2
next_hop=10.1.1.1 | | | |<------|------> Hello
|<------|------>| | | Hello
<------|------>| | | | Hello
| |<------|------>| | Hello
|======>| | | | ICMP (ping) request 1; src=10.1.1.1
next_hop=10.1.1.2 | | |<------|------>| Hello | |======>| | |
ICMP (ping) request 1; src=10.1.1.2 next_hop=10.1.1.3 | | |======>| | ICMP
(ping) request 1; src=10.1.1.3 next_hop=10.1.1.4 | | | |======>| ICMP
(ping) request 1; src=10.1.1.4 next_hop=10.1.1.5 | | | |<======| ICMP
(ping) reply 1; src=10.1.1.5 next_hop=10.1.1.4 | | |<======| | ICMP (ping)
reply 1; src=10.1.1.4 next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply
11; src=10.1.1.3 next_hop=10.1.1.2
|<======| | | | ICMP (ping) reply 1; src=10.1.1.2
next_hop=10.1.1.1 | | | |<------|------> Hello
|<------|------>| | | Hello
<------|------>| | | | Hello
| | |<------|------>| Hello
| |<------|------>| | Hello
|======>| | | | ICMP (ping) request 2; src=10.1.1.1
next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 2; src=10.1.1.2
next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 2; src=10.1.1.3
next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 2; src=10.1.1.4
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 2; src=10.1.1.5
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 2; src=10.1.1.4
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 2; src=10.1.1.3
next_hop=10.1.1.2
|<======| | | | ICMP (ping) reply 2; src=10.1.1.2
next_hop=10.1.1.1 | | | |<------|------> Hello
<------|------>| | | | Hello
| |<------|------>| | Hello
|<------|------>| | | Hello
| | |<------|------>| Hello
|======>| | | | ICMP (ping) request 3; src=10.1.1.1
next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 3; src=10.1.1.2
next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 3; src=10.1.1.3
next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 3; src=10.1.1.4
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 3; src=10.1.1.5
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 3; src=10.1.1.4
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 3; src=10.1.1.3
next_hop=10.1.1.2
|<======| | | | ICMP (ping) reply 3; src=10.1.1.2
next_hop=10.1.1.1 | | | |<------|------> Hello
<------|------>| | | | Hello
|<------|--> | | | Hello |
| | <--|--> | | Hello |Node 3 move away => nobody hear his
packets and node 3 doesn't hear anything ! | | | <--|------>| Hello |
|======>| | | | ICMP (ping) request 4; src=10.1.1.1
next_hop=10.1.1.2 | |==> | | | ICMP (ping) request 4; src=10.1.1.2
next_hop=10.1.1.3. 7 retries.
|<======| | | | RERR (unreachable dst 10.1.1.3 & 10.1.1.5)
src=10.1.1.2 | | | |<------|------> Hello
<------|------>| | | | Hello
|<------|--> | | | Hello
| | <--|--> | | Hello
| | | <--|------>| Hello
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=0,
ID=2, org_seqno=2) src = 10.1.1.1
|<------|--> | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=1,
ID=2, org_seqno=2) src = 10.1.1.2 | | | |<------|------> Hello | | |
<--|------>| Hello | | <--|--> | | Hello
|<------|--> | | | Hello
<------|------>| | | | Hello
| | | |======>| RERR (unreachable dst 10.1.1.1 & 10.1.1.3)
src=10.1.1.4 | | | |<------|------> Hello | | | <--|------>| Hello
| | <--|--> | | Hello
|<------|--> | | | Hello
<------|------>| | | | Hello
| | | |<------|------> Hello
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=0,
ID=4, org_seqno=3) src = 10.1.1.1
|<------|--> | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=1,
ID=4, org_seqno=3) src = 10.1.1.2
..................................................................
*
Definition at line 162 of file aodv-regression.h.
|
override |
Definition at line 89 of file aodv-regression.cc.
References m_nodes.
|
private |
Compare traces with reference ones.
Definition at line 236 of file aodv-regression.cc.
References m_prefix, m_size, and NS_PCAP_TEST_EXPECT_EQ.
Referenced by DoRun().
Here is the caller graph for this function:
|
private |
Create devices, install TCP/IP stack and applications.
Definition at line 171 of file aodv-regression.cc.
References ns3::AodvHelper::AssignStreams(), ns3::InternetStackHelper::AssignStreams(), ns3::YansWifiChannelHelper::AssignStreams(), ns3::Socket::Bind(), ns3::Socket::Connect(), ns3::YansWifiChannelHelper::Create(), ns3::Socket::CreateSocket(), ns3::TestCase::CreateTempDirFilename(), ns3::YansWifiChannelHelper::Default(), ns3::WifiPhyHelper::DisablePreambleDetectionModel(), ns3::PcapHelperForDevice::EnablePcapAll(), ns3::NodeContainer::Get(), ns3::Ipv4Address::GetAny(), ns3::InternetStackHelper::Install(), ns3::TypeId::LookupByName(), m_nodes, m_prefix, m_size, m_socket, NS_TEST_ASSERT_MSG_EQ, SendPing(), ns3::ObjectBase::SetAttribute(), ns3::YansWifiPhyHelper::SetChannel(), ns3::WifiPhyHelper::SetErrorRateModel(), ns3::InternetStackHelper::SetRoutingHelper(), ns3::WifiMacHelper::SetType(), and ns3::WIFI_STANDARD_80211a.
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Create test topology.
Definition at line 148 of file aodv-regression.cc.
References ns3::NodeContainer::Create(), m_nodes, m_size, and m_step.
Referenced by DoRun().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overrideprivatevirtual |
Go.
Implements ns3::TestCase.
Definition at line 124 of file aodv-regression.cc.
References CheckResults(), CreateDevices(), CreateNodes(), ns3::Simulator::Destroy(), ns3::NodeContainer::Get(), m_arpAliveTimeout, m_nodes, m_size, m_time, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Config::SetDefault(), ns3::MobilityModel::SetPosition(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), and ns3::Simulator::Stop().
Here is the call graph for this function:
|
private |
Send one ping.
Definition at line 95 of file aodv-regression.cc.
References 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(), SendPing(), ns3::Icmpv4Header::SetCode(), ns3::Icmpv4Echo::SetData(), ns3::Icmpv4Echo::SetIdentifier(), ns3::Icmpv4Echo::SetSequenceNumber(), and ns3::Icmpv4Header::SetType().
Referenced by CreateDevices(), and SendPing().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
|
private |
Definition at line 182 of file aodv-regression.h.
Referenced by ~ChainRegressionTest(), CreateDevices(), CreateNodes(), and DoRun().
|
private |
PCAP file names prefix.
Definition at line 185 of file aodv-regression.h.
Referenced by CheckResults(), and CreateDevices().
|
private |
|
private |
Chain size.
Definition at line 189 of file aodv-regression.h.
Referenced by CheckResults(), CreateDevices(), CreateNodes(), and DoRun().
Socket.
Definition at line 195 of file aodv-regression.h.
Referenced by CreateDevices(), and SendPing().
|
private |
|
private |
Total simulation time.
Definition at line 187 of file aodv-regression.h.
Referenced by DoRun(), and SendPing().