A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Jaume Nin <jaume.nin@cttc.cat>
7
*/
8
9
#include "
epc-test-gtpu.h
"
10
11
#include "ns3/epc-gtpu-header.h"
12
#include "ns3/log.h"
13
#include "ns3/object.h"
14
#include "ns3/packet.h"
15
16
using namespace
ns3
;
17
18
NS_LOG_COMPONENT_DEFINE
(
"EpcGtpuTest"
);
19
20
/**
21
* TestSuite
22
*/
23
24
EpsGtpuTestSuite::EpsGtpuTestSuite
()
25
:
TestSuite
(
"epc-gtpu"
,
Type
::SYSTEM)
26
{
27
AddTestCase
(
new
EpsGtpuHeaderTestCase
(), TestCase::Duration::QUICK);
28
}
29
30
static
EpsGtpuTestSuite
epsGtpuTestSuite
;
31
32
/**
33
* TestCase
34
*/
35
36
EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
()
37
:
TestCase
(
"Check header coding and decoding"
)
38
{
39
NS_LOG_INFO
(
"Creating EpsGtpuHeaderTestCase"
);
40
}
41
42
EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
()
43
{
44
}
45
46
void
47
EpsGtpuHeaderTestCase::DoRun
()
48
{
49
auto
logLevel = (
LogLevel
)(
LOG_PREFIX_FUNC
|
LOG_PREFIX_TIME
|
LOG_LEVEL_ALL
);
50
51
LogComponentEnable
(
"EpcGtpuTest"
, logLevel);
52
GtpuHeader
h1;
53
h1.
SetExtensionHeaderFlag
(
true
);
54
h1.
SetLength
(1234);
55
h1.
SetMessageType
(123);
56
h1.
SetNPduNumber
(123);
57
h1.
SetNPduNumberFlag
(
true
);
58
h1.
SetNextExtensionType
(123);
59
h1.
SetProtocolType
(
true
);
60
h1.
SetSequenceNumber
(1234);
61
h1.
SetSequenceNumberFlag
(
true
);
62
h1.
SetTeid
(1234567);
63
h1.
SetVersion
(123);
64
65
Packet
p;
66
GtpuHeader
h2;
67
p.
AddHeader
(h1);
68
p.
RemoveHeader
(h2);
69
70
NS_TEST_ASSERT_MSG_EQ
(h1, h2,
"Wrong value!"
);
71
}
EpsGtpuHeaderTestCase
Test 1.Check header coding and decoding.
Definition
epc-test-gtpu.h:38
EpsGtpuHeaderTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
epc-test-gtpu.cc:47
EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
~EpsGtpuHeaderTestCase() override
Definition
epc-test-gtpu.cc:42
EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
EpsGtpuHeaderTestCase()
TestCase.
Definition
epc-test-gtpu.cc:36
EpsGtpuTestSuite
Test suite for testing GPRS tunnelling protocol header coding and decoding.
Definition
epc-test-gtpu.h:29
EpsGtpuTestSuite::EpsGtpuTestSuite
EpsGtpuTestSuite()
TestSuite.
Definition
epc-test-gtpu.cc:24
ns3::GtpuHeader
Implementation of the GPRS Tunnelling Protocol header according to GTPv1-U Release 10 as per 3Gpp TS ...
Definition
epc-gtpu-header.h:29
ns3::GtpuHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t sequenceNumber)
Set sequence number function.
Definition
epc-gtpu-header.cc:235
ns3::GtpuHeader::SetExtensionHeaderFlag
void SetExtensionHeaderFlag(bool extensionHeaderFlag)
Set extension header flag function.
Definition
epc-gtpu-header.cc:193
ns3::GtpuHeader::SetTeid
void SetTeid(uint32_t teid)
Set TEID function.
Definition
epc-gtpu-header.cc:247
ns3::GtpuHeader::SetVersion
void SetVersion(uint8_t version)
Set version function.
Definition
epc-gtpu-header.cc:253
ns3::GtpuHeader::SetNPduNumber
void SetNPduNumber(uint8_t nPduNumber)
Set NPDU number function.
Definition
epc-gtpu-header.cc:211
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:217
ns3::GtpuHeader::SetMessageType
void SetMessageType(uint8_t messageType)
Set message type function.
Definition
epc-gtpu-header.cc:205
ns3::GtpuHeader::SetSequenceNumberFlag
void SetSequenceNumberFlag(bool sequenceNumberFlag)
Set sequence number flag function.
Definition
epc-gtpu-header.cc:241
ns3::GtpuHeader::SetProtocolType
void SetProtocolType(bool protocolType)
Set protocol type function.
Definition
epc-gtpu-header.cc:229
ns3::GtpuHeader::SetNextExtensionType
void SetNextExtensionType(uint8_t nextExtensionType)
Set next extension type function.
Definition
epc-gtpu-header.cc:223
ns3::GtpuHeader::SetLength
void SetLength(uint16_t length)
Set the length in octets of the payload.
Definition
epc-gtpu-header.cc:199
ns3::Packet
network packets
Definition
packet.h:228
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition
packet.cc:283
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition
packet.cc:257
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition
test.cc:292
ns3::TestSuite
A suite of tests to run.
Definition
test.h:1267
ns3::TestSuite::Type
Type
Type of test.
Definition
test.h:1274
epsGtpuTestSuite
static EpsGtpuTestSuite epsGtpuTestSuite
Definition
epc-test-gtpu.cc:30
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:191
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition
log.h:264
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:134
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:291
ns3::LogLevel
LogLevel
Logging severity classes and levels.
Definition
log.h:83
ns3::LOG_LEVEL_ALL
@ LOG_LEVEL_ALL
Print everything.
Definition
log.h:105
ns3::LOG_PREFIX_FUNC
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition
log.h:107
ns3::LOG_PREFIX_TIME
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition
log.h:108
src
lte
test
epc-test-gtpu.cc
Generated on Tue Dec 10 2024 18:20:44 for ns-3 by
1.11.0