From 04683d0fb8ac267cf49e83175d408106f6c6cc1e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 16 Feb 2018 22:43:45 +0100 Subject: sgsn: Add TC_rau_unknown Change-Id: If33fc690cedcc362c3cd5d7c1951440ecba328c2 --- sgsn/SGSN_Tests.ttcn | 80 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 8 deletions(-) (limited to 'sgsn') diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index be1af57e..7e1c48e0 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -66,6 +66,7 @@ type record BSSGP_ConnHdlrPars { hexstring msisdn, /* P-TMSI allocated to the simulated MS */ OCT4 p_tmsi optional, + OCT3 p_tmsi_sig optional, /* TLLI of the simulated MS */ OCT4 tlli, RoutingAreaIdentificationV ra optional, @@ -165,6 +166,7 @@ runs on test_CT return BSSGP_ConnHdlr { imsi := f_gen_imsi(imsi_suffix), msisdn := f_gen_msisdn(imsi_suffix), p_tmsi := omit, + p_tmsi_sig := omit, tlli := f_gprs_tlli_random(), ra := omit, bssgp_cell_id := gb.cfg.cell_id, @@ -211,14 +213,11 @@ runs on BSSGP_ConnHdlr { } /* TODO: - * RAU without Attach * Detach without Attach * SM procedures without attach / RAU * ATTACH / RAU ** with / without authentication ** with / without P-TMSI allocation - ** timeout from HLR on SAI - ** timeout from HLR on UL ** reject from HLR on SAI ** reject from HLR on UL * re-transmissions of LLC frames @@ -278,11 +277,36 @@ function f_gmm_auth () runs on BSSGP_ConnHdlr { deactivate(di); } +function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr { + /* mandatory IE */ + g_pars.ra := aa.routingAreaIdentification; + if (ispresent(aa.allocatedPTMSI)) { + if (not g_pars.net.expect_ptmsi) { + setverdict(fail, "unexpected P-TMSI allocation"); + self.stop; + } + g_pars.p_tmsi := aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets; + /* update TLLI? */ + } + if (ispresent(aa.msIdentity)) { + setverdict(fail, "unexpected TMSI allocation in non-combined attach"); + self.stop; + } + /* P-TMSI.sig */ + if (ispresent(aa.ptmsiSignature)) { + g_pars.p_tmsi_sig := aa.ptmsiSignature.valueField; + } + /* updateTimer */ + // aa.readyTimer + /* T3302, T3319, T3323, T3312_ext, T3324 */ +} + function f_random_RAI(HEX0_3n mcc := '262'H, HEX0_3n mnc := '42'H) return RoutingAreaIdentificationV { return f_RAI(mcc, mnc, f_rnd_octstring(2), f_rnd_octstring(1)); } private function f_TC_attach(charstring id) runs on BSSGP_ConnHdlr { + var BssgpDecoded bd; var MobileIdentityLV mi; var RoutingAreaIdentificationV old_ra := f_random_RAI(); @@ -300,7 +324,10 @@ private function f_TC_attach(charstring id) runs on BSSGP_ConnHdlr { GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); - BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))); + BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd { + f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept); + } + /* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */ BSSGP.send(ts_GMM_ATTACH_COMPL); setverdict(pass); } @@ -374,6 +401,7 @@ testcase TC_attach_auth_sai_timeout() runs on test_CT { /* HLR never responds to UL REQ, expect ATTACH REJECT */ private function f_TC_attach_gsup_lu_timeout(charstring id) runs on BSSGP_ConnHdlr { + var BssgpDecoded bd; var MobileIdentityLV mi; var RoutingAreaIdentificationV old_ra := f_random_RAI(); @@ -392,7 +420,8 @@ private function f_TC_attach_gsup_lu_timeout(charstring id) runs on BSSGP_ConnHd [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) { setverdict(pass); } - [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) { + [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd { + f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept); setverdict(fail); } } @@ -407,6 +436,7 @@ testcase TC_attach_gsup_lu_timeout() runs on test_CT { /* Attempt of combined GPRS + IMSI attach: network should ACK only GPRS attach */ private function f_TC_attach_combined(charstring id) runs on BSSGP_ConnHdlr { + var BssgpDecoded bd; var MobileIdentityLV mi; var RoutingAreaIdentificationV old_ra := f_random_RAI(); @@ -424,11 +454,12 @@ private function f_TC_attach_combined(charstring id) runs on BSSGP_ConnHdlr { GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi)); GSUP.send(ts_GSUP_UL_RES(g_pars.imsi)); - BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))); + BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd { + f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept); + } BSSGP.send(ts_GMM_ATTACH_COMPL); setverdict(pass); } - testcase TC_attach_combined() runs on test_CT { var BSSGP_ConnHdlr vc_conn; f_init(); @@ -439,6 +470,7 @@ testcase TC_attach_combined() runs on test_CT { /* Attempt of GPRS ATTACH in 'accept all' mode */ private function f_TC_attach_accept_all(charstring id) runs on BSSGP_ConnHdlr { + var BssgpDecoded bd; var MobileIdentityLV mi; var RoutingAreaIdentificationV old_ra := f_random_RAI(); @@ -452,7 +484,9 @@ private function f_TC_attach_accept_all(charstring id) runs on BSSGP_ConnHdlr { BSSGP.send(ts_GMM_ATTACH_REQ(mi, old_ra, false, false, omit, omit)); f_gmm_auth(); - BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))); + BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd { + f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept); + } BSSGP.send(ts_GMM_ATTACH_COMPL); setverdict(pass); } @@ -505,6 +539,35 @@ testcase TC_attach_closed() runs on test_CT { vc_conn.done; } +/* Routing Area Update from Unknown TLLI -> REJECT */ +private function f_TC_rau_unknown(charstring id) runs on BSSGP_ConnHdlr { + var MobileIdentityLV mi; + var RoutingAreaIdentificationV old_ra := f_random_RAI(); + + if (ispresent(g_pars.p_tmsi)) { + mi := valueof(ts_MI_TMSI_LV(g_pars.p_tmsi)); + } else { + mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); + } + + BSSGP.send(ts_GMM_RAU_REQ(mi, GPRS_UPD_T_RA, old_ra, false, omit, omit)); + alt { + [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_RAU_REJECT('0a'O))) { + setverdict(pass); + } + /* FIXME: Expect XID RESET? */ + [] BSSGP.receive { repeat; } + } +} +testcase TC_rau_unknown() runs on test_CT { + var BSSGP_ConnHdlr vc_conn; + f_init(); + f_sleep(1.0); + vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb[0], 9); + vc_conn.done; +} + + control { @@ -515,6 +578,7 @@ control { execute( TC_attach_combined() ); execute( TC_attach_accept_all() ); execute( TC_attach_closed() ); + execute( TC_rau_unknown() ); } -- cgit v1.2.3