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
wimax-service-flow-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
* <amine.ismail@udcast.com>
8
*
9
*/
10
#include "ns3/cs-parameters.h"
11
#include "ns3/internet-stack-helper.h"
12
#include "ns3/ipcs-classifier-record.h"
13
#include "ns3/ipv4-address-helper.h"
14
#include "ns3/ipv4-address.h"
15
#include "ns3/ipv4-interface-container.h"
16
#include "ns3/service-flow.h"
17
#include "ns3/simulator.h"
18
#include "ns3/test.h"
19
#include "ns3/wimax-helper.h"
20
21
using namespace
ns3
;
22
23
/**
24
* @ingroup wimax-test
25
* @ingroup tests
26
*
27
* @brief Test the service flow creation.
28
*/
29
class
Ns3WimaxSfCreationTestCase
:
public
TestCase
30
{
31
public
:
32
Ns3WimaxSfCreationTestCase
();
33
~Ns3WimaxSfCreationTestCase
()
override
;
34
35
private
:
36
void
DoRun
()
override
;
37
};
38
39
Ns3WimaxSfCreationTestCase::Ns3WimaxSfCreationTestCase
()
40
:
TestCase
(
"Test the service flow tlv implementation."
)
41
{
42
}
43
44
Ns3WimaxSfCreationTestCase::~Ns3WimaxSfCreationTestCase
()
45
{
46
}
47
48
void
49
Ns3WimaxSfCreationTestCase::DoRun
()
50
{
51
// default values
52
int
duration = 2;
53
WimaxHelper::SchedulerType
scheduler =
WimaxHelper::SCHED_TYPE_SIMPLE
;
54
55
NodeContainer
ssNodes
;
56
NodeContainer
bsNodes
;
57
58
ssNodes
.
Create
(1);
59
bsNodes
.Create(1);
60
61
WimaxHelper
wimax;
62
63
NetDeviceContainer
ssDevs
;
64
NetDeviceContainer
bsDevs
;
65
66
ssDevs
= wimax.
Install
(
ssNodes
,
67
WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION
,
68
WimaxHelper::SIMPLE_PHY_TYPE_OFDM
,
69
scheduler);
70
bsDevs
= wimax.
Install
(
bsNodes
,
71
WimaxHelper::DEVICE_TYPE_BASE_STATION
,
72
WimaxHelper::SIMPLE_PHY_TYPE_OFDM
,
73
scheduler);
74
75
ssDevs
.
Get
(0)->GetObject<
SubscriberStationNetDevice
>()->SetModulationType(
76
WimaxPhy::MODULATION_TYPE_QAM16_12
);
77
bsDevs
.Get(0)->GetObject<
BaseStationNetDevice
>();
78
79
InternetStackHelper
stack;
80
stack.Install(
bsNodes
);
81
stack.Install(
ssNodes
);
82
83
Ipv4AddressHelper
address;
84
address.SetBase(
"10.1.1.0"
,
"255.255.255.0"
);
85
86
Ipv4InterfaceContainer
SSinterfaces
= address.Assign(
ssDevs
);
87
Ipv4InterfaceContainer
BSinterface
= address.Assign(
bsDevs
);
88
89
// Create one UGS Downlink service flow between the ss and the bs
90
auto
DlServiceFlowUgs
=
new
ServiceFlow
(
ServiceFlow::SF_DIRECTION_DOWN
);
91
IpcsClassifierRecord
DlClassifierUgs
(
Ipv4Address
(
"0.0.0.0"
),
92
Ipv4Mask
(
"0.0.0.0"
),
93
Ipv4Address
(
"0.0.0.0"
),
94
Ipv4Mask
(
"0.0.0.0"
),
95
3000,
96
3000,
97
0,
98
35000,
99
17,
100
1);
101
CsParameters
DlcsParam
(
CsParameters::ADD
,
DlClassifierUgs
);
102
DlServiceFlowUgs
->SetConvergenceSublayerParam(
DlcsParam
);
103
DlServiceFlowUgs
->SetCsSpecification(
ServiceFlow::IPV4
);
104
DlServiceFlowUgs
->SetServiceSchedulingType(
ServiceFlow::SF_TYPE_UGS
);
105
DlServiceFlowUgs
->SetMaxSustainedTrafficRate(1000000);
106
DlServiceFlowUgs
->SetMinReservedTrafficRate(1000000);
107
DlServiceFlowUgs
->SetMinTolerableTrafficRate(1000000);
108
DlServiceFlowUgs
->SetMaximumLatency(10);
109
DlServiceFlowUgs
->SetMaxTrafficBurst(1000);
110
DlServiceFlowUgs
->SetTrafficPriority(1);
111
112
// Create one UGS Uplink service flow between the ss and the bs
113
auto
UlServiceFlowUgs
=
new
ServiceFlow
(
ServiceFlow::SF_DIRECTION_UP
);
114
IpcsClassifierRecord
UlClassifierUgs
(
Ipv4Address
(
"0.0.0.0"
),
115
Ipv4Mask
(
"0.0.0.0"
),
116
Ipv4Address
(
"0.0.0.0"
),
117
Ipv4Mask
(
"0.0.0.0"
),
118
0,
119
35000,
120
3000,
121
3000,
122
17,
123
1);
124
CsParameters
UlcsParam
(
CsParameters::ADD
,
UlClassifierUgs
);
125
UlServiceFlowUgs
->SetConvergenceSublayerParam(
UlcsParam
);
126
UlServiceFlowUgs
->SetCsSpecification(
ServiceFlow::IPV4
);
127
UlServiceFlowUgs
->SetServiceSchedulingType(
ServiceFlow::SF_TYPE_UGS
);
128
UlServiceFlowUgs
->SetMaxSustainedTrafficRate(1000000);
129
UlServiceFlowUgs
->SetMinReservedTrafficRate(1000000);
130
UlServiceFlowUgs
->SetMinTolerableTrafficRate(1000000);
131
UlServiceFlowUgs
->SetMaximumLatency(10);
132
UlServiceFlowUgs
->SetMaxTrafficBurst(1000);
133
UlServiceFlowUgs
->SetTrafficPriority(1);
134
ssDevs
.Get(0)->GetObject<
SubscriberStationNetDevice
>()->AddServiceFlow(
DlServiceFlowUgs
);
135
ssDevs
.Get(0)->GetObject<
SubscriberStationNetDevice
>()->AddServiceFlow(
UlServiceFlowUgs
);
136
137
Simulator::Stop
(
Seconds
(duration));
138
Simulator::Run
();
139
Simulator::Destroy
();
140
}
141
142
/**
143
* @ingroup wimax-test
144
* @ingroup tests
145
*
146
* @brief Ns3 Wimax Service Flow Test Suite
147
*/
148
class
Ns3WimaxServiceFlowTestSuite
:
public
TestSuite
149
{
150
public
:
151
Ns3WimaxServiceFlowTestSuite
();
152
};
153
154
Ns3WimaxServiceFlowTestSuite::Ns3WimaxServiceFlowTestSuite
()
155
:
TestSuite
(
"wimax-service-flow"
,
Type
::UNIT)
156
{
157
AddTestCase
(
new
Ns3WimaxSfCreationTestCase
, TestCase::Duration::QUICK);
158
}
159
160
static
Ns3WimaxServiceFlowTestSuite
ns3WimaxServiceFlowTestSuite
;
///< the test suite
Ns3WimaxServiceFlowTestSuite
Ns3 Wimax Service Flow Test Suite.
Definition
wimax-service-flow-test.cc:149
Ns3WimaxServiceFlowTestSuite::Ns3WimaxServiceFlowTestSuite
Ns3WimaxServiceFlowTestSuite()
Definition
wimax-service-flow-test.cc:154
Ns3WimaxSfCreationTestCase
Test the service flow creation.
Definition
wimax-service-flow-test.cc:30
Ns3WimaxSfCreationTestCase::~Ns3WimaxSfCreationTestCase
~Ns3WimaxSfCreationTestCase() override
Definition
wimax-service-flow-test.cc:44
Ns3WimaxSfCreationTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
wimax-service-flow-test.cc:49
Ns3WimaxSfCreationTestCase::Ns3WimaxSfCreationTestCase
Ns3WimaxSfCreationTestCase()
Definition
wimax-service-flow-test.cc:39
ns3::BaseStationNetDevice
BaseStation NetDevice.
Definition
bs-net-device.h:43
ns3::CsParameters
CsParameters class.
Definition
cs-parameters.h:25
ns3::CsParameters::ADD
@ ADD
Definition
cs-parameters.h:30
ns3::InternetStackHelper
aggregate IP/TCP/UDP functionality to existing Nodes.
Definition
internet-stack-helper.h:81
ns3::IpcsClassifierRecord
IpcsClassifierRecord class.
Definition
ipcs-classifier-record.h:27
ns3::Ipv4AddressHelper
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Definition
ipv4-address-helper.h:38
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4InterfaceContainer
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Definition
ipv4-interface-container.h:45
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition
ipv4-address.h:246
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::NetDeviceContainer::Get
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Definition
net-device-container.cc:56
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition
node-container.cc:73
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::ServiceFlow::SF_DIRECTION_UP
@ SF_DIRECTION_UP
Definition
service-flow.h:38
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition
simulator.cc:131
ns3::Simulator::Run
static void Run()
Run the simulation.
Definition
simulator.cc:167
ns3::Simulator::Stop
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition
simulator.cc:175
ns3::SubscriberStationNetDevice
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition
ss-net-device.h:39
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::WimaxHelper
helps to manage and create WimaxNetDevice objects
Definition
wimax-helper.h:48
ns3::WimaxHelper::SchedulerType
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Definition
wimax-helper.h:75
ns3::WimaxHelper::SCHED_TYPE_SIMPLE
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
Definition
wimax-helper.h:76
ns3::WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION
@ DEVICE_TYPE_SUBSCRIBER_STATION
Subscriber station(SS) device.
Definition
wimax-helper.h:56
ns3::WimaxHelper::DEVICE_TYPE_BASE_STATION
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
Definition
wimax-helper.h:57
ns3::WimaxHelper::SIMPLE_PHY_TYPE_OFDM
@ SIMPLE_PHY_TYPE_OFDM
Definition
wimax-helper.h:67
ns3::WimaxHelper::Install
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
Definition
wimax-helper.cc:254
ns3::WimaxPhy::MODULATION_TYPE_QAM16_12
@ MODULATION_TYPE_QAM16_12
Definition
wimax-phy.h:47
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
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1344
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3WimaxServiceFlowTestSuite
static Ns3WimaxServiceFlowTestSuite ns3WimaxServiceFlowTestSuite
the test suite
Definition
wimax-service-flow-test.cc:160
src
wimax
test
wimax-service-flow-test.cc
Generated on Mon Dec 15 2025 15:22:12 for ns-3 by
1.9.8