A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tc-regression-test.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 TC_REGRESSION_TEST_H
21#define TC_REGRESSION_TEST_H
22
23#include "ns3/ipv4-raw-socket-impl.h"
24#include "ns3/node-container.h"
25#include "ns3/nstime.h"
26#include "ns3/socket.h"
27#include "ns3/test.h"
28
29namespace ns3
30{
31namespace olsr
32{
33/**
34 * \ingroup olsr-test
35 * \ingroup tests
36 *
37 * \brief Less trivial test of OLSR Topology Control message generation
38 *
39 * This test simulates 3 Wi-Fi stations with chain topology and runs OLSR without any extra traffic.
40 * It is expected that only second station will send TC messages.
41 *
42 * Expected trace (20 seconds, note random b-cast jitter):
43 \verbatim
44 1 2 3
45 |<------|------>| HELLO (empty) src = 10.1.1.2
46 | |<------|------> HELLO (empty) src = 10.1.1.3
47 <------|------>| | HELLO (empty) src = 10.1.1.1
48 <------|------>| | HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src
49 = 10.1.1.1 | |<------|------> HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src
50 = 10.1.1.3
51 |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type:
52 Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
53 |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type:
54 Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
55 <------|------>| | HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src
56 = 10.1.1.1 | |<------|------> HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src
57 = 10.1.1.3
58 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
59 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
60 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
61 = 10.1.1.1 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
62 = 10.1.1.3
63 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
64 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
65 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
66 = 10.1.1.1 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
67 = 10.1.1.3
68 |<======|======>| TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric,
69 Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 | |<------|------>
70 HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
71 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
72 = 10.1.1.1
73 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
74 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
75 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
76 = 10.1.1.1 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
77 = 10.1.1.3
78 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
79 = 10.1.1.1 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
80 = 10.1.1.3
81 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
82 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
83 |<======|======>| TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2
84 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
85 = 10.1.1.3
86 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
87 = 10.1.1.1
88 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
89 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
90 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
91 = 10.1.1.1 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src
92 = 10.1.1.3
93 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type:
94 Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2 \endverbatim
95 */
97{
98 public:
100 ~TcRegressionTest() override;
101
102 private:
103 /// Total simulation time
105 /// Create & configure test network
106 void CreateNodes();
107 void DoRun() override;
108
109 /**
110 * Receive raw data on node A
111 * \param socket receiving socket
112 */
113 void ReceivePktProbeA(Ptr<Socket> socket);
114 /// Packet counter on node A
115 uint8_t m_countA;
116 /// Receiving socket on node A
118
119 /**
120 * Receive raw data on node B
121 * \param socket receiving socket
122 */
123 void ReceivePktProbeB(Ptr<Socket> socket);
124 /// Packet counter on node B
125 uint8_t m_countB;
126 /// Receiving socket on node B
128
129 /**
130 * Receive raw data on node C
131 * \param socket receiving socket
132 */
133 void ReceivePktProbeC(Ptr<Socket> socket);
134 /// Packet counter on node C
135 uint8_t m_countC;
136 /// Receiving socket on node C
138};
139
140} // namespace olsr
141} // namespace ns3
142
143#endif /* TC_REGRESSION_TEST_H */
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
Less trivial test of OLSR Topology Control message generation.
void CreateNodes()
Create & configure test network.
void ReceivePktProbeB(Ptr< Socket > socket)
Receive raw data on node B.
uint8_t m_countB
Packet counter on node B.
Ptr< Ipv4RawSocketImpl > m_rxSocketB
Receiving socket on node B.
void ReceivePktProbeC(Ptr< Socket > socket)
Receive raw data on node C.
uint8_t m_countC
Packet counter on node C.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< Ipv4RawSocketImpl > m_rxSocketC
Receiving socket on node C.
void ReceivePktProbeA(Ptr< Socket > socket)
Receive raw data on node A.
const Time m_time
Total simulation time.
Ptr< Ipv4RawSocketImpl > m_rxSocketA
Receiving socket on node A.
uint8_t m_countA
Packet counter on node A.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Definition: olsr.py:1