A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
epc-test-gtpu.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Jaume Nin <jaume.nin@cttc.cat>
19
*/
20
21
22
#include "ns3/log.h"
23
#include "ns3/object.h"
24
#include "ns3/packet.h"
25
#include "ns3/epc-gtpu-header.h"
26
27
#include "
epc-test-gtpu.h
"
28
29
NS_LOG_COMPONENT_DEFINE
(
"EpcGtpuTest"
);
30
31
namespace
ns3 {
32
33
38
EpsGtpuTestSuite::EpsGtpuTestSuite
()
39
:
TestSuite
(
"epc-gtpu"
, SYSTEM)
40
{
41
AddTestCase
(
new
EpsGtpuHeaderTestCase
(),
TestCase::QUICK
);
42
}
43
44
static
EpsGtpuTestSuite
epsGtpuTestSuite
;
45
46
51
EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
()
52
:
TestCase
(
"Check header coding and decoding"
)
53
{
54
NS_LOG_INFO
(
"Creating EpsGtpuHeaderTestCase"
);
55
}
56
57
EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
()
58
{
59
}
60
61
void
62
EpsGtpuHeaderTestCase::DoRun
(
void
)
63
{
64
LogLevel
logLevel = (
LogLevel
)(
LOG_PREFIX_FUNC
|
LOG_PREFIX_TIME
|
LOG_LEVEL_ALL
);
65
66
LogComponentEnable
(
"EpcGtpuTest"
, logLevel);
67
GtpuHeader
h1;
68
h1.
SetExtensionHeaderFlag
(
true
);
69
h1.
SetLength
(1234);
70
h1.
SetMessageType
(123);
71
h1.
SetNPduNumber
(123);
72
h1.
SetNPduNumberFlag
(
true
);
73
h1.
SetNextExtensionType
(123);
74
h1.
SetProtocolType
(
true
);
75
h1.
SetSequenceNumber
(1234);
76
h1.
SetSequenceNumberFlag
(
true
);
77
h1.
SetTeid
(1234567);
78
h1.
SetVersion
(123);
79
80
Packet
p;
81
GtpuHeader
h2;
82
p.
AddHeader
(h1);
83
p.
RemoveHeader
(h2);
84
85
NS_TEST_ASSERT_MSG_EQ
(h1, h2,
"Wrong value!"
);
86
}
87
88
}
// namespace ns3
89
ns3::Packet::RemoveHeader
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition:
packet.cc:268
ns3::epsGtpuTestSuite
static EpsGtpuTestSuite epsGtpuTestSuite
Definition:
epc-test-gtpu.cc:44
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1025
ns3::EpsGtpuTestSuite
Definition:
epc-test-gtpu.h:33
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Definition:
log.h:298
ns3::TestCase
encapsulates test code
Definition:
test.h:849
ns3::GtpuHeader::SetVersion
void SetVersion(uint8_t m_version)
Definition:
epc-gtpu-header.cc:261
ns3::Packet
network packets
Definition:
packet.h:203
ns3::EpsGtpuHeaderTestCase::~EpsGtpuHeaderTestCase
virtual ~EpsGtpuHeaderTestCase()
Definition:
epc-test-gtpu.cc:57
ns3::GtpuHeader::SetNPduNumber
void SetNPduNumber(uint8_t m_nPduNumber)
Definition:
epc-gtpu-header.cc:219
ns3::GtpuHeader::SetExtensionHeaderFlag
void SetExtensionHeaderFlag(bool m_extensionHeaderFlag)
Definition:
epc-gtpu-header.cc:201
ns3::GtpuHeader::SetProtocolType
void SetProtocolType(bool m_protocolType)
Definition:
epc-gtpu-header.cc:237
epc-test-gtpu.h
ns3::GtpuHeader::SetNPduNumberFlag
void SetNPduNumberFlag(bool m_nPduNumberFlag)
Definition:
epc-gtpu-header.cc:225
ns3::GtpuHeader::SetMessageType
void SetMessageType(uint8_t m_messageType)
Definition:
epc-gtpu-header.cc:213
ns3::GtpuHeader::SetTeid
void SetTeid(uint32_t m_teid)
Definition:
epc-gtpu-header.cc:255
ns3::LOG_PREFIX_TIME
Definition:
log.h:93
ns3::LOG_PREFIX_FUNC
Definition:
log.h:92
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition:
test.cc:173
ns3::EpsGtpuHeaderTestCase::EpsGtpuHeaderTestCase
EpsGtpuHeaderTestCase()
TestCase.
Definition:
epc-test-gtpu.cc:51
ns3::TestCase::QUICK
Fast test.
Definition:
test.h:857
ns3::GtpuHeader::SetSequenceNumberFlag
void SetSequenceNumberFlag(bool m_sequenceNumberFlag)
Definition:
epc-gtpu-header.cc:249
ns3::GtpuHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t m_sequenceNumber)
Definition:
epc-gtpu-header.cc:243
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("EpcGtpuTest")
ns3::LogLevel
LogLevel
Logging severity classes and levels.
Definition:
log.h:68
ns3::GtpuHeader::SetLength
void SetLength(uint16_t m_length)
Definition:
epc-gtpu-header.cc:207
ns3::LOG_LEVEL_ALL
Definition:
log.h:90
ns3::GtpuHeader::SetNextExtensionType
void SetNextExtensionType(uint8_t m_nextExtensionType)
Definition:
epc-gtpu-header.cc:231
ns3::EpsGtpuTestSuite::EpsGtpuTestSuite
EpsGtpuTestSuite()
TestSuite.
Definition:
epc-test-gtpu.cc:38
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition:
packet.cc:253
ns3::LogComponentEnable
void LogComponentEnable(char const *name, enum LogLevel level)
Definition:
log.cc:311
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:137
ns3::EpsGtpuHeaderTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
epc-test-gtpu.cc:62
ns3::GtpuHeader
Implementation of the GTPv1-U Release 10 as per 3Gpp TS 29.281 document.
Definition:
epc-gtpu-header.h:39
ns3::EpsGtpuHeaderTestCase
Test 1.Check header coding and decoding.
Definition:
epc-test-gtpu.h:42
src
lte
test
epc-test-gtpu.cc
Generated on Sat Apr 19 2014 14:07:02 for ns-3 by
1.8.6