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 * 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
17using 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
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
173
174 /// PCAP file names prefix
175 const std::string m_prefix;
176 /// Total simulation time
178 /// Chain size
180 /// Chain step, meters
181 const double m_step;
182 /// ARP alive timeout
184 /// 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 */
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.
encapsulates test code
Definition test.h:1050
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
ChainRegressionTest(const char *const prefix, Time time=Seconds(10), uint32_t size=5, Time arpAliveTimeout=Seconds(120))
Create test case.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1345
Every class exported by the ns3 library is enclosed in the ns3 namespace.