Split GTP_CodecPort/GTP_Templates into C and U variants

The Types are already split in the dependent modules in GTPC_Types and
GTPU_Types.
There's no point in keeping them together in the same file since those 2
protocols are mostly independent.
Furthermore, testsuites using GTPv2C + GTPv1U don't need GTPv1C.

Change-Id: Ic15c9a2e92828cbafb4dda7355ee534107051e2d
This commit is contained in:
Pau Espin 2024-02-29 19:47:07 +01:00 committed by pespin
parent 7b2cc9219a
commit 4b090c95d5
29 changed files with 360 additions and 294 deletions

View File

@ -91,8 +91,8 @@ FILES+="Osmocom_VTY_Functions.ttcn "
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
# IPA_Emulation + dependencies
FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn
GTP_Templates.ttcn IPCP_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn
GTPv1C_Templates.ttcn IPCP_Types.ttcn "
gen_links $DIR $FILES
ignore_pp_results

View File

@ -10,7 +10,8 @@ FILES="
BSSGP_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
IPA_CodecPort_CtrlFunctDef.cc
IPL4asp_PT.cc
IPL4asp_discovery.cc

View File

@ -21,6 +21,6 @@ GGSN_Tests.m_ggsn_ip4_dns2 := "8.8.8.8"
GGSN_Tests.m_ggsn_ip6_dns1 := "2001:4860:4860::8888"
GGSN_Tests.m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoGGSN";
GTP_CodecPort.mp_pl_SystemUnderTest := GGSN;
GTPv1C_CodecPort.mp_pl_SystemUnderTest := GGSN;
[EXECUTE]

View File

@ -18,11 +18,14 @@ module GGSN_Tests {
import from Misc_Helpers all;
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from GTP_CodecPort all;
import from GTP_CodecPort_CtrlFunct all;
import from GTP_Templates all;
import from GTPv1C_CodecPort all;
import from GTPv1U_CodecPort all;
import from GTPv1C_CodecPort_CtrlFunct all;
import from GTPv1U_CodecPort_CtrlFunct all;
import from GTPC_Types all;
import from GTPU_Types all;
import from GTPv1C_Templates all;
import from GTPv1U_Templates all;
import from IPCP_Types all;
import from PAP_Types all;
import from IP_Types all;
@ -121,8 +124,8 @@ module GGSN_Tests {
var OCT4 g_sgsn_ip_c;
var OCT4 g_sgsn_ip_u;
/* FIXME: parse remName from config file */
var GtpPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT };
var GtpPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT };
var Gtp1cPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT };
var Gtp1uPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT };
timer T_default := 3.0;
/* next to-be-sent GTP-C sequence number */
@ -279,12 +282,12 @@ module GGSN_Tests {
var Result res;
map(self:GTPC, system:GTPC);
res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}});
res := GTPv1C_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}});
log("GTP1C ConnectionID: ", res.connId);
g_peer_c.connId := res.connId;
map(self:GTPU, system:GTPU);
res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}});
res := GTPv1U_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}});
g_peer_u.connId:= res.connId;
g_restart_ctr := f_rnd_octstring(1);

View File

@ -59,7 +59,8 @@ gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn PAP_Types.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_ts29_212_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts32_299_Templates.ttcn "
FILES+="Osmocom_VTY_Functions.ttcn "

View File

@ -9,7 +9,8 @@ FILES="
DIAMETER_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
ICMP_EncDec.cc
ICMPv6_EncDec.cc
IPL4asp_PT.cc

View File

@ -35,8 +35,8 @@ import from HNBLLIF_Types all;
import from HNBLLIF_Templates all;
import from GTP_Emulation all;
import from GTP_Templates all;
import from GTP_CodecPort all;
import from GTPv1U_Templates all;
import from GTPv1U_CodecPort all;
import from GTPU_Types all;
/* this component represents a single Iuh connection at the HNBGW. */
@ -192,14 +192,14 @@ template (value) TestHdlrParams t_def_TestHdlrPars := {
sac := 4
}
template (value) GtpPeer ts_GtpPeerU(charstring ip) := {
template (value) Gtp1uPeer ts_GtpPeerU(charstring ip) := {
connId := 1,
remName := ip,
remPort := GTP1U_PORT
}
function f_gtpu_send(uint32_t tei, octetstring payload) runs on HNBGW_ConnHdlr {
var GtpPeer peer := valueof(ts_GtpPeerU(g_pars.hnodeb_addr));
var Gtp1uPeer peer := valueof(ts_GtpPeerU(g_pars.hnodeb_addr));
GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, int2oct(tei, 4), payload));
}

View File

@ -53,7 +53,7 @@ import from HNBLLIF_Types all;
import from HNBLLIF_Templates all;
import from GTPU_Types all;
import from GTP_Templates all;
import from GTPv1U_Templates all;
import from GTP_Emulation all;
import from IuUP_Types all;

View File

@ -63,7 +63,9 @@ FILES="HNBLLIF_Types.ttcn HNBLLIF_Templates.ttcn HNBLLIF_CodecPort.ttcn "
FILES+="Iuh_Types.ttcn Iuh_CodecPort.ttcn Iuh_CodecPort_CtrlFunctDef.cc Iuh_CodecPort_CtrlFunct.ttcn Iuh_Emulation.ttcn DNS_Helpers.ttcn "
FILES+="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn "
FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn IPCP_Types.ttcn GSM_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn "
FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn GSM_Types.ttcn "
gen_links $DIR $FILES
ignore_pp_results

View File

@ -27,7 +27,8 @@ FILES="
UD_PT.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
"
export CPPFLAGS_TTCN3="

View File

@ -16,8 +16,10 @@ import from General_Types all;
import from Osmocom_Types all;
import from GTPC_Types all;
import from GTPU_Types all;
import from GTP_CodecPort all;
import from GTP_CodecPort_CtrlFunct all;
import from GTPv1C_CodecPort all;
import from GTPv1U_CodecPort all;
import from GTPv1C_CodecPort_CtrlFunct all;
import from GTPv1U_CodecPort_CtrlFunct all;
/***********************************************************************
* Main Emulation Component
@ -172,13 +174,13 @@ private function f_init(GtpEmulationCfg cfg) runs on GTP_Emulation_CT {
var Result res;
map(self:GTPC, system:GTPC);
res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, cfg.gtpc_bind_ip,
res := GTPv1C_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, cfg.gtpc_bind_ip,
cfg.gtpc_bind_port, {udp:={}});
g_gtpc_id := res.connId;
if (isvalue(cfg.gtpu_bind_ip) and isvalue(cfg.gtpu_bind_port)) {
map(self:GTPU, system:GTPU);
res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, cfg.gtpu_bind_ip,
res := GTPv1U_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, cfg.gtpu_bind_ip,
cfg.gtpu_bind_port, {udp:={}});
g_gtpu_id := res.connId;
}

View File

@ -1,4 +1,4 @@
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode GTP
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode GTPv1C
* (C) 2017 Harald Welte <laforge@gnumonks.org>
* All rights reserved.
*
@ -9,11 +9,10 @@
*/
module GTP_CodecPort {
module GTPv1C_CodecPort {
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from GTPC_Types all;
import from GTPU_Types all;
import from Misc_Helpers all;
modulepar {
@ -21,7 +20,7 @@ module GTP_CodecPort {
}
/* identifies a remote peer (sender or receiver) */
type record GtpPeer {
type record Gtp1cPeer {
ConnectionId connId,
HostName remName,
PortNumber remPort
@ -29,16 +28,10 @@ module GTP_CodecPort {
/* Decoded GTP1C (Control Plane), used in send and receive direction */
type record Gtp1cUnitdata {
GtpPeer peer,
Gtp1cPeer peer,
PDU_GTPC gtpc
}
/* Decoded GTP1U (User Plane), used in send and receive direction */
type record Gtp1uUnitdata {
GtpPeer peer,
PDU_GTPU gtpu
}
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
type port GTPC_PT message {
out Gtp1cUnitdata;
@ -69,33 +62,4 @@ module GTP_CodecPort {
log2str("Rx GTPv1-C with field length ", out_ud.gtpc.lengthf, " + 8 != exp ", lengthof(in_ud.msg)));
}
} with { extension "prototype(fast)" };
/* dual-faced port on top of IPL4asp; ASP_Event passed through transparently */
type port GTPU_PT message {
out Gtp1uUnitdata;
in Gtp1uUnitdata,
ASP_ConnId_ReadyToRelease,
ASP_Event;
} with { extension "user IPL4asp_PT
out(Gtp1uUnitdata -> ASP_SendTo: function(f_enc_Gtp1uUD))
in(ASP_RecvFrom -> Gtp1uUnitdata: function(f_dec_Gtp1uUD);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)" }
function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) {
out_ud.connId := in_ud.peer.connId;
out_ud.remName := in_ud.peer.remName;
out_ud.remPort := in_ud.peer.remPort;
out_ud.proto := { udp := {} };
out_ud.msg := enc_PDU_GTPU(in_ud.gtpu);
} with { extension "prototype(fast)" };
function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) {
out_ud.peer.connId := in_ud.connId;
out_ud.peer.remName := in_ud.remName;
out_ud.peer.remPort := in_ud.remPort;
out_ud.gtpu := dec_PDU_GTPU(in_ud.msg);
} with { extension "prototype(fast)" };
}

View File

@ -1,6 +1,6 @@
module GTP_CodecPort_CtrlFunct {
module GTPv1C_CodecPort_CtrlFunct {
import from GTP_CodecPort all;
import from GTPv1C_CodecPort all;
import from IPL4asp_Types all;
external function f_IPL4_listen(
@ -39,12 +39,4 @@ module GTP_CodecPort_CtrlFunct {
in ConnectionId id,
out UserData userData
) return Result;
external function f_GTPU_listen(
inout GTPU_PT portRef,
in HostName locName,
in PortNumber locPort,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
}

View File

@ -1,11 +1,11 @@
#include "IPL4asp_PortType.hh"
#include "IPL4asp_PT.hh"
#include "GTP_CodecPort.hh"
#include "GTPv1C_CodecPort.hh"
namespace GTP__CodecPort__CtrlFunct {
namespace GTPv1C__CodecPort__CtrlFunct {
IPL4asp__Types::Result f__IPL4__listen(
GTP__CodecPort::GTPC__PT& portRef,
GTPv1C__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ProtoTuple& proto,
@ -13,9 +13,9 @@ namespace GTP__CodecPort__CtrlFunct {
{
return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
}
IPL4asp__Types::Result f__IPL4__connect(
GTP__CodecPort::GTPC__PT& portRef,
GTPv1C__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::HostName& remName,
const IPL4asp__Types::PortNumber& remPort,
const IPL4asp__Types::HostName& locName,
@ -29,38 +29,27 @@ namespace GTP__CodecPort__CtrlFunct {
}
IPL4asp__Types::Result f__IPL4__close(
GTP__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
GTPv1C__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::ProtoTuple& proto)
{
return f__IPL4__PROVIDER__close(portRef, connId, proto);
}
IPL4asp__Types::Result f__IPL4__setUserData(
GTP__CodecPort::GTPC__PT& portRef,
GTPv1C__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__setUserData(portRef, connId, userData);
}
IPL4asp__Types::Result f__IPL4__getUserData(
GTP__CodecPort::GTPC__PT& portRef,
GTPv1C__CodecPort::GTPC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
}
IPL4asp__Types::Result f__GTPU__listen(
GTP__CodecPort::GTPU__PT& portRef,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
}
}

View File

@ -1,4 +1,4 @@
/* GTP Templates in TTCN-3
/* GTPv1-C Templates in TTCN-3
* (C) 2018 Harald Welte <laforge@gnumonks.org>
* contributions by sysmocom - s.f.m.c. GmbH
* All rights reserved.
@ -9,13 +9,12 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module GTP_Templates {
module GTPv1C_Templates {
import from General_Types all;
import from Osmocom_Types all;
import from GTPC_Types all;
import from GTPU_Types all;
import from GTP_CodecPort all;
import from GTPv1C_CodecPort all;
import from IPCP_Types all;
import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
@ -416,7 +415,7 @@ module GTP_Templates {
/* template matching reception of GTP-C unit-data */
template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) GtpPeer peer,
template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
template (present) OCT1 msg_type,
template (present) OCT4 teid,
template (present) GTPC_PDUs pdus := ?) := {
@ -425,7 +424,7 @@ module GTP_Templates {
}
/* template matching reception of GTP-C echo-request */
template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
echoResponse := {
@ -435,7 +434,7 @@ module GTP_Templates {
}
/* template matching reception of GTP-C echo-response */
template (present) Gtp1cUnitdata tr_GTPC_PONG(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
template (present) Gtp1cUnitdata tr_GTPC_PONG(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
echoResponse := {
@ -445,7 +444,7 @@ module GTP_Templates {
}
/* master template for senidng a GTP-C echo response */
template (value) Gtp1cUnitdata ts_GTPC_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
template (value) Gtp1cUnitdata ts_GTPC_PONG(Gtp1cPeer peer, uint16_t seq, OCT1 rest_ctr) := {
peer := peer,
gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
}
@ -457,7 +456,7 @@ module GTP_Templates {
}
/* master template for sending a GTP-C echo request */
template (value) Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := {
template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer peer, uint16_t seq) := {
peer := peer,
gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
}
@ -787,7 +786,7 @@ module GTP_Templates {
}
}
template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer peer, uint16_t seq, hexstring imsi,
template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(Gtp1cPeer peer, uint16_t seq, hexstring imsi,
OCT1 restart_ctr, OCT4 teid_data,
OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
octetstring apn, octetstring sgsn_ip_sign,
@ -859,7 +858,7 @@ module GTP_Templates {
}
}
template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(GtpPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(Gtp1cPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
OCT1 restart_ctr, OCT4 teid_data,
OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
octetstring sgsn_ip_data,
@ -928,7 +927,7 @@ module GTP_Templates {
}
}
template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
OCT1 cause,
OCT4 teid_ctrl, OCT4 teid_data,
BIT4 nsapi, octetstring ggsn_ip_sign,
@ -1132,7 +1131,7 @@ module GTP_Templates {
}
}
template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid,
template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
peer := peer,
gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
@ -1151,7 +1150,7 @@ module GTP_Templates {
}
}
template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
OCT1 cause,
template (omit) ProtConfigOptions pco := omit) := {
peer := peer,
@ -1188,7 +1187,7 @@ module GTP_Templates {
private_extension_gtpc := *
}
}
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) GtpPeer peer,
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) Gtp1cPeer peer,
template (present) GTPC_PDUs SGSNContextReqPDU) := {
peer := peer,
gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
@ -1221,7 +1220,7 @@ module GTP_Templates {
private_extension_gtpc := omit
}
}
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(GtpPeer peer, uint16_t seq,
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(Gtp1cPeer peer, uint16_t seq,
template (value) GTPC_PDUs SGSNContextReqPDU) := {
peer := peer,
gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
@ -1262,7 +1261,7 @@ module GTP_Templates {
private_extension_gtpc := *
}
}
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) GtpPeer peer := ?,
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) Gtp1cPeer peer := ?,
template (present) OCT4 teid := ?,
template (present) GTPC_PDUs SGSNContextRespPDU := ?)
:= tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
@ -1305,7 +1304,7 @@ module GTP_Templates {
private_extension_gtpc := omit
}
}
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(GtpPeer peer, OCT4 teid, uint16_t seq,
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
template (value) GTPC_PDUs SGSNContextRespPDU) := {
peer := peer,
gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
@ -1323,7 +1322,7 @@ module GTP_Templates {
private_extension_gtpc := *
}
}
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) GtpPeer peer := ?,
template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) Gtp1cPeer peer := ?,
template (present) OCT4 teid := ?,
template (present) GTPC_PDUs SGSNContextAckPDU := ?)
:= tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
@ -1337,7 +1336,7 @@ module GTP_Templates {
private_extension_gtpc := omit
}
}
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(GtpPeer peer, OCT4 teid, uint16_t seq,
template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU(GTP_CAUSE_REQUEST_ACCEPTED)) := {
peer := peer,
gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
@ -1730,13 +1729,13 @@ module GTP_Templates {
}
}
template (present) Gtp1cUnitdata
tr_GTPC_RANInfoRelay(template (present) GtpPeer peer,
tr_GTPC_RANInfoRelay(template (present) Gtp1cPeer peer,
template (present) RANTransparentContainer transparentContainer) := {
peer := peer,
gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
}
template (value) Gtp1cUnitdata
ts_GTPC_RANInfoRelay(template (value) GtpPeer peer,
ts_GTPC_RANInfoRelay(template (value) Gtp1cPeer peer,
template (value) RANTransparentContainer transparentContainer,
template (omit) RIM_RoutingAddress ra := omit,
template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
@ -1765,157 +1764,6 @@ module GTP_Templates {
sON_TransferApplicationIdentity := son_app_id
}
/* GTP-U */
template (present) PDU_GTPU tr_GTP1U_PDU(template (present) OCT1 msg_type,
template (present) OCT4 teid,
template (present) GTPU_IEs ies := ?) := {
pn_bit := ?,
s_bit := ?,
e_bit := ?,
spare := ?,
/* Protocol Type flag (PT) shall be set to '1' in GTP */
pt := '1'B,
/* Version shall be set to decimal 1 ('001'). */
version := '001'B,
messageType := msg_type,
lengthf := ?,
teid := teid,
opt_part := *,
gtpu_IEs := ies
}
function f_GTPU_s_bit(template (omit) uint16_t seq) return BIT1 {
if (istemplatekind(seq, "omit")) {
return '0'B;
}
return '1'B;
}
function f_GTPU_opt_part(template (omit) uint16_t seq) return template (omit) GTPU_Header_optional_part {
if (istemplatekind(seq, "omit")) {
return omit;
}
var GTPU_Header_optional_part ret := {
sequenceNumber := int2oct(valueof(seq), 2),
npduNumber := '00'O,
nextExtHeader := '00'O,
gTPU_extensionHeader_List := omit
};
return ret;
}
/* generalized GTP-U send template */
template (value) PDU_GTPU ts_GTP1U_PDU(OCT1 msg_type, template (omit) uint16_t seq, OCT4 teid, GTPU_IEs ies) := {
/* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN
* flag is set to 1. */
pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */
/* If the Sequence Number flag (S) is set to '1' the sequence number field is present and
* meaningful otherwise it is set to '0'. For GTP-U messages Echo Request, Echo Response,
* Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'.
*
* Note that the caller must ensure that these conditions hold.
* The caller can either pass a sequence number (we set s_bit to '1'B) when appropriate,
* or may omit the sequence number (we set s_bit to '0'B). */
s_bit := f_GTPU_s_bit(seq),
/* Extension header presence */
e_bit := '0'B,
spare := '0'B,
/* Protocol Type flag (PT) shall be set to '1' in GTP */
pt := '1'B,
/* Version shall be set to decimal 1 ('001'). */
version := '001'B,
messageType := msg_type,
lengthf := 0, /* we assume encoder overwrites this */
teid := teid,
opt_part := f_GTPU_opt_part(seq),
gtpu_IEs := ies
}
template (present) Gtp1uUnitdata tr_GTPU_MsgType(template (present) GtpPeer peer,
template (present) OCT1 msg_type,
template (present) OCT4 teid) := {
peer := peer,
gtpu := tr_GTP1U_PDU(msg_type, teid)
}
/* template matching reception of GTP-U echo-request/response */
template (present) Gtp1uUnitdata tr_GTPU_PING(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O);
template (present) Gtp1uUnitdata tr_GTPU_PONG(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoResponse, '00000000'O);
/* template matching reception of GTP-U GPDU */
template GTPU_IEs t_GPDU(template (present) octetstring data) := {
g_PDU_IEs := {
data := data
}
}
template (present) Gtp1uUnitdata tr_GTPU_GPDU(template (present) GtpPeer peer,
template (present) OCT4 teid,
template (present) octetstring data := ?) := {
peer := peer,
gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data))
}
template (present) GTPU_IEs ts_UEchoReqPDU := {
echoRequest_IEs := {
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-C echo request */
template (value) Gtp1uUnitdata ts_GTPU_PING(GtpPeer peer, uint16_t seq) := {
peer := peer,
gtpu := ts_GTP1U_PDU(echoRequest, seq, '00000000'O, valueof(ts_UEchoReqPDU))
}
template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := {
echoResponse_IEs := {
recovery_gtpu := {
type_gtpu := '00'O, /* we assume encoder fixes? */
restartCounter := restart_counter
},
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-U echo response */
template (present) Gtp1uUnitdata ts_GTPU_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
peer := peer,
gtpu := ts_GTP1U_PDU(echoResponse, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr)))
}
template (value) GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := {
type_gtpu := '85'O,
lengthf := lengthof(ip_addr),
gSNAddressValue := ip_addr
}
template (value) TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := {
type_gtpu := '10'O,
teidDataI := teid
}
template (value) GTPU_IEs ts_UErrorIndication(OCT4 teid, octetstring gsn_addr) := {
errorIndication_IEs := {
teidDataI_gtpu := ts_UteidDataI(teid),
gSNAddress_gtpu := ts_UGsnAddr(gsn_addr),
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-U Error indication */
template (value) Gtp1uUnitdata ts_GTPU_ErrorIndication(GtpPeer peer, uint16_t seq, OCT4 teid, octetstring gsn_addr) := {
peer := peer,
gtpu := ts_GTP1U_PDU('1A'O, seq, '00000000'O, valueof(ts_UErrorIndication(teid, gsn_addr)))
}
/* master template for sending a GTP-U user plane data */
template (value) Gtp1uUnitdata ts_GTP1U_GPDU(GtpPeer peer, template (omit) uint16_t seq, OCT4 teid, octetstring data) := {
peer := peer,
gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }})
}
/* 3GPP TS 29.060, section 7.7.57 */
template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
type_gtpc := '9F'O,

View File

@ -0,0 +1,58 @@
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode GTPv1-U
* (C) 2017 Harald Welte <laforge@gnumonks.org>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module GTPv1U_CodecPort {
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from GTPU_Types all;
import from Misc_Helpers all;
/* identifies a remote peer (sender or receiver) */
type record Gtp1uPeer {
ConnectionId connId,
HostName remName,
PortNumber remPort
}
/* Decoded GTP1U (User Plane), used in send and receive direction */
type record Gtp1uUnitdata {
Gtp1uPeer peer,
PDU_GTPU gtpu
}
/* dual-faced port on top of IPL4asp; ASP_Event passed through transparently */
type port GTPU_PT message {
out Gtp1uUnitdata;
in Gtp1uUnitdata,
ASP_ConnId_ReadyToRelease,
ASP_Event;
} with { extension "user IPL4asp_PT
out(Gtp1uUnitdata -> ASP_SendTo: function(f_enc_Gtp1uUD))
in(ASP_RecvFrom -> Gtp1uUnitdata: function(f_dec_Gtp1uUD);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)" }
function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) {
out_ud.connId := in_ud.peer.connId;
out_ud.remName := in_ud.peer.remName;
out_ud.remPort := in_ud.peer.remPort;
out_ud.proto := { udp := {} };
out_ud.msg := enc_PDU_GTPU(in_ud.gtpu);
} with { extension "prototype(fast)" };
function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) {
out_ud.peer.connId := in_ud.connId;
out_ud.peer.remName := in_ud.remName;
out_ud.peer.remPort := in_ud.remPort;
out_ud.gtpu := dec_PDU_GTPU(in_ud.msg);
} with { extension "prototype(fast)" };
}

View File

@ -0,0 +1,13 @@
module GTPv1U_CodecPort_CtrlFunct {
import from GTPv1U_CodecPort all;
import from IPL4asp_Types all;
external function f_GTPU_listen(
inout GTPU_PT portRef,
in HostName locName,
in PortNumber locPort,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
}

View File

@ -0,0 +1,17 @@
#include "IPL4asp_PortType.hh"
#include "IPL4asp_PT.hh"
#include "GTPv1U_CodecPort.hh"
namespace GTPv1U__CodecPort__CtrlFunct {
IPL4asp__Types::Result f__GTPU__listen(
GTPv1U__CodecPort::GTPU__PT& portRef,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
}
}

View File

@ -0,0 +1,167 @@
/* GTPv1-U Templates in TTCN-3
* (C) 2018 Harald Welte <laforge@gnumonks.org>
* contributions by sysmocom - s.f.m.c. GmbH
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module GTPv1U_Templates {
import from General_Types all;
import from Osmocom_Types all;
import from GTPU_Types all;
import from GTPv1U_CodecPort all;
template (present) PDU_GTPU tr_GTP1U_PDU(template (present) OCT1 msg_type,
template (present) OCT4 teid,
template (present) GTPU_IEs ies := ?) := {
pn_bit := ?,
s_bit := ?,
e_bit := ?,
spare := ?,
/* Protocol Type flag (PT) shall be set to '1' in GTP */
pt := '1'B,
/* Version shall be set to decimal 1 ('001'). */
version := '001'B,
messageType := msg_type,
lengthf := ?,
teid := teid,
opt_part := *,
gtpu_IEs := ies
}
function f_GTPU_s_bit(template (omit) uint16_t seq) return BIT1 {
if (istemplatekind(seq, "omit")) {
return '0'B;
}
return '1'B;
}
function f_GTPU_opt_part(template (omit) uint16_t seq) return template (omit) GTPU_Header_optional_part {
if (istemplatekind(seq, "omit")) {
return omit;
}
var GTPU_Header_optional_part ret := {
sequenceNumber := int2oct(valueof(seq), 2),
npduNumber := '00'O,
nextExtHeader := '00'O,
gTPU_extensionHeader_List := omit
};
return ret;
}
/* generalized GTP-U send template */
template (value) PDU_GTPU ts_GTP1U_PDU(OCT1 msg_type, template (omit) uint16_t seq, OCT4 teid, GTPU_IEs ies) := {
/* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN
* flag is set to 1. */
pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */
/* If the Sequence Number flag (S) is set to '1' the sequence number field is present and
* meaningful otherwise it is set to '0'. For GTP-U messages Echo Request, Echo Response,
* Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'.
*
* Note that the caller must ensure that these conditions hold.
* The caller can either pass a sequence number (we set s_bit to '1'B) when appropriate,
* or may omit the sequence number (we set s_bit to '0'B). */
s_bit := f_GTPU_s_bit(seq),
/* Extension header presence */
e_bit := '0'B,
spare := '0'B,
/* Protocol Type flag (PT) shall be set to '1' in GTP */
pt := '1'B,
/* Version shall be set to decimal 1 ('001'). */
version := '001'B,
messageType := msg_type,
lengthf := 0, /* we assume encoder overwrites this */
teid := teid,
opt_part := f_GTPU_opt_part(seq),
gtpu_IEs := ies
}
template (present) Gtp1uUnitdata tr_GTPU_MsgType(template (present) Gtp1uPeer peer,
template (present) OCT1 msg_type,
template (present) OCT4 teid) := {
peer := peer,
gtpu := tr_GTP1U_PDU(msg_type, teid)
}
/* template matching reception of GTP-U echo-request/response */
template (present) Gtp1uUnitdata tr_GTPU_PING(template (present) Gtp1uPeer peer) := tr_GTPU_MsgType(peer, '01'O, '00000000'O);
template (present) Gtp1uUnitdata tr_GTPU_PONG(template (present) Gtp1uPeer peer) := tr_GTPU_MsgType(peer, '02'O, '00000000'O);
/* template matching reception of GTP-U GPDU */
template GTPU_IEs t_GPDU(template (present) octetstring data) := {
g_PDU_IEs := {
data := data
}
}
template (present) Gtp1uUnitdata tr_GTPU_GPDU(template (present) Gtp1uPeer peer,
template (present) OCT4 teid,
template (present) octetstring data := ?) := {
peer := peer,
gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data))
}
template (present) GTPU_IEs ts_UEchoReqPDU := {
echoRequest_IEs := {
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-C echo request */
template (value) Gtp1uUnitdata ts_GTPU_PING(Gtp1uPeer peer, uint16_t seq) := {
peer := peer,
gtpu := ts_GTP1U_PDU('01'O, seq, '00000000'O, valueof(ts_UEchoReqPDU))
}
template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := {
echoResponse_IEs := {
recovery_gtpu := {
type_gtpu := '00'O, /* we assume encoder fixes? */
restartCounter := restart_counter
},
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-U echo response */
template (present) Gtp1uUnitdata ts_GTPU_PONG(Gtp1uPeer peer, uint16_t seq, OCT1 rest_ctr) := {
peer := peer,
gtpu := ts_GTP1U_PDU('02'O, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr)))
}
template (value) GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := {
type_gtpu := '85'O,
lengthf := lengthof(ip_addr),
gSNAddressValue := ip_addr
}
template (value) TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := {
type_gtpu := '10'O,
teidDataI := teid
}
template (value) GTPU_IEs ts_UErrorIndication(OCT4 teid, octetstring gsn_addr) := {
errorIndication_IEs := {
teidDataI_gtpu := ts_UteidDataI(teid),
gSNAddress_gtpu := ts_UGsnAddr(gsn_addr),
private_extension_gtpu := omit
}
}
/* master template for sending a GTP-U Error indication */
template (value) Gtp1uUnitdata ts_GTPU_ErrorIndication(Gtp1uPeer peer, uint16_t seq, OCT4 teid, octetstring gsn_addr) := {
peer := peer,
gtpu := ts_GTP1U_PDU('1A'O, seq, '00000000'O, valueof(ts_UErrorIndication(teid, gsn_addr)))
}
/* master template for sending a GTP-U user plane data */
template (value) Gtp1uUnitdata ts_GTP1U_GPDU(Gtp1uPeer peer, template (omit) uint16_t seq, OCT4 teid, octetstring data) := {
peer := peer,
gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }})
}
}

View File

@ -15,7 +15,7 @@ module GTPv2_CodecPort {
import from GTPv2_Types all;
/* identifies a remote peer (sender or receiver) */
type record GtpPeer {
type record Gtp2cPeer {
ConnectionId connId,
HostName remName,
IPL4asp_Types.PortNumber remPort
@ -23,7 +23,7 @@ module GTPv2_CodecPort {
/* Decoded GTP2C (Control Plane), used in send and receive direction */
type record Gtp2cUnitdata {
GtpPeer peer,
Gtp2cPeer peer,
PDU_GTPCv2 gtpc
}

View File

@ -62,7 +62,7 @@ type component GTPv2_Emulation_CT {
var Gtp2EmulationCfg g_gtp2_cfg;
/* State */
var GtpPeer g_peer;
var Gtp2cPeer g_peer;
var integer g_gtp2c_id;
var OCT1 g_restart_ctr;
var uint16_t g_c_seq_nr;

View File

@ -35,9 +35,9 @@ import from SGsAP_Templates all;
import from SGsAP_Emulation all;
import from GTP_Emulation all;
import from GTP_Templates all;
import from GTP_CodecPort all;
import from GTPC_Types all;
import from GTPv1C_CodecPort all;
import from GTPv1C_Templates all;
import from LTE_CryptoFunctions all;
@ -157,7 +157,7 @@ type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr
var ConnHdlrPars g_pars;
timer g_Tguard := 30.0;
var GtpPeer g_gn_iface_peer := { connId := 1, remName := mp_gn_remote_ip, remPort := mp_gn_remote_port };
var Gtp1cPeer g_gn_iface_peer := { connId := 1, remName := mp_gn_remote_ip, remPort := mp_gn_remote_port };
}
type record ConnHdlrPars {
@ -960,7 +960,7 @@ private function f_gtp_sgsn_context_4g_to_2g(OCT4 new_sgsn_local_teid := '123456
}
private altstep as_gtp_sgsn_context_2g_to_4g(OCT4 new_sgsn_teid := 'ABABABAB'O, GTP_Templates.GTP_RATType rat_type := GTP_RAT_TYPE_EUTRAN) runs on ConnHdlr {
private altstep as_gtp_sgsn_context_2g_to_4g(OCT4 new_sgsn_teid := 'ABABABAB'O, GTPv1C_Templates.GTP_RATType rat_type := GTP_RAT_TYPE_EUTRAN) runs on ConnHdlr {
var Gtp1cUnitdata gtpc_pdu;
[] GTP.receive(tr_GTPC_SGSNContextReq(g_gn_iface_peer, tr_SGSNContextReqPDU(rat_type := int2oct(enum2int(rat_type), 1)))) -> value gtpc_pdu {

View File

@ -77,7 +77,7 @@ FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFu
FILES+="NAS_Templates.ttcn GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn "
FILES+="DIAMETER_Templates.ttcn DIAMETER_ts29_272_Templates.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn "
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "

View File

@ -11,7 +11,8 @@ FILES="
DIAMETER_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
GTPv2_CodecPort_CtrlFunctDef.cc
IPL4asp_PT.cc
IPL4asp_discovery.cc

View File

@ -59,7 +59,7 @@ gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn PAP_Types.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn "
FILES+="DNS_Helpers.ttcn "

View File

@ -9,7 +9,8 @@ FILES="
DIAMETER_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
GTPv2_CodecPort_CtrlFunctDef.cc
ICMP_EncDec.cc
ICMPv6_EncDec.cc

View File

@ -42,11 +42,13 @@ import from RANAP_Templates all;
import from RANAP_PDU_Descriptions all;
import from RANAP_IEs all;
import from GTP_Emulation all;
import from GTP_Templates all;
import from GTP_CodecPort all;
import from GTPv1C_CodecPort all;
import from GTPv1U_CodecPort all;
import from GTPC_Types all;
import from GTPU_Types all;
import from GTPv1C_Templates all;
import from GTPv1U_Templates all;
import from GTP_Emulation all;
import from LLC_Types all;
import from LLC_Templates all;
@ -1550,12 +1552,13 @@ function f_pdp_ctx_deact_mt(inout PdpActPars apars, boolean error_ind := false,
runs on BSSGP_ConnHdlr {
var Gtp1cUnitdata g_ud;
var integer seq_nr := 23;
var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
BSSGP[ran_index].clear;
if (error_ind) {
var Gtp1uPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_c));
GTP.send(ts_GTPU_ErrorIndication(peer, 0 /* seq */, apars.ggsn_tei_u, apars.ggsn_ip_u));
} else {
var Gtp1cPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
GTP.send(ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B));
}
@ -1650,20 +1653,20 @@ template (value) PdpActPars t_PdpActPars(charstring ggsn_ip) := {
sgsn_ip_u := omit
}
template (value) GtpPeer ts_GtpPeerU(octetstring ip) := {
template (value) Gtp1uPeer ts_GtpPeerU(octetstring ip) := {
connId := 1,
remName := f_inet_ntoa(ip),
remPort := GTP1U_PORT
}
template (value) GtpPeer ts_GtpPeerC(octetstring ip) := {
template (value) Gtp1cPeer ts_GtpPeerC(octetstring ip) := {
connId := 1,
remName := f_inet_ntoa(ip),
remPort := GTP1C_PORT
}
private function f_gtpu_send(inout PdpActPars apars, octetstring payload) runs on BSSGP_ConnHdlr {
var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
var Gtp1uPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, apars.sgsn_tei_u, payload));
}
@ -1734,7 +1737,7 @@ runs on BSSGP_ConnHdlr {
private function f_gtpu_xceive_mo(inout PdpActPars apars, octetstring payload, integer ran_index := 0, uint9_t n_u := 0)
runs on BSSGP_ConnHdlr {
/* Send PDU via SNDCP/LLC/BSSGP/NS via simulated MS/PCU to the SGSN */
var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
var Gtp1uPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
var PDU_SN sndcp := valueof(ts_SN_UD(apars.nsapi, payload));
BSSGP[ran_index].send(ts_LLC_UI(enc_PDU_SN(sndcp), apars.sapi, '0'B, n_u));
/* Expect PDU via GTP from SGSN on simulated GGSN */
@ -2049,7 +2052,6 @@ private function f_TC_attach_restart_ctr_create(charstring id) runs on BSSGP_Con
var Gtp1cUnitdata g_ud;
var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
var integer seq_nr := 23;
var GtpPeer peer;
/* first perform regular attach */
f_TC_attach(id);
@ -2089,7 +2091,7 @@ testcase TC_attach_restart_ctr_create() runs on test_CT {
private function f_TC_attach_pdp_act_deact_mt_t3395_expire(charstring id) runs on BSSGP_ConnHdlr {
var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
var integer seq_nr := 23;
var GtpPeer peer;
var Gtp1cPeer peer;
var integer i;
/* first perform regular attach */
@ -2193,7 +2195,7 @@ private function f_TC_attach_pdp_act_deact_gtp_retrans_resp(charstring id) runs
/* Now perform an MT DeleteCtxReq and emulate GGSN didn't receive response and sends a duplicated DeleteCtxReq */
BSSGP[0].clear;
var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
var Gtp1cPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B);
GTP.send(g_delete_req);
alt {
@ -3469,7 +3471,7 @@ testcase TC_rim_eutran_to_geran() runs on test_CT {
/* connect RIM related port */
connect(vc_GTP:CLIENT_DEFAULT, self:GTPC);
var GtpPeer peer := {
var Gtp1cPeer peer := {
connId := 1,
remName := mp_sgsn_gtp_ip,
remPort := GTP1C_PORT
@ -3651,7 +3653,7 @@ private function f_TC_cell_change_different_rai_ci_data(charstring id) runs on B
var octetstring payload := f_rnd_octstring(200);
var PDU_SN sndcp := valueof(ts_SN_UD(apars.nsapi, payload));
BSSGP[1].send(ts_LLC_UI(enc_PDU_SN(sndcp), apars.sapi, '0'B, 1));
var GtpPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
var Gtp1uPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u));
timer T := 2.0;
T.start;
alt {

View File

@ -93,7 +93,9 @@ FILES+="RAN_Emulation.ttcnpp RAN_Adapter.ttcnpp SCCP_Templates.ttcn "
# IPA_Emulation + dependencies
FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc "
FILES+="PCO_Types.ttcn GSUP_Types.ttcn GSUP_Templates.ttcn GSUP_Emulation.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn IPCP_Types.ttcn RAW_NS.ttcnpp "
FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn "
FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn RAW_NS.ttcnpp "
gen_links $DIR $FILES
ignore_pp_results

View File

@ -9,7 +9,8 @@ FILES="
BSSGP_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
GTPv1C_CodecPort_CtrlFunctDef.cc
GTPv1U_CodecPort_CtrlFunctDef.cc
IPA_CodecPort_CtrlFunctDef.cc
IPL4asp_PT.cc
IPL4asp_discovery.cc