Add GTPv2_Emulation component

Change-Id: If73aa453e44ebf28032c60d207feb03e8061dc0c
diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn
index 23b0053..3d69017 100644
--- a/library/GTPv2_Templates.ttcn
+++ b/library/GTPv2_Templates.ttcn
@@ -30,6 +30,7 @@
 }
 
 template (present) PDU_GTPCv2 tr_PDU_GTP2C(template OCT4 teid := ?,
+					   template (present) OCT3 seq := ?,
 					   template (present) GTPCv2_PDUs pdus := ?,
 					   template PDU_GTPCv2 piggyback := omit) := {
 	spare := '000'B,
@@ -39,12 +40,78 @@
 	messageType := ?,
 	lengthf := ?,
 	tEID := teid,
-	sequenceNumber := ?,
+	sequenceNumber := seq,
 	spare3 := '00'O,
 	gtpcv2_pdu := pdus,
 	piggybackPDU_GTPCv2 := piggyback
 }
 
+template (present) OCT1 gtp2_requests := (
+	'01'O,	// echoRequest
+	'20'O,	// createSessionRequest
+	'5F'O,	// createBearerRequest
+	'22'O, 	// modifyBearerRequest
+	'24'O,	// deleteSessionRequest
+	'63'O,	// deleteBearerRequest
+	'A8'O,	// deleteIndirectDataForwardingTunnelRequest
+	'61'O,	// updateBearerRequest
+	'42'O,	// deleteBearerCommand
+	'A6'O,	// createIndirectDataForwardingTunnelRequest
+	'AA'O,	// releaseAccessBearersRequest
+	'B3'O,	// modifyAccessBearersRequest
+	'85'O,	// forwardRelocationRequest
+	'82'O,	// contextRequest
+	'80'O,	// identificationRequest
+	'26'O,	// changeNotificationRequest
+	'8B'O,	// relocationCancelRequest
+	'A0'O,	// createForwardingTunnelRequest
+	'65'O,	// deletePDN_ConnectionSetRequest
+	'C8'O,	// updatePDN_ConnectionSetRequest
+	'9E'O,	// uE_RegistrationQueryRequest
+	'E7'O,	// mBMSSessionStartRequest
+	'E9'O,	// mBMSSessionUpdateRequest
+	'EB'O 	// mBMSSessionStopRequest
+);
+template (present) OCT1 gtp2_responses := (
+	'02'O,	// echoResponse
+	'21'O,	// createSessionResponse
+	'60'O,	// createBearerResponse
+	'23'O, 	// modifyBearerResponse
+	'25'O,	// deleteSessionResponse
+	'64'O,	// deleteBearerResponse
+	'A9'O,	// deleteIndirectDataForwardingTunnelResponse
+	'62'O,	// updateBearerResponse
+	'43'O,	// deleteBearerFailureIndication
+	'A7'O,	// createIndirectDataForwardingTunnelResponse
+	'AB'O,	// releaseAccessBearersResponse
+	'B4'O,	// modifyAccessBearersResponse
+	'86'O,	// forwardRelocationResponse
+	'83'O,	// contextResponse
+	'81'O,	// identificationResponse
+	'27'O,	// changeNotificationResponse
+	'8C'O,	// relocationCancelResponse
+	'A1'O,	// createForwardingTunnelResponse
+	'66'O,	// deletePDN_ConnectionSetResponse
+	'C9'O,	// updatePDN_ConnectionSetResponse
+	'9F'O,	// uE_RegistrationQueryResponse
+	'E8'O,	// mBMSSessionStartResponse
+	'EA'O,	// mBMSSessionUpdateResponse
+	'EC'O 	// mBMSSessionStopResponse
+);
+
+template (present) PDU_GTPCv2 tr_PDU_GTP2C_msgtypes(template (present) OCT1 types) := {
+	spare := '000'B,
+	t_Bit := ?,
+	p_Bit := ?,
+	version := '010'B,
+	messageType := types,
+	lengthf := ?,
+	tEID := ?,
+	sequenceNumber := ?,
+	spare3 := '00'O,
+	gtpcv2_pdu := ?,
+	piggybackPDU_GTPCv2 := *
+};
 
 /* 8.3 */
 template (value) IMSI ts_GTP2C_Imsi(template (value) hexstring imsi) := {
@@ -62,6 +129,23 @@
 	iMSI_Value := imsi
 }
 
+template (present) MSISDN ts_GTP2C_msisdn(template (present) hexstring msisdn) := {
+	elementIdentifier := '4C'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	mSISDN_Value := msisdn
+}
+private function fs_GTP2C_msisdn(template (omit) hexstring msisdn) return
+template (omit) MSISDN {
+	if (istemplatekind(msisdn, "omit")) {
+		return omit;
+	} else {
+		return ts_GTP2C_msisdn(msisdn);
+	}
+}
+
+
 /* 8.4-1 */
 /*
 type enumerated GTP2C_Cause {
@@ -109,6 +193,25 @@
 	instanceOfOffendingIE := *,
 	spare3 := *
 }
+private function fs_GTP2C_Cause(template (omit) OCT1 cause, template (value) BIT1 cs) return
+template (omit) Cause {
+	if (istemplatekind(cause, "omit")) {
+		return omit;
+	} else {
+		return ts_GTP2C_Cause(cause, cs);
+	}
+}
+private function fr_GTP2C_Cause(template OCT1 cause) return
+template Cause {
+	if (istemplatekind(cause, "omit")) {
+		return omit;
+	} else if (istemplatekind(cause, "*")) {
+		return *;
+	} else {
+		return tr_GTP2C_Cause(cause);
+	}
+}
+
 
 /* 8.5 */
 template (value) AccessPointName ts_GTP2C_APN(template (value) octetstring apn) := {
@@ -126,6 +229,41 @@
 	aPN_Value := apn
 }
 
+/* 8.7 */
+template (value) AggregateMaximumBitRate
+ts_GTP2C_Ambr(integer ambr_ul, integer ambr_dl) := {
+	elementIdentifier := '48'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	aPN_AMBR_for_uplink := int2oct(ambr_ul, 4),
+	aPN_AMBR_for_downlink := int2oct(ambr_dl, 4)
+}
+
+/* 8.8 */
+template (value) EPS_BearerID
+ts_GTP2C_EpsBearerId(template (value) uint4_t bid) := {
+	elementIdentifier := '49'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	ePS_Bearer_ID_Value := bid,
+	spare2 := '0000'B,
+	additionalOctets := omit
+}
+template (present) EPS_BearerID
+tr_GTP2C_EpsBearerId(template (present) uint4_t bid) := {
+	elementIdentifier := '49'O,
+	lengthIndicator := ?, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	ePS_Bearer_ID_Value := bid,
+	spare2 := '0000'B,
+	additionalOctets := *
+}
+
+
+
 /* 8.14 */
 template (value) PDN_AddressAllocation
 ts_GTP2C_PdnAddrAlloc(template (value) BIT3 pdn_type,
@@ -156,6 +294,31 @@
 tr_GTP2C_PdnAddrAlloc_v4(template (present) OCT4 addr) :=
 	ts_GTP2C_PdnAddrAlloc('001'B, {iPv4_Address:=addr});
 
+/* 8.15 */
+template (value) Bearer_QoS
+ts_GTP2C_BearerQos(template (value) OCT1 qci,
+		   uint40_t max_br_ul, uint40_t max_br_dl,
+		   uint40_t g_br_ul, uint40_t g_br_dl,
+		   template (value) BIT4 prio_lvl := '1001'B,
+		   template (value) BIT1 pe_vuln := '0'B,
+		   template (value) BIT1 pe_capa := '0'B) := {
+	elementIdentifier := '50'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	pVI := pe_vuln,
+	spare2 := '0'B,
+	pL := prio_lvl,
+	pCI := pe_capa,
+	spare3 := '0'B,
+	labelQCI := qci,
+	maxBitrateUplink := int2oct(max_br_ul, 5),
+	maxBitrateDownLink := int2oct(max_br_dl, 5),
+	guaranteedBitrateUplink := int2oct(g_br_ul, 5),
+	guaranteedBitrateDownLink := int2oct(g_br_dl, 5),
+	additionalOctets := omit
+}
+
 /* 8.17 */
 template (value) RAT_Type ts_GTP2C_RatType(template (value) integer rat) := {
 	elementIdentifier := '53'O,
@@ -174,6 +337,66 @@
 	additionalOctets := *
 }
 
+/* 8.21 */
+function ts_GTP2C_UserLocInfo(template (omit) CGI cgi := omit,
+			      template (omit) SAI sai := omit,
+			      template (omit) RAI rai := omit,
+			      template (omit) TAI tai := omit,
+			      template (omit) ECGI ecgi := omit,
+			      template (omit) LAI lai := omit)
+return template (value) UserLocationInfo {
+	var template (value) UserLocationInfo uli;
+	uli.elementIdentifier := '56'O;
+	uli.lengthIndicator := 0; // overwritten
+	uli.instance := '0000'B;
+	uli.spare := '0000'B;
+	uli.spare2 := '00'B;
+	uli.additionalOctets := omit;
+
+	if (istemplatekind(cgi, "omit")) {
+		uli.cGI_Flag := '0'B;
+	} else {
+		uli.cGI_Flag := '1'B;
+	}
+	uli.cGI := cgi;
+
+	if (istemplatekind(sai, "omit")) {
+		uli.sAI_Flag := '0'B;
+	} else {
+		uli.sAI_Flag := '1'B;
+	}
+	uli.sAI := sai;
+
+	if (istemplatekind(rai, "omit")) {
+		uli.rAI_Flag := '0'B;
+	} else {
+		uli.rAI_Flag := '1'B;
+	}
+	uli.rAI := rai
+
+	if (istemplatekind(tai, "omit")) {
+		uli.tAI_Flag := '0'B;
+	} else {
+		uli.tAI_Flag := '1'B;
+	}
+	uli.tAI := tai
+
+	if (istemplatekind(ecgi, "omit")) {
+		uli.eCGI_Flag := '0'B;
+	} else {
+		uli.eCGI_Flag := '1'B;
+	}
+	uli.eCGI := ecgi;
+
+	if (istemplatekind(lai, "omit")) {
+		uli.lAI_Flag := '0'B;
+	} else {
+		uli.lAI_Flag := '1'B;
+	}
+	uli.lAI := lai
+
+	return uli;
+}
 
 /* 8.22 */
 private function f_bit4oct(template (omit) octetstring os) return BIT1
@@ -184,16 +407,59 @@
 		return '1'B;
 	}
 }
+type enumerated FteidInterface {
+	FTEID_IF_S1U_eNodeB_GTPU	(0),
+	FTEID_IF_S1U_SGW_GTPU		(1),
+	FTEID_IF_S12_RNC_GTPU		(2),
+	FTEID_IF_S12_SGW_GTPU		(3),
+	FTEID_IF_S5S8_SGW_GTPU		(4),
+	FTEID_IF_S5S8_PGW_GTPU		(5),
+	FTEID_IF_S5S8_SGW_GTPC		(6),
+	FTEID_IF_S5S8_PGW_GTPC		(7),
+	FTEID_IF_S5S8_SGW_PMIPv6	(8),
+	FTEID_IF_S5S8_PGW_PMIPv6	(9),
+	FTEID_IF_S11_MME_GTPC		(10),
+	FTEID_IF_S11S4_SGW_GTPC		(11),
+	FTEID_IF_S10ND26_MME_GTPC	(12),
+	FTEID_IF_S3_MME_GTPC		(13),
+	FTEID_IF_S3_SGSN_GTPC		(14),
+	FTEID_IF_S4_SGSN_GTPU		(15),
+	FTEID_IF_S4_SGW_GTPU		(16),
+	FTEID_IF_S16_SGSN_GTPC		(18),
+	FTEID_IF_eNB_GTPU_DL_DATA_FW	(19),
+	FTEID_IF_eNB_GTPU_UL_DATA_FW	(20),
+	FTEID_IF_RNC_GTPU_DATA_FW	(21),
+	FTEID_IF_SGSN_GTPU_DATA_FW	(22),
+	FTEID_IF_SGWUPF_GTPU_DL_DATA_FW	(23),
+	FTEID_IF_Sm_MMBS_GW_GTPC	(24),
+	FTEID_IF_Sn_MMBS_GW_GTPC	(25),
+	FTEID_IF_Sm_MME_GTPC		(26),
+	FTEID_IF_Sn_MME_GTPC		(27),
+	FTEID_IF_SGW_GTPU_UL_DATA_FW	(28),
+	FTEID_IF_Sn_SGSN_GTPU		(29),
+	FTEID_IF_S2b_ePDG_GTPC		(30),
+	FTEID_IF_S2bU_ePDG_GTPU		(31),
+	FTEID_IF_S2b_PGW_GTPC		(32),
+	FTEID_IF_S2bU_PGW_GTPU		(33),
+	FTEID_IF_S2a_TWAN_GTPU		(34),
+	FTEID_IF_S2a_TWAN_GTPC		(35),
+	FTEID_IF_S2a_PGW_GTPC		(36),
+	FTEID_IF_S2a_PGW_GTPU		(37),
+	FTEID_IF_S11_MME_GTPU		(38),
+	FTEID_IF_S11_SGW_GTPU		(39),
+	FTEID_IF_N26_AMF_GTPC		(40)
+};
 template (value) FullyQualifiedTEID
-ts_GTP2C_FTEID(integer if_type, OCT4 teid, template (omit) OCT4 v4_addr := omit,
+ts_GTP2C_FTEID(FteidInterface if_type, OCT4 teid, uint4_t instance := 0,
+		template (omit) OCT4 v4_addr := omit,
 		template (omit) OCT16 v6_addr := omit) := {
 	elementIdentifier := '57'O,
 	lengthIndicator := 0, /* overwritten */
-	instance := '0000'B,
+	instance := int2bit(instance, 4),
 	spare := '0000'B,
-	interfaceType := if_type,
-	v6_Flag := f_bit4oct(v4_addr),
-	v4_Flag := f_bit4oct(v6_addr),
+	interfaceType := enum2int(if_type),
+	v6_Flag := f_bit4oct(v6_addr),
+	v4_Flag := f_bit4oct(v4_addr),
 	tEID_GRE_Key := teid,
 	iPv4_Address := v4_addr,
 	iPv6_Address := v6_addr,
@@ -201,11 +467,12 @@
 }
 template (present) FullyQualifiedTEID
 tr_GTP2C_FTEID(template (present) integer if_type, template (present) OCT4 teid,
+		template BIT4 instance := ?,
 		template OCT4 v4_addr := omit,
 		template OCT16 v6_addr := omit) := {
 	elementIdentifier := '57'O,
 	lengthIndicator := ?,
-	instance := ?,
+	instance := instance,
 	spare := '0000'B,
 	interfaceType := if_type,
 	v6_Flag := ?,
@@ -216,6 +483,134 @@
 	additionalOctets := omit
 }
 
+/* 8.28 */
+template (value) BearerContextGrouped
+ts_GTP2C_BcGrouped(template (value) BearerContextIEs ies) := {
+	elementIdentifier := '5D'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	bearerContextIEs := ies
+}
+template (present) BearerContextGrouped
+tr_GTP2C_BcGrouped(template (present) BearerContextIEs ies) := {
+	elementIdentifier := '5D'O,
+	lengthIndicator := ?, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	bearerContextIEs := ies
+}
+
+
+
+/* 8.30 */
+template (value) ChargingCharacteristics
+ts_GTP2C_ChargingCaracteristics(template (value) OCT2 cc) := {
+	elementIdentifier := '5F'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	chargingCharacteristicsValue := cc,
+	additionalOctets := omit
+}
+template (present) ChargingCharacteristics
+tr_GTP2C_ChargingCaracteristics(template (present) OCT2 cc) := {
+	elementIdentifier := '5F'O,
+	lengthIndicator := ?, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	chargingCharacteristicsValue := cc,
+	additionalOctets := omit
+}
+
+
+/* 8.34 */
+template (value) PDN_Type
+ts_GTP2C_PdnType(template (value) BIT3 pdn_type) := {
+	elementIdentifier := '63'O,
+	lengthIndicator := 0,
+	instance := '0000'B,
+	spare := '0000'B,
+	pDN_TypeValue := pdn_type,
+	spare2 := '00000'B,
+	additionalOctets := omit
+}
+template (present) PDN_Type
+tr_GTP2C_PdnType(template (present) BIT3 pdn_type) := {
+	elementIdentifier := '63'O,
+	lengthIndicator := ?,
+	instance := ?,
+	spare := ?,
+	pDN_TypeValue := pdn_type,
+	spare2 := ?,
+	additionalOctets := *
+}
+
+/* 8.35 */
+template (value) ProcedureTransactionID
+ts_GTP2C_ProcTransId(template (value) integer pti) := {
+	elementIdentifier := '64'O,
+	lengthIndicator := 0,
+	instance := '0000'B,
+	spare := '0000'B,
+	pTI_Value := pti,
+	additionalOctets := omit
+}
+template (present) ProcedureTransactionID
+tr_GTP2C_ProcTransId(template (present) integer pti) := {
+	elementIdentifier := '64'O,
+	lengthIndicator := ?,
+	instance :=?,
+	spare := ?,
+	pTI_Value := pti,
+	additionalOctets := *
+}
+
+
+/* 8.57 */
+template (value) APN_Restriction
+ts_GTP2C_ApnRestriction(template (value) integer val) := {
+	elementIdentifier := '7F'O,
+	lengthIndicator := 0,
+	instance := '0000'B,
+	spare := '0000'B,
+	restrictionTypeValue := val,
+	additionalOctets := omit
+}
+template (present) APN_Restriction
+tr_GTP2C_ApnRestriction(template (present) integer val) := {
+	elementIdentifier := '7F'O,
+	lengthIndicator := ?,
+	instance := '0000'B,
+	spare := ?,
+	restrictionTypeValue := val,
+	additionalOctets := *
+}
+
+
+/* 8.58 */
+template (value) SelectionMode
+ts_GTP2C_SelectionMode(template (value) integer mode) := {
+	elementIdentifier := '80'O,
+	lengthIndicator := 0, /* overwritten */
+	instance := '0000'B,
+	spare := '0000'B,
+	selectionModeValue := mode,
+	spare2 := '000000'B,
+	additionalOctets := omit
+}
+template (present) SelectionMode
+tr_GTP2C_SelectionMode(template (present) integer mode) := {
+	elementIdentifier := '80'O,
+	lengthIndicator := ?,
+	instance := ?,
+	spare := ?,
+	selectionModeValue := mode,
+	spare2 := ?,
+	additionalOctets := *
+}
+
+
 
 
 template (value) PDU_GTPCv2 ts_PDU_GTP2C(template (omit) OCT4 teid, template (value) OCT3 seq,
@@ -236,8 +631,117 @@
 }
 
 
+template (value) PDU_GTPCv2
+ts_GTP2C_EchoReq(template (value) integer rec_val) :=
+ts_PDU_GTP2C(omit, '000000'O, '01'O, {
+	echoRequest := {
+		recovery := {
+			elementIdentifier := '03'O,
+			lengthIndicator := 0,
+			instance := '0000'B,
+			spare := '0000'B,
+			recoveryValue := rec_val
+		},
+		sendingNodeFeatures := omit,
+		privateExtension := omit
+	}});
 template (present) PDU_GTPCv2
-tr_GTP2C_CreateSessionReq(template (present) hexstring imsi) := tr_PDU_GTP2C('00000000'O, {
+tr_GTP2C_EchoReq(template (present) OCT3 seq := ?) :=
+tr_PDU_GTP2C(omit, seq, { echoRequest := ? }, omit);
+
+template (value) PDU_GTPCv2
+ts_GTP2C_EchoResp(template (value) integer rec_val) :=
+ts_PDU_GTP2C(omit, '000000'O, '02'O, {
+	echoRequest := {
+		recovery := {
+			elementIdentifier := '03'O,
+			lengthIndicator := 0,
+			instance := '0000'B,
+			spare := '0000'B,
+			recoveryValue := rec_val
+		},
+		sendingNodeFeatures := omit,
+		privateExtension := omit
+	}});
+template (present) PDU_GTPCv2
+tr_GTP2C_EchoResp(template (present) OCT3 seq := ?) :=
+tr_PDU_GTP2C(omit, seq, { echoResponse := ? }, omit);
+
+
+
+template (present) PDU_GTPCv2
+ts_GTP2C_CreateSessionReq(template (value) hexstring imsi, template (omit) hexstring msisdn,
+			  integer rat_type, template (value) FullyQualifiedTEID sender_fteid,
+			  template (value) octetstring apn, template (value) BIT3 pdn_type,
+			  template (omit) FullyQualifiedTEID_List teid_list,
+			  template (value) OCT2 chg_car, template (value) uint4_t bearer_id,
+			  template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) :=
+ts_PDU_GTP2C('00000000'O, '000000'O, '20'O, {
+	createSessionRequest := {
+		iMSI := ts_GTP2C_Imsi(imsi),
+		mSISDN := fs_GTP2C_msisdn(msisdn),
+		mEI := omit,
+		userLocationInfo := omit,
+		servingNetwork := omit,
+		rAT_Type := ts_GTP2C_RatType(rat_type),
+		indication := omit,
+		fullyQualifiedTEID := { sender_fteid },
+		accessPointName := ts_GTP2C_APN(apn),
+		selectionMode := ts_GTP2C_SelectionMode(0),
+		pDN_Type := ts_GTP2C_PdnType(pdn_type),
+		pDN_AddressAllocation := ts_GTP2C_PdnAddrAlloc('001'B, {iPv4_Address:='00000000'O}),
+		maxAPN_Restriction := ts_GTP2C_ApnRestriction(0),
+		ambr := ts_GTP2C_Ambr(102400, 102400),
+		linkedEPS_Bearer_ID := omit,
+		trustedWLANModeIndication := omit,
+		protocolConfigOptions := omit,
+		bearerContextGrouped := {
+			ts_GTP2C_BcGrouped({
+				ePS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
+				cause := omit,
+				ePS_Bearer_TFT := omit,
+				fullyQualifiedTEID := teid_list,
+				bearerLevel_QoS := qos,
+				chargingID := omit,
+				bearerFlags := omit,
+				transactionIdentifier := omit,
+				protocolConfigOptions := omit,
+				rAN_NASCause := omit,
+				additionalProtocolConfigOptions := omit,
+				extendedProtocolConfigOptions := omit
+				})
+		},
+		traceInformation := omit,
+		recovery := omit,
+		csid := omit,
+		uE_TimeZone := omit,
+		user_CSG_Information := omit,
+		chargingCharacteristics := ts_GTP2C_ChargingCaracteristics(chg_car),
+		lDN := omit,
+		signallingPriorityIndication := omit,
+		iP_Addr := omit,
+		portNumber := omit,
+		aPCO := omit,
+		trustedWLANAccessNetworkIdentifier := omit,
+		cNOperatorSelectionEntity := omit,
+		presenceReportingAreaInformation := omit,
+		overloadControlInformationGrouped := omit,
+		originationTimeStamp := omit,
+		maximumWaitTime := omit,
+		wLANLocationTimestamp := omit,
+		nBIFOMContainer := omit,
+		remoteUEContextGrouped := omit,
+		nodeIdentifier := omit,
+		extendedProtocolConfigOptions := omit,
+		servingPLMNRateControl := omit,
+		counter := omit,
+		privateExtension := omit
+	}});
+
+
+template (present) PDU_GTPCv2
+tr_GTP2C_CreateSessionReq(template (present) hexstring imsi) :=
+tr_PDU_GTP2C('00000000'O, ?, {
 	createSessionRequest := {
 		iMSI := tr_GTP2C_Imsi(imsi),
 		mSISDN := *,
@@ -287,7 +791,7 @@
 template (value) PDU_GTPCv2
 ts_GTP2C_CreateSessionResp(template (value) FullyQualifiedTEID_List fteids,
 			   template (value) PDN_AddressAllocation addr) :=
-ts_PDU_GTP2C('00000000'O, '000000'O, '20'O, {
+ts_PDU_GTP2C('00000000'O, '000000'O, '21'O, {
 	createSessionResponse := {
 		cause := ts_GTP2C_Cause(int2oct(16, 1), '0'B),
 		changeReportingAction := omit,
@@ -317,6 +821,219 @@
 		extendedProtocolConfigOptions := omit,
 		privateExtension := omit
 	}});
+template (present) PDU_GTPCv2
+tr_GTP2C_CreateSessionResp(template (present) OCT4 d_teid := ?,
+			   template (present) OCT3 seq := ?,
+			   template (present) OCT1 cause := ?,
+			   template FullyQualifiedTEID_List fteids := *,
+			   template PDN_AddressAllocation addr := *,
+			   template BearerContextGrouped_List bctxg := *) :=
+tr_PDU_GTP2C(d_teid, seq, {
+	createSessionResponse := {
+		cause := tr_GTP2C_Cause(cause),
+		changeReportingAction := *,
+		cSG_InformationReportingAction := *,
+		heNBInformationReporting := *,
+		fullyQualifiedTEID := fteids,
+		pDN_AddressAllocation := addr,
+		aPN_Restriction := ?,
+		ambr := *,
+		linkedEPS_Bearer_ID := *,
+		protocolConfigOptions := *,
+		bearerContextGrouped := bctxg,
+		recovery := *,
+		chargingGatewayName := *,
+		chargingGatewayAddress := *,
+		csid := *,
+		lDN := *,
+		pGW_Back_OffTime := *,
+		aPCO := *,
+		trustedWLANIPv4Parameters := *,
+		indicationFlags := *,
+		presenceReportingAreaAction := *,
+		loadControlInformationGrouped := *,
+		overloadControlInformationGrouped := *,
+		nBIFOMContainer := *,
+		pDNConnectionChargingID := *,
+		extendedProtocolConfigOptions := *,
+		privateExtension := *
+	}});
+
+
+template (value) PDU_GTPCv2
+ts_GTP2C_DeleteSessionReq(template (value) OCT4 d_teid,
+			  template (omit) OCT1 cause := omit,
+			  template (value) FullyQualifiedTEID sender_fteid,
+			  template (omit) FullyQualifiedTEID_List teid_list := omit,
+			  template (value) uint4_t bearer_id) :=
+ts_PDU_GTP2C(d_teid, '000000'O, '24'O, {
+	deleteSessionRequest := {
+		cause := fs_GTP2C_Cause(cause, '0'B),
+		linkedEPS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
+		uLI := omit,
+		indicationFlags := omit,
+		protocolConfigOptions := omit,
+		originatingNode := omit,
+		fullyQualifiedTEID := sender_fteid,
+		uE_TimeZone := omit,
+		uLITimestamp := omit,
+		rANNASReleaseCause := omit,
+		trustedWLANAccessNetworkIdentifier := omit,
+		tWANIdentifierTimestamp := omit,
+		overloadControlInformationGrouped := omit,
+		uELocalIP_Addr := omit,
+		portNumber := omit,
+		extendedProtocolConfigOptions := omit,
+		privateExtension := omit
+	}});
+template (present) PDU_GTPCv2
+tr_GTP2C_DeleteSessionReq(template (present) OCT4 d_teid,
+			  template (present) OCT3 seq := ?,
+			  template (omit) OCT1 cause,
+			  template (present) FullyQualifiedTEID sender_fteid,
+			  template FullyQualifiedTEID_List teid_list,
+			  template (present) uint4_t bearer_id) :=
+tr_PDU_GTP2C(d_teid, seq, {
+	deleteSessionRequest := {
+		cause := fr_GTP2C_Cause(cause),
+		linkedEPS_Bearer_ID := tr_GTP2C_EpsBearerId(bearer_id),
+		uLI := *,
+		indicationFlags := *,
+		protocolConfigOptions := *,
+		originatingNode := *,
+		fullyQualifiedTEID := sender_fteid,
+		uE_TimeZone := *,
+		uLITimestamp := *,
+		rANNASReleaseCause := *,
+		trustedWLANAccessNetworkIdentifier := *,
+		tWANIdentifierTimestamp := *,
+		overloadControlInformationGrouped := *,
+		uELocalIP_Addr := *,
+		portNumber := *,
+		extendedProtocolConfigOptions := *,
+		privateExtension := *
+	}});
+
+
+template (value) PDU_GTPCv2
+ts_GTP2C_DeleteSessionResp(template (value) OCT4 d_teid,
+			   template (value) OCT3 seq,
+			   template (value) OCT1 cause) :=
+ts_PDU_GTP2C(d_teid, '000000'O, '25'O, {
+	deleteSessionResponse := {
+		cause := ts_GTP2C_Cause(cause, '0'B),
+		recovery := omit,
+		protocolConfigOptions := omit,
+		indicationFlags := omit,
+		loadControlInformationGrouped := omit,
+		overloadControlInformationGrouped := omit,
+		extendedProtocolConfigOptions := omit,
+		privateExtension := omit
+
+	}});
+template (present) PDU_GTPCv2
+tr_GTP2C_DeleteSessionResp(template (present) OCT4 d_teid,
+			   template (present) OCT3 seq := ?,
+			   template (present) OCT1 cause := ?
+			) :=
+tr_PDU_GTP2C(d_teid, seq, {
+	deleteSessionResponse := {
+		cause := tr_GTP2C_Cause(cause),
+		recovery := *,
+		protocolConfigOptions := *,
+		indicationFlags := *,
+		loadControlInformationGrouped := *,
+		overloadControlInformationGrouped := *,
+		extendedProtocolConfigOptions := *,
+		privateExtension := *
+	}});
+
+template (value) PDU_GTPCv2
+ts_GTP2C_CreateBearerReq(template (value) OCT4 d_teid,
+			 template (value) integer proc_trans_id,
+			 template (value) uint4_t linked_id,
+			 template (value) uint4_t bearer_id,
+			 template (omit) FullyQualifiedTEID_List teid_list,
+			 template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) :=
+ts_PDU_GTP2C(d_teid, '000000'O, '5F'O, {
+	createBearerRequest := {
+		procedureTransactionID := ts_GTP2C_ProcTransId(proc_trans_id),
+		linkedEPS_BearerID := ts_GTP2C_EpsBearerId(linked_id),
+		protocolConfigOptions := omit,
+		bearerContextGrouped := {
+			ts_GTP2C_BcGrouped({
+				ePS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
+				cause := omit,
+				ePS_Bearer_TFT := omit,
+				fullyQualifiedTEID := teid_list,
+				bearerLevel_QoS := qos,
+				chargingID := omit,
+				bearerFlags := omit,
+				transactionIdentifier := omit,
+				protocolConfigOptions := omit,
+				rAN_NASCause := omit,
+				additionalProtocolConfigOptions := omit,
+				extendedProtocolConfigOptions := omit
+				})
+		},
+		csid := omit,
+		changeReportingAction := omit,
+		cSG_InformationReportingAction := omit,
+		heNBInformationReporting := omit,
+		presenceReportingAreaAction := omit,
+		indicationFlags := omit,
+		loadControlInformationGrouped := omit,
+		overloadControlInformationGrouped := omit,
+		nBIFOMContainer := omit,
+		privateExtension := omit
+	}});
+
+
+template (value) PDU_GTPCv2
+ts_GTP2C_DeleteBearerReq(template (value) OCT4 d_teid,
+			 template (value) integer proc_trans_id,
+			 template (value) uint4_t bearer_id,
+			 template (value) OCT1 cause) :=
+ts_PDU_GTP2C(d_teid, '000000'O, '63'O, {
+	deleteBearerRequest := {
+		epsBearerIdentity := { ts_GTP2C_EpsBearerId(bearer_id) },
+		bearerContextGrouped := omit,
+		procedureTransactionID := ts_GTP2C_ProcTransId(proc_trans_id),
+		protocolConfigOptions := omit,
+		csid := omit,
+		cause := ts_GTP2C_Cause(cause, '0'B),
+		indicationFlags := omit,
+		loadControlInformationGrouped := omit,
+		overloadControlInformationGrouped := omit,
+		nBIFOMContainer := omit,
+		extendedProtocolConfigOptions := omit,
+		privateExtension := omit
+	}});
+
+
+template (present) PDU_GTPCv2
+tr_GTP2C_DeleteBearerResp(template (present) OCT4 d_teid,
+			  template (present) OCT3 seq := ?,
+			  template (present) OCT1 cause := ?) :=
+tr_PDU_GTP2C(d_teid, seq, {
+	deleteBearerResponse := {
+		cause := tr_GTP2C_Cause(cause),
+		linkedBearerIdentity := *,
+		bearerContextGrouped := *,
+		recovery := *,
+		csid := *,
+		protocolConfigOptions := *,
+		uE_TimeZone := *,
+		uLI := *,
+		uLITimestamp := *,
+		trustedWLANAccessNetworkIdentifier := *,
+		tWANIdentifierTimestamp := *,
+		overloadControlInformationGrouped := *,
+		iP_Addr := *,
+		portNumber := *,
+		nBIFOMContainer := *,
+		privateExtension := *
+	}});