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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
7 *
8 */
9#include "ns3/mac-messages.h"
10#include "ns3/service-flow.h"
11#include "ns3/test.h"
12
13using namespace ns3;
14
15/**
16 * @ingroup wimax
17 * @defgroup wimax-test wimax module tests
18 */
19
20/**
21 * @ingroup wimax-test
22 * @ingroup tests
23 *
24 * @brief Test the DSA request message.
25 */
27{
28 public:
30 ~DsaRequestTestCase() override;
31
32 private:
33 void DoRun() override;
34};
35
37 : TestCase("Test the DSA request messages")
38{
39}
40
44
45void
47{
49 CsParameters csParam(CsParameters::ADD, classifier);
51
52 sf.SetSfid(100);
57 sf.SetMinReservedTrafficRate(1000000);
59 sf.SetMaximumLatency(10);
60 sf.SetMaxTrafficBurst(1000);
62
63 DsaReq dsaReq(sf);
64 Ptr<Packet> packet = Create<Packet>();
65 packet->AddHeader(dsaReq);
66
67 DsaReq dsaReqRecv;
68 packet->RemoveHeader(dsaReqRecv);
69
70 ServiceFlow sfRecv = dsaReqRecv.GetServiceFlow();
71
74 "The sfRecv had the wrong direction.");
75 NS_TEST_ASSERT_MSG_EQ(sfRecv.GetSfid(), 100, "The sfRecv had the wrong sfid.");
78 "The sfRecv had the wrong cs specification.");
81 "The sfRecv had the wrong service scheduling type.");
83 1000000,
84 "The sfRecv had the wrong maximum sustained traffic rate.");
86 1000000,
87 "The sfRecv had the wrong minimum reserved traffic rate.");
89 1000000,
90 "The sfRecv had the wrong minimum tolerable traffic rate.");
92 10,
93 "The sfRecv had the wrong maximum latency.");
95 1000,
96 "The sfRecv had the wrong maximum traffic burst.");
98 1,
99 "The sfRecv had the wrong traffic priority.");
100}
101
102/**
103 * @ingroup wimax-test
104 * @ingroup tests
105 *
106 * @brief Ns3 Wimax Mac Messages Test Suite
107 */
109{
110 public:
112};
113
115 : TestSuite("wimax-mac-messages", Type::UNIT)
116{
117 AddTestCase(new DsaRequestTestCase, TestCase::Duration::QUICK);
118}
119
Test the DSA request message.
void DoRun() override
Implementation to actually run this TestCase.
Ns3 Wimax Mac Messages Test Suite.
CsParameters class.
This class implements the DSA-REQ message described by "IEEE Standard forLocal and metropolitan area ...
ServiceFlow GetServiceFlow() const
IpcsClassifierRecord class.
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
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: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
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#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:134
static Ns3WimaxMacMessagesTestSuite ns3WimaxMacMessagesTestSuite
the test suite
Every class exported by the ns3 library is enclosed in the ns3 namespace.