sgsn: Add TC_detach_* for various GPRS DETACH use cases
Change-Id: I2243b850400482b911d687585929a2eef3490954
diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index fda9549..0a21999 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -286,6 +286,14 @@
tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, {
tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
+template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) :=
+ tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
+ tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) });
+
+template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) :=
+ ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
+ valueof(ts_GSUP_IE_IMSI(imsi)) });
+
template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
tag := OSMO_GSUP_CANCEL_TYPE_IE,
@@ -298,6 +306,9 @@
template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
+template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
+ tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
+
template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
tag := iei,
len := ?,
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 5b6b481..9bd74db 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -65,10 +65,18 @@
}
/* send template fro Mobile Identity (TMSI) */
-template MobileIdentityTLV ts_MI_TMSI_TLV(OCT4 tmsi) := {
- elementIdentifier := '0100011'B,
- spare1 := '0'B,
- mobileIdentityLV := ts_MI_TMSI_LV(tmsi)
+function ts_MI_TMSI_TLV(template (omit) OCT4 tmsi) return template (omit) MobileIdentityTLV {
+ var template (omit) MobileIdentityTLV ret;
+ if (istemplatekind(tmsi, "omit")) {
+ return omit;
+ } else {
+ ret := {
+ elementIdentifier := '0100011'B,
+ spare1 := '0'B,
+ mobileIdentityLV := ts_MI_TMSI_LV(valueof(tmsi))
+ }
+ return ret;
+ }
}
template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
@@ -1689,12 +1697,42 @@
const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;
-template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt) := {
+template (value) DetachTypeV ts_GMM_DetType(BIT3 dtt, boolean power_off := false) := {
detachType := dtt,
- powerOffFlag := '0'B
+ powerOffFlag := bool2bit(power_off)
}
-template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS) := {
+function ts_PtmsiSigTV(template (omit) OCT3 val) return template (omit) P_TMSISignatureTV {
+ var template (omit) P_TMSISignatureTV ret;
+ if (istemplatekind(val, "omit")) {
+ return omit;
+ } else {
+ ret := {
+ elementIdentifier := '19'O,
+ valueField := valueof(val)
+ }
+ return ret;
+ }
+}
+
+function ts_PtmsiSigTLV(template (omit) OCT3 val) return template (omit) P_TMSISignature2TLV {
+ var template (omit) P_TMSISignature2TLV ret;
+ if (istemplatekind(val, "omit")) {
+ return omit;
+ } else {
+ ret := {
+ elementIdentifier := '19'O,
+ lengthIndicator := 3,
+ valueField := valueof(val)
+ }
+ return ret;
+ }
+}
+
+template (value) PDU_L3_MS_SGSN ts_GMM_DET_REQ_MO(BIT3 dtt := c_GMM_DTT_MO_GPRS,
+ boolean power_off := false,
+ template (omit) OCT4 p_tmsi := omit,
+ template (omit) OCT3 p_tmsi_sig := omit) := {
discriminator := '0000'B, /* overwritten */
tiOrSkip := {
skipIndicator := '0000'B
@@ -1703,10 +1741,26 @@
gprs_mm := {
detachRequest_MS_SGSN := {
messageType := '00000000'B, /* overwritten */
- detachType := valueof(ts_GMM_DetType(dtt)),
+ detachType := valueof(ts_GMM_DetType(dtt, power_off)),
spare := '0000'B,
- ptmsi := omit, /* TODO */
- ptmsiSignature := omit /* TODO */
+ ptmsi := ts_MI_TMSI_TLV(p_tmsi),
+ ptmsiSignature := ts_PtmsiSigTLV(p_tmsi_sig)
+ }
+ }
+ }
+}
+
+template PDU_L3_SGSN_MS tr_GMM_DET_ACCEPT_MT := {
+ discriminator := '1000'B,
+ tiOrSkip := {
+ skipIndicator := '0000'B
+ },
+ msgs := {
+ gprs_mm := {
+ detachAccept_SGSN_MS := {
+ messageType := '00000110'B,
+ forceToStandby := ?,
+ spare := '0000'B
}
}
}