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
This commit is contained in:
Harald Welte 2020-08-18 22:55:02 +02:00
parent 4698a4c4e3
commit 79f1e45436
2 changed files with 23 additions and 2 deletions

View File

@ -61,6 +61,10 @@ import from SGsAP_Emulation all;
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_mm_imei_early() runs on BSC_ConnHdlr
}
}
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 @@ function f_mm_common() runs on BSC_ConnHdlr
}
/* 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 @@ function f_mm_common() runs on BSC_ConnHdlr
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 @@ function f_mm_common() runs on BSC_ConnHdlr
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)");

View File

@ -807,6 +807,7 @@ private function f_tc_lu_clear_request(charstring id, BSC_ConnHdlrPars pars) run
/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
f_cl3_or_initial_ue(l3_lu);
f_expect_common_id();
/* Send Early Classmark, just for the fun of it */
BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3));
@ -926,6 +927,7 @@ private function f_tc_lu_tmsi_noauth_unknown(charstring id, BSC_ConnHdlrPars par
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req(CM_ID_TYPE_IMSI)));
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(overlong_imsi))); /* test for OS#2864 */
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi)));
f_expect_common_id();
/* Expect MSC to do UpdateLocation to HLR; respond to it */
GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));
@ -3972,6 +3974,7 @@ private function f_tc_cipher_complete_with_invalid_cipher(charstring id, BSC_Con
mtc.stop;
}
}
f_expect_common_id();
/* Expect LU reject from MSC. */
alt {
@ -4008,6 +4011,7 @@ friend function f_tc_lu_with_invalid_mcc_mnc(charstring id, BSC_ConnHdlrPars par
/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi)
f_cl3_or_initial_ue(l3_lu);
f_expect_common_id();
/* Expect LU reject from MSC. */
alt {
@ -4066,6 +4070,7 @@ private function f_tc_cipher_complete_without_alg(charstring id, BSC_ConnHdlrPar
mtc.stop;
}
}
f_expect_common_id();
/* TODO: Verify MSC is using the best cipher available! How? */