summaryrefslogtreecommitdiffstats
path: root/sgsn
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-10 14:02:49 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-07-13 19:16:22 +0200
commitdc27e483c89d9871b5ed162675d6efba26ecdc06 (patch)
treee424b998965bac42f5e9fbc872f542141b27dc3d /sgsn
parent67e47dd328af6447a158929ed726075f1431a0d9 (diff)
sgsn: Add test to verify restart_ctr during echo req/reply.
Currently test doesn't fully work because it doesn't match the PDP CTX DEL REQ correctly. Change-Id: I1dcb250dba2079c14b857c0b89a02ac21d1c591f
Diffstat (limited to 'sgsn')
-rw-r--r--sgsn/SGSN_Tests.ttcn53
-rw-r--r--sgsn/expected-results.xml3
2 files changed, 55 insertions, 1 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index cfe2d3f..e76ed09 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -64,6 +64,7 @@ type component test_CT {
port TELNETasp_PT SGSNVTY;
var boolean g_initialized := false;
+ var boolean g_use_echo := false;
};
type component BSSGP_ConnHdlr extends BSSGP_Client_CT, GSUP_ConnHdlr, GTP_ConnHdlr {
@@ -160,6 +161,14 @@ private function f_init_vty() runs on test_CT {
f_vty_config(SGSNVTY, "sgsn", "auth-policy remote");
}
+private function f_vty_enable_echo_interval(boolean enable) runs on test_CT {
+ if (enable) {
+ f_vty_config(SGSNVTY, "sgsn", "ggsn 0 echo-interval 5");
+ } else {
+ f_vty_config(SGSNVTY, "sgsn", "ggsn 0 no echo-interval");
+ }
+}
+
function f_init(BcdMccMnc mcc_mnc := '26242F'H) runs on test_CT {
if (g_initialized == true) {
@@ -184,6 +193,7 @@ function f_init(BcdMccMnc mcc_mnc := '26242F'H) runs on test_CT {
f_init_gsup("SGSN_Test");
f_init_gtp("SGSN_Test");
f_init_vty();
+ f_vty_enable_echo_interval(g_use_echo);
}
type function void_fn(charstring id) runs on BSSGP_ConnHdlr;
@@ -874,6 +884,7 @@ type record PdpActPars {
OCT4 ggsn_tei_u, /* GGSN TEI User */
octetstring ggsn_ip_c, /* GGSN IP Control */
octetstring ggsn_ip_u, /* GGSN IP User */
+ OCT1 ggsn_restart_ctr, /* GGSN Restart Counter */
OCT4 sgsn_tei_c optional, /* SGSN TEI Control */
OCT4 sgsn_tei_u optional, /* SGSN TEI User */
@@ -1025,6 +1036,7 @@ template (value) PdpActPars t_PdpActPars(charstring ggsn_ip) := {
ggsn_tei_u := f_rnd_octstring(4),
ggsn_ip_c := f_inet_addr(ggsn_ip),
ggsn_ip_u := f_inet_addr(ggsn_ip),
+ ggsn_restart_ctr := int2oct(2, 1),
sgsn_tei_c := omit,
sgsn_tei_u := omit,
@@ -1251,6 +1263,46 @@ 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 {
+ var Gtp1cUnitdata g_ud;
+ var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+
+ /* first perform regular attach */
+ f_TC_attach(id);
+ /* Activate a pdp context against the GGSN */
+ f_pdp_ctx_act(apars);
+ /* Wait to receive first echo request and send initial Restart counter */
+ GTP.receive(tr_GTPC_MsgType(?, echoRequest, ?)) -> value g_ud {
+ var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber);
+ GTP.send(ts_GTPC_PONG(g_ud.peer, seq_nr, apars.ggsn_restart_ctr));
+ }
+ /* Wait to receive second echo request and send incremented Restart
+ counter. This will fake a restarted GGSN, and pdp ctx allocated
+ should be released by SGSN */
+ apars.ggsn_restart_ctr := int2oct(oct2int(apars.ggsn_restart_ctr) + 1, 1);
+ GTP.receive(tr_GTPC_MsgType(?, echoRequest, ?)) -> value g_ud {
+ var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber);
+ GTP.send(ts_GTPC_PONG(g_ud.peer, seq_nr, apars.ggsn_restart_ctr));
+ }
+ var OCT1 cause_network_failure := int2oct(38, 1)
+ alt {
+ [] BSSGP.receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_REQ_MT(apars.tid, cause_network_failure, true))) {
+ BSSGP.send(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid));
+ setverdict(pass);
+ }
+ [] as_xid(apars);
+ }
+ setverdict(pass);
+}
+testcase TC_attach_restart_ctr_dettach() 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.done;
+ g_use_echo := false
+}
+
private function f_TC_hlr_location_cancel_request_update(charstring id) runs on BSSGP_ConnHdlr {
/* MS: perform regular attach */
f_TC_attach(id);
@@ -1625,6 +1677,7 @@ 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() );
}
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index 1949199..f2f2500 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<testsuite name='Titan' tests='25' failures='5' errors='3' skipped='0' inconc='0' time='MASKED'>
+<testsuite name='Titan' tests='26' failures='5' 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'/>
@@ -65,4 +65,5 @@
<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'/>
</testsuite>