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