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
// clang-format off
27
/**
28
* [10.1.1.1] <-- step --> [10.1.1.2] <-- step --> [10.1.1.3] <-- step --> [10.1.1.4] <-- step --> [10.1.1.5]
29
*/
30
// clang-format on
31
/**
32
* Each node can hear only his right and his left neighbor, if they exist.
33
* When one third of total time expired, central node moves away.
34
* After this, node 3 doesn't hear any packets from other nodes and nobody hears his packets.
35
* We want to demonstrate in this script
36
* 1) route establishing
37
* 2) broken link detection both from layer 2 information and hello messages.
38
*
39
*/
40
// clang-format off
41
/**
42
* \verbatim
43
Expected packets time diagram.
44
45
1 2 3 4 5
46
<-------|------>| | | | 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
47
|<------|------>| | | 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
48
| |<------|------>| | 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
49
| | |<------|------>| 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
50
| | | |<------|------> ARP request. Who has 10.1.1.4? Tell 10.1.1.5
51
| | | |======>| ARP reply
52
| | | |<======| RREP (orig 10.1.1.1, dst 10.1.1.5, hop=0, dst_seqno=0) src=10.1.1.5
53
| | |<------|------>| ARP request. Who has 10.1.1.3? Tell 10.1.1.4
54
| | |======>| | ARP reply
55
| | |<======| | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=1, dst_seqno=0) src=10.1.1.4
56
| |<------|------>| | ARP request. Who has 10.1.1.2? Tell 10.1.1.3
57
| |======>| | | ARP reply
58
| |<======| | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=2, dst_seqno=0) src=10.1.1.3
59
|<------|------>| | | ARP request. Who has 10.1.1.1? Tell 10.1.1.2
60
|======>| | | | ARP reply
61
|<======| | | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=3, dst_seqno=0) src=10.1.1.2
62
<-------|------>| | | | ARP request. Who has 10.1.1.2? Tell 10.1.1.1
63
|<======| | | |
64
|======>| | | | 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
65
|<------|------>| | | ARP request. Who has 10.1.1.3? Tell 10.1.1.2
66
| |<======| | | ARP reply
67
| |======>| | | 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
68
| |<------|------>| | ARP request. Who has 10.1.1.4? Tell 10.1.1.3
69
| | |<======| | ARP reply
70
| | |======>| | 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
71
| | |<------|------>| ARP request. Who has 10.1.1.5? Tell 10.1.1.4
72
| | | |<======| ARP reply
73
| | | |======>| ICMP (ping) request 0; src=10.1.1.4 next_hop=10.1.1.5
74
| | | |<======| ICMP (ping) reply 0; src=10.1.1.5 next_hop=10.1.1.4
75
| | |<======| | ICMP (ping) reply 0; src=10.1.1.4 next_hop=10.1.1.3
76
| |<======| | | ICMP (ping) reply 0; src=10.1.1.3 next_hop=10.1.1.2
77
|<======| | | | ICMP (ping) reply 0; src=10.1.1.2 next_hop=10.1.1.1
78
| | | |<------|------> Hello
79
|<------|------>| | | Hello
80
<-------|------>| | | | Hello
81
| |<------|------>| | Hello
82
|======>| | | | ICMP (ping) request 1; src=10.1.1.1 next_hop=10.1.1.2
83
| | |<------|------>| Hello
84
| |======>| | | ICMP (ping) request 1; src=10.1.1.2 next_hop=10.1.1.3
85
| | |======>| | ICMP (ping) request 1; src=10.1.1.3 next_hop=10.1.1.4
86
| | | |======>| ICMP (ping) request 1; src=10.1.1.4 next_hop=10.1.1.5
87
| | | |<======| ICMP (ping) reply 1; src=10.1.1.5 next_hop=10.1.1.4
88
| | |<======| | ICMP (ping) reply 1; src=10.1.1.4 next_hop=10.1.1.3
89
| |<======| | | ICMP (ping) reply 11; src=10.1.1.3 next_hop=10.1.1.2
90
|<======| | | | ICMP (ping) reply 1; src=10.1.1.2 next_hop=10.1.1.1
91
| | | |<------|------> Hello
92
|<------|------>| | | Hello
93
<-------|------>| | | | Hello
94
| | |<------|------>| Hello
95
| |<------|------>| | Hello
96
|======>| | | | ICMP (ping) request 2; src=10.1.1.1 next_hop=10.1.1.2
97
| |======>| | | ICMP (ping) request 2; src=10.1.1.2 next_hop=10.1.1.3
98
| | |======>| | ICMP (ping) request 2; src=10.1.1.3 next_hop=10.1.1.4
99
| | | |======>| ICMP (ping) request 2; src=10.1.1.4 next_hop=10.1.1.5
100
| | | |<======| ICMP (ping) reply 2; src=10.1.1.5 next_hop=10.1.1.4
101
| | |<======| | ICMP (ping) reply 2; src=10.1.1.4 next_hop=10.1.1.3
102
| |<======| | | ICMP (ping) reply 2; src=10.1.1.3 next_hop=10.1.1.2
103
|<======| | | | ICMP (ping) reply 2; src=10.1.1.2 next_hop=10.1.1.1
104
| | | |<------|------> Hello
105
<-------|------>| | | | Hello
106
| |<------|------>| | Hello
107
|<------|------>| | | Hello
108
| | |<------|------>| Hello
109
|======>| | | | ICMP (ping) request 3; src=10.1.1.1 next_hop=10.1.1.2
110
| |======>| | | ICMP (ping) request 3; src=10.1.1.2 next_hop=10.1.1.3
111
| | |======>| | ICMP (ping) request 3; src=10.1.1.3 next_hop=10.1.1.4
112
| | | |======>| ICMP (ping) request 3; src=10.1.1.4 next_hop=10.1.1.5
113
| | | |<======| ICMP (ping) reply 3; src=10.1.1.5 next_hop=10.1.1.4
114
| | |<======| | ICMP (ping) reply 3; src=10.1.1.4 next_hop=10.1.1.3
115
| |<======| | | ICMP (ping) reply 3; src=10.1.1.3 next_hop=10.1.1.2
116
|<======| | | | ICMP (ping) reply 3; src=10.1.1.2 next_hop=10.1.1.1
117
| | | |<------|------> Hello
118
<-------|------>| | | | Hello
119
|<------|--> | | | Hello |
120
| | <--|--> | | Hello |Node 3 move away => nobody hear his packets and node 3 doesn't hear anything !
121
| | | <--|------>| Hello |
122
|======>| | | | ICMP (ping) request 4; src=10.1.1.1 next_hop=10.1.1.2
123
| |==> | | | ICMP (ping) request 4; src=10.1.1.2 next_hop=10.1.1.3. 7 retries.
124
|<======| | | | RERR (unreachable dst 10.1.1.3 & 10.1.1.5) src=10.1.1.2
125
| | | |<------|------> Hello
126
<-------|------>| | | | Hello
127
|<------|--> | | | Hello
128
| | <--|--> | | Hello
129
| | | <--|------>| Hello
130
<-------|------>| | | | 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
131
|<------|--> | | | 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
132
| | | |<------|------> Hello
133
| | | <--|------>| Hello
134
| | <--|--> | | Hello
135
|<------|--> | | | Hello
136
<-------|------>| | | | Hello
137
| | | |======>| RERR (unreachable dst 10.1.1.1 & 10.1.1.3) src=10.1.1.4
138
| | | |<------|------> Hello
139
| | | <--|------>| Hello
140
| | <--|--> | | Hello
141
|<------|--> | | | Hello
142
<-------|------>| | | | Hello
143
| | | |<------|------> Hello
144
<-------|------>| | | | 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
145
|<------|--> | | | 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
146
.................................................
147
\endverbatim
148
*/
149
//clang-format on
150
class
ChainRegressionTest
:
public
TestCase
151
{
152
public
:
153
/**
154
* Create test case
155
*
156
* \param prefix Unique file names prefix
157
* \param size Number of nodes in the chain
158
* \param time Simulation time
159
* \param arpAliveTimeout ARP alive timeout, this is used to check that ARP and routing do
160
* not interfere
161
*/
162
ChainRegressionTest
(
const
char
*
const
prefix,
163
Time
time =
Seconds
(10),
164
uint32_t
size = 5,
165
Time
arpAliveTimeout =
Seconds
(120));
166
~ChainRegressionTest
()
override
;
167
168
private
:
169
/// \internal It is important to have pointers here
170
NodeContainer
*
m_nodes
;
171
172
/// PCAP file names prefix
173
const
std::string
m_prefix
;
174
/// Total simulation time
175
const
Time
m_time
;
176
/// Chain size
177
const
uint32_t
m_size
;
178
/// Chain step, meters
179
const
double
m_step
;
180
/// ARP alive timeout
181
const
Time
m_arpAliveTimeout
;
182
/// Socket
183
Ptr<Socket>
m_socket
;
184
/// Sequence number
185
uint16_t
m_seq
;
186
187
/// Create test topology
188
void
CreateNodes
();
189
/// Create devices, install TCP/IP stack and applications
190
void
CreateDevices
();
191
/// Compare traces with reference ones
192
void
CheckResults
();
193
/// Go
194
void
DoRun
()
override
;
195
/// Send one ping
196
void
SendPing
();
197
};
198
199
#endif
/* AODV_REGRESSION_H */
ChainRegressionTest
AODV chain regression test.
Definition
aodv-regression.h:151
ChainRegressionTest::m_size
const uint32_t m_size
Chain size.
Definition
aodv-regression.h:177
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:185
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:181
ChainRegressionTest::m_step
const double m_step
Chain step, meters.
Definition
aodv-regression.h:179
ChainRegressionTest::~ChainRegressionTest
~ChainRegressionTest() override
Definition
aodv-regression.cc:79
ChainRegressionTest::m_nodes
NodeContainer * m_nodes
Definition
aodv-regression.h:170
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:175
ChainRegressionTest::m_prefix
const std::string m_prefix
PCAP file names prefix.
Definition
aodv-regression.h:173
ChainRegressionTest::m_socket
Ptr< Socket > m_socket
Socket.
Definition
aodv-regression.h:183
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:1308
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
aodv
test
aodv-regression.h
Generated on Fri Nov 8 2024 13:58:58 for ns-3 by
1.11.0