DIAMETER_Emulation: Add support for IMSI in Subscription-Id
Ths IMSI on the Gx interface is encoded into a different AVP than
on the S6a/S6d interfaces. Let's make sure our DIAMETER_Emulation
knows both formats.
Change-Id: I299fcc2e01e908914df32fda4fb93b1114402c77
diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn
index fad44c3..6dd44b3 100644
--- a/library/DIAMETER_Emulation.ttcn
+++ b/library/DIAMETER_Emulation.ttcn
@@ -216,7 +216,16 @@
imsi_avp := f_DIAMETER_get_avp(pdu, c_AVP_Code_BASE_NONE_User_Name);
if (istemplatekind(imsi_avp, "omit")) {
- return omit;
+ var template (omit) AVP sid_avp;
+ sid_avp := f_DIAMETER_get_avp(pdu, c_AVP_Code_DCC_NONE_Subscription_Id);
+ if (istemplatekind(sid_avp, "omit")) {
+ return omit;
+ }
+ var AVP_Grouped grp := valueof(sid_avp.avp_data.avp_DCC_NONE_Subscription_Id);
+ if (not match(grp[0], tr_SubcrIdType(END_USER_IMSI))) {
+ return omit;
+ }
+ return str2hex(oct2char(grp[1].avp.avp_data.avp_DCC_NONE_Subscription_Id_Data));
} else {
var octetstring imsi_oct := valueof(imsi_avp.avp_data.avp_BASE_NONE_User_Name);
return str2hex(oct2char(imsi_oct));
diff --git a/library/DIAMETER_Templates.ttcn b/library/DIAMETER_Templates.ttcn
index 533ede2..11746eb 100644
--- a/library/DIAMETER_Templates.ttcn
+++ b/library/DIAMETER_Templates.ttcn
@@ -101,6 +101,7 @@
};
/* 3GPP TS 29.272 Section 7.1.8 */
+const uint32_t c_DIAMETER_3GPP_Gx_AID := 16777238;
const uint32_t c_DIAMETER_3GPP_S6_AID := 16777251;
const uint32_t c_DIAMETER_3GPP_S13_AID := 16777252;
const uint32_t c_DIAMETER_3GPP_S7_AID := 16777308;
@@ -190,6 +191,14 @@
vendor_id := vendor_id_3GPP
}
+template (present) GenericAVP tr_SubcrIdType(template (present) DCC_NONE_Subscription_Id_Type t) := {
+ avp := {
+ avp_header := tr_DIA_Hdr(c_AVP_Code_DCC_NONE_Subscription_Id_Type),
+ avp_data := {
+ avp_DCC_NONE_Subscription_Id_Type := t
+ }
+ }
+}
template (value) GenericAVP ts_AVP_OriginHost(template (value) charstring host) := {
avp := {