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
diff --git a/library/GTPv1C_Templates.ttcn b/library/GTPv1C_Templates.ttcn
new file mode 100644
index 0000000..4a0c8b2
--- /dev/null
+++ b/library/GTPv1C_Templates.ttcn
@@ -0,0 +1,1792 @@
+/* GTPv1-C 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 GTPv1C_Templates {
+
+	import from General_Types all;
+	import from Osmocom_Types all;
+	import from GTPC_Types all;
+	import from GTPv1C_CodecPort all;
+	import from IPCP_Types all;
+	import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
+
+	template (present) OCT1 gtp1_requests := (
+		'10'O, /* createPDPContextRequest */
+		'12'O, /* updatePDPContextRequest */
+		'14'O, /*  */
+		'16'O, /* deletePDPContextRequest */
+		'1B'O, /* pdu_NotificationRequest */
+		'1D'O, /* pdu_NotificationRejectRequest */
+		'1F'O, /* supportedExtensionHeadersNotification */
+		'20'O, /* sendRouteingInformationForGPRSRequest */
+		'22'O, /* failureReportRequest */
+		'24'O, /* noteMS_GPRSPresentRequest */
+		'30'O, /* identificationRequest */
+		'32'O, /* sgsn_ContextRequest */
+		'35'O, /* forwardRelocationRequest */
+		'38'O, /* relocationCancelRequest */
+		'3A'O, /* forwardSRNSContext */
+		'3D'O, /* uERegistrationQueryRequest */
+		'46'O, /* ranInformationRelay */
+		'60'O, /* mBMSNotificationRequest */
+		'62'O, /* mBMSNotificationRejectRequest */
+		'64'O, /* createMBMSContextRequest */
+		'66'O, /* updateMBMSContextRequest */
+		'68'O, /* deleteMBMSContextRequest */
+		'70'O, /* mBMSRegistrationRequest */
+		'72'O, /* mBMSDeRegistrationRequest */
+		'74'O, /* mBMSSessionStartRequest */
+		'76'O, /* mBMSSessionStopRequest */
+		'78'O, /* mBMSSessionUpdateRequest */
+		'80'O /* mS_InfoChangeNotificationRequest */
+	);
+
+	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 */
+	};
+
+	template (value) Cause_gtpc ts_Cause_gtpc(template (value) GTP_Cause cause) := {
+		type_gtpc := '01'O,
+		causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
+	}
+	private function enum2oct1_Cause_gtpc_tmpl(template GTP_Cause inp) return template OCT1
+	{
+		if (istemplatekind(inp, "omit")) {
+			return omit;
+		} else if (istemplatekind(inp, "*")) {
+			return *;
+		} else if (istemplatekind(inp, "?")) {
+			return ?;
+		} else {
+			return int2oct(enum2int(valueof(inp)), 1);
+		}
+	}
+	template (present) Cause_gtpc tr_Cause_gtpc(template (present) GTP_Cause cause) := {
+		type_gtpc := '01'O,
+		causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
+	}
+	function f_tr_Cause_gtpc(template GTP_Cause cause) return
+	template Cause_gtpc {
+		if (istemplatekind(cause, "omit")) {
+			return omit;
+		} else if (istemplatekind(cause, "*")) {
+			return *;
+		} else {
+			return tr_Cause_gtpc(cause);
+		}
+	}
+
+	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 (present) PDU_GTPC tr_GTP1C_PDU(template (present) OCT1 msg_type, template (present) OCT4 teid, template (present) 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 (value) 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 (value) Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
+		type_gtpc := '0E'O,
+		restartCounter := restart_counter
+	}
+
+	template (present) Recovery_gtpc tr_Recovery(template (present) OCT1 restart_counter) := {
+		type_gtpc := '0E'O,
+		restartCounter := restart_counter
+	}
+
+	/* Packet TMSI - 7.7.5 */
+	template (value) PacketTMSI ts_PTMSI(OCT4 ptmsi) := {
+		type_gtpc := '05'O,
+		p_tmsi := ptmsi
+	}
+
+	/* PTMSI Signature - 7.7.9 */
+	template (value) PTMSI_Signature ts_PTMSI_sig(OCT3 ptmsi_sig) := {
+		type_gtpc := '0C'O,
+		ptmsi_Signature := ptmsi_sig
+	}
+
+	/* MS Validated - 7.7.10 */
+	template (value) MS_Validated ts_MS_Validated(template (value) BIT1 msValidated) := {
+		type_gtpc := '0D'O,
+		msValidated := msValidated,
+		spare := '1111111'B
+	}
+	template (present) MS_Validated tr_MS_Validated(template (present) BIT1 msValidated := ?) := {
+		type_gtpc := '0D'O,
+		msValidated := msValidated,
+		spare := '1111111'B
+	}
+	function f_tr_MS_Validated(template BIT1 msValidated := *) return template MS_Validated {
+		if (istemplatekind(msValidated, "omit")) {
+			return omit;
+		} else if (istemplatekind(msValidated, "*")) {
+			return *;
+		} else {
+			return tr_MS_Validated(msValidated);
+		}
+	}
+	private function f_ts_MS_Validated(template (omit) BIT1 msValidated)
+	return template (omit) MS_Validated {
+		if (istemplatekind(msValidated, "omit")) {
+			return omit;
+		}
+		return ts_MS_Validated(msValidated);
+	}
+
+	/* 7.7.13 TEI Data I */
+	template (value) TeidDataI ts_TeidDataI(template (value) OCT4 teid) := {
+		type_gtpc := '10'O,
+		teidDataI := teid
+	}
+	template (present) TeidDataI tr_TeidDataI(template (present) OCT4 teid := ?) := {
+		type_gtpc := '10'O,
+		teidDataI := teid
+	}
+
+	/* 7.7.14 TEI Control Plane */
+	template (value) TeidControlPlane ts_TEIC(template (value) OCT4 teic) := {
+		type_gtpc := '11'O,
+		teidControlPlane := teic
+	}
+	template (present) TeidControlPlane tr_TEIC(template (present) OCT4 teic := ?) := {
+		type_gtpc := '11'O,
+		teidControlPlane := teic
+	}
+	private function f_ts_TEIC(template (omit) OCT4 teic)
+	return template (omit) TeidControlPlane {
+		if (istemplatekind(teic, "omit")) {
+			return omit;
+		}
+		return ts_TEIC(teic);
+	}
+
+	/* 7.7.15 Tunnel Endpoint Identifier Data II */
+	template (value) TeidDataII ts_TeidDataII(template (value) BIT4 nsapi,
+						  template (value) OCT4 teid) := {
+		type_gtpc := '12'O,
+		nsapi := nsapi,
+		unused := '0000'B,
+		teidDataII := teid
+	}
+	template (present) TeidDataII tr_TeidDataII(template (present) BIT4 nsapi := ?,
+						    template (present) OCT4 teid := ?) := {
+		type_gtpc := '12'O,
+		nsapi := nsapi,
+		unused := '0000'B,
+		teidDataII := teid
+	}
+
+	/* IMEI(SV) IE TS 29.060 7.7.53 */
+	template (value) 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 (present) 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 (value) 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 (present) ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := {
+		type_gtpc := '1A'O,
+		chargingChar := chargingChar
+	}
+
+	/* 7.7.28 MM Context */
+	template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
+						      template (value) OCT16 ik) := {
+		type_gtpc := '81'O,
+		context := {
+			mmcontUMTS := {
+				lengthf := 0, /* overwritten */
+				ksi := '001'B,
+				usedGPRSIntegrityAlgorithm := '000'B,
+				ugipai := '1'B, /* Integrity Protection not required */
+				gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
+				spare1 := '000'B,
+				noofVectors := 0, /* TODO: fill quintpuplets*/
+				security := '01'B, /* UMTS key and quintuplets */
+				ck := ck,
+				ik := ik,
+				quintupletlength := 0, /* overwritten */
+				quintuplet := ''O,
+				drx_par := '0000'O,
+				msNetW_cap_length := 0, /* overwritten */
+				msNetw_cap := omit,
+				containerLength := 0, /* overwritten */
+				container := omit,
+				access_restriction_data_length := 0, /* overwritten */
+				access_restriction_data := omit
+			}
+		}
+	}
+
+	/* 7.7.29 PDP Context */
+	template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
+							      template (value) octetstring ggsn_gsn_addr,
+							      template (value) octetstring apn,
+							      template (value) OCT4 ggsn_teic := '12345678'O,
+							      template (value) OCT4 ggsn_teid := '87654321'O) := {
+		type_gtpc := '82'O,
+		lengthf := 0, /* overwritten */
+		nsapi := '0101'B,
+		order := '0'B,
+		asi := '0'B,
+		vaa := '0'B,
+		ea := '0'B,
+		sapi := '0011'B,
+		spare1 := '0000'B,
+		qos_subLength := 0, /* overwritten */
+		qos_sub := ts_QosProfileValueDefault,
+		qos_reqLength := 0, /* overwritten */
+		qos_req := ts_QosProfileValueDefault,
+		qos_negLength := 0, /* overwritten */
+		qos_neg := ts_QosProfileValueDefault,
+		snd := '0000'O,
+		snu := '0000'O,
+		sendNPDUnum := '00'O,
+		receiveNPDUnum := '00'O,
+		uteidControlPlane := ggsn_teic,
+		uteidData1 := ggsn_teid,
+		pdpcontext := '00'O,
+		pdp_typeorg := '0001'B, /* IETF */
+		spare2 := '1111'B,
+		pdp_typenum := '21'O, /* IETF IPV4 */
+		pdp_addressLength := 0, /* overwritten */
+		pdp_address := pdp_addr,
+		ggsn_addressControlPlaneLength := 0, /* overwritten */
+		ggsn_addressControlPlane := ggsn_gsn_addr,
+		ggsn_addressUserPlaneLength := 0, /* overwritten */
+		ggsn_addressUserPlane := ggsn_gsn_addr,
+		apnLength := 0, /* overwritten */
+		apn := apn,
+		transactionId := '0001'B,
+		spare3 := '0000'B,
+		transactionID_cont := '00'O,
+		pdp_typenum2 := omit,
+		pdp_addresslength2 := omit,
+		pdp_Address2 := omit
+	}
+
+
+	/* template matching reception of GTP-C unit-data */
+	template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
+							 template (present) OCT1 msg_type,
+							 template (present) OCT4 teid,
+							 template (present) GTPC_PDUs pdus := ?) := {
+		peer := peer,
+		gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
+	}
+
+	/* template matching reception of GTP-C echo-request */
+	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 := {
+			recovery := tr_Recovery(restart_counter),
+			private_extension_gtpc := *
+		}
+	}
+
+	/* template matching reception of GTP-C echo-response */
+	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 := {
+			recovery := ts_Recovery(restart_counter),
+			private_extension_gtpc := omit
+		}
+	}
+
+	/* master template for senidng a GTP-C echo response */
+	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)
+	}
+
+	template (value) GTPC_PDUs ts_EchoReqPDU := {
+		echoRequest := {
+			private_extension_gtpc := omit
+		}
+	}
+
+	/* master template for sending a GTP-C echo request */
+	template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer 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 (present) 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 (present) 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 (present) 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 (present) 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 (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
+	template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
+		endUserAddress := {
+			endUserAddressIPv4 := {
+				lengthf := f_eua_ipv4_len(ip_addr)
+			}
+		}
+	}
+
+	template (present) 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 (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
+	template (present) EndUserAddress tr_EuaIPv6(template (present) 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 (present) 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 (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
+	template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
+						       template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
+		endUserAddress := {
+			endUserAddressIPv4andIPv6 := {
+				lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
+			}
+		}
+	}
+
+	template (value) AccessPointName ts_APN(octetstring apn) := {
+		type_gtpc := '83'O,
+		lengthf := lengthof(apn),
+		apn_value := apn
+	}
+
+	template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
+		type_gtpc := '85'O,
+		lengthf := lengthof(ip_addr),
+		addressf := ip_addr
+	}
+	template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
+		type_gtpc := '85'O,
+		lengthf := ?,
+		addressf := ip_addr
+	}
+
+	template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
+		type_gtpc := '86'O,
+		lengthf := lengthof(msisdn),
+		msisdn := msisdn
+	}
+
+	template (value) QoSV_GTPC ts_QosValueDefault := {
+		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 := '010'B, /* Erroneus SDU are delivered */
+		deliveryOrder := '10'B, /* Without delivery order */
+		trafficClass := '100'B, /* Background */
+		maxSDUSize := '96'O, /* 1500 octets */
+		maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
+		maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
+		sduErrorRatio := '0100'B, /* 1x10^-4 */
+		residualBER := '0101'B, /* 1x10^-3 */
+		trafficHandlingPriority := '01'B, /* prio 1 */
+		transferDelay := '000001'B, /* 10 ms */
+		guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
+		guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
+		sourceStatisticsDescriptor := '0000'B, /* unknown */
+		signallingIndication := '0'B, /* Not optimized */
+		spare4 := '000'B,
+		maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
+		guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
+		maxBitrateUplinkExt := '6e'O, /* 52 mbps */
+		guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
+	}
+
+	template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
+		allocRetensionPrio := '00'O,
+		qos_ProfileValue := ts_QosValueDefault
+	}
+
+	template (value) QualityOfServiceProfile ts_QosDefault := {
+		type_gtpc := '87'O,
+		lengthf := 17,
+		allocRetensionPrio := '00'O,
+		qos_ProfileValue := ts_QosValueDefault
+	}
+
+	template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
+		type_gtpc := '02'O,
+		digits := digits,
+		padding := 'F'H
+	}
+	function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
+		var template (omit) IMSI_gtpc imsi;
+		if (istemplatekind(digits, "omit")) {
+			imsi := omit;
+		} else {
+			imsi := ts_Imsi(valueof(digits));
+		}
+		return imsi;
+	}
+	template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
+		type_gtpc := '02'O,
+		digits := digits,
+		padding := 'F'H
+	}
+	function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
+		if (istemplatekind(digits, "omit")) {
+			return omit;
+		} else if (istemplatekind(digits, "*")) {
+			return *;
+		} else {
+			return tr_Imsi(digits);
+		}
+	}
+
+	/* 7.7.50 RAT Type */
+	type enumerated GTP_RATType {
+		GTP_RAT_TYPE_RESERVED		(0),
+		GTP_RAT_TYPE_UTRAN		(1),
+		GTP_RAT_TYPE_GERAN		(2),
+		GTP_RAT_TYPE_WLAN		(3),
+		GTP_RAT_TYPE_GAN		(4),
+		GTP_RAT_TYPE_HSPA_E		(5),
+		GTP_RAT_TYPE_EUTRAN		(6)
+	};
+	template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
+			type_gtpc := '97'O,
+			lengthf := 1,
+			ratTypeValue := rat_type
+	}
+	function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
+		if (istemplatekind(rat_type, "omit")) {
+			return omit;
+		} else {
+			return ts_RATType(rat_type);
+		}
+	}
+	template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
+			type_gtpc := '97'O,
+			lengthf := 1,
+			ratTypeValue := rat_type
+	}
+	function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
+		if (istemplatekind(rat_type, "omit")) {
+			return omit;
+		} else if (istemplatekind(rat_type, "*")) {
+			return *;
+		} else {
+			return tr_RATType(rat_type);
+		}
+	}
+
+	template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
+								    template (value) hexstring mnc_digits,
+								    template (value) OCT2      lac,
+								    template (value) OCT1      rac) := {
+		type_gtpc := '03'O,
+		mcc_digits := mcc_digits,
+		mnc_digits := mnc_digits,
+		lac := lac,
+		rac := rac
+	}
+
+	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 (value) 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 (omit) 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 (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,
+							 octetstring sgsn_ip_data, octetstring msisdn,
+							 template (omit) 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 (value) 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 (omit) 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 (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,
+							 template (omit) 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 (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
+		type_gtpc := '14'O,
+		nsapi := nsapi,
+		unused := '0000'B
+	}
+
+	template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
+		type_gtpc := '08'O,
+		reordreq := bool2bit(req),
+		spare := '0000000'B
+	}
+
+	template (value) 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 (omit) EndUserAddress eua := omit,
+						       template (omit) Recovery_gtpc recovery := omit,
+						       template (omit) 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 (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,
+							     octetstring ggsn_ip_data, OCT4 chg_id,
+							     template (omit) EndUserAddress eua := omit,
+							     template (omit) Recovery_gtpc recovery := omit,
+							     template (omit) 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 (value) ProtConfigOptions ts_PCO := {
+		type_gtpc := '84'O,
+		lengthf := 0,
+		configProtocol := '000'B,
+		spare := '0000'B,
+		extension0 := '1'B,
+		protocols := {}
+	}
+	/* PCO receive base template */
+	template (present) ProtConfigOptions tr_PCO := {
+		type_gtpc := '84'O,
+		lengthf := ?,
+		configProtocol := '000'B,
+		spare := ?,
+		extension0 := '1'B,
+		protocols := {}
+	}
+
+	template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
+		protocols := {
+			{ protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
+		}
+	}
+	template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
+		protocols := {
+			*, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
+		}
+	}
+
+	template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) 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(ipcp_req_id))) }
+		}
+	}
+
+	template (value) 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 (value) 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 (value) 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 (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
+		protocolID := prot_id,
+		lengthProtoID := ?,
+		protoIDContents := ?
+	}
+	template (value) 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 (value) 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 (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
+		protocols := { *, tr_PCO_Proto(prot_id), * }
+	}
+
+	template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
+		protocols := {
+			{ protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
+		}
+	}
+	template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) 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 (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
+					      template (present) IpcpOptionList opts) := {
+		code := code,
+		identifier := identifier,
+		len := ?,
+		options := opts
+	}
+	template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
+		code := IPCP_OPT_PrimaryDNS,
+		len := 6,
+		data := addr
+	}
+	template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
+		code := IPCP_OPT_SecondaryDNS,
+		len := 6,
+		data := addr
+	}
+	template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
+						      template (present) OCT4 dns1 := ?,
+						      template (present) OCT4 dns2 := ?) :=
+		tr_IPCP(LCP_Configure_Ack, identifier,
+				{ *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
+
+	template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
+		code := code,
+		identifier := identifier,
+		len := 0,	/* overwritten */
+		options := opts
+	}
+	template (value) 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 (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
+		ts_IPCP(LCP_Configure_Request, identifier,
+			{ tr_IPCP_PrimaryDns('00000000'O) });
+	template (value) 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 (value) 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 (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,
+					valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
+	}
+
+	template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
+						       template (omit) ProtConfigOptions pco := omit) := {
+		deletePDPContextResponse := {
+			cause := { '00'O, cause },
+			protConfigOptions := pco,
+			userLocationInformation := omit,
+			mS_TimeZone := omit,
+			uLI_Timestamp := omit,
+			private_extension_gtpc := omit
+		}
+	}
+
+	template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
+							     OCT1 cause,
+							     template (omit) ProtConfigOptions pco := omit) := {
+		peer := peer,
+		gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
+					valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
+	}
+
+	/* SGSN Context Request - 7.5.3 */
+	template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
+							template (present) OCT4 teic := ?,
+							template (present) octetstring sgsn_addr_control := ?,
+							template hexstring imsi := *,
+							template BIT1 msValidated := *,
+							template TLLI tlli := *,
+							template PacketTMSI ptmsi := *,
+							template PTMSI_Signature ptmsi_sig := *,
+							template OCT1 rat_type := *) := {
+		sgsn_ContextRequest := {
+			imsi := f_tr_Imsi(imsi),
+			routingAreaIdentity := rai,
+			tlli := tlli,
+			packetTMSI := ptmsi,
+			ptmsi_Signature := ptmsi_sig,
+			ms_Validated := f_tr_MS_Validated(msValidated),
+			teidControlPlane := {
+				type_gtpc := '11'O,
+				teidControlPlane := teic
+			},
+			sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
+			alternative_sgsn_addr_controlPlane := *,
+			sGSN_Number := *,
+			ratType := f_tr_RATType(rat_type),
+			hopCounter := *,
+			private_extension_gtpc := *
+		}
+	}
+	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)
+	}
+	template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
+							template (value) OCT4 teic,
+							template (value) octetstring sgsn_addr_control,
+							template (omit) hexstring imsi := omit,
+							template (omit) BIT1 msValidated := '0'B,
+							template (omit) TLLI tlli := omit,
+							template (omit) PacketTMSI ptmsi := omit,
+							template (omit) PTMSI_Signature ptmsi_sig := omit,
+							template (omit) OCT1 rat_type := omit) := {
+		sgsn_ContextRequest := {
+			imsi := f_ts_Imsi(imsi),
+			routingAreaIdentity := rai,
+			tlli := tlli,
+			packetTMSI := ptmsi,
+			ptmsi_Signature := ptmsi_sig,
+			ms_Validated := f_ts_MS_Validated(msValidated),
+			teidControlPlane := {
+				type_gtpc := '11'O,
+				teidControlPlane := teic
+			},
+			sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
+			alternative_sgsn_addr_controlPlane := omit,
+			sGSN_Number := omit,
+			ratType := f_ts_RATType(rat_type),
+			hopCounter := omit,
+			private_extension_gtpc := omit
+		}
+	}
+	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)
+	}
+
+	/* SGSN Context Response - 7.5.4 */
+	template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
+							  template hexstring imsi := *) := {
+		sgsn_ContextResponse := {
+			cause := tr_Cause_gtpc(cause),
+			imsi := f_tr_Imsi(imsi),
+			teidControlPlane := *,
+			rabContext := *,
+			radioPrioritySMS := *,
+			radioPriority := *,
+			packetFlowID := *,
+			charging_char := *,
+			mm_Context := *,
+			pdp_Context := *,
+			sgsn_addr_controlPlane := *,
+			pdpContextPriorization := *,
+			radioPriority_LCS := *,
+			mBMS_UE_Context := *,
+			subscribedRFSP_Index := *,
+			rFSP_IndexInUse := *,
+			colocatedGGSN_PGW_FQDN := *,
+			evolvedAllocationRetentionPriorityII := *,
+			extendedCommonFlags := *,
+			ue_network_capability := *,
+			ue_ambr := *,
+			apn_ambr_nsapi := *,
+			signallingPriorityIndication_nsapi := *,
+			higher_bitrates_than_16mbps_flag := *,
+			selectionMode_nsapi := *,
+			localHomeNetworkID_nsapi := *,
+			uE_UsageType := *,
+			extendedCommonFlagsII := *,
+			private_extension_gtpc := *
+		}
+	}
+	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);
+
+	template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
+							template (omit) hexstring imsi := omit,
+							template (omit) OCT4 teic := omit,
+							template (omit) octetstring sgsn_addr_control := omit,
+							template (omit) MM_Context mm_context := omit,
+							template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
+		sgsn_ContextResponse := {
+			cause := ts_Cause_gtpc(cause),
+			imsi := f_ts_Imsi(imsi),
+			teidControlPlane := f_ts_TEIC(teic),
+			rabContext := omit,
+			radioPrioritySMS := omit,
+			radioPriority := omit,
+			packetFlowID := omit,
+			charging_char := omit,
+			mm_Context := mm_context,
+			pdp_Context := pdp_ctx_list,
+			sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
+			pdpContextPriorization := omit,
+			radioPriority_LCS := omit,
+			mBMS_UE_Context := omit,
+			subscribedRFSP_Index := omit,
+			rFSP_IndexInUse := omit,
+			colocatedGGSN_PGW_FQDN := omit,
+			evolvedAllocationRetentionPriorityII := omit,
+			extendedCommonFlags := omit,
+			ue_network_capability := omit,
+			ue_ambr := omit,
+			apn_ambr_nsapi := omit,
+			signallingPriorityIndication_nsapi := omit,
+			higher_bitrates_than_16mbps_flag := omit,
+			selectionMode_nsapi := omit,
+			localHomeNetworkID_nsapi := omit,
+			uE_UsageType := omit,
+			extendedCommonFlagsII := omit,
+			private_extension_gtpc := omit
+		}
+	}
+	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)
+	}
+
+
+	/* SGSN Context Acknowledge - 7.5.5 */
+	template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
+		sgsn_ContextAcknowledge := {
+			cause := tr_Cause_gtpc(cause),
+			teidDataII := *,
+			sgsn_AddressForUserTraffic := *,
+			sgsn_Number := *,
+			nodeIdentifier  := *,
+			private_extension_gtpc := *
+		}
+	}
+	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);
+	template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
+		sgsn_ContextAcknowledge := {
+			cause := ts_Cause_gtpc(cause),
+			teidDataII := omit,
+			sgsn_AddressForUserTraffic := omit,
+			sgsn_Number := omit,
+			nodeIdentifier  := omit,
+			private_extension_gtpc := omit
+		}
+	}
+	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)
+	}
+
+	/* 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 (present) GTP_CellId cid) return template (present) Cell_Identifier_V_GTPC {
+		var template Cell_Identifier_V_GTPC ret := {
+			mccDigit1 := ?,
+			mccDigit2 := ?,
+			mccDigit3 := ?,
+			mncDigit3 := ?,
+			mncDigit1 := ?,
+			mncDigit2 := ?,
+			lac := ?,
+			rac := ?,
+			cI_value := ?
+		}
+		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 (value) 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 (present) GTP_CellId cid,
+					template (present) integer tac,
+					template (present) octetstring gnbid) return template (present) ENB_Identifier {
+		var template (present) ENB_Identifier ret := {
+			mccDigit1 := ?,
+			mccDigit2 := ?,
+			mccDigit3 := ?,
+			mncDigit3 := ?,
+			mncDigit1 := ?,
+			mncDigit2 := ?,
+			tAC := ?,
+			globalENB_ID := ?
+		}
+		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 (value) 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 (present) RIM_Routing_Information_GTPC
+	tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) 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 (present) RAN_Information_Request_Application_Container_NACC_GTPC
+	tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) 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 (present) RAN_Information_Request_Application_Container_GTPC
+	tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) 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 (present) RAN_Information_Application_Container_NACC_GTPC
+	tr_GTPC_RAN_Information_Application_Container_NACC(template (present) 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
+	}
+	external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
+		with { extension "prototype(convert) encode(RAW)" };
+	external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
+		with { extension "prototype(convert) decode(RAW)" };
+
+	/* 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 (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
+	tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
+					template (present) RIM_Routing_Information_GTPC src := ?,
+					template (present) 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
+		}
+	}
+	template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
+		type_gtpc := '90'O,
+		lengthf := ?,
+		rANTransparentContainerField := {
+			pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
+		}
+	}
+
+	/* RAN_Information */
+	template (present) 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 (present) ApplContainer_or_ApplErrContainer_GTPC
+	tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) 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 (present) RAN_Information_RIM_Container_GTPC
+	tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
+					      template (present) RIM_Sequence_Number_GTPC seq,
+					      template (present) RIM_PDU_Indications_GTPC ind,
+					      template RIM_Protocol_Version_Number_GTPC ver := *,
+					      template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
+					      template SON_TransferApplicationIdentity son_app_id := *) := {
+		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 (present) PDU_BSSGP_RAN_INFORMATION_GTPC
+	tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
+				template (present) RIM_Routing_Information_GTPC src,
+				template (present) 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 (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) 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 (present) RANTransparentContainer tr_RANTransparentContainer(template (present) 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 (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
+		ranInformationRelay := {
+			transparentContainer := transparentContainer,
+			rIM_RoutingAddress := *,
+			rIM_RoutingAddress_Discriminator := *,
+			private_extension_gtpc := *
+		}
+	}
+	template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
+						    template (omit) RIM_RoutingAddress ra := omit,
+						    template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
+		ranInformationRelay := {
+			transparentContainer := transparentContainer,
+			rIM_RoutingAddress := ra,
+			rIM_RoutingAddress_Discriminator := ra_discr,
+			private_extension_gtpc := omit
+		}
+	}
+	template (present) Gtp1cUnitdata
+	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) Gtp1cPeer peer,
+			     template (value) RANTransparentContainer transparentContainer,
+			     template (omit) RIM_RoutingAddress ra := omit,
+			     template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
+		peer := peer,
+		gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
+	}
+
+
+	template (present) RAN_Information_Request_RIM_Container_GTPC
+	tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
+						      template (present) RIM_Sequence_Number_GTPC seq := ?,
+						      template (present) 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
+	}
+
+	/* 3GPP TS 29.060, section 7.7.57 */
+	template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
+		type_gtpc := '9F'O,
+		lengthf := 0,	/* we assume encoder overwrites this */
+		rIM_RoutingAddressValue := addr_value
+	}
+	template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
+		type_gtpc := '9F'O,
+		lengthf := ?,
+		rIM_RoutingAddressValue := addr_value
+	}
+
+	/* 3GPP TS 29.060, section 7.7.77 */
+	template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
+		type_gtpc := 'B2'O,
+		lengthf := 0,	/* we assume encoder overwrites this */
+		rra_discriminator := addr_discr,
+		spare := '0000'B
+	}
+	template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
+		type_gtpc := 'B2'O,
+		lengthf := ?,
+		rra_discriminator := addr_discr,
+		spare := '0000'B
+	}
+}