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
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
18
namespace
ns3
19
{
20
namespace
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
71
class
TcRegressionTest
:
public
TestCase
72
{
73
public
:
74
TcRegressionTest
();
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
92
Ptr<Ipv4RawSocketImpl>
m_rxSocketA
;
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
102
Ptr<Ipv4RawSocketImpl>
m_rxSocketB
;
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
112
Ptr<Ipv4RawSocketImpl>
m_rxSocketC
;
113
};
114
115
}
// namespace olsr
116
}
// namespace ns3
117
118
#endif
/* TC_REGRESSION_TEST_H */
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
ns3::olsr::TcRegressionTest
Less trivial test of OLSR Topology Control message generation.
Definition
tc-regression-test.h:72
ns3::olsr::TcRegressionTest::CreateNodes
void CreateNodes()
Create & configure test network.
Definition
tc-regression-test.cc:65
ns3::olsr::TcRegressionTest::ReceivePktProbeB
void ReceivePktProbeB(Ptr< Socket > socket)
Receive raw data on node B.
Definition
tc-regression-test.cc:219
ns3::olsr::TcRegressionTest::~TcRegressionTest
~TcRegressionTest() override
Definition
tc-regression-test.cc:44
ns3::olsr::TcRegressionTest::m_countB
uint8_t m_countB
Packet counter on node B.
Definition
tc-regression-test.h:100
ns3::olsr::TcRegressionTest::m_rxSocketB
Ptr< Ipv4RawSocketImpl > m_rxSocketB
Receiving socket on node B.
Definition
tc-regression-test.h:102
ns3::olsr::TcRegressionTest::TcRegressionTest
TcRegressionTest()
Definition
tc-regression-test.cc:35
ns3::olsr::TcRegressionTest::ReceivePktProbeC
void ReceivePktProbeC(Ptr< Socket > socket)
Receive raw data on node C.
Definition
tc-regression-test.cc:291
ns3::olsr::TcRegressionTest::m_countC
uint8_t m_countC
Packet counter on node C.
Definition
tc-regression-test.h:110
ns3::olsr::TcRegressionTest::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
tc-regression-test.cc:49
ns3::olsr::TcRegressionTest::m_rxSocketC
Ptr< Ipv4RawSocketImpl > m_rxSocketC
Receiving socket on node C.
Definition
tc-regression-test.h:112
ns3::olsr::TcRegressionTest::ReceivePktProbeA
void ReceivePktProbeA(Ptr< Socket > socket)
Receive raw data on node A.
Definition
tc-regression-test.cc:116
ns3::olsr::TcRegressionTest::m_time
const Time m_time
Total simulation time.
Definition
tc-regression-test.h:79
ns3::olsr::TcRegressionTest::m_rxSocketA
Ptr< Ipv4RawSocketImpl > m_rxSocketA
Receiving socket on node A.
Definition
tc-regression-test.h:92
ns3::olsr::TcRegressionTest::m_countA
uint8_t m_countA
Packet counter on node A.
Definition
tc-regression-test.h:90
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
olsr
Definition
olsr.py:1
src
olsr
test
tc-regression-test.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0