laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17948 )


Change subject: DIAMETER_Emulation: Add support for IMSI in Subscription-Id
......................................................................

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
---
M library/DIAMETER_Emulation.ttcn
M library/DIAMETER_Templates.ttcn
2 files changed, 19 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/48/17948/1

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 := {

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/17948
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I299fcc2e01e908914df32fda4fb93b1114402c77
Gerrit-Change-Number: 17948
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to