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
mac-messages-test.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 INRIA, UDcast
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
7
*
8
*/
9
#include "ns3/mac-messages.h"
10
#include "ns3/service-flow.h"
11
#include "ns3/test.h"
12
13
using namespace
ns3
;
14
15
/**
16
* @ingroup wimax
17
* @defgroup wimax-test wimax module tests
18
*/
19
20
/**
21
* @ingroup wimax-test
22
* @ingroup tests
23
*
24
* @brief Test the DSA request message.
25
*/
26
class
DsaRequestTestCase
:
public
TestCase
27
{
28
public
:
29
DsaRequestTestCase
();
30
~DsaRequestTestCase
()
override
;
31
32
private
:
33
void
DoRun
()
override
;
34
};
35
36
DsaRequestTestCase::DsaRequestTestCase
()
37
:
TestCase
(
"Test the DSA request messages"
)
38
{
39
}
40
41
DsaRequestTestCase::~DsaRequestTestCase
()
42
{
43
}
44
45
void
46
DsaRequestTestCase::DoRun
()
47
{
48
IpcsClassifierRecord
classifier
=
IpcsClassifierRecord
();
49
CsParameters
csParam
(
CsParameters::ADD
,
classifier
);
50
ServiceFlow
sf
=
ServiceFlow
(
ServiceFlow::SF_DIRECTION_DOWN
);
51
52
sf
.SetSfid(100);
53
sf
.SetConvergenceSublayerParam(
csParam
);
54
sf
.SetCsSpecification(
ServiceFlow::IPV4
);
55
sf
.SetServiceSchedulingType(
ServiceFlow::SF_TYPE_UGS
);
56
sf
.SetMaxSustainedTrafficRate(1000000);
57
sf
.SetMinReservedTrafficRate(1000000);
58
sf
.SetMinTolerableTrafficRate(1000000);
59
sf
.SetMaximumLatency(10);
60
sf
.SetMaxTrafficBurst(1000);
61
sf
.SetTrafficPriority(1);
62
63
DsaReq
dsaReq
(
sf
);
64
Ptr<Packet>
packet =
Create<Packet>
();
65
packet->AddHeader(
dsaReq
);
66
67
DsaReq
dsaReqRecv
;
68
packet->RemoveHeader(
dsaReqRecv
);
69
70
ServiceFlow
sfRecv
=
dsaReqRecv
.GetServiceFlow();
71
72
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetDirection(),
73
ServiceFlow::SF_DIRECTION_DOWN
,
74
"The sfRecv had the wrong direction."
);
75
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetSfid(), 100,
"The sfRecv had the wrong sfid."
);
76
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetCsSpecification(),
77
ServiceFlow::IPV4
,
78
"The sfRecv had the wrong cs specification."
);
79
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetServiceSchedulingType(),
80
ServiceFlow::SF_TYPE_UGS
,
81
"The sfRecv had the wrong service scheduling type."
);
82
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetMaxSustainedTrafficRate(),
83
1000000,
84
"The sfRecv had the wrong maximum sustained traffic rate."
);
85
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetMinReservedTrafficRate(),
86
1000000,
87
"The sfRecv had the wrong minimum reserved traffic rate."
);
88
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetMinTolerableTrafficRate(),
89
1000000,
90
"The sfRecv had the wrong minimum tolerable traffic rate."
);
91
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetMaximumLatency(),
92
10,
93
"The sfRecv had the wrong maximum latency."
);
94
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetMaxTrafficBurst(),
95
1000,
96
"The sfRecv had the wrong maximum traffic burst."
);
97
NS_TEST_ASSERT_MSG_EQ
(
sfRecv
.GetTrafficPriority(),
98
1,
99
"The sfRecv had the wrong traffic priority."
);
100
}
101
102
/**
103
* @ingroup wimax-test
104
* @ingroup tests
105
*
106
* @brief Ns3 Wimax Mac Messages Test Suite
107
*/
108
class
Ns3WimaxMacMessagesTestSuite
:
public
TestSuite
109
{
110
public
:
111
Ns3WimaxMacMessagesTestSuite
();
112
};
113
114
Ns3WimaxMacMessagesTestSuite::Ns3WimaxMacMessagesTestSuite
()
115
:
TestSuite
(
"wimax-mac-messages"
,
Type
::UNIT)
116
{
117
AddTestCase
(
new
DsaRequestTestCase
, TestCase::Duration::QUICK);
118
}
119
120
static
Ns3WimaxMacMessagesTestSuite
ns3WimaxMacMessagesTestSuite
;
///< the test suite
DsaRequestTestCase
Test the DSA request message.
Definition
mac-messages-test.cc:27
DsaRequestTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
mac-messages-test.cc:46
DsaRequestTestCase::~DsaRequestTestCase
~DsaRequestTestCase() override
Definition
mac-messages-test.cc:41
DsaRequestTestCase::DsaRequestTestCase
DsaRequestTestCase()
Definition
mac-messages-test.cc:36
Ns3WimaxMacMessagesTestSuite
Ns3 Wimax Mac Messages Test Suite.
Definition
mac-messages-test.cc:109
Ns3WimaxMacMessagesTestSuite::Ns3WimaxMacMessagesTestSuite
Ns3WimaxMacMessagesTestSuite()
Definition
mac-messages-test.cc:114
ns3::CsParameters
CsParameters class.
Definition
cs-parameters.h:25
ns3::CsParameters::ADD
@ ADD
Definition
cs-parameters.h:30
ns3::DsaReq
This class implements the DSA-REQ message described by "IEEE Standard for Local and metropolitan area...
Definition
mac-messages.h:375
ns3::IpcsClassifierRecord
IpcsClassifierRecord class.
Definition
ipcs-classifier-record.h:27
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::ServiceFlow
This class implements service flows as described by the IEEE-802.16 standard.
Definition
service-flow.h:32
ns3::ServiceFlow::SF_TYPE_UGS
@ SF_TYPE_UGS
Definition
service-flow.h:57
ns3::ServiceFlow::IPV4
@ IPV4
Definition
service-flow.h:65
ns3::ServiceFlow::SF_DIRECTION_DOWN
@ SF_DIRECTION_DOWN
Definition
service-flow.h:37
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition
test.cc:292
ns3::TestSuite
A suite of tests to run.
Definition
test.h:1267
ns3::TestSuite::Type
Type
Type of test.
Definition
test.h:1274
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
NS_TEST_ASSERT_MSG_EQ
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition
test.h:134
ns3WimaxMacMessagesTestSuite
static Ns3WimaxMacMessagesTestSuite ns3WimaxMacMessagesTestSuite
the test suite
Definition
mac-messages-test.cc:120
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
wimax
test
mac-messages-test.cc
Generated on Mon Dec 15 2025 15:22:12 for ns-3 by
1.9.8