A Discrete-Event Network Simulator
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
28using 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
41time expired,
42 * central node moves away. After this, node 3 doesn't hear any packets from other nodes and nobody
43hears 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,
52hop=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,
54hop=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
60request. 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 | |======>| | |
63ARP reply | |<======| | | RREP (orig 10.1.1.1, dst 10.1.1.5, hop=2,
64dst_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,
68dst_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;
72src=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;
76src=10.1.1.2 next_hop=10.1.1.3 | |<------|------>| | ARP request. Who
77has 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 | | | |<======|
80ARP reply | | | |======>| ICMP (ping) request 0; src=10.1.1.4
81next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 0; src=10.1.1.5
82next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 0; src=10.1.1.4
83next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 0; src=10.1.1.3
84next_hop=10.1.1.2
85 |<======| | | | ICMP (ping) reply 0; src=10.1.1.2
86next_hop=10.1.1.1 | | | |<------|------> Hello
87 |<------|------>| | | Hello
88 <------|------>| | | | Hello
89 | |<------|------>| | Hello
90 |======>| | | | ICMP (ping) request 1; src=10.1.1.1
91next_hop=10.1.1.2 | | |<------|------>| Hello | |======>| | |
92ICMP (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)
96reply 1; src=10.1.1.4 next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply
9711; src=10.1.1.3 next_hop=10.1.1.2
98 |<======| | | | ICMP (ping) reply 1; src=10.1.1.2
99next_hop=10.1.1.1 | | | |<------|------> Hello
100 |<------|------>| | | Hello
101 <------|------>| | | | Hello
102 | | |<------|------>| Hello
103 | |<------|------>| | Hello
104 |======>| | | | ICMP (ping) request 2; src=10.1.1.1
105next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 2; src=10.1.1.2
106next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 2; src=10.1.1.3
107next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 2; src=10.1.1.4
108next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 2; src=10.1.1.5
109next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 2; src=10.1.1.4
110next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 2; src=10.1.1.3
111next_hop=10.1.1.2
112 |<======| | | | ICMP (ping) reply 2; src=10.1.1.2
113next_hop=10.1.1.1 | | | |<------|------> Hello
114 <------|------>| | | | Hello
115 | |<------|------>| | Hello
116 |<------|------>| | | Hello
117 | | |<------|------>| Hello
118 |======>| | | | ICMP (ping) request 3; src=10.1.1.1
119next_hop=10.1.1.2 | |======>| | | ICMP (ping) request 3; src=10.1.1.2
120next_hop=10.1.1.3 | | |======>| | ICMP (ping) request 3; src=10.1.1.3
121next_hop=10.1.1.4 | | | |======>| ICMP (ping) request 3; src=10.1.1.4
122next_hop=10.1.1.5 | | | |<======| ICMP (ping) reply 3; src=10.1.1.5
123next_hop=10.1.1.4 | | |<======| | ICMP (ping) reply 3; src=10.1.1.4
124next_hop=10.1.1.3 | |<======| | | ICMP (ping) reply 3; src=10.1.1.3
125next_hop=10.1.1.2
126 |<======| | | | ICMP (ping) reply 3; src=10.1.1.2
127next_hop=10.1.1.1 | | | |<------|------> Hello
128 <------|------>| | | | Hello
129 |<------|--> | | | Hello |
130 | | <--|--> | | Hello |Node 3 move away => nobody hear his
131packets and node 3 doesn't hear anything ! | | | <--|------>| Hello |
132 |======>| | | | ICMP (ping) request 4; src=10.1.1.1
133next_hop=10.1.1.2 | |==> | | | ICMP (ping) request 4; src=10.1.1.2
134next_hop=10.1.1.3. 7 retries.
135 |<======| | | | RERR (unreachable dst 10.1.1.3 & 10.1.1.5)
136src=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,
142ID=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,
144ID=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)
149src=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,
155ID=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,
157ID=4, org_seqno=3) src = 10.1.1.2
158
159..................................................................
160 * \endverbatim
161 */
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
183
184 /// PCAP file names prefix
185 const std::string m_prefix;
186 /// Total simulation time
188 /// Chain size
190 /// Chain step, meters
191 const double m_step;
192 /// ARP alive timeout
194 /// 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 */
AODV chain regression test.
const uint32_t m_size
Chain size.
void CreateNodes()
Create test topology.
void DoRun() override
Go.
uint16_t m_seq
Sequence number.
void SendPing()
Send one ping.
const Time m_arpAliveTimeout
ARP alive timeout.
const double m_step
Chain step, meters.
~ChainRegressionTest() override
NodeContainer * m_nodes
void CheckResults()
Compare traces with reference ones.
const Time m_time
Total simulation time.
const std::string m_prefix
PCAP file names prefix.
Ptr< Socket > m_socket
Socket.
void CreateDevices()
Create devices, install TCP/IP stack and applications.
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
encapsulates test code
Definition: test.h:1061
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
Every class exported by the ns3 library is enclosed in the ns3 namespace.