bsc: Add CommonID Test: Send CommonID from MSC and check it is processed

Related: OS#2969
Change-Id: I501108bc6c19b17d3fc680211c7290a31770a159
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 84f8eaf..9cb15f2 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -2777,6 +2777,33 @@
 	vc_conn.done;
 }
 
+/* Send a CommonID from the simulated MSC and verify that the information is used to
+ * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */
+private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	f_MscConnHdlr_init_vty();
+
+	f_create_chan_and_exp();
+	/* we should now have a COMPL_L3 at the MSC */
+	BSSAP.receive(tr_BSSMAP_ComplL3);
+
+	/* Send CommonID */
+	BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi));
+
+	/* Use VTY to verify that the IMSI of the subscr_conn is set */
+	var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*";
+	f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0);
+
+	setverdict(pass);
+}
+testcase TC_common_id() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	vc_conn := f_start_handler(refers(f_tc_common_id));
+	vc_conn.done;
+}
+
 private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr {
 	g_pars := f_gen_test_hdlr_pars();
 	f_create_chan_and_exp();
@@ -5206,6 +5233,7 @@
 	execute( TC_oml_unknown_unit_id() );
 
 	execute( TC_classmark() );
+	execute( TC_common_id() );
 	execute( TC_unsol_ass_fail() );
 	execute( TC_unsol_ass_compl() );
 	execute( TC_unsol_ho_fail() );