A Discrete-Event Network Simulator
API
ss-mac-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2007,2008, 2009 INRIA, UDcast
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19 * <amine.ismail@udcast.com>
20 */
21#include "ns3/log.h"
22#include "ns3/test.h"
23#include "ns3/simulator.h"
24#include "ns3/wimax-helper.h"
25#include "ns3/net-device-container.h"
26#include "ns3/node-container.h"
27
28using namespace ns3;
29
40{
41public:
44
45private:
46 virtual void DoRun (void);
47
48};
49
51 : TestCase ("Test the network entry procedure")
52{
53}
54
56{
57}
58
59void
61{
62 WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
63 NodeContainer ssNodes;
64 NodeContainer bsNodes;
65
66 ssNodes.Create (10);
67 bsNodes.Create (1);
68
69 WimaxHelper wimax;
70
71 NetDeviceContainer ssDevs, bsDevs;
72
73 ssDevs = wimax.Install (ssNodes,
74 WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
75 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
76 scheduler);
77 bsDevs = wimax.Install (bsNodes,
78 WimaxHelper::DEVICE_TYPE_BASE_STATION,
79 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
80 scheduler);
81 Simulator::Stop (Seconds (1));
83 for (int i = 0; i < 10; i++)
84 {
85 NS_TEST_EXPECT_MSG_EQ (ssDevs.Get (i)->GetObject<SubscriberStationNetDevice> ()->IsRegistered (),true,
86 "SS[" << i << "] IsNotRegistered");
87 }
88 Simulator::Destroy ();
89}
90
101{
102public:
105
106private:
107 virtual void DoRun (void);
108
109};
110
112 : TestCase ("Test if the management connections are correctly setup")
113{
114}
115
117{
118}
119
120void
122{
123 WimaxHelper::SchedulerType scheduler = WimaxHelper::SCHED_TYPE_SIMPLE;
124 NodeContainer ssNodes;
125 NodeContainer bsNodes;
126
127 ssNodes.Create (10);
128 bsNodes.Create (1);
129
130 WimaxHelper wimax;
131
132 NetDeviceContainer ssDevs, bsDevs;
133
134 ssDevs = wimax.Install (ssNodes,
135 WimaxHelper::DEVICE_TYPE_SUBSCRIBER_STATION,
136 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
137 scheduler);
138 bsDevs = wimax.Install (bsNodes,
139 WimaxHelper::DEVICE_TYPE_BASE_STATION,
140 WimaxHelper::SIMPLE_PHY_TYPE_OFDM,
141 scheduler);
142 Simulator::Stop (Seconds (1));
144 for (int i = 0; i < 10; i++)
145 {
147 true, "Management connections for SS[" << i << "] are not allocated");
148 }
149 Simulator::Destroy ();
150}
151
159{
160public:
162};
163
165 : TestSuite ("wimax-ss-mac-layer", UNIT)
166{
167 AddTestCase (new Ns3WimaxNetworkEntryTestCase, TestCase::QUICK);
169}
170
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
Test if the management connections are correctly setup.
Definition: ss-mac-test.cc:101
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: ss-mac-test.cc:121
Test the network entry procedure.
Definition: ss-mac-test.cc:40
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: ss-mac-test.cc:60
Ns3WimaxNetworkEntryTestCase()
Definition: ss-mac-test.cc:50
virtual ~Ns3WimaxNetworkEntryTestCase()
Definition: ss-mac-test.cc:55
Ns3 Wimax SS Mac Test Suite.
Definition: ss-mac-test.cc:159
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.
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:49
bool GetAreManagementConnectionsAllocated(void) const
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
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
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:240
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Ns3WimaxSSMacTestSuite ns3WimaxSSMacTestSuite
the test suite
Definition: ss-mac-test.cc:171