summaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-02-17 15:24:48 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-18 10:26:34 +0100
commit6abb9fe76fc18fec3b35c5b63daee21774d9ed19 (patch)
treee650a656f76f7ae3300c738fa7d3d87227d454e6 /sgsn
parent91636de6d5acfc385f70dd45182836c259bca251 (diff)
sgsn: Add TC_detach_* for various GPRS DETACH use cases
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.ttcn90
1 files changed, 90 insertions, 0 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 9e00a13..3cf1657 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -635,6 +635,92 @@ testcase TC_attach_rau() runs on test_CT {
vc_conn.done;
}
+/* general GPRS DETACH helper */
+function f_detach_mo(BIT3 detach_type, boolean power_off, boolean expect_purge) runs on BSSGP_ConnHdlr {
+ var BssgpDecoded bd;
+ timer T := 5.0;
+ BSSGP.send(ts_GMM_DET_REQ_MO(detach_type, power_off));
+ if (expect_purge) {
+ GSUP.receive(tr_GSUP_PURGE_MS_REQ(g_pars.imsi, OSMO_GSUP_CN_DOMAIN_PS));
+ GSUP.send(ts_GSUP_PURGE_MS_RES(g_pars.imsi));
+ }
+ T.start;
+ alt {
+ [not expect_purge] GSUP.receive(tr_GSUP_PURGE_MS_REQ(?)) {
+ setverdict(fail, "Unexpected GSUP PURGE MS for unregistered TLLI");
+ }
+ [power_off] BSSGP.receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
+ g_pars.ra := omit;
+ setverdict(fail, "Unexpected ATTACH ACCEPT in no-power-off DETACH");
+ /* TODO: check if any PDP contexts are deactivated on network side? */
+ }
+ [power_off] T.timeout {
+ setverdict(pass);
+ }
+ [not power_off] BSSGP.receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value bd {
+ g_pars.ra := omit;
+ setverdict(pass);
+ /* TODO: check if any PDP contexts are deactivated on network side? */
+ }
+ [] BSSGP.receive { repeat; }
+ }
+}
+
+/* IMSI DETACH (non-power-off) for unknown TLLI */
+private function f_TC_detach_unknown_nopoweroff(charstring id) runs on BSSGP_ConnHdlr {
+ f_detach_mo(c_GMM_DTT_MO_GPRS, false, false);
+}
+testcase TC_detach_unknown_nopoweroff() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ f_sleep(1.0);
+ vc_conn := f_start_handler(refers(f_TC_detach_unknown_nopoweroff), testcasename(), g_gb[0], 13);
+ vc_conn.done;
+}
+
+/* IMSI DETACH (power-off) for unknown TLLI */
+private function f_TC_detach_unknown_poweroff(charstring id) runs on BSSGP_ConnHdlr {
+ f_detach_mo(c_GMM_DTT_MO_GPRS, true, false);
+}
+testcase TC_detach_unknown_poweroff() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ f_sleep(1.0);
+ vc_conn := f_start_handler(refers(f_TC_detach_unknown_poweroff), testcasename(), g_gb[0], 14);
+ vc_conn.done;
+}
+
+/* IMSI DETACH (non-power-off) for known TLLI */
+private function f_TC_detach_nopoweroff(charstring id) runs on BSSGP_ConnHdlr {
+ /* first perform regular attach */
+ f_TC_attach(id);
+
+ f_detach_mo(c_GMM_DTT_MO_GPRS, false, true);
+}
+testcase TC_detach_nopoweroff() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ f_sleep(1.0);
+ vc_conn := f_start_handler(refers(f_TC_detach_nopoweroff), testcasename(), g_gb[0], 15);
+ vc_conn.done;
+}
+
+/* IMSI DETACH (power-off) for known TLLI */
+private function f_TC_detach_poweroff(charstring id) runs on BSSGP_ConnHdlr {
+ /* first perform regular attach */
+ f_TC_attach(id);
+
+ f_detach_mo(c_GMM_DTT_MO_GPRS, true, true);
+}
+testcase TC_detach_poweroff() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ f_sleep(1.0);
+ vc_conn := f_start_handler(refers(f_TC_detach_poweroff), testcasename(), g_gb[0], 16);
+ vc_conn.done;
+}
+
+
control {
@@ -649,6 +735,10 @@ control {
execute( TC_attach_closed() );
execute( TC_rau_unknown() );
execute( TC_attach_rau() );
+ execute( TC_detach_unknown_nopoweroff() );
+ execute( TC_detach_unknown_poweroff() );
+ execute( TC_detach_nopoweroff() );
+ execute( TC_detach_poweroff() );
}