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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Authors: Pavel Boyko <boyko@iitp.ru>
18
*/
19
20
#ifndef AODV_REGRESSION_H
21
#define AODV_REGRESSION_H
22
23
#include "ns3/node-container.h"
24
#include "ns3/nstime.h"
25
#include "ns3/socket.h"
26
#include "ns3/test.h"
27
28
using namespace
ns3
;
29
30
/**
31
* \ingroup aodv
32
*
33
* \brief AODV chain regression test
34
*
35
* This script creates 1-dimensional grid topology and then ping last node from the first one:
36
*
37
* [10.1.1.1] <-- step --> [10.1.1.2] <-- step --> [10.1.1.3] <-- step --> [10.1.1.4] <-- step -->
38
[10.1.1.5]
39
*
40
* Each node can hear only his right and his left neighbor, if they exist. When one third of total
41
time expired,
42
* central node moves away. After this, node 3 doesn't hear any packets from other nodes and nobody
43
hears his packets.
44
* We want to demonstrate in this script
45
* 1) route establishing
46
* 2) broken link detection both from layer 2 information and hello messages.
47
*
48
* \verbatim
49
Expected packets time diagram.
50
1 2 3 4 5
51
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1,
52
hop=0, ID=1, org_seqno=1) src = 10.1.1.1
53
|<------|------>| | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1,
54
hop=1, ID=1, org_seqno=1) src = 10.1.1.2 | |<------|------>| | RREQ
55
(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 | |
56
|<------|------>| RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, U=1, hop=3, ID=1, org_seqno=1) src
57
= 10.1.1.4 | | | |<------|------> ARP request. Who has 10.1.1.4? Tell 10.1.1.5 |
58
| | |======>| ARP reply | | | |<======| RREP
59
(orig 10.1.1.1, dst 10.1.1.5, hop=0, dst_seqno=0) src=10.1.1.5 | | |<------|------>| ARP
60
request. Who has 10.1.1.3? Tell 10.1.1.4 | | |======>| | ARP reply | |
61
|<======| | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=1, dst_seqno=0) src=10.1.1.4 |
62
|<------|------>| | ARP request. Who has 10.1.1.2? Tell 10.1.1.3 | |======>| | |
63
ARP reply | |<======| | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=2,
64
dst_seqno=0) src=10.1.1.3
65
|<------|------>| | | ARP request. Who has 10.1.1.1? Tell 10.1.1.2
66
|======>| | | | ARP reply
67
|<======| | | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=3,
68
dst_seqno=0) src=10.1.1.2
69
<-------|------>| | | | ARP request. Who has 10.1.1.2? Tell 10.1.1.1
70
|<======| | | |
71
|======>| | | | ICMP (ping) request 0 from 10.1.1.1 to 10.1.1.5;
72
src=10.1.1.1 next_hop=10.1.1.2
73
|<------|------>| | | ARP request. Who has 10.1.1.3? Tell 10.1.1.2
74
| |<======| | | ARP reply
75
| |======>| | | ICMP (ping) request 0 from 10.1.1.1 to 10.1.1.5;
76
src=10.1.1.2 next_hop=10.1.1.3 | |<------|------>| | ARP request. Who
77
has 10.1.1.4? Tell 10.1.1.3 | | |<======| | ARP reply | | |======>|
78
| 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 | |
79
|<------|------>| ARP request. Who has 10.1.1.5? Tell 10.1.1.4 | | | |<======|
80
ARP reply | | | |======>| ICMP (ping) request 0; src=10.1.1.4
81
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 0; src=10.1.1.5
82
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 0; src=10.1.1.4
83
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 0; src=10.1.1.3
84
next_hop=10.1.1.2
85
|<======| | | | ICMP (ping) reply 0; src=10.1.1.2
86
next_hop=10.1.1.1 | | | |<------|------> Hello
87
|<------|------>| | | Hello
88
<------|------>| | | | Hello
89
| |<------|------>| | Hello
90
|======>| | | | ICMP (ping) request 1; src=10.1.1.1
91
next_hop=10.1.1.2 | | |<------|------>| Hello | |======>| | |
92
ICMP (ping) request 1; src=10.1.1.2 next_hop=10.1.1.3 | | |======>| | ICMP
93
(ping) request 1; src=10.1.1.3 next_hop=10.1.1.4 | | | |======>| ICMP
94
(ping) request 1; src=10.1.1.4 next_hop=10.1.1.5 | | | |<======| ICMP
95
(ping) reply 1; src=10.1.1.5 next_hop=10.1.1.4 | | |<======| | ICMP (ping)
96
reply 1; src=10.1.1.4 next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply
97
11; src=10.1.1.3 next_hop=10.1.1.2
98
|<======| | | | ICMP (ping) reply 1; src=10.1.1.2
99
next_hop=10.1.1.1 | | | |<------|------> Hello
100
|<------|------>| | | Hello
101
<------|------>| | | | Hello
102
| | |<------|------>| Hello
103
| |<------|------>| | Hello
104
|======>| | | | ICMP (ping) request 2; src=10.1.1.1
105
next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 2; src=10.1.1.2
106
next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 2; src=10.1.1.3
107
next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 2; src=10.1.1.4
108
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 2; src=10.1.1.5
109
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 2; src=10.1.1.4
110
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 2; src=10.1.1.3
111
next_hop=10.1.1.2
112
|<======| | | | ICMP (ping) reply 2; src=10.1.1.2
113
next_hop=10.1.1.1 | | | |<------|------> Hello
114
<------|------>| | | | Hello
115
| |<------|------>| | Hello
116
|<------|------>| | | Hello
117
| | |<------|------>| Hello
118
|======>| | | | ICMP (ping) request 3; src=10.1.1.1
119
next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 3; src=10.1.1.2
120
next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 3; src=10.1.1.3
121
next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 3; src=10.1.1.4
122
next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 3; src=10.1.1.5
123
next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 3; src=10.1.1.4
124
next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 3; src=10.1.1.3
125
next_hop=10.1.1.2
126
|<======| | | | ICMP (ping) reply 3; src=10.1.1.2
127
next_hop=10.1.1.1 | | | |<------|------> Hello
128
<------|------>| | | | Hello
129
|<------|--> | | | Hello |
130
| | <--|--> | | Hello |Node 3 move away => nobody hear his
131
packets and node 3 doesn't hear anything ! | | | <--|------>| Hello |
132
|======>| | | | ICMP (ping) request 4; src=10.1.1.1
133
next_hop=10.1.1.2 | |==> | | | ICMP (ping) request 4; src=10.1.1.2
134
next_hop=10.1.1.3. 7 retries.
135
|<======| | | | RERR (unreachable dst 10.1.1.3 & 10.1.1.5)
136
src=10.1.1.2 | | | |<------|------> Hello
137
<------|------>| | | | Hello
138
|<------|--> | | | Hello
139
| | <--|--> | | Hello
140
| | | <--|------>| Hello
141
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=0,
142
ID=2, org_seqno=2) src = 10.1.1.1
143
|<------|--> | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=1,
144
ID=2, org_seqno=2) src = 10.1.1.2 | | | |<------|------> Hello | | |
145
<--|------>| Hello | | <--|--> | | Hello
146
|<------|--> | | | Hello
147
<------|------>| | | | Hello
148
| | | |======>| RERR (unreachable dst 10.1.1.1 & 10.1.1.3)
149
src=10.1.1.4 | | | |<------|------> Hello | | | <--|------>| Hello
150
| | <--|--> | | Hello
151
|<------|--> | | | Hello
152
<------|------>| | | | Hello
153
| | | |<------|------> Hello
154
<------|------>| | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=0,
155
ID=4, org_seqno=3) src = 10.1.1.1
156
|<------|--> | | | RREQ (orig 10.1.1.1, dst 10.1.1.5, G=1, hop=1,
157
ID=4, org_seqno=3) src = 10.1.1.2
158
159
..................................................................
160
* \endverbatim
161
*/
162
class
ChainRegressionTest
:
public
TestCase
163
{
164
public
:
165
/**
166
* Create test case
167
*
168
* \param prefix Unique file names prefix
169
* \param size Number of nodes in the chain
170
* \param time Simulation time
171
* \param arpAliveTimeout ARP alive timeout, this is used to check that ARP and routing do
172
* not interfere
173
*/
174
ChainRegressionTest
(
const
char
*
const
prefix,
175
Time
time =
Seconds
(10),
176
uint32_t
size = 5,
177
Time
arpAliveTimeout =
Seconds
(120));
178
~ChainRegressionTest
()
override
;
179
180
private
:
181
/// \internal It is important to have pointers here
182
NodeContainer
*
m_nodes
;
183
184
/// PCAP file names prefix
185
const
std::string
m_prefix
;
186
/// Total simulation time
187
const
Time
m_time
;
188
/// Chain size
189
const
uint32_t
m_size
;
190
/// Chain step, meters
191
const
double
m_step
;
192
/// ARP alive timeout
193
const
Time
m_arpAliveTimeout
;
194
/// Socket
195
Ptr<Socket>
m_socket
;
196
/// Sequence number
197
uint16_t
m_seq
;
198
199
/// Create test topology
200
void
CreateNodes
();
201
/// Create devices, install TCP/IP stack and applications
202
void
CreateDevices
();
203
/// Compare traces with reference ones
204
void
CheckResults
();
205
/// Go
206
void
DoRun
()
override
;
207
/// Send one ping
208
void
SendPing
();
209
};
210
211
#endif
/* AODV_REGRESSION_H */
ChainRegressionTest
AODV chain regression test.
Definition:
aodv-regression.h:163
ChainRegressionTest::m_size
const uint32_t m_size
Chain size.
Definition:
aodv-regression.h:189
ChainRegressionTest::CreateNodes
void CreateNodes()
Create test topology.
Definition:
aodv-regression.cc:149
ChainRegressionTest::DoRun
void DoRun() override
Go.
Definition:
aodv-regression.cc:125
ChainRegressionTest::m_seq
uint16_t m_seq
Sequence number.
Definition:
aodv-regression.h:197
ChainRegressionTest::SendPing
void SendPing()
Send one ping.
Definition:
aodv-regression.cc:96
ChainRegressionTest::m_arpAliveTimeout
const Time m_arpAliveTimeout
ARP alive timeout.
Definition:
aodv-regression.h:193
ChainRegressionTest::m_step
const double m_step
Chain step, meters.
Definition:
aodv-regression.h:191
ChainRegressionTest::~ChainRegressionTest
~ChainRegressionTest() override
Definition:
aodv-regression.cc:90
ChainRegressionTest::m_nodes
NodeContainer * m_nodes
Definition:
aodv-regression.h:182
ChainRegressionTest::CheckResults
void CheckResults()
Compare traces with reference ones.
Definition:
aodv-regression.cc:237
ChainRegressionTest::m_time
const Time m_time
Total simulation time.
Definition:
aodv-regression.h:187
ChainRegressionTest::m_prefix
const std::string m_prefix
PCAP file names prefix.
Definition:
aodv-regression.h:185
ChainRegressionTest::m_socket
Ptr< Socket > m_socket
Socket.
Definition:
aodv-regression.h:195
ChainRegressionTest::CreateDevices
void CreateDevices()
Create devices, install TCP/IP stack and applications.
Definition:
aodv-regression.cc:172
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::TestCase
encapsulates test code
Definition:
test.h:1061
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
uint32_t
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1319
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
aodv
test
aodv-regression.h
Generated on Tue May 28 2024 23:34:05 for ns-3 by
1.9.6