library/DIAMETER_Templates: rework existing ULR/ULA templates
* Make both {hbh,ete}_id parameters last among the others;
* Use more elegant and consistent template formatting;
* Make Origin{Host,Realm} values configurable;
* Make DestinationRealm value configurable;
* Make SessionId value configurable.
Change-Id: I0585e306a87453c212c6b5ac5635181c47b34b4f
Related: SYS#5602
diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn
index fd4683e..4cd2b6b 100644
--- a/library/DIAMETER_Templates.ttcn
+++ b/library/DIAMETER_Templates.ttcn
@@ -106,6 +106,8 @@
const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252;
const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308;
+const octetstring c_def_sess_id := char2oct("ttcn3.session");
+
template (value) PDU_DIAMETER
ts_DIAMETER(template (value) BIT8 flags,
template (value) Command_Code cmd_code,
@@ -908,34 +910,50 @@
/* TS 29.262 7.2.3 Update Location Request */
template (present) PDU_DIAMETER
-tr_DIA_ULR(hexstring imsi) := tr_DIAMETER(flags:='11000000'B, cmd_code:=Update_Location,
- app_id:=int2oct(c_DIAMETER_3GPP_S6_AID, 4),
- avps := superset(
- tr_AVP_SessionId,
- tr_AVP_AuthSessionState,
- tr_AVP_OriginHost,
- tr_AVP_OriginRealm,
- tr_AVP_DestinationRealm,
- tr_AVP_UserNameImsi(imsi),
- tr_AVP_3GPP_RatType(EUTRAN),
- tr_AVP_3GPP_UlrFlags,
- tr_AVP_3GPP_VisitedPlmnId
+tr_DIA_ULR(/* template (present) */ hexstring imsi,
+ template (present) octetstring sess_id := ?,
+ template (present) charstring orig_host := ?,
+ template (present) charstring orig_realm := ?,
+ template (present) charstring dest_realm := ?,
+ template (present) UINT32 hbh_id := ?,
+ template (present) UINT32 ete_id := ?) :=
+ tr_DIAMETER(flags := '11000000'B,
+ cmd_code := Update_Location,
+ app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
+ hbh_id := hbh_id,
+ ete_id := ete_id,
+ avps := superset(
+ tr_AVP_SessionId(sess_id),
+ tr_AVP_AuthSessionState,
+ tr_AVP_OriginHost(orig_host),
+ tr_AVP_OriginRealm(orig_realm),
+ tr_AVP_DestinationRealm(dest_realm),
+ tr_AVP_UserNameImsi(imsi),
+ tr_AVP_3GPP_RatType(EUTRAN),
+ tr_AVP_3GPP_UlrFlags,
+ tr_AVP_3GPP_VisitedPlmnId
));
template (value) PDU_DIAMETER
-ts_DIA_ULA(template (value) UINT32 hbh_id, template (value) UINT32 ete_id,
- template (value) octetstring sess_id,
- template (value) AVP_list sub_data_content)
-:= ts_DIAMETER(flags:='01000000'B, cmd_code:=Update_Location,
- app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4), hbh_id:=hbh_id, ete_id:=ete_id,
- avps := {
- ts_AVP_SessionId(sess_id),
- ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */
- ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
- ts_AVP_OriginHost("hss.localdomain"),
- ts_AVP_OriginRealm("localdomain"),
- ts_AVP_3GPP_UlaFlags('00000002'O),
- ts_AVP_3GPP_SubscriptionData(sub_data_content)
+ts_DIA_ULA(template (value) AVP_list sub_data,
+ template (value) octetstring sess_id := c_def_sess_id,
+ template (value) charstring orig_host := "hss.localdomain",
+ template (value) charstring orig_realm := "localdomain",
+ template (value) UINT32 hbh_id := '00000000'O,
+ template (value) UINT32 ete_id := '00000000'O) :=
+ ts_DIAMETER(flags:='01000000'B,
+ cmd_code := Update_Location,
+ app_id := int2oct(c_DIAMETER_3GPP_S6_AID, 4),
+ hbh_id := hbh_id,
+ ete_id := ete_id,
+ avps := {
+ ts_AVP_SessionId(sess_id),
+ ts_AVP_ResultCode(DIAMETER_SUCCESS), /* optional */
+ ts_AVP_AuthSessionState(NO_STATE_MAINTAINED),
+ ts_AVP_OriginHost(orig_host),
+ ts_AVP_OriginRealm(orig_realm),
+ ts_AVP_3GPP_UlaFlags('00000002'O),
+ ts_AVP_3GPP_SubscriptionData(sub_data)
});
diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn
index f9bcf6d..2140971 100644
--- a/mme/MME_Tests.ttcn
+++ b/mme/MME_Tests.ttcn
@@ -493,14 +493,12 @@
var PDU_DIAMETER rx_dia;
[] DIAMETER.receive(tr_DIA_ULR(g_pars.ue_pars.imsi)) -> value rx_dia {
var template (omit) AVP avp;
- var octetstring sess_id;
var hexstring imsi;
var template (value) AVP_list sub_data;
/* retrieve input data */
imsi := valueof(f_DIAMETER_get_imsi(rx_dia));
avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_BASE_NONE_Session_Id);
- sess_id := valueof(avp.avp_data.avp_BASE_NONE_Session_Id);
sub_data := {
ts_AVP_3GPP_SubscriberStatus(SERVICE_GRANTED),
@@ -513,7 +511,9 @@
})
};
- DIAMETER.send(ts_DIA_ULA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id, sub_data));
+ DIAMETER.send(ts_DIA_ULA(sub_data, avp.avp_data.avp_BASE_NONE_Session_Id,
+ hbh_id := rx_dia.hop_by_hop_id,
+ ete_id := rx_dia.end_to_end_id));
}
}