summaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-16 22:43:45 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-18 10:25:25 +0100
commit04683d0fb8ac267cf49e83175d408106f6c6cc1e (patch)
tree026c7346cbc0e2aaf6f9878a8d25c638ec7b76d7 /sgsn
parentb2124b21ba6c3606cf6d9db3062c59667612e537 (diff)
sgsn: Add TC_rau_unknown
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.ttcn80
1 files changed, 72 insertions, 8 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index be1af57..7e1c48e 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() );
}