summaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-14 19:03:28 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-03-16 18:47:19 +0100
commit8df7d15a6642816fd1c06a443d7b14149bedf4e3 (patch)
treec7486fd42077d4b47d8c659a0a6096f8b259771f /sgsn
parentcd11223c0f78b9d101dcf5b5d012b571c48c1a21 (diff)
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
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.ttcn25
1 files changed, 21 insertions, 4 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index a853c6d..79aa166 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -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() );