Change in osmo-ttcn3-hacks[master]: sgsn: Add test to verify restart_ctr during echo req/reply.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 16 17:46:18 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9950 )

Change subject: sgsn: Add test to verify restart_ctr during echo req/reply.
......................................................................

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
---
M sgsn/SGSN_Tests.ttcn
M sgsn/expected-results.xml
2 files changed, 55 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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>

-- 
To view, visit https://gerrit.osmocom.org/9950
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1dcb250dba2079c14b857c0b89a02ac21d1c591f
Gerrit-Change-Number: 9950
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180716/4c55d944/attachment.htm>


More information about the gerrit-log mailing list