pgw: Introduce test TC_s2b_createSession_v4_no_apco
This test allows initial testing of a session creation through the S2b
interface (emulating an ePDG).
A follow-up test will be added to test the APCO IE (feature which
open5gs-smfd still doesn't support).
Change-Id: I38e469edf0e00feca5a648035b64645e2c905937
diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn
index e7481ca..69107d4 100644
--- a/library/DIAMETER_Emulation.ttcn
+++ b/library/DIAMETER_Emulation.ttcn
@@ -37,6 +37,7 @@
import from DIAMETER_Templates all;
import from Osmocom_Types all;
import from IPL4asp_Types all;
+import from TCCConversion_Functions all;
import from Native_Functions all;
type hexstring IMSI;
@@ -297,7 +298,13 @@
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));
+ var charstring imsi_str := oct2char(imsi_oct);
+ /* Username may be a NAI instead of IMSI: "<IMSI>@nai.epc.mnc<MNC>.mcc<MCC>.3gppnetwork.org" */
+ var integer pos := f_strstr(imsi_str, "@");
+ if (pos != -1) {
+ imsi_str := substr(imsi_str, 0, pos);
+ }
+ return str2hex(imsi_str);
}
}