A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mac-messages-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 *
19 */
20#include "ns3/mac-messages.h"
21#include "ns3/service-flow.h"
22#include "ns3/test.h"
23
24using namespace ns3;
25
26/**
27 * \ingroup wimax
28 * \defgroup wimax-test wimax module tests
29 */
30
31/**
32 * \ingroup wimax-test
33 * \ingroup tests
34 *
35 * \brief Test the DSA request message.
36 */
38{
39 public:
41 ~DsaRequestTestCase() override;
42
43 private:
44 void DoRun() override;
45};
46
48 : TestCase("Test the DSA request messages")
49{
50}
51
53{
54}
55
56void
58{
60 CsParameters csParam(CsParameters::ADD, classifier);
62
63 sf.SetSfid(100);
68 sf.SetMinReservedTrafficRate(1000000);
70 sf.SetMaximumLatency(10);
71 sf.SetMaxTrafficBurst(1000);
73
74 DsaReq dsaReq(sf);
75 Ptr<Packet> packet = Create<Packet>();
76 packet->AddHeader(dsaReq);
77
78 DsaReq dsaReqRecv;
79 packet->RemoveHeader(dsaReqRecv);
80
81 ServiceFlow sfRecv = dsaReqRecv.GetServiceFlow();
82
85 "The sfRecv had the wrong direction.");
86 NS_TEST_ASSERT_MSG_EQ(sfRecv.GetSfid(), 100, "The sfRecv had the wrong sfid.");
89 "The sfRecv had the wrong cs specification.");
92 "The sfRecv had the wrong service scheduling type.");
94 1000000,
95 "The sfRecv had the wrong maximum sustained traffic rate.");
97 1000000,
98 "The sfRecv had the wrong minimum reserved traffic rate.");
100 1000000,
101 "The sfRecv had the wrong minimum tolerable traffic rate.");
103 10,
104 "The sfRecv had the wrong maximum latency.");
106 1000,
107 "The sfRecv had the wrong maximum traffic burst.");
109 1,
110 "The sfRecv had the wrong traffic priority.");
111}
112
113/**
114 * \ingroup wimax-test
115 * \ingroup tests
116 *
117 * \brief Ns3 Wimax Mac Messages Test Suite
118 */
120{
121 public:
123};
124
126 : TestSuite("wimax-mac-messages", Type::UNIT)
127{
128 AddTestCase(new DsaRequestTestCase, TestCase::Duration::QUICK);
129}
130
Test the DSA request message.
void DoRun() override
Implementation to actually run this TestCase.
~DsaRequestTestCase() override
Ns3 Wimax Mac Messages Test Suite.
CsParameters class.
Definition: cs-parameters.h:36
This class implements the DSA-REQ message described by "IEEE Standard for Local and metropolitan area...
Definition: mac-messages.h:386
ServiceFlow GetServiceFlow() const
IpcsClassifierRecord class.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
void SetSfid(uint32_t sfid)
Set SFID.
void SetCsSpecification(CsSpecification spec)
Set CS specification.
ServiceFlow::SchedulingType GetServiceSchedulingType() const
Get service scheduling type.
uint32_t GetMaxSustainedTrafficRate() const
Get max sustained traffic rate.
uint32_t GetMaxTrafficBurst() const
Get max traffic burst.
uint32_t GetSfid() const
Get SFID.
uint32_t GetMaximumLatency() const
Get maximum latency.
void SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
void SetServiceSchedulingType(ServiceFlow::SchedulingType schedType)
Set service scheduling type.
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
uint8_t GetTrafficPriority() const
Get traffic priority.
uint32_t GetMinReservedTrafficRate() const
Get minimum reserved traffic rate.
void SetTrafficPriority(uint8_t priority)
Set traffic priority.
CsSpecification GetCsSpecification() const
Get CS specification.
void SetMinTolerableTrafficRate(uint32_t minJitter)
Set minimum tolerable traffic rate.
uint32_t GetMinTolerableTrafficRate() const
Get minimum tolerable traffic rate.
void SetMinReservedTrafficRate(uint32_t minResvRate)
Set minimum reserved traffic rate.
Direction GetDirection() const
Get direction.
void SetMaxSustainedTrafficRate(uint32_t maxSustainedRate)
Set max sustained traffic rate.
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
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:145
static Ns3WimaxMacMessagesTestSuite ns3WimaxMacMessagesTestSuite
the test suite
Every class exported by the ns3 library is enclosed in the ns3 namespace.