msc: add TC_lu_tmsi_noauth_notmsi

Add test case for handling a LU by TMSI MI when 'no assign-tmsi' is
configured.

This test will pass from osmo-msc patch
I583682d1a35a70b008d7bb2d89ba7c3109a60b21 on

Depends: osmo-msc I583682d1a35a70b008d7bb2d89ba7c3109a60b21
Related: SYS#6860 OS#4721
Change-Id: If10b9987395670b084ff8ad6d1f033ff46896d75
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 3effd52..2923a62 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -7289,10 +7289,52 @@
 	vc_conn.done;
 }
 
+/* MSC <-> BSC: ID req/rsp for IMSI */
+private altstep as_id_req_imsi()
+runs on BSC_ConnHdlr {
+	[] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req(CM_ID_TYPE_IMSI))) {
+		var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp(mi)));
+		repeat;
+		}
+}
+
+/* MSC is configured to not assign a TMSI; MS sends LU Request with a TMSI MI (from another cell), and MSC shall not use
+ * that TMSI. */
+private function f_tc_lu_tmsi_noauth_notmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	f_init_handler(pars, t_guard := 20.0);
+
+	/* Perform Location Updating using an unknown TMSI MI. Expect an ID Request to come from the MSC and answer
+	 * that with as_id_req_imsi(). */
+	activate(as_id_req_imsi());
+	f_perform_lu(use_mi := ts_MI_TMSI_LV(pars.tmsi));
+
+	f_sleep(1.0);
+
+	/* Attached by invalid TMSI, and the MSC has asked for the IMSI. Initiate Paging and make sure the MSC doesn't
+	 * use the invalid TMSI for it. */
+	f_ran_register_imsi(g_pars.imsi, omit);
+	f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " paging");
+	f_expect_paging_tmsi(omit);
+}
+testcase TC_lu_tmsi_noauth_notmsi() runs on MTC_CT {
+	var BSC_ConnHdlrPars pars;
+	var BSC_ConnHdlr vc_conn;
+	f_init();
+	f_vty_config(MSCVTY, "msc", "no assign-tmsi");
+	pars := f_init_pars(101);
+	pars.net.expect_tmsi := false;
+	pars.tmsi := '0badbad0'O;
+	pars.mm_info := false;
+	vc_conn := f_start_handler_with_pars(refers(f_tc_lu_tmsi_noauth_notmsi), pars);
+	vc_conn.done;
+}
+
 control {
 	execute( TC_cr_before_reset() );
 	execute( TC_lu_imsi_noauth_tmsi() );
 	execute( TC_lu_imsi_noauth_notmsi() );
+	execute( TC_lu_tmsi_noauth_notmsi() );
 	execute( TC_lu_imsi_reject() );
 	execute( TC_lu_imsi_timeout_gsup() );
 	execute( TC_lu_imsi_auth_tmsi() );