sgsn: test GMM Attach with 3-digit leading-zero MNC
Add general infrastructure to - pass an MCC-MNC for BSSGP to use into f_init(); - verify that the Attach Accept PLMN matches the BSSGP one. Add TC_attach_mnc3() to feed an MNC with three digits and a leading zero, to verify the recent mnc3 patches. When testing against a libosmocore and osmo-sgsn before mnc3, this results in: Test case TC_attach_mnc3 finished. Verdict: fail reason: "mismatching PLMN in Attach Accept: 02342F; expected 023042" With the current master branches the proper 3-digit MNC with leading zero is fed back into the Attach Accept message. Change-Id: I8901ec0b090e342ebb04a04f9d759fc46c7d9cab
This commit is contained in:
parent
cd11223c0f
commit
8df7d15a66
|
@ -84,5 +84,15 @@ function f_RAI(HEX0_3n mcc, HEX0_3n mnc, OCT2 lac, OCT1 rac) return RoutingAreaI
|
|||
return ret;
|
||||
}
|
||||
|
||||
function f_RAI_to_plmn_hexstr(RoutingAreaIdentificationV rai) return hexstring {
|
||||
var hexstring plmn :=
|
||||
rai.mccDigit1
|
||||
& rai.mccDigit2
|
||||
& rai.mccDigit3
|
||||
& rai.mncDigit1
|
||||
& rai.mncDigit2
|
||||
& rai.mncDigit3;
|
||||
return plmn;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ import from SNDCP_Types all;
|
|||
import from TELNETasp_PortType all;
|
||||
import from Osmocom_VTY_Functions all;
|
||||
|
||||
import from GSM_RR_Types all;
|
||||
|
||||
|
||||
modulepar {
|
||||
/* IP/port on which we run our internal GSUP/HLR emulation */
|
||||
|
@ -157,7 +159,7 @@ private function f_init_vty() runs on test_CT {
|
|||
}
|
||||
|
||||
|
||||
function f_init() runs on test_CT {
|
||||
function f_init(BcdMccMnc mcc_mnc := '26242F'H) runs on test_CT {
|
||||
if (g_initialized == true) {
|
||||
return;
|
||||
}
|
||||
|
@ -168,7 +170,7 @@ function f_init() runs on test_CT {
|
|||
cell_id := {
|
||||
ra_id := {
|
||||
lai := {
|
||||
mcc_mnc := '26242F'H, lac := 13135},
|
||||
mcc_mnc := mcc_mnc, lac := 13135},
|
||||
rac := 0
|
||||
},
|
||||
cell_id := 20960
|
||||
|
@ -271,7 +273,7 @@ testcase TC_wait_ns_up() runs on test_CT {
|
|||
}
|
||||
|
||||
altstep as_mm_identity() runs on BSSGP_ConnHdlr {
|
||||
var MobileIdentityLV mi;
|
||||
var MobileL3_CommonIE_Types.MobileIdentityLV mi;
|
||||
[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ID_REQ('001'B))) {
|
||||
mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
|
||||
BSSGP.send(ts_GMM_ID_RESP(mi));
|
||||
|
@ -325,6 +327,12 @@ function f_upd_ptmsi_and_tlli(OCT4 p_tmsi) runs on BSSGP_ConnHdlr {
|
|||
|
||||
function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr {
|
||||
/* mandatory IE */
|
||||
var hexstring aa_plmn := f_RAI_to_plmn_hexstr(aa.routingAreaIdentification);
|
||||
if (not (g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc == aa_plmn)) {
|
||||
setverdict(fail, "mismatching PLMN in Attach Accept: " & hex2str(aa_plmn)
|
||||
& "; expected " & hex2str(g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc));
|
||||
self.stop;
|
||||
}
|
||||
g_pars.ra := aa.routingAreaIdentification;
|
||||
if (ispresent(aa.allocatedPTMSI)) {
|
||||
if (not g_pars.net.expect_ptmsi) {
|
||||
|
@ -375,7 +383,7 @@ function f_random_RAI(HEX0_3n mcc := '262'H, HEX0_3n mnc := '42'H) return Routin
|
|||
}
|
||||
|
||||
/* return a MobileIdentityLV: P-TMSI if we have one, IMSI otherwise */
|
||||
private function f_mi_get_lv() runs on BSSGP_ConnHdlr return MobileIdentityLV {
|
||||
private function f_mi_get_lv() runs on BSSGP_ConnHdlr return MobileL3_CommonIE_Types.MobileIdentityLV {
|
||||
if (ispresent(g_pars.p_tmsi)) {
|
||||
return valueof(ts_MI_TMSI_LV(g_pars.p_tmsi));
|
||||
} else {
|
||||
|
@ -419,6 +427,14 @@ testcase TC_attach() runs on test_CT {
|
|||
vc_conn.done;
|
||||
}
|
||||
|
||||
testcase TC_attach_mnc3() runs on test_CT {
|
||||
var BSSGP_ConnHdlr vc_conn;
|
||||
f_init('023042'H);
|
||||
f_sleep(1.0);
|
||||
vc_conn := f_start_handler(refers(f_TC_attach), testcasename(), g_gb[0], 1001);
|
||||
vc_conn.done;
|
||||
}
|
||||
|
||||
/* MS never responds to ID REQ, expect ATTACH REJECT */
|
||||
private function f_TC_attach_auth_id_timeout(charstring id) runs on BSSGP_ConnHdlr {
|
||||
var RoutingAreaIdentificationV old_ra := f_random_RAI();
|
||||
|
@ -1136,6 +1152,7 @@ testcase TC_attach_pdp_act_user_deact_mt() runs on test_CT {
|
|||
|
||||
control {
|
||||
execute( TC_attach() );
|
||||
execute( TC_attach_mnc3() );
|
||||
execute( TC_attach_auth_id_timeout() );
|
||||
execute( TC_attach_auth_sai_timeout() );
|
||||
execute( TC_attach_auth_sai_reject() );
|
||||
|
|
Loading…
Reference in New Issue