1416 lines
46 KiB
Plaintext
1416 lines
46 KiB
Plaintext
/* GTP 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 GTP_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 IPCP_Types all;
|
|
import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
|
|
|
|
type record GTP_CellId {
|
|
RoutingAreaIdentification ra_id,
|
|
CellIdentity cell_id
|
|
} with { encode "RAW" };
|
|
|
|
template (value) GTP_CellId ts_GTP_CellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := {
|
|
ra_id := rai,
|
|
cell_id := cell_id
|
|
};
|
|
|
|
/* Table 38 of 3GPP TS 29.060 */
|
|
type enumerated GTP_Cause {
|
|
GTP_CAUSE_REQUEST_IMEI (1),
|
|
GTP_CAUSE_REQUEST_IMSI_AND_IMEI (2),
|
|
GTP_CAUSE_NO_IDENTITY_NEDED (3),
|
|
GTP_CAUSE_MS_REFUSES (4),
|
|
GTP_CAUSE_MS_IS_NOT_GPRS_RESPONDING (5),
|
|
/* reserved */
|
|
GTP_CAUSE_REQUEST_ACCEPTED (128)
|
|
/* FIXME */
|
|
};
|
|
|
|
private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
|
|
if (istemplatekind(inp, "omit")) {
|
|
return omit;
|
|
} else if (istemplatekind(inp, "*")) {
|
|
return *;
|
|
} else if (istemplatekind(inp, "?")) {
|
|
return ?;
|
|
}
|
|
return int2oct(valueof(inp), len);
|
|
}
|
|
|
|
private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
|
|
if (istemplatekind(inp, "omit")) {
|
|
return omit;
|
|
} else if (istemplatekind(inp, "*")) {
|
|
return *;
|
|
} else if (istemplatekind(inp, "?")) {
|
|
return ?;
|
|
}
|
|
return int2hex(valueof(inp), len);
|
|
}
|
|
|
|
/* generalized GTP-C receive template */
|
|
template PDU_GTPC tr_GTP1C_PDU(template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdu := ?) := {
|
|
/* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
|
|
* error if this flag is set to '1'. */
|
|
pn_bit := '0'B,
|
|
/* Sequence number flag (S) shall be set to '1'. */
|
|
s_bit := '1'B,
|
|
e_bit := ?,
|
|
spare := ?,
|
|
/* Protocol Type flag (PT) shall be set to '1'.*/
|
|
pt := '1'B,
|
|
/* Version shall be set to decimal 1 ('001'). */
|
|
version := '001'B,
|
|
messageType := msg_type,
|
|
lengthf := ?,
|
|
teid := teid,
|
|
opt_part := *,
|
|
gtpc_pdu := pdu
|
|
}
|
|
|
|
/* generalized GTP-C send template */
|
|
template PDU_GTPC ts_GTP1C_PDU(OCT1 msg_type, OCT4 teid, GTPC_PDUs pdu, uint16_t seq_nr) := {
|
|
/* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
|
|
* error if this flag is set to '1'. */
|
|
pn_bit := '0'B,
|
|
/* Sequence number flag (S) shall be set to '1'. */
|
|
s_bit := '1'B,
|
|
e_bit := '0'B,
|
|
spare := '0'B,
|
|
/* Protocol Type flag (PT) shall be set to '1'.*/
|
|
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 := {
|
|
sequenceNumber := int2oct(seq_nr, 2),
|
|
npduNumber := '00'O,
|
|
nextExtHeader := '00'O,
|
|
gTPC_extensionHeader_List := omit
|
|
},
|
|
gtpc_pdu := pdu
|
|
}
|
|
|
|
/* recovery IE */
|
|
template Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
|
|
type_gtpc := '0E'O,
|
|
restartCounter := restart_counter
|
|
}
|
|
|
|
template Recovery_gtpc tr_Recovery(template OCT1 restart_counter) := {
|
|
type_gtpc := '0E'O,
|
|
restartCounter := restart_counter
|
|
}
|
|
|
|
/* IMEI(SV) IE TS 29.060 7.7.53 */
|
|
template IMEISV_gtpc ts_IMEISV(template (value) OCT8 imeisv) := {
|
|
type_gtpc := '9A'O,
|
|
lengthf := 8,
|
|
imeisv := imeisv
|
|
}
|
|
private function f_ts_IMEISV(template (omit) OCT8 imeisv)
|
|
return template (omit) IMEISV_gtpc {
|
|
if (istemplatekind(imeisv, "omit")) {
|
|
return omit;
|
|
}
|
|
return ts_IMEISV(imeisv);
|
|
}
|
|
|
|
template IMEISV_gtpc tr_IMEISV(template (present) OCT8 imeisv) := {
|
|
type_gtpc := '9A'O,
|
|
lengthf := 8,
|
|
imeisv := imeisv
|
|
}
|
|
|
|
// MS Time Zone - 7.7.52
|
|
template (value) MS_TimeZone ts_MS_TimeZone(template (value) OCT1 timeZone := '00'O,
|
|
template (value) BIT2 daylightSavingTime := '00'B) := {
|
|
type_gtpc := '99'O,
|
|
lengthf := 2,
|
|
timeZone := timeZone,
|
|
daylightSavingTime := daylightSavingTime,
|
|
spare1 := '000'B,
|
|
sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
|
|
spare2 := '00'B
|
|
}
|
|
function f_ts_MS_TimeZone(template (omit) OCT1 timeZone, template (omit) BIT2 daylightSavingTime)
|
|
return template (omit) MS_TimeZone {
|
|
if (istemplatekind(timeZone, "omit") and istemplatekind(daylightSavingTime, "omit")) {
|
|
return omit;
|
|
}
|
|
if (istemplatekind(timeZone, "omit")) {
|
|
return ts_MS_TimeZone(daylightSavingTime := daylightSavingTime);
|
|
}
|
|
if (istemplatekind(daylightSavingTime, "omit")) {
|
|
return ts_MS_TimeZone(timeZone);
|
|
}
|
|
return ts_MS_TimeZone(timeZone, daylightSavingTime);
|
|
}
|
|
|
|
template (present) MS_TimeZone tr_MS_TimeZone(template (present) OCT1 timeZone := ?,
|
|
template (present) BIT2 daylightSavingTime := ?) := {
|
|
type_gtpc := '99'O,
|
|
lengthf := 2,
|
|
timeZone := timeZone,
|
|
daylightSavingTime := daylightSavingTime,
|
|
spare1 := '000'B,
|
|
sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
|
|
spare2 := '00'B
|
|
}
|
|
|
|
/* Charging Characteristics IE TS 29.060 7.7.23 */
|
|
template ChargingCharacteristics_GTPC ts_ChargingCharacteristics(template (value) OCT2 chargingChar) := {
|
|
type_gtpc := '1A'O,
|
|
chargingChar := chargingChar
|
|
}
|
|
private function f_ts_ChargingCharacteristics(template (omit) OCT2 chargingChar)
|
|
return template (omit) ChargingCharacteristics_GTPC {
|
|
if (istemplatekind(chargingChar, "omit")) {
|
|
return omit;
|
|
}
|
|
return ts_ChargingCharacteristics(chargingChar);
|
|
}
|
|
|
|
template ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := {
|
|
type_gtpc := '1A'O,
|
|
chargingChar := chargingChar
|
|
}
|
|
|
|
|
|
/* template matching reception of GTP-C echo-request */
|
|
template Gtp1cUnitdata tr_GTPC_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdus := ?) := {
|
|
peer := peer,
|
|
gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
|
|
}
|
|
|
|
/* template matching reception of GTP-C echo-request */
|
|
template Gtp1cUnitdata tr_GTPC_PING(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
|
|
|
|
template GTPC_PDUs tr_EchoRespPDU(template OCT1 restart_counter) := {
|
|
echoResponse := {
|
|
recovery := tr_Recovery(restart_counter),
|
|
private_extension_gtpc := *
|
|
}
|
|
}
|
|
|
|
/* template matching reception of GTP-C echo-response */
|
|
template Gtp1cUnitdata tr_GTPC_PONG(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
|
|
|
|
template GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
|
|
echoResponse := {
|
|
recovery := ts_Recovery(restart_counter),
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
/* master template for senidng a GTP-C echo response */
|
|
template Gtp1cUnitdata ts_GTPC_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
|
|
}
|
|
|
|
template GTPC_PDUs ts_EchoReqPDU := {
|
|
echoRequest := {
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
/* master template for sending a GTP-C echo request */
|
|
template Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
|
|
}
|
|
|
|
private function f_eua_ipv4_len(template OCT4 ip_addr) return template integer {
|
|
if (istemplatekind(ip_addr, "omit")) {
|
|
return 2;
|
|
} else if (istemplatekind(ip_addr, "*")) {
|
|
return ?;
|
|
} else if (istemplatekind(ip_addr, "?")) {
|
|
return 6;
|
|
}
|
|
return 6;
|
|
}
|
|
|
|
private function f_eua_ipv6_len(template OCT16 ip_addr) return template integer {
|
|
if (istemplatekind(ip_addr, "omit")) {
|
|
return 2;
|
|
} else if (istemplatekind(ip_addr, "*")) {
|
|
return ?;
|
|
} else if (istemplatekind(ip_addr, "?")) {
|
|
return 18;
|
|
}
|
|
return 18;
|
|
}
|
|
|
|
private function f_eua_ipv4v6_len(template OCT4 ip_addr4, template OCT16 ip_addr6) return template integer {
|
|
var integer len := 2;
|
|
if (istemplatekind(ip_addr4, "*") or
|
|
istemplatekind(ip_addr6, "*")) {
|
|
return ?;
|
|
}
|
|
if (not istemplatekind(ip_addr4, "omit")) {
|
|
len := len + 4;
|
|
}
|
|
if (not istemplatekind(ip_addr6, "omit")) {
|
|
len := len + 16;
|
|
}
|
|
return len;
|
|
}
|
|
|
|
template EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
|
|
type_gtpc := '80'O,
|
|
endUserAddress := {
|
|
endUserAddressIPv4 := {
|
|
lengthf := 2,
|
|
pdp_typeorg := '0001'B,
|
|
spare := '1111'B,
|
|
pdp_typenum := '21'O,
|
|
ipv4_address := ip_addr
|
|
}
|
|
}
|
|
}
|
|
template EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
|
|
template EndUserAddress tr_EuaIPv4(template OCT4 ip_addr) modifies t_EuaIPv4 := {
|
|
endUserAddress := {
|
|
endUserAddressIPv4 := {
|
|
lengthf := f_eua_ipv4_len(ip_addr)
|
|
}
|
|
}
|
|
}
|
|
|
|
template EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
|
|
type_gtpc := '80'O,
|
|
endUserAddress := {
|
|
endUserAddressIPv6 := {
|
|
lengthf := 2,
|
|
pdp_typeorg := '0001'B,
|
|
spare := '1111'B,
|
|
pdp_typenum := '57'O,
|
|
ipv6_address := ip_addr
|
|
}
|
|
}
|
|
}
|
|
template EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
|
|
template EndUserAddress tr_EuaIPv6(template OCT16 ip_addr) modifies t_EuaIPv6 := {
|
|
endUserAddress := {
|
|
endUserAddressIPv6 := {
|
|
lengthf := f_eua_ipv6_len(ip_addr)
|
|
}
|
|
}
|
|
}
|
|
|
|
/* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
|
|
template EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
|
|
type_gtpc := '80'O,
|
|
endUserAddress := {
|
|
endUserAddressIPv4andIPv6 := {
|
|
lengthf := 2,
|
|
pdp_typeorg := '0001'B,
|
|
spare := '1111'B,
|
|
pdp_typenum := '8D'O,
|
|
ipv4_address := ip_addr4,
|
|
ipv6_address := ip_addr6
|
|
}
|
|
}
|
|
}
|
|
template EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
|
|
template EndUserAddress tr_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
|
|
endUserAddress := {
|
|
endUserAddressIPv4andIPv6 := {
|
|
lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
|
|
}
|
|
}
|
|
}
|
|
|
|
template AccessPointName ts_APN(octetstring apn) := {
|
|
type_gtpc := '83'O,
|
|
lengthf := lengthof(apn),
|
|
apn_value := apn
|
|
}
|
|
|
|
template GSN_Address_GTPC ts_GsnAddr(octetstring ip_addr) := {
|
|
type_gtpc := '85'O,
|
|
lengthf := lengthof(ip_addr),
|
|
addressf := ip_addr
|
|
}
|
|
|
|
template MSISDN ts_Msisdn(octetstring msisdn) := {
|
|
type_gtpc := '86'O,
|
|
lengthf := lengthof(msisdn),
|
|
msisdn := msisdn
|
|
}
|
|
|
|
template QualityOfServiceProfile ts_QosDefault := {
|
|
type_gtpc := '87'O,
|
|
lengthf := 4,
|
|
allocRetensionPrio := '00'O,
|
|
qos_ProfileValue := {
|
|
reliabilityClass := '011'B,
|
|
delayClass := '001'B,
|
|
spare1 := '00'B,
|
|
precedenceClass := '010'B,
|
|
spare2 := '0'B,
|
|
peakThroughput := '1001'B,
|
|
meanThroughput := '11111'B,
|
|
spare3 := '000'B,
|
|
deliverErroneusSDU := omit,
|
|
deliveryOrder := omit,
|
|
trafficClass := omit,
|
|
maxSDUSize := omit,
|
|
maxBitrateUplink := omit,
|
|
maxBitrateDownlink := omit,
|
|
sduErrorRatio := omit,
|
|
residualBER := omit,
|
|
trafficHandlingPriority := omit,
|
|
transferDelay := omit,
|
|
guaranteedBitRateUplink := omit,
|
|
guaranteedBitRateDownlink := omit,
|
|
sourceStatisticsDescriptor := omit,
|
|
signallingIndication := omit,
|
|
spare4 := omit,
|
|
maxBitrateDownlinkExt := omit,
|
|
guaranteedBitRateDownlinkExt := omit,
|
|
maxBitrateUplinkExt := omit,
|
|
guaranteedBitRateUplinkExt := omit
|
|
}
|
|
}
|
|
|
|
template IMSI_gtpc ts_Imsi(hexstring digits) := {
|
|
type_gtpc := '02'O,
|
|
digits := digits,
|
|
padding := 'F'H
|
|
}
|
|
|
|
function f_ts_RATType(template (omit) OCT1 ratType := omit) return template (omit) RATType {
|
|
var template (omit) RATType rt;
|
|
if (istemplatekind(ratType, "omit")) {
|
|
rt := omit;
|
|
} else {
|
|
rt := {
|
|
type_gtpc := '97'O,
|
|
lengthf := 1,
|
|
ratTypeValue := ratType
|
|
};
|
|
}
|
|
return rt;
|
|
}
|
|
|
|
template (value) GeographicLocationCGI
|
|
ts_GeographicLocationCGI(template (value) hexstring mcc,
|
|
template (value) hexstring mnc,
|
|
template (value) OCT2 lac,
|
|
template (value) OCT2 cI_value) :=
|
|
{
|
|
mccDigit1 := mcc[0],
|
|
mccDigit2 := mcc[1],
|
|
mccDigit3 := mcc[2],
|
|
mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
|
|
mncDigit1 := mnc[0],
|
|
mncDigit2 := mnc[1],
|
|
lac := lac,
|
|
cI_value := cI_value
|
|
}
|
|
|
|
template GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
|
|
BIT4 nsapi, EndUserAddress eua, octetstring apn,
|
|
octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
|
|
octetstring msisdn, template ProtConfigOptions pco := omit,
|
|
template (omit) OCT1 ratType := omit,
|
|
template (omit) UserLocationInformation uli := omit,
|
|
template (omit) OCT2 charging_char := omit,
|
|
template (omit) OCT8 imeisv := omit,
|
|
template(omit) MS_TimeZone ms_tz := omit) := {
|
|
createPDPContextRequest := {
|
|
imsi := ts_Imsi(imsi),
|
|
rai := omit,
|
|
recovery := ts_Recovery(restart_ctr),
|
|
selectionMode := {
|
|
type_gtpc := '0F'O,
|
|
selectModeValue := '00'B,
|
|
spare := '111111'B
|
|
},
|
|
teidDataI := {
|
|
type_gtpc := '00'O,
|
|
teidDataI := teid_data
|
|
},
|
|
teidControlPlane := {
|
|
type_gtpc := '00'O,
|
|
teidControlPlane := teid_ctrl
|
|
},
|
|
nsapi := {
|
|
type_gtpc := '00'O,
|
|
nsapi := nsapi,
|
|
unused := '0000'B
|
|
},
|
|
linked_nsapi := omit,
|
|
charging_char := f_ts_ChargingCharacteristics(charging_char),
|
|
trace_ref := omit,
|
|
trace_type := omit,
|
|
endUserAddress := eua,
|
|
accessPointName := ts_APN(apn),
|
|
protConfigOptions := pco,
|
|
sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
|
|
sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
|
|
msisdn := ts_Msisdn(msisdn),
|
|
qualityOfServiceProfile := ts_QosDefault,
|
|
tft := omit,
|
|
triggerId := omit,
|
|
omcId := omit,
|
|
commonFlags := omit,
|
|
aPN_Restriction := omit,
|
|
ratType := f_ts_RATType(ratType),
|
|
userLocationInformation := uli,
|
|
mS_TimeZone := ms_tz,
|
|
imeisv := f_ts_IMEISV(imeisv),
|
|
camelChargingInformationContainer := omit,
|
|
additionalTraceInfo := omit,
|
|
correlationID := omit,
|
|
evolvedAllocationRetentionPriorityI := omit,
|
|
extendedCommonFlags := omit,
|
|
userCSGInformation := omit,
|
|
aPN_AMBR := omit,
|
|
signallingPriorityIndication := omit,
|
|
cN_OperatorSelectionEntity := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
template Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer 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,
|
|
octetstring sgsn_ip_data, octetstring msisdn,
|
|
template ProtConfigOptions pco := omit,
|
|
template (omit) OCT1 ratType := omit,
|
|
template (omit) UserLocationInformation uli := omit,
|
|
template (omit) OCT2 charging_char := omit,
|
|
template (omit) OCT8 imeisv := omit,
|
|
template(omit) MS_TimeZone ms_tz := omit) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
|
|
valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
|
|
nsapi, eua, apn, sgsn_ip_sign,
|
|
sgsn_ip_data, msisdn, pco, ratType, uli,
|
|
charging_char, imeisv, ms_tz)), seq)
|
|
}
|
|
|
|
|
|
template GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
|
|
BIT4 nsapi,
|
|
octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
|
|
template ProtConfigOptions pco := omit,
|
|
template (omit) OCT1 ratType := omit,
|
|
template (omit) UserLocationInformation uli := omit) := {
|
|
updatePDPContextRequest := {
|
|
updatePDPContextRequestSGSN := {
|
|
imsi := ts_Imsi(imsi),
|
|
rai := omit,
|
|
recovery := ts_Recovery(restart_ctr),
|
|
teidDataI := {
|
|
type_gtpc := '00'O,
|
|
teidDataI := teid_data
|
|
},
|
|
teidControlPlane := {
|
|
type_gtpc := '00'O,
|
|
teidControlPlane := teid_ctrl
|
|
},
|
|
nsapi := {
|
|
type_gtpc := '00'O,
|
|
nsapi := nsapi,
|
|
unused := '0000'B
|
|
},
|
|
trace_ref := omit,
|
|
trace_type := omit,
|
|
protConfigOptions := pco,
|
|
sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
|
|
sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
|
|
alt_ggsn_addr_controlPane := omit,
|
|
alt_ggsn_addr_traffic := omit,
|
|
qualityOfServiceProfile := ts_QosDefault,
|
|
tft := omit,
|
|
triggerId := omit,
|
|
omcId := omit,
|
|
commonFlags := omit,
|
|
ratType := f_ts_RATType(ratType),
|
|
userLocationInformation := uli,
|
|
mS_TimeZone := omit,
|
|
additionalTraceInfo := omit,
|
|
directTunnelFlags := omit,
|
|
evolvedAllocationRetentionPriorityI := omit,
|
|
extendedCommonFlags := omit,
|
|
userCSGInformation := omit,
|
|
aPN_AMBR := omit,
|
|
signallingPriorityIndication := omit,
|
|
cN_OperatorSelectionEntity := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
}
|
|
|
|
template Gtp1cUnitdata ts_GTPC_UpdatePDP(GtpPeer 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,
|
|
template ProtConfigOptions pco := omit,
|
|
template (omit) OCT1 ratType := omit,
|
|
template (omit) UserLocationInformation uli := omit) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
|
|
valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
|
|
nsapi, sgsn_ip_sign,
|
|
sgsn_ip_data, pco, ratType, uli)), seq)
|
|
}
|
|
|
|
|
|
template NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
|
|
type_gtpc := '14'O,
|
|
nsapi := nsapi,
|
|
unused := '0000'B
|
|
}
|
|
|
|
template ReorderingRequired ts_ReorderReq(boolean req := false) := {
|
|
type_gtpc := '08'O,
|
|
reordreq := bool2bit(req),
|
|
spare := '0000000'B
|
|
}
|
|
|
|
template GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
|
|
octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
|
|
OCT4 chg_id, template EndUserAddress eua := omit,
|
|
template Recovery_gtpc recovery := omit,
|
|
template ProtConfigOptions pco := omit) := {
|
|
createPDPContextResponse := {
|
|
cause := { '00'O, cause },
|
|
reorderingRequired := ts_ReorderReq(false),
|
|
recovery := recovery,
|
|
teidDataI := {
|
|
type_gtpc := '00'O,
|
|
teidDataI := teid_data
|
|
},
|
|
teidControlPlane := {
|
|
type_gtpc := '00'O,
|
|
teidControlPlane := teid_ctrl
|
|
},
|
|
nsapi := ts_NSAPI(nsapi),
|
|
chargingID := {
|
|
type_gtpc := '7F'O,
|
|
chargingID := chg_id
|
|
},
|
|
endUserAddress := eua,
|
|
protConfigOptions := pco,
|
|
ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
|
|
ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
|
|
alt_ggsn_addr_controlPane := omit,
|
|
alt_ggsn_addr_traffic := omit,
|
|
qualityOfServiceProfile := ts_QosDefault,
|
|
commonFlags := omit,
|
|
aPN_Restriction := omit,
|
|
mS_InfoChangeReportingAction := omit,
|
|
bearerControlMode := omit,
|
|
evolvedAllocationRetentionPriorityI := omit,
|
|
extendedCommonFlag := omit,
|
|
csg_information_reporting_action := omit,
|
|
aPN_AMBR := omit,
|
|
gGSN_BackOffTime := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
template Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
|
|
OCT1 cause,
|
|
OCT4 teid_ctrl, OCT4 teid_data,
|
|
BIT4 nsapi, octetstring ggsn_ip_sign,
|
|
octetstring ggsn_ip_data, OCT4 chg_id,
|
|
template EndUserAddress eua := omit,
|
|
template Recovery_gtpc recovery := omit,
|
|
template ProtConfigOptions pco := omit) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
|
|
valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
|
|
ggsn_ip_sign, ggsn_ip_data, chg_id,
|
|
eua, recovery, pco)), seq)
|
|
}
|
|
|
|
/* PCO send base template */
|
|
template ProtConfigOptions ts_PCO := {
|
|
type_gtpc := '84'O,
|
|
lengthf := 0,
|
|
configProtocol := '000'B,
|
|
spare := '0000'B,
|
|
extension0 := '1'B,
|
|
protocols := {}
|
|
}
|
|
/* PCO receive base template */
|
|
template ProtConfigOptions tr_PCO := {
|
|
type_gtpc := '84'O,
|
|
lengthf := ?,
|
|
configProtocol := '000'B,
|
|
spare := ?,
|
|
extension0 := '1'B,
|
|
protocols := {}
|
|
}
|
|
|
|
template ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
|
|
protocols := {
|
|
{ protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
|
|
}
|
|
}
|
|
template ProtConfigOptions tr_PCO_IPv6_DNS_resp(template OCT16 contents) modifies tr_PCO := {
|
|
protocols := {
|
|
*, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
|
|
}
|
|
}
|
|
|
|
template ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := {
|
|
protocols := {
|
|
/* dummy PAP entry to check if our parser in the GGSN can properly iterate over
|
|
* the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
|
|
{ protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
|
|
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
|
|
}
|
|
}
|
|
|
|
template ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
|
|
protocols := {
|
|
/* dummy PAP entry to check if our parser can cope with a single primary DNS entry
|
|
* see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
|
|
{ protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
|
|
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
|
|
}
|
|
}
|
|
template ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
|
|
protocols := {
|
|
/* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
|
|
* see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
|
|
{ protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
|
|
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
|
|
}
|
|
}
|
|
template ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
|
|
protocols := {
|
|
/* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
|
|
* in separate IPCP containers OS#3381 */
|
|
{ protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
|
|
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
|
|
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
|
|
}
|
|
}
|
|
|
|
template ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
|
|
protocolID := prot_id,
|
|
lengthProtoID := ?,
|
|
protoIDContents := ?
|
|
}
|
|
template ProtocolElement ts_PCOelem_PAP_broken := {
|
|
protocolID := 'C023'O,
|
|
lengthProtoID := 60,
|
|
/* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
|
|
protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
|
|
}
|
|
template ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
|
|
protocols := {
|
|
ts_PCOelem_PAP_broken,
|
|
{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
|
|
}
|
|
}
|
|
template ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
|
|
protocols := { *, tr_PCO_Proto(prot_id), * }
|
|
}
|
|
|
|
template ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
|
|
protocols := {
|
|
{ protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
|
|
}
|
|
}
|
|
template ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template OCT4 contents) modifies tr_PCO := {
|
|
protocols := {
|
|
*, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
|
|
}
|
|
}
|
|
|
|
/* extract a given protocol payload from PCO */
|
|
function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
|
|
var integer i;
|
|
var integer num_matches := 0;
|
|
for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
|
|
if (pco.protocols[i].protocolID == protocol) {
|
|
num_matches := num_matches + 1;
|
|
if (num_matches == nth_match) {
|
|
return pco.protocols[i].protoIDContents;
|
|
}
|
|
}
|
|
}
|
|
setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
|
|
mtc.stop;
|
|
return ''O;
|
|
}
|
|
|
|
template IpcpPacket tr_IPCP(template LcpCode code, template uint8_t identifier,
|
|
template IpcpOptionList opts) := {
|
|
code := code,
|
|
identifier := identifier,
|
|
len := ?,
|
|
options := opts
|
|
}
|
|
template IpcpOption tr_IPCP_PrimaryDns(template OCT4 addr) := {
|
|
code := IPCP_OPT_PrimaryDNS,
|
|
len := 6,
|
|
data := addr
|
|
}
|
|
template IpcpOption tr_IPCP_SecondaryDns(template OCT4 addr) := {
|
|
code := IPCP_OPT_SecondaryDNS,
|
|
len := 6,
|
|
data := addr
|
|
}
|
|
template IpcpPacket tr_IPCP_Ack_DNS(template uint8_t identifier := ?, template OCT4 dns1 := ?,
|
|
template OCT4 dns2 := ?) :=
|
|
tr_IPCP(LCP_Configure_Ack, identifier,
|
|
{ *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
|
|
|
|
template IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template IpcpOptionList opts) := {
|
|
code := code,
|
|
identifier := identifier,
|
|
len := 0, /* overwritten */
|
|
options := opts
|
|
}
|
|
template IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
|
|
ts_IPCP(LCP_Configure_Request, identifier,
|
|
{ tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
|
|
|
|
template IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
|
|
ts_IPCP(LCP_Configure_Request, identifier,
|
|
{ tr_IPCP_PrimaryDns('00000000'O) });
|
|
template IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
|
|
ts_IPCP(LCP_Configure_Request, identifier,
|
|
{ tr_IPCP_SecondaryDns('00000000'O) });
|
|
|
|
function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
|
|
if (istemplatekind(ind, "omit")) {
|
|
return omit;
|
|
}
|
|
var TearDownInd ret := {
|
|
type_gtpc := '13'O,
|
|
tdInd := valueof(ind),
|
|
spare:= '0000000'B
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
template GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
|
|
deletePDPContextRequest := {
|
|
cause := omit,
|
|
tearDownIndicator := f_teardown_ind_IE(teardown_ind),
|
|
nsapi := {
|
|
type_gtpc := '14'O,
|
|
nsapi := nsapi,
|
|
unused := '0000'B
|
|
},
|
|
protConfigOptions := omit,
|
|
userLocationInformation := omit,
|
|
mS_TimeZone := omit,
|
|
extendedCommonFlags := omit,
|
|
uLI_Timestamp := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
template Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid,
|
|
BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
|
|
valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
|
|
}
|
|
|
|
template GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
|
|
template ProtConfigOptions pco := omit) := {
|
|
deletePDPContextResponse := {
|
|
cause := { '00'O, cause },
|
|
protConfigOptions := pco,
|
|
userLocationInformation := omit,
|
|
mS_TimeZone := omit,
|
|
uLI_Timestamp := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
|
|
template Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
|
|
OCT1 cause,
|
|
template ProtConfigOptions pco := omit) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
|
|
valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
|
|
}
|
|
|
|
|
|
/* GTP-C RIM */
|
|
|
|
template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
|
|
iEI := '4B'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 1
|
|
},
|
|
rIMApplicationIdentity := app_id
|
|
}
|
|
/* 3GPP TS 48.018 11.3.62 */
|
|
template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
|
|
iEI := '4C'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 4
|
|
},
|
|
rIMSequenceNumber := int2oct(seq, 4)
|
|
}
|
|
template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
|
|
iEI := '4F'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 1
|
|
},
|
|
ack := bool2bit(ack),
|
|
pDU_Type_Extension := type_ext,
|
|
reserved := '0000'B
|
|
}
|
|
/* 3GPP TS 48.018 11.3.67 */
|
|
template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
|
|
iEI := '55'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 1
|
|
},
|
|
rIMProtocolVersionNumber := int2oct(ver, 1)
|
|
}
|
|
function tr_GTPC_Cell_Identifier_V(template GTP_CellId cid) return template Cell_Identifier_V_GTPC {
|
|
var template Cell_Identifier_V_GTPC ret := {
|
|
mccDigit1 := ?,
|
|
mccDigit2 := ?,
|
|
mccDigit3 := ?,
|
|
mncDigit3 := ?,
|
|
mncDigit1 := ?,
|
|
mncDigit2 := ?,
|
|
lac := ?,
|
|
rac := ?,
|
|
cI_value := ?
|
|
}
|
|
if (istemplatekind(cid, "omit")) {
|
|
return omit;
|
|
} else if (istemplatekind(cid, "*")) {
|
|
return *;
|
|
} else if (istemplatekind(cid, "?")) {
|
|
return ?;
|
|
}
|
|
if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
|
|
if (isvalue(cid.ra_id.lai.mcc_mnc)) {
|
|
ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
|
|
ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
|
|
ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
|
|
ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
|
|
ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
|
|
ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
|
|
}
|
|
if (isvalue(cid.ra_id.lai.lac)) {
|
|
ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
|
|
}
|
|
}
|
|
if (isvalue(cid) and isvalue(cid.ra_id)) {
|
|
ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
|
|
}
|
|
if (isvalue(cid)) {
|
|
ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
|
|
}
|
|
return ret;
|
|
}
|
|
template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
|
|
mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
|
|
mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
|
|
mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
|
|
mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
|
|
mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
|
|
mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
|
|
lac := int2oct(cid.ra_id.lai.lac, 2),
|
|
rac := int2oct(cid.ra_id.rac, 1),
|
|
cI_value := int2oct(cid.cell_id, 2)
|
|
}
|
|
template RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
|
|
cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
|
|
}
|
|
function tr_GTPC_ENB_Identifier(template GTP_CellId cid, template integer tac, template octetstring gnbid) return template ENB_Identifier {
|
|
var template ENB_Identifier ret := {
|
|
mccDigit1 := ?,
|
|
mccDigit2 := ?,
|
|
mccDigit3 := ?,
|
|
mncDigit3 := ?,
|
|
mncDigit1 := ?,
|
|
mncDigit2 := ?,
|
|
tAC := ?,
|
|
globalENB_ID := ?
|
|
}
|
|
if (istemplatekind(cid, "omit") and istemplatekind(tac, "omit") and istemplatekind(gnbid, "omit")) {
|
|
return omit;
|
|
} else if (istemplatekind(cid, "*") and istemplatekind(tac, "*") and istemplatekind(gnbid, "*")) {
|
|
return *;
|
|
} else if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
|
|
return ?;
|
|
}
|
|
if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
|
|
if (isvalue(cid.ra_id.lai.mcc_mnc)) {
|
|
ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
|
|
ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
|
|
ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
|
|
ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
|
|
ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
|
|
ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
|
|
}
|
|
}
|
|
if (isvalue(tac)) {
|
|
ret.tAC := int2oct(valueof(tac), 2);
|
|
}
|
|
if (isvalue(gnbid)) {
|
|
ret.globalENB_ID := gnbid;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
|
|
mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
|
|
mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
|
|
mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
|
|
mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
|
|
mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
|
|
mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
|
|
tAC := int2oct(tac, 2),
|
|
globalENB_ID := gnbid
|
|
}
|
|
template RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
|
|
eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
|
|
}
|
|
template RIM_Routing_Information_GTPC
|
|
tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template RIM_Routing_Address_GTPC addr) := {
|
|
iEI := '54'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := ?
|
|
},
|
|
rIMRoutingAddressDiscriminator := addr_discr,
|
|
spare := '0'H,
|
|
rIM_Routing_Address := addr
|
|
}
|
|
template (value) RIM_Routing_Information_GTPC
|
|
ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
|
|
iEI := '54'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 0 /* overwritten */
|
|
},
|
|
rIMRoutingAddressDiscriminator := addr_discr,
|
|
spare := '0'H,
|
|
rIM_Routing_Address := addr
|
|
}
|
|
/* 3GPP TS 48.018 11.3.63.1.1 */
|
|
template RAN_Information_Request_Application_Container_NACC_GTPC
|
|
tr_GTPC_RAN_Information_Request_Application_Container_NACC(template GTP_CellId cid) := {
|
|
iEI := '4D'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := ?
|
|
},
|
|
reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
|
|
}
|
|
template (value) RAN_Information_Request_Application_Container_NACC_GTPC
|
|
ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
|
|
iEI := '4D'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 0 /* overwritten */
|
|
},
|
|
reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
|
|
}
|
|
/* 3GPP TS 48.018 11.3.63.1 */
|
|
template RAN_Information_Request_Application_Container_GTPC
|
|
tru_GTPC_RAN_Information_Request_Application_Container_NACC(template GTP_CellId cid) := {
|
|
nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
|
|
}
|
|
template (value) RAN_Information_Request_Application_Container_GTPC
|
|
tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
|
|
nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
|
|
}
|
|
/* 3GPP TS 48.018 11.3.63.2.1 */
|
|
template RAN_Information_Application_Container_NACC_GTPC
|
|
tr_GTPC_RAN_Information_Application_Container_NACC(template GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
|
|
iEI := '4E'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := ?
|
|
},
|
|
reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
|
|
typeBit := bool2bit(psi_type),
|
|
number_of_SI_PSI := int2bit(si_psi_num, 7),
|
|
sI_PSI := si_psi
|
|
}
|
|
template (value) RAN_Information_Application_Container_NACC_GTPC
|
|
ts_GTPC_RAN_Information_Application_Container_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
|
|
iEI := '4E'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 0 /* overwritten */
|
|
},
|
|
reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
|
|
typeBit := bool2bit(psi_type),
|
|
number_of_SI_PSI := int2bit(si_psi_num, 7),
|
|
sI_PSI := si_psi
|
|
}
|
|
|
|
/* RAN_Information_Request */
|
|
template (value) RAN_Information_Request_RIM_Container_GTPC
|
|
ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
|
|
template (value) RIM_Sequence_Number_GTPC seq,
|
|
template (value) RIM_PDU_Indications_GTPC ind,
|
|
template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
|
|
template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
|
|
template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
|
|
iEI := '57'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 0 /* overwritten */
|
|
},
|
|
rIM_Application_Identity := app_id,
|
|
rIM_Sequence_Number := seq,
|
|
rIM_PDU_Indications := ind,
|
|
rIM_Protocol_Version_Number := ver,
|
|
application_Container := app_cont,
|
|
sON_TransferApplicationIdentity := son_app_id
|
|
}
|
|
template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
|
|
ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
|
|
template (value) RIM_Routing_Information_GTPC src,
|
|
template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
|
|
bssgpPduType := '71'O,
|
|
destination_Cell_Identifier := dest,
|
|
source_Cell_Identifier := src,
|
|
rIM_Container := cont
|
|
}
|
|
template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
|
|
type_gtpc := '90'O,
|
|
lengthf := 0, /* FIXME */
|
|
rANTransparentContainerField := {
|
|
pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
|
|
}
|
|
}
|
|
|
|
/* RAN_Information */
|
|
template ApplContainer_or_ApplErrContainer_NACC_GTPC
|
|
tru_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
|
|
application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
|
|
}
|
|
template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
|
|
tsu_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
|
|
application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
|
|
}
|
|
template ApplContainer_or_ApplErrContainer_GTPC
|
|
tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
|
|
nacc := cont
|
|
}
|
|
template (value) ApplContainer_or_ApplErrContainer_GTPC
|
|
tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
|
|
nacc := cont
|
|
}
|
|
template RAN_Information_RIM_Container_GTPC
|
|
tr_GTPC_RAN_Information_RIM_Container(template RIM_Application_Identity_GTPC app_id,
|
|
template RIM_Sequence_Number_GTPC seq,
|
|
template RIM_PDU_Indications_GTPC ind,
|
|
template RIM_Protocol_Version_Number_GTPC ver := omit,
|
|
template ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
|
|
template SON_TransferApplicationIdentity son_app_id := omit) := {
|
|
iEI := '58'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := ?
|
|
},
|
|
rIM_Application_Identity := app_id,
|
|
rIM_Sequence_Number := seq,
|
|
rIM_PDU_Indications := ind,
|
|
rIM_Protocol_Version_Number := ver,
|
|
applContainer_or_ApplErrContainer := app_cont,
|
|
sON_TransferApplicationIdentity := son_app_id
|
|
}
|
|
template (value) RAN_Information_RIM_Container_GTPC
|
|
ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
|
|
template (value) RIM_Sequence_Number_GTPC seq,
|
|
template (value) RIM_PDU_Indications_GTPC ind,
|
|
template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
|
|
template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
|
|
template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
|
|
iEI := '58'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := 0 /* overwritten */
|
|
},
|
|
rIM_Application_Identity := app_id,
|
|
rIM_Sequence_Number := seq,
|
|
rIM_PDU_Indications := ind,
|
|
rIM_Protocol_Version_Number := ver,
|
|
applContainer_or_ApplErrContainer := app_cont,
|
|
sON_TransferApplicationIdentity := son_app_id
|
|
}
|
|
template PDU_BSSGP_RAN_INFORMATION_GTPC
|
|
tr_GTPC_RAN_Information(template RIM_Routing_Information_GTPC dest,
|
|
template RIM_Routing_Information_GTPC src,
|
|
template RAN_Information_RIM_Container_GTPC cont) := {
|
|
bssgpPduType := '70'O,
|
|
destination_Cell_Identifier := dest,
|
|
source_Cell_Identifier := src,
|
|
rIM_Container := cont
|
|
}
|
|
template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
|
|
ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
|
|
template (value) RIM_Routing_Information_GTPC src,
|
|
template (value) RAN_Information_RIM_Container_GTPC cont) := {
|
|
bssgpPduType := '70'O,
|
|
destination_Cell_Identifier := dest,
|
|
source_Cell_Identifier := src,
|
|
rIM_Container := cont
|
|
}
|
|
template RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
|
|
type_gtpc := '90'O,
|
|
lengthf := ?,
|
|
rANTransparentContainerField := {
|
|
pDU_BSSGP_RAN_INFORMATION := pdu
|
|
}
|
|
}
|
|
template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
|
|
type_gtpc := '90'O,
|
|
lengthf := 0, /* overwritten */
|
|
rANTransparentContainerField := {
|
|
pDU_BSSGP_RAN_INFORMATION := pdu
|
|
}
|
|
}
|
|
|
|
template RANTransparentContainer tr_RANTransparentContainer(template RANTransparentContainerField rANTransparentContainerField) := {
|
|
type_gtpc := '90'O,
|
|
lengthf := ?,
|
|
rANTransparentContainerField := rANTransparentContainerField
|
|
}
|
|
template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
|
|
type_gtpc := '90'O,
|
|
lengthf := 0, /* overwritten */
|
|
rANTransparentContainerField := rANTransparentContainerField
|
|
}
|
|
template GTPC_PDUs tr_RANInfoRelay(template RANTransparentContainer transparentContainer) := {
|
|
ranInformationRelay := {
|
|
transparentContainer := transparentContainer,
|
|
rIM_RoutingAddress := *,
|
|
rIM_RoutingAddress_Discriminator := *,
|
|
private_extension_gtpc := *
|
|
}
|
|
}
|
|
template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer) := {
|
|
ranInformationRelay := {
|
|
transparentContainer := transparentContainer,
|
|
rIM_RoutingAddress := omit,
|
|
rIM_RoutingAddress_Discriminator := omit,
|
|
private_extension_gtpc := omit
|
|
}
|
|
}
|
|
template Gtp1cUnitdata
|
|
tr_GTPC_RANInfoRelay(template GtpPeer peer,
|
|
template RANTransparentContainer transparentContainer) := {
|
|
peer := peer,
|
|
gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
|
|
}
|
|
template (value) Gtp1cUnitdata
|
|
ts_GTPC_RANInfoRelay(template (value) GtpPeer peer,
|
|
template (value) RANTransparentContainer transparentContainer) := {
|
|
peer := peer,
|
|
gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer)), 0)
|
|
}
|
|
|
|
|
|
template RAN_Information_Request_RIM_Container_GTPC
|
|
tr_GTPC_RAN_Information_Request_RIM_Container(template RIM_Application_Identity_GTPC app_id := ?,
|
|
template RIM_Sequence_Number_GTPC seq := ?,
|
|
template RIM_PDU_Indications_GTPC ind := ?,
|
|
template RIM_Protocol_Version_Number_GTPC ver := *,
|
|
template RAN_Information_Request_Application_Container_GTPC app_cont := *,
|
|
template SON_TransferApplicationIdentity son_app_id := *) := {
|
|
iEI := '57'O,
|
|
ext := '1'B,
|
|
lengthIndicator := {
|
|
length1 := ?
|
|
},
|
|
rIM_Application_Identity := app_id,
|
|
rIM_Sequence_Number := seq,
|
|
rIM_PDU_Indications := ind,
|
|
rIM_Protocol_Version_Number := ver,
|
|
application_Container := app_cont,
|
|
sON_TransferApplicationIdentity := son_app_id
|
|
}
|
|
|
|
/* GTP-U */
|
|
|
|
template PDU_GTPU tr_GTP1U_PDU(template OCT1 msg_type, template OCT4 teid, template 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 Gtp1uUnitdata tr_GTPU_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid) := {
|
|
peer := peer,
|
|
gtpu := tr_GTP1U_PDU(msg_type, teid)
|
|
}
|
|
|
|
|
|
/* template matching reception of GTP-U echo-request/response */
|
|
template Gtp1uUnitdata tr_GTPU_PING(template GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O);
|
|
template Gtp1uUnitdata tr_GTPU_PONG(template GtpPeer peer) := tr_GTPU_MsgType(peer, echoResponse, '00000000'O);
|
|
|
|
/* template matching reception of GTP-U GPDU */
|
|
template GTPU_IEs t_GPDU(template octetstring data) := {
|
|
g_PDU_IEs := {
|
|
data := data
|
|
}
|
|
}
|
|
template Gtp1uUnitdata tr_GTPU_GPDU(template GtpPeer peer, template OCT4 teid, template octetstring data := ?) := {
|
|
peer := peer,
|
|
gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data))
|
|
}
|
|
|
|
template 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 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 GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := {
|
|
type_gtpu := '85'O,
|
|
lengthf := lengthof(ip_addr),
|
|
gSNAddressValue := ip_addr
|
|
}
|
|
|
|
template TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := {
|
|
type_gtpu := '10'O,
|
|
teidDataI := teid
|
|
}
|
|
|
|
template 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 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 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 }})
|
|
}
|
|
}
|