bsc: Introduce test TC_assignment_emerg_setup_allow_imei
Related: OS#5849
Change-Id: I5a95cb0cd6903801db8cfcc1542bd6147461eebe
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index ea73f4a..c3743df 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -759,6 +759,7 @@
pars.mscpool.bssap_idx := bssap_idx;
pars.expect_tsc := c_BtsParams[0].tsc;
pars.imsi := f_rnd_imsi('00101'H);
+ pars.imei := f_rnd_imei('00101'H);
log(testcasename(), ": using IMSI ", pars.imsi);
@@ -9223,6 +9224,26 @@
f_shutdown_helper();
}
+/* Test MO emergency call using MobileIdentity=IMEI (possible for emergency
+ * calls from phones without SIM card).
+ * 3GPP TS 24.008 section 10.5.1.4, OS#5849 */
+testcase TC_assignment_emerg_setup_allow_imei() runs on test_CT {
+ var TestHdlrParams pars := f_gen_test_hdlr_pars();
+ var MSC_ConnHdlr vc_conn;
+
+ /* Remove IMSI set by f_gen_test_hdlr_pars(), then IMEI will be used to place the call */
+ pars.imsi := omit;
+
+ f_init(1, true);
+ f_sleep(1.0);
+
+ f_vty_allow_emerg_msc(true);
+ f_vty_allow_emerg_bts(true, 0);
+ vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars);
+ vc_conn.done;
+ f_shutdown_helper();
+}
+
/* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */
testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT {
var TestHdlrParams pars := f_gen_test_hdlr_pars();
@@ -12387,6 +12408,7 @@
/* Emergency call handling (deny / allow) */
execute( TC_assignment_emerg_setup_allow() );
+ execute( TC_assignment_emerg_setup_allow_imei() );
execute( TC_assignment_emerg_setup_deny_msc() );
execute( TC_assignment_emerg_setup_deny_bts() );
execute( TC_emerg_premption() );
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index dd044e0..13fe723 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -730,7 +730,8 @@
type record TestHdlrParams {
OCT1 ra,
GsmFrameNumber fn,
- hexstring imsi,
+ hexstring imsi optional,
+ hexstring imei optional,
RslLinkId link_id,
integer media_nr, /* determins MGCP EP, port numbers */
BSSMAP_IE_SpeechCodecList ass_codec_list optional,
@@ -764,7 +765,8 @@
template (value) TestHdlrParams t_def_TestHdlrPars := {
ra := '23'O,
fn := 23,
- imsi := '001019876543210'H,
+ imsi := omit, /* set to random in f_gen_test_hdlr_pars() */
+ imei := omit, /* set to random in f_gen_test_hdlr_pars() */
link_id := valueof(ts_RslLinkID_DCCH(0)),
media_nr := 1,
ass_codec_list := omit,
@@ -804,12 +806,23 @@
function f_create_chan_and_exp(template (present) PDU_BSSAP exp_l3_compl := ?)
runs on MSC_ConnHdlr {
- var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
- var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
- var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info);
+ var MobileIdentityLV mi;
+ var PDU_ML3_MS_NW l3_info;
+ var octetstring l3_enc;
var template uint3_t tsc := ?;
timer T;
+ if (ispresent(g_pars.imsi)) {
+ mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+ } else if (ispresent(g_pars.imei)) {
+ mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
+ } else {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Either imsi or imei must be set!");
+ }
+ l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
+ l3_enc := enc_PDU_ML3_MS_NW(l3_info);
+
if (not istemplatekind(g_pars.expect_tsc, "omit")) {
tsc := g_pars.expect_tsc;
}
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 2edec36..dc4fd65 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -105,6 +105,10 @@
return prefix & f_rnd_hexstring(15 - lengthof(prefix), 10);
}
+function f_rnd_imei(in hexstring prefix) return hexstring {
+ return prefix & f_rnd_hexstring(14 - lengthof(prefix), 10);
+}
+
function f_rnd_msisdn(in octetstring prefix, integer len := 6) return octetstring {
return prefix & f_rnd_octstring(len - lengthof(prefix));
}