A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
aodv-regression.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 IITP RAS
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Pavel Boyko <boyko@iitp.ru>
7
*/
8
9
#ifndef AODV_REGRESSION_H
10
#define AODV_REGRESSION_H
11
12
#include "ns3/node-container.h"
13
#include "ns3/nstime.h"
14
#include "ns3/socket.h"
15
#include "ns3/test.h"
16
17
using namespace
ns3
;
18
19
/**
20
* @ingroup aodv
21
*
22
* @brief AODV chain regression test
23
*
24
* This script creates 1-dimensional grid topology and then ping last node from the first one:
25
*/
26
27
// clang-format off
28
/**
29
* [10.1.1.1] <-- step --> [10.1.1.2] <-- step --> [10.1.1.3] <-- step --> [10.1.1.4] <-- step --> [10.1.1.5]
30
*/
31
// clang-format on
32
33
/**
34
* Each node can hear only his right and his left neighbor, if they exist.
35
* When one third of total time expired, central node moves away.
36
* After this, node 3 doesn't hear any packets from other nodes and nobody hears his packets.
37
* We want to demonstrate in this script
38
* 1) route establishing
39
* 2) broken link detection both from layer 2 information and hello messages.
40
*
41
*/
42
// clang-format off
43
/**
44
* \verbatim
45
Expected packets time diagram.
46
47
1 2 3 4 5
48
<-------|------>| | | | 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
49
|<------|------>| | | 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
50
| |<------|------>| | 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
51
| | |<------|------>| 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
52
| | | |<------|------> ARP request. Who has 10.1.1.4? Tell 10.1.1.5
53
| | | |======>| ARP reply
54
| | | |<======| RREP (orig 10.1.1.1, dst 10.1.1.5, hop=0, dst_seqno=0) src=10.1.1.5
55
| | |<------|------>| ARP request. Who has 10.1.1.3? Tell 10.1.1.4
56
| | |======>| | ARP reply
57
| | |<======| | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=1, dst_seqno=0) src=10.1.1.4
58
| |<------|------>| | ARP request. Who has 10.1.1.2? Tell 10.1.1.3
59
| |======>| | | ARP reply
60
| |<======| | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=2, dst_seqno=0) src=10.1.1.3
61
|<------|------>| | | ARP request. Who has 10.1.1.1? Tell 10.1.1.2
62
|======>| | | | ARP reply
63
|<======| | | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=3, dst_seqno=0) src=10.1.1.2
64
<-------|------>| | | | ARP request. Who has 10.1.1.2? Tell 10.1.1.1
65
|<======| | | |
66
|======>| | | | 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
67
|<------|------>| | | ARP request. Who has 10.1.1.3? Tell 10.1.1.2
68
| |<======| | | ARP reply
69
| |======>| | | 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
70
| |<------|------>| | ARP request. Who has 10.1.1.4? Tell 10.1.1.3
71
| | |<======| | ARP reply
72
| | |======>| | 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
73
| | |<------|------>| ARP request. Who has 10.1.1.5? Tell 10.1.1.4
74
| | | |<======| ARP reply
75
| | | |======>| ICMP (ping) request 0; src=10.1.1.4 next_hop=10.1.1.5
76
| | | |<======| ICMP (ping) reply 0; src=10.1.1.5 next_hop=10.1.1.4
77
| | |<======| | ICMP (ping) reply 0; src=10.1.1.4 next_hop=10.1.1.3
78
| |<======| | | ICMP (ping) reply 0; src=10.1.1.3 next_hop=10.1.1.2
79
|<======| | | | ICMP (ping) reply 0; src=10.1.1.2 next_hop=10.1.1.1
80
| | | |<------|------> Hello
81
|<------|------>| | | Hello
82
<-------|------>| | | | Hello
83
| |<------|------>| | Hello
84
|======>| | | | ICMP (ping) request 1; src=10.1.1.1 next_hop=10.1.1.2
85
| | |<------|------>| Hello
86
| |======>| | | ICMP (ping) request 1; src=10.1.1.2 next_hop=10.1.1.3
87
| | |======>| | ICMP (ping) request 1; src=10.1.1.3 next_hop=10.1.1.4
88
| | | |======>| ICMP (ping) request 1; src=10.1.1.4 next_hop=10.1.1.5
89
| | | |<======| ICMP (ping) reply 1; src=10.1.1.5 next_hop=10.1.1.4
90
| | |<======| | ICMP (ping) reply 1; src=10.1.1.4 next_hop=10.1.1.3
91
| |<======| | | ICMP (ping) reply 11; src=10.1.1.3 next_hop=10.1.1.2
92
|<======| | | | ICMP (ping) reply 1; src=10.1.1.2 next_hop=10.1.1.1
93
| | | |<------|------> Hello
94
|<------|------>| | | Hello
95
<-------|------>| | | | Hello
96
| | |<------|------>| Hello
97
| |<------|------>| | Hello
98
|======>| | | | ICMP (ping) request 2; src=10.1.1.1 next_hop=10.1.1.2
99
| |======>| | | ICMP (ping) request 2; src=10.1.1.2 next_hop=10.1.1.3
100
| | |======>| | ICMP (ping) request 2; src=10.1.1.3 next_hop=10.1.1.4
101
| | | |======>| ICMP (ping) request 2; src=10.1.1.4 next_hop=10.1.1.5
102
| | | |<======| ICMP (ping) reply 2; src=10.1.1.5 next_hop=10.1.1.4
103
| | |<======| | ICMP (ping) reply 2; src=10.1.1.4 next_hop=10.1.1.3
104
| |<======| | | ICMP (ping) reply 2; src=10.1.1.3 next_hop=10.1.1.2
105
|<======| | | | ICMP (ping) reply 2; src=10.1.1.2 next_hop=10.1.1.1
106
| | | |<------|------> Hello
107
<-------|------>| | | | Hello
108
| |<------|------>| | Hello
109
|<------|------>| | | Hello
110
| | |<------|------>| Hello
111
|======>| | | | ICMP (ping) request 3; src=10.1.1.1 next_hop=10.1.1.2
112
| |======>| | | ICMP (ping) request 3; src=10.1.1.2 next_hop=10.1.1.3
113
| | |======>| | ICMP (ping) request 3; src=10.1.1.3 next_hop=10.1.1.4
114
| | | |======>| ICMP (ping) request 3; src=10.1.1.4 next_hop=10.1.1.5
115
| | | |<======| ICMP (ping) reply 3; src=10.1.1.5 next_hop=10.1.1.4
116
| | |<======| | ICMP (ping) reply 3; src=10.1.1.4 next_hop=10.1.1.3
117
| |<======| | | ICMP (ping) reply 3; src=10.1.1.3 next_hop=10.1.1.2
118
|<======| | | | ICMP (ping) reply 3; src=10.1.1.2 next_hop=10.1.1.1
119
| | | |<------|------> Hello
120
<-------|------>| | | | Hello
121
|<------|--> | | | Hello |
122
| | <--|--> | | Hello |Node 3 move away => nobody hear his packets and node 3 doesn't hear anything !
123
| | | <--|------>| Hello |
124
|======>| | | | ICMP (ping) request 4; src=10.1.1.1 next_hop=10.1.1.2
125
| |==> | | | ICMP (ping) request 4; src=10.1.1.2 next_hop=10.1.1.3. 7 retries.
126
|<======| | | | RERR (unreachable dst 10.1.1.3 & 10.1.1.5) src=10.1.1.2
127
| | | |<------|------> Hello
128
<-------|------>| | | | Hello
129
|<------|--> | | | Hello
130
| | <--|--> | | Hello
131
| | | <--|------>| Hello
132
<-------|------>| | | | 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
133
|<------|--> | | | 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
134
| | | |<------|------> Hello
135
| | | <--|------>| Hello
136
| | <--|--> | | Hello
137
|<------|--> | | | Hello
138
<-------|------>| | | | Hello
139
| | | |======>| RERR (unreachable dst 10.1.1.1 & 10.1.1.3) src=10.1.1.4
140
| | | |<------|------> Hello
141
| | | <--|------>| Hello
142
| | <--|--> | | Hello
143
|<------|--> | | | Hello
144
<-------|------>| | | | Hello
145
| | | |<------|------> Hello
146
<-------|------>| | | | 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
147
|<------|--> | | | 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
148
.................................................
149
\endverbatim
150
*/
151
//clang-format on
152
class
ChainRegressionTest
:
public
TestCase
153
{
154
public
:
155
/**
156
* Create test case
157
*
158
* \param prefix Unique file names prefix
159
* \param size Number of nodes in the chain
160
* \param time Simulation time
161
* \param arpAliveTimeout ARP alive timeout, this is used to check that ARP and routing do
162
* not interfere
163
*/
164
ChainRegressionTest
(
const
char
*
const
prefix,
165
Time
time =
Seconds
(10),
166
uint32_t
size = 5,
167
Time
arpAliveTimeout =
Seconds
(120));
168
~ChainRegressionTest
()
override
;
169
170
private
:
171
/// \internal It is important to have pointers here
172
NodeContainer
*
m_nodes
;
173
174
/// PCAP file names prefix
175
const
std::string
m_prefix
;
176
/// Total simulation time
177
const
Time
m_time
;
178
/// Chain size
179
const
uint32_t
m_size
;
180
/// Chain step, meters
181
const
double
m_step
;
182
/// ARP alive timeout
183
const
Time
m_arpAliveTimeout
;
184
/// Socket
185
Ptr<Socket>
m_socket
;
186
/// Sequence number
187
uint16_t
m_seq
;
188
189
/// Create test topology
190
void
CreateNodes
();
191
/// Create devices, install TCP/IP stack and applications
192
void
CreateDevices
();
193
/// Compare traces with reference ones
194
void
CheckResults
();
195
/// Go
196
void
DoRun
()
override
;
197
/// Send one ping
198
void
SendPing
();
199
};
200
201
#endif
/* AODV_REGRESSION_H */
ChainRegressionTest
AODV chain regression test.
Definition
aodv-regression.h:153
ChainRegressionTest::m_size
const uint32_t m_size
Chain size.
Definition
aodv-regression.h:179
ChainRegressionTest::CreateNodes
void CreateNodes()
Create test topology.
Definition
aodv-regression.cc:138
ChainRegressionTest::DoRun
void DoRun() override
Go.
Definition
aodv-regression.cc:114
ChainRegressionTest::m_seq
uint16_t m_seq
Sequence number.
Definition
aodv-regression.h:187
ChainRegressionTest::SendPing
void SendPing()
Send one ping.
Definition
aodv-regression.cc:85
ChainRegressionTest::m_arpAliveTimeout
const Time m_arpAliveTimeout
ARP alive timeout.
Definition
aodv-regression.h:183
ChainRegressionTest::m_step
const double m_step
Chain step, meters.
Definition
aodv-regression.h:181
ChainRegressionTest::~ChainRegressionTest
~ChainRegressionTest() override
Definition
aodv-regression.cc:79
ChainRegressionTest::m_nodes
NodeContainer * m_nodes
Definition
aodv-regression.h:172
ChainRegressionTest::CheckResults
void CheckResults()
Compare traces with reference ones.
Definition
aodv-regression.cc:226
ChainRegressionTest::m_time
const Time m_time
Total simulation time.
Definition
aodv-regression.h:177
ChainRegressionTest::m_prefix
const std::string m_prefix
PCAP file names prefix.
Definition
aodv-regression.h:175
ChainRegressionTest::m_socket
Ptr< Socket > m_socket
Socket.
Definition
aodv-regression.h:185
ChainRegressionTest::CreateDevices
void CreateDevices()
Create devices, install TCP/IP stack and applications.
Definition
aodv-regression.cc:161
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
uint32_t
ChainRegressionTest::ChainRegressionTest
ChainRegressionTest(const char *const prefix, Time time=Seconds(10), uint32_t size=5, Time arpAliveTimeout=Seconds(120))
Create test case.
Definition
aodv-regression.cc:64
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1345
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
aodv
test
aodv-regression.h
Generated on Tue Apr 29 2025 11:06:50 for ns-3 by
1.11.0