A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
epc-test-gtpu.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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
* Author: Jaume Nin <jaume.nin@cttc.cat>
18
*/
19
20
#include "
epc-test-gtpu.h
"
21
22
#include "ns3/epc-gtpu-header.h"
23
#include "ns3/log.h"
24
#include "ns3/object.h"
25
#include "ns3/packet.h"
26
27
using namespace
ns3
;
28
29
NS_LOG_COMPONENT_DEFINE
(
"EpcGtpuTest"
);
30
35
EpsGtpuTestSuite::EpsGtpuTestSuite
()
36
:
TestSuite
(
"epc-gtpu"
, SYSTEM)
37
{
38
AddTestCase
(
new
EpsGtpuHeaderTestCase
(), TestCase::QUICK);
39
}
40
41
static
EpsGtpuTestSuite
epsGtpuTestSuite
;
42
47
EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
()
48
:
TestCase
(
"Check header coding and decoding"
)
49
{
50
NS_LOG_INFO
(
"Creating EpsGtpuHeaderTestCase"
);
51
}
52
53
EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
()
54
{
55
}
56
57
void
58
EpsGtpuHeaderTestCase::DoRun
()
59
{
60
auto
logLevel = (
LogLevel
)(
LOG_PREFIX_FUNC
|
LOG_PREFIX_TIME
|
LOG_LEVEL_ALL
);
61
62
LogComponentEnable
(
"EpcGtpuTest"
, logLevel);
63
GtpuHeader
h1;
64
h1.
SetExtensionHeaderFlag
(
true
);
65
h1.
SetLength
(1234);
66
h1.
SetMessageType
(123);
67
h1.
SetNPduNumber
(123);
68
h1.
SetNPduNumberFlag
(
true
);
69
h1.
SetNextExtensionType
(123);
70
h1.
SetProtocolType
(
true
);
71
h1.
SetSequenceNumber
(1234);
72
h1.
SetSequenceNumberFlag
(
true
);
73
h1.
SetTeid
(1234567);
74
h1.
SetVersion
(123);
75
76
Packet
p;
77
GtpuHeader
h2;
78
p.
AddHeader
(h1);
79
p.
RemoveHeader
(h2);
80
81
NS_TEST_ASSERT_MSG_EQ
(h1, h2,
"Wrong value!"
);
82
}
EpsGtpuHeaderTestCase
Test 1.Check header coding and decoding.
Definition:
epc-test-gtpu.h:49
EpsGtpuHeaderTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition:
epc-test-gtpu.cc:58
EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
~EpsGtpuHeaderTestCase() override
Definition:
epc-test-gtpu.cc:53
EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
EpsGtpuHeaderTestCase()
TestCase.
Definition:
epc-test-gtpu.cc:47
EpsGtpuTestSuite
Test suite for testing GPRS tunnelling protocol header coding and decoding.
Definition:
epc-test-gtpu.h:40
EpsGtpuTestSuite::EpsGtpuTestSuite
EpsGtpuTestSuite()
TestSuite.
Definition:
epc-test-gtpu.cc:35
ns3::GtpuHeader
Implementation of the GPRS Tunnelling Protocol header according to GTPv1-U Release 10 as per 3Gpp TS ...
Definition:
epc-gtpu-header.h:40
ns3::GtpuHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t sequenceNumber)
Set sequence number function.
Definition:
epc-gtpu-header.cc:246
ns3::GtpuHeader::SetExtensionHeaderFlag
void SetExtensionHeaderFlag(bool extensionHeaderFlag)
Set extension header flag function.
Definition:
epc-gtpu-header.cc:204
ns3::GtpuHeader::SetTeid
void SetTeid(uint32_t teid)
Set TEID function.
Definition:
epc-gtpu-header.cc:258
ns3::GtpuHeader::SetVersion
void SetVersion(uint8_t version)
Set version function.
Definition:
epc-gtpu-header.cc:264
ns3::GtpuHeader::SetNPduNumber
void SetNPduNumber(uint8_t nPduNumber)
Set NPDU number function.
Definition:
epc-gtpu-header.cc:222
ns3::GtpuHeader::SetNPduNumberFlag
void SetNPduNumberFlag(bool nPduNumberFlag)
Sets the flag that indicates the presence of a meaningful value of the N-PDU Number field.
Definition:
epc-gtpu-header.cc:228
ns3::GtpuHeader::SetMessageType
void SetMessageType(uint8_t messageType)
Set message type function.
Definition:
epc-gtpu-header.cc:216
ns3::GtpuHeader::SetSequenceNumberFlag
void SetSequenceNumberFlag(bool sequenceNumberFlag)
Set sequence number flag function.
Definition:
epc-gtpu-header.cc:252
ns3::GtpuHeader::SetProtocolType
void SetProtocolType(bool protocolType)
Set protocol type function.
Definition:
epc-gtpu-header.cc:240
ns3::GtpuHeader::SetNextExtensionType
void SetNextExtensionType(uint8_t nextExtensionType)
Set next extension type function.
Definition:
epc-gtpu-header.cc:234
ns3::GtpuHeader::SetLength
void SetLength(uint16_t length)
Set the length in octets of the payload.
Definition:
epc-gtpu-header.cc:210
ns3::Packet
network packets
Definition:
packet.h:239
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition:
packet.cc:294
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition:
packet.cc:268
ns3::TestCase
encapsulates test code
Definition:
test.h:1060
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition:
test.cc:301
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1256
epsGtpuTestSuite
static EpsGtpuTestSuite epsGtpuTestSuite
Definition:
epc-test-gtpu.cc:41
epc-test-gtpu.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition:
log.h:275
NS_TEST_ASSERT_MSG_EQ
#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:144
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LogComponentEnable
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition:
log.cc:302
ns3::LogLevel
LogLevel
Logging severity classes and levels.
Definition:
log.h:94
ns3::LOG_LEVEL_ALL
@ LOG_LEVEL_ALL
Print everything.
Definition:
log.h:116
ns3::LOG_PREFIX_FUNC
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition:
log.h:118
ns3::LOG_PREFIX_TIME
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition:
log.h:119
src
lte
test
epc-test-gtpu.cc
Generated on Sun Mar 3 2024 17:11:03 for ns-3 by
1.9.1