A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ss-mac-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
7 * <amine.ismail@udcast.com>
8 */
9#include "ns3/log.h"
10#include "ns3/net-device-container.h"
11#include "ns3/node-container.h"
12#include "ns3/simulator.h"
13#include "ns3/test.h"
14#include "ns3/wimax-helper.h"
15
16using namespace ns3;
17
18/**
19 * @ingroup wimax-test
20 * @ingroup tests
21 *
22 * @brief Test the network entry procedure.
23 * Create a network with a BS and 10 SS and check that all the SS perform the
24 * network entry correctly
25 *
26 */
28{
29 public:
32
33 private:
34 void DoRun() override;
35};
36
38 : TestCase("Test the network entry procedure")
39{
40}
41
45
46void
48{
50 NodeContainer ssNodes;
51 NodeContainer bsNodes;
52
53 ssNodes.Create(10);
54 bsNodes.Create(1);
55
56 WimaxHelper wimax;
57
58 NetDeviceContainer ssDevs;
59 NetDeviceContainer bsDevs;
60
61 ssDevs = wimax.Install(ssNodes,
64 scheduler);
65 bsDevs = wimax.Install(bsNodes,
68 scheduler);
71 for (int i = 0; i < 10; i++)
72 {
74 ssDevs.Get(i)->GetObject<SubscriberStationNetDevice>()->IsRegistered(),
75 true,
76 "SS[" << i << "] IsNotRegistered");
77 }
79}
80
81/**
82 * @ingroup wimax-test
83 * @ingroup tests
84 *
85 * @brief Test if the management connections are correctly setup.
86 * Create a network with a BS and 10 SS and check that the management
87 * connections are correctly setup for all SS
88 *
89 */
91{
92 public:
95
96 private:
97 void DoRun() override;
98};
99
101 : TestCase("Test if the management connections are correctly setup")
102{
103}
104
108
109void
111{
113 NodeContainer ssNodes;
114 NodeContainer bsNodes;
115
116 ssNodes.Create(10);
117 bsNodes.Create(1);
118
119 WimaxHelper wimax;
120
121 NetDeviceContainer ssDevs;
122 NetDeviceContainer bsDevs;
123
124 ssDevs = wimax.Install(ssNodes,
127 scheduler);
128 bsDevs = wimax.Install(bsNodes,
131 scheduler);
134 for (int i = 0; i < 10; i++)
135 {
136 NS_TEST_EXPECT_MSG_EQ(ssDevs.Get(i)
137 ->GetObject<SubscriberStationNetDevice>()
139 true,
140 "Management connections for SS[" << i << "] are not allocated");
141 }
143}
144
145/**
146 * @ingroup wimax-test
147 * @ingroup tests
148 *
149 * @brief Ns3 Wimax SS Mac Test Suite
150 */
152{
153 public:
155};
156
158 : TestSuite("wimax-ss-mac-layer", Type::UNIT)
159{
160 AddTestCase(new Ns3WimaxNetworkEntryTestCase, TestCase::Duration::QUICK);
161 AddTestCase(new Ns3WimaxManagementConnectionsTestCase, TestCase::Duration::QUICK);
162}
163
Test if the management connections are correctly setup.
void DoRun() override
Implementation to actually run this TestCase.
Test the network entry procedure.
void DoRun() override
Implementation to actually run this TestCase.
~Ns3WimaxNetworkEntryTestCase() override
Ns3WimaxNetworkEntryTestCase()
Ns3 Wimax SS Mac Test Suite.
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.
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.
bool GetAreManagementConnectionsAllocated() const
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)
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Ns3WimaxSSMacTestSuite ns3WimaxSSMacTestSuite
the test suite