summaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-17 15:50:21 +0200
committerHarald Welte <laforge@gnumonks.org>2018-07-21 17:54:35 +0000
commit940134537a11f14d1151a90a30ec24feccf742b0 (patch)
treed48ec41680cfed0bf81fc8e0bd6519110334fddb /sgsn
parent72edc8ad7f45f4fab3f4e55f73f4720abb0236ce (diff)
sgsn: Add Test to verify Recovery procedure during CreatePdpResp
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.ttcn59
-rw-r--r--sgsn/expected-results.xml5
2 files changed, 56 insertions, 8 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 782d89c..d7e956f 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -903,9 +903,14 @@ private function f_process_gtp_ctx_act_req(inout PdpActPars apars, PDU_GTPC gtpc
f_gtp_register_teid(apars.ggsn_tei_u);
}
-function f_pdp_ctx_act(inout PdpActPars apars) runs on BSSGP_ConnHdlr {
+function f_pdp_ctx_act(inout PdpActPars apars, boolean send_recovery := false) runs on BSSGP_ConnHdlr {
var boolean exp_rej := ispresent(apars.exp_rej_cause);
var Gtp1cUnitdata g_ud;
+ var template Recovery_gtpc recovery := omit;
+
+ if (send_recovery) {
+ recovery := ts_Recovery(apars.ggsn_restart_ctr);
+ }
BSSGP.send(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr,
apars.apn, apars.pco));
@@ -916,7 +921,8 @@ function f_pdp_ctx_act(inout PdpActPars apars) runs on BSSGP_ConnHdlr {
apars.sgsn_tei_c, apars.gtp_resp_cause,
apars.ggsn_tei_c, apars.ggsn_tei_u,
apars.nsapi,
- apars.ggsn_ip_c, apars.ggsn_ip_u, apars.chg_id));
+ apars.ggsn_ip_c, apars.ggsn_ip_u, apars.chg_id,
+ omit, recovery));
}
alt {
[exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_REJ(apars.tid, apars.exp_rej_cause))) {
@@ -1263,7 +1269,7 @@ testcase TC_attach_second_attempt() runs on test_CT {
vc_conn.done;
}
-private function f_TC_attach_restart_ctr_dettach(charstring id) runs on BSSGP_ConnHdlr {
+private function f_TC_attach_restart_ctr_echo(charstring id) runs on BSSGP_ConnHdlr {
var Gtp1cUnitdata g_ud;
var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
@@ -1294,15 +1300,55 @@ private function f_TC_attach_restart_ctr_dettach(charstring id) runs on BSSGP_Co
}
setverdict(pass);
}
-testcase TC_attach_restart_ctr_dettach() runs on test_CT {
+/* ATTACH + trigger Recovery procedure through EchoResp */
+testcase TC_attach_restart_ctr_echo() runs on test_CT {
var BSSGP_ConnHdlr vc_conn;
g_use_echo := true
f_init();
- vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_dettach), testcasename(), g_gb[0], 23, 30.0);
+ vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_echo), testcasename(), g_gb[0], 23, 30.0);
vc_conn.done;
g_use_echo := false
}
+private function f_TC_attach_restart_ctr_create(charstring id) runs on BSSGP_ConnHdlr {
+ var Gtp1cUnitdata g_ud;
+ var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+ var integer seq_nr := 23;
+ var GtpPeer peer;
+ /* first perform regular attach */
+ f_TC_attach(id);
+
+ /* Use this CTX ACT to send initial Restart counter to SGSN. */
+ apars.gtp_resp_cause := int2oct(199, 1); /* no resources available */
+ apars.exp_rej_cause := '1a'O; /* insufficient resources */
+ f_pdp_ctx_act(apars, true);
+
+ /* Increment restart_ctr. This will fake a restarted GGSN when CreatePdpResp is
+/* received. */
+ apars.ggsn_restart_ctr := int2oct(oct2int(apars.ggsn_restart_ctr) + 1, 1);
+
+ /* FIXME: Once we can easily handle different pdp ctx simultaneously, it
+ would be great to have an active pdp context here before triggering
+ Recovery, and making sure the the DEACT request is sent by the SGSN.
+ */
+
+ /* Activate a pdp context against the GGSN, send incremented Recovery
+ IE. This should trigger the recovery path, but still this specific
+ CTX activation should work. */
+ apars.exp_rej_cause := omit; /* default value for tests */
+ apars.gtp_resp_cause := int2oct(128, 1); /* default value for tests */
+ f_pdp_ctx_act(apars, true);
+
+ setverdict(pass);
+}
+/* ATTACH + trigger Recovery procedure through CreatePdpResp */
+testcase TC_attach_restart_ctr_create() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ vc_conn := f_start_handler(refers(f_TC_attach_restart_ctr_create), testcasename(), g_gb[0], 24, 30.0);
+ vc_conn.done;
+}
+
/* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MT direction + trigger T3395 */
private function f_TC_attach_pdp_act_deact_mt_t3395_expire(charstring id) runs on BSSGP_ConnHdlr {
var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
@@ -1713,7 +1759,8 @@ control {
execute( TC_attach_pdp_act_user_deact_mo() );
execute( TC_attach_pdp_act_user_deact_mt() );
execute( TC_attach_second_attempt() );
- execute( TC_attach_restart_ctr_dettach() );
+ execute( TC_attach_restart_ctr_echo() );
+ execute( TC_attach_restart_ctr_create() );
execute( TC_attach_pdp_act_deact_mt_t3395_expire() );
}
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index f2bf327..5b756cd 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<testsuite name='Titan' tests='28' failures='4' errors='3' skipped='0' inconc='0' time='MASKED'>
+<testsuite name='Titan' tests='29' failures='4' errors='3' skipped='0' inconc='0' time='MASKED'>
<testcase classname='SGSN_Tests' name='TC_attach' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_mnc3' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_umts_aka_umts_res' time='MASKED'/>
@@ -60,6 +60,7 @@
<testcase classname='SGSN_Tests' name='TC_attach_second_attempt' time='MASKED'>
<error type='DTE'></error>
</testcase>
- <testcase classname='SGSN_Tests' name='TC_attach_restart_ctr_dettach' time='MASKED'/>
+ <testcase classname='SGSN_Tests' name='TC_attach_restart_ctr_echo' time='MASKED'/>
+ <testcase classname='SGSN_Tests' name='TC_attach_restart_ctr_create' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_pdp_act_deact_mt_t3395_expire' time='MASKED'/>
</testsuite>