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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Pavel Boyko <boyko@iitp.ru>
7 */
8
9#ifndef TC_REGRESSION_TEST_H
10#define TC_REGRESSION_TEST_H
11
12#include "ns3/ipv4-raw-socket-impl.h"
13#include "ns3/node-container.h"
14#include "ns3/nstime.h"
15#include "ns3/socket.h"
16#include "ns3/test.h"
17
18namespace ns3
19{
20namespace olsr
21{
22/**
23 * \ingroup olsr-test
24 * \ingroup tests
25 *
26 * \brief Less trivial test of OLSR Topology Control message generation
27 *
28 * This test simulates 3 Wi-Fi stations with chain topology and runs OLSR without any extra traffic.
29 * It is expected that only second station will send TC messages.
30 *
31 * Expected trace (20 seconds, note random b-cast jitter):
32 */
33// clang-format off
34/**
35 * \verbatim
36 1 2 3
37 |<------|------>| HELLO (empty) src = 10.1.1.2
38 | |<------|------> HELLO (empty) src = 10.1.1.3
39 <------|------>| | HELLO (empty) src = 10.1.1.1
40 <------|------>| | HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
41 | |<------|------> HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
42 |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
43 |<------|------>| HELLO (Link Type: Asymmetric, Neighbor: 10.1.1.3; Link Type: Asymmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
44 <------|------>| | HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.1
45 | |<------|------> HELLO (Link Type: Symmetric, Neighbor: 10.1.1.2) src = 10.1.1.3
46 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
47 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
48 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
49 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
50 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
51 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
52 |<======|======>| TC (10.1.1.3; 10.1.1.1) + HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
53 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
54 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
55 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
56 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
57 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
58 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
59 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
60 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
61 |<======|======>| TC (10.1.1.3; 10.1.1.1) src = 10.1.1.2
62 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
63 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
64 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
65 <------|------>| | HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.1
66 | |<------|------> HELLO (Link Type: MPR Link, Neighbor: 10.1.1.2) src = 10.1.1.3
67 |<------|------>| HELLO (Link Type: Symmetric, Neighbor: 10.1.1.3; Link Type: Symmetric, Neighbor: 10.1.1.1) src = 10.1.1.2
68 \endverbatim
69 */
70// clang-format on
72{
73 public:
75 ~TcRegressionTest() override;
76
77 private:
78 /// Total simulation time
79 const Time m_time;
80 /// Create & configure test network
81 void CreateNodes();
82 void DoRun() override;
83
84 /**
85 * Receive raw data on node A
86 * \param socket receiving socket
87 */
88 void ReceivePktProbeA(Ptr<Socket> socket);
89 /// Packet counter on node A
90 uint8_t m_countA;
91 /// Receiving socket on node A
93
94 /**
95 * Receive raw data on node B
96 * \param socket receiving socket
97 */
98 void ReceivePktProbeB(Ptr<Socket> socket);
99 /// Packet counter on node B
100 uint8_t m_countB;
101 /// Receiving socket on node B
103
104 /**
105 * Receive raw data on node C
106 * \param socket receiving socket
107 */
108 void ReceivePktProbeC(Ptr<Socket> socket);
109 /// Packet counter on node C
110 uint8_t m_countC;
111 /// Receiving socket on node C
113};
114
115} // namespace olsr
116} // namespace ns3
117
118#endif /* TC_REGRESSION_TEST_H */
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
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