GTPv2: Declare GTP2C_Cause as enum
Change-Id: Id26f59274d7a8813b64b9b4b7c5c39cc12d5a0ac
diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn
index 753774d..6bd3ba6 100644
--- a/library/GTPv2_Templates.ttcn
+++ b/library/GTPv2_Templates.ttcn
@@ -147,28 +147,37 @@
/* 8.4-1 */
-/*
type enumerated GTP2C_Cause {
Local_Detach (2),
Complete_Detach (3),
RAT_changed_from_3GPP_to_Non_3GPP (4),
ISR_deactivation (5),
- Error_Ind_from_RNC_eNB_SGSN_MME (5),
+ Error_Ind_from_RNC_eNB_SGSN_MME (6),
IMSI_Detach_Only (7),
Reactivation_Required (8),
-}
-*/
-
-const integer c_GTP2C_Cause_LocalDetach := 1;
+ PDN_reconnection_to_APN_disallowed (9),
+ Access_changed_from_Non_3GPP_to_3GPP (10),
+ PDN_connection_inactivity_timer_expires (11),
+ PGW_not_responding (12),
+ Network_Failure (13),
+ QoS_parameter_mismatch (14),
+ EPS_to_5GS_Mobility (15),
+ Request_accepted (16),
+ Request_accepted_partially (17),
+ New_PDN_type_due_to_network_preference (18),
+ New_PDN_type_due_to_single_address_bearer_only (19),
+ /* ... */
+ Context_Not_Found (64)
+} with { variant "FIELDLENGTH(8)" encode "RAW" };
/* 8.4 */
-template (value) Cause ts_GTP2C_Cause(template (value) OCT1 cause,
+template (value) Cause ts_GTP2C_Cause(template (value) GTP2C_Cause cause,
template (value) BIT1 cs) := {
elementIdentifier := '02'O,
lengthIndicator := 0, /* overwritten */
instance := '0000'B,
spare := '0000'B,
- causeValue := cause,
+ causeValue := int2oct(enum2int(valueof(cause)), 1),
cS := cs,
bCE := '0'B,
pCE := '0'B,
@@ -178,12 +187,24 @@
instanceOfOffendingIE := omit,
spare3 := omit
}
-template (present) Cause tr_GTP2C_Cause(template (present) OCT1 cause) := {
+private function enum2int_GTP2C_Cause_tmpl(template GTP2C_Cause inp) return template integer
+{
+ if (istemplatekind(inp, "omit")) {
+ return omit;
+ } else if (istemplatekind(inp, "*")) {
+ return *;
+ } else if (istemplatekind(inp, "?")) {
+ return ?;
+ } else {
+ return enum2int(valueof(inp));
+ }
+}
+template (present) Cause tr_GTP2C_Cause(template (present) GTP2C_Cause cause) := {
elementIdentifier := '02'O,
lengthIndicator := ?,
instance := ?,
spare := '0000'B,
- causeValue := cause,
+ causeValue := int2oct_tmpl(enum2int_GTP2C_Cause_tmpl(cause), 1),
cS := ?,
bCE := ?,
pCE := ?,
@@ -193,7 +214,7 @@
instanceOfOffendingIE := *,
spare3 := *
}
-private function fs_GTP2C_Cause(template (omit) OCT1 cause, template (value) BIT1 cs) return
+private function fs_GTP2C_Cause(template (omit) GTP2C_Cause cause, template (value) BIT1 cs) return
template (omit) Cause {
if (istemplatekind(cause, "omit")) {
return omit;
@@ -201,7 +222,7 @@
return ts_GTP2C_Cause(cause, cs);
}
}
-private function fr_GTP2C_Cause(template OCT1 cause) return
+private function fr_GTP2C_Cause(template GTP2C_Cause cause) return
template Cause {
if (istemplatekind(cause, "omit")) {
return omit;
@@ -793,7 +814,7 @@
template (value) PDN_AddressAllocation addr) :=
ts_PDU_GTP2C('00000000'O, '000000'O, '21'O, {
createSessionResponse := {
- cause := ts_GTP2C_Cause(int2oct(16, 1), '0'B),
+ cause := ts_GTP2C_Cause(Request_accepted, '0'B),
changeReportingAction := omit,
cSG_InformationReportingAction := omit,
heNBInformationReporting := omit,
@@ -824,7 +845,7 @@
template (present) PDU_GTPCv2
tr_GTP2C_CreateSessionResp(template (present) OCT4 d_teid := ?,
template (present) OCT3 seq := ?,
- template (present) OCT1 cause := ?,
+ template (present) GTP2C_Cause cause := ?,
template FullyQualifiedTEID_List fteids := *,
template PDN_AddressAllocation addr := *,
template BearerContextGrouped_List bctxg := *) :=
@@ -862,7 +883,7 @@
template (value) PDU_GTPCv2
ts_GTP2C_DeleteSessionReq(template (value) OCT4 d_teid,
- template (omit) OCT1 cause := omit,
+ template (omit) GTP2C_Cause cause := omit,
template (value) FullyQualifiedTEID sender_fteid,
template (omit) FullyQualifiedTEID_List teid_list := omit,
template (value) uint4_t bearer_id) :=
@@ -889,7 +910,7 @@
template (present) PDU_GTPCv2
tr_GTP2C_DeleteSessionReq(template (present) OCT4 d_teid,
template (present) OCT3 seq := ?,
- template (omit) OCT1 cause,
+ template (omit) GTP2C_Cause cause,
template (present) FullyQualifiedTEID sender_fteid,
template FullyQualifiedTEID_List teid_list,
template (present) uint4_t bearer_id) :=
@@ -918,7 +939,7 @@
template (value) PDU_GTPCv2
ts_GTP2C_DeleteSessionResp(template (value) OCT4 d_teid,
template (value) OCT3 seq,
- template (value) OCT1 cause) :=
+ template (value) GTP2C_Cause cause) :=
ts_PDU_GTP2C(d_teid, '000000'O, '25'O, {
deleteSessionResponse := {
cause := ts_GTP2C_Cause(cause, '0'B),
@@ -934,7 +955,7 @@
template (present) PDU_GTPCv2
tr_GTP2C_DeleteSessionResp(template (present) OCT4 d_teid,
template (present) OCT3 seq := ?,
- template (present) OCT1 cause := ?
+ template (present) GTP2C_Cause cause := ?
) :=
tr_PDU_GTP2C(d_teid, seq, {
deleteSessionResponse := {
@@ -993,7 +1014,7 @@
ts_GTP2C_DeleteBearerReq(template (value) OCT4 d_teid,
template (value) integer proc_trans_id,
template (value) uint4_t bearer_id,
- template (value) OCT1 cause) :=
+ template (value) GTP2C_Cause cause) :=
ts_PDU_GTP2C(d_teid, '000000'O, '63'O, {
deleteBearerRequest := {
epsBearerIdentity := { ts_GTP2C_EpsBearerId(bearer_id) },
@@ -1014,7 +1035,7 @@
template (present) PDU_GTPCv2
tr_GTP2C_DeleteBearerResp(template (present) OCT4 d_teid,
template (present) OCT3 seq := ?,
- template (present) OCT1 cause := ?) :=
+ template (present) GTP2C_Cause cause := ?) :=
tr_PDU_GTP2C(d_teid, seq, {
deleteBearerResponse := {
cause := tr_GTP2C_Cause(cause),