msc: Expect CommonID from MSC by default

As of osmo-msc Change-Id I2552736477663adb250c55728093500e8ae83ebb,
osmo-msc is always sending BSSMAP CommonID to the BSC.  Let's adjust our
test expectation, while allowing the user to start the tests with
BSC_ConnectionHandler.mp_expect_common_id := false
to get the existing behavior (expect no bSSMAP CommonId) can be
restored, e.g. for testing 'latest'.

Change-Id: I4976d9bb1f07c8ab4ffa02848414f8ddd1bdfd3f
Related: OS#2969
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index cc69a68..053a5f6 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -61,6 +61,10 @@
 
 import from TCCConversion_Functions { function f_strstr };
 
+modulepar {
+	boolean mp_expect_common_id := true;
+}
+
 /* this component represents a single subscriber connection */
 type component BSC_ConnHdlr extends RAN_ConnHdlr, MNCC_ConnHdlr, GSUP_ConnHdlr, MGCP_ConnHdlr, SMPP_ConnHdlr, CTRL_Adapter_CT, SGsAP_ConnHdlr {
 	var BSC_ConnHdlrPars g_pars;
@@ -519,6 +523,17 @@
 	}
 }
 
+function f_expect_common_id() runs on BSC_ConnHdlr
+{
+	if (g_pars.ran_is_geran) {
+		if (mp_expect_common_id) {
+			BSSAP.receive(tr_BSSMAP_CommonId(g_pars.imsi));
+		}
+	} else {
+		BSSAP.receive(tr_RANAP_CommonId(imsi_hex2oct(g_pars.imsi)));
+	}
+}
+
 function f_mm_common() runs on BSC_ConnHdlr
 {
 	f_mm_auth();
@@ -539,6 +554,7 @@
 			}
 			/* FIXME: Send the best available algorithm */
 		}
+		f_expect_common_id();
 	} else { /* UTRAN */
 		alt {
 		[g_pars.net.expect_ciph] BSSAP.receive(tr_RANAP_SecurityModeCmdEnc(uia_algs := ?,
@@ -549,7 +565,7 @@
 			var IntegrityProtectionAlgorithm uia_chosen := 0; /*standard_UMTS_integrity_algorithm_UIA1*/
 			var EncryptionAlgorithm uea_chosen := 1; /*standard_UMTS_encryption_algorith_UEA1*/
 			BSSAP.send(ts_RANAP_SecurityModeCompleteEnc(uia_chosen, uea_chosen));
-			BSSAP.receive(tr_RANAP_CommonId(imsi_hex2oct(g_pars.imsi)));
+			f_expect_common_id();
 			}
 		[g_pars.net.expect_ciph] BSSAP.receive(tr_RANAP_SecurityModeCmdEnc(?,?,?,?,?)) {
 			setverdict(fail, "Invalid SecurityModeCommand (ciphering case)");
@@ -560,7 +576,7 @@
 										    key_sts := ?)) {
 			var IntegrityProtectionAlgorithm uia_chosen := 0; /*standard_UMTS_integrity_algorithm_UIA1;*/
 			BSSAP.send(ts_RANAP_SecurityModeComplete(uia_chosen));
-			BSSAP.receive(tr_RANAP_CommonId(imsi_hex2oct(g_pars.imsi)));
+			f_expect_common_id();
 			}
 		[not g_pars.net.expect_ciph] BSSAP.receive(tr_RANAP_SecurityModeCmd(?,?,?)) {
 			setverdict(fail, "Invalid SecurityModeCommand (non-ciphering case)");