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 * 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
21using namespace ns3;
22
23/**
24 * \ingroup wimax-test
25 * \ingroup tests
26 *
27 * \brief Test the service flow creation.
28 */
30{
31 public:
34
35 private:
36 void DoRun() override;
37};
38
40 : TestCase("Test the service flow tlv implementation.")
41{
42}
43
47
48void
50{
51 // default values
52 int duration = 2;
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,
69 scheduler);
70 bsDevs = wimax.Install(bsNodes,
73 scheduler);
74
75 ssDevs.Get(0)->GetObject<SubscriberStationNetDevice>()->SetModulationType(
77 bsDevs.Get(0)->GetObject<BaseStationNetDevice>();
78
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));
140}
141
142/**
143 * \ingroup wimax-test
144 * \ingroup tests
145 *
146 * \brief Ns3 Wimax Service Flow Test Suite
147 */
149{
150 public:
152};
153
155 : TestSuite("wimax-service-flow", Type::UNIT)
156{
157 AddTestCase(new Ns3WimaxSfCreationTestCase, TestCase::Duration::QUICK);
158}
159
Ns3 Wimax Service Flow Test Suite.
Test the service flow creation.
void DoRun() override
Implementation to actually run this TestCase.
BaseStation NetDevice.
CsParameters class.
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.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
a class to represent an Ipv4 address mask
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
SubscriberStationNetDevice subclass of WimaxNetDevice.
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
helps to manage and create WimaxNetDevice objects
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
@ SCHED_TYPE_SIMPLE
A simple priority-based FCFS scheduler.
@ DEVICE_TYPE_SUBSCRIBER_STATION
Subscriber station(SS) device.
@ DEVICE_TYPE_BASE_STATION
Base station(BS) device.
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
@ MODULATION_TYPE_QAM16_12
Definition wimax-phy.h:47
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Ns3WimaxServiceFlowTestSuite ns3WimaxServiceFlowTestSuite
the test suite