Change in ...osmo-ttcn3-hacks[master]: ggsn: Introduce test TC_pdp_act2_recovery

pespin gerrit-no-reply at lists.osmocom.org
Tue Aug 27 13:05:37 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15283 )

Change subject: ggsn: Introduce test TC_pdp_act2_recovery
......................................................................

ggsn: Introduce test TC_pdp_act2_recovery

Some code is moved out of f_pdp_ctx_act() into f_handle_create_req() in
order to re-use it in the test.

Related: OS#4165
Change-Id: I48c1bc9287ce8b820e5ea672dffbc5a8503f16d7
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/expected-results.xml
2 files changed, 111 insertions(+), 42 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index e294fb7..4a53fa1 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -267,6 +267,51 @@
 		}
 	}
 
+	function f_handle_create_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in OCT1 exp_cause := '80'O) runs on GT_CT {
+		var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse;
+		if (exp_cause == '80'O and exp_cause == cpr.cause.causevalue) {
+			/*  Check if EUA type corresponds to requested type */
+			if (match(ctx.eua, t_EuaIPv4(?)) and
+			    not match(cpr.endUserAddress, tr_EuaIPv4(?))){
+				setverdict(fail);
+			}
+			if (match(ctx.eua, t_EuaIPv6(?)) and
+			    not match(cpr.endUserAddress, tr_EuaIPv6(?))) {
+				setverdict(fail);
+			}
+			if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and
+			    not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) {
+				setverdict(fail);
+			}
+			/* Check if PCO response corresponds to request */
+			if (ispresent(ctx.pco_req)) {
+				if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and
+				    not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) {
+					log("IPv4 DNS Container requested, but missing");
+					setverdict(fail);
+				}
+				if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and
+				    not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) {
+					log("IPv6 DNS Container requested, but missing");
+					setverdict(fail);
+				}
+			}
+			ctx.teid_remote := cpr.teidDataI.teidDataI;
+			ctx.teic_remote := cpr.teidControlPlane.teidControlPlane;
+			ctx.eua := cpr.endUserAddress;
+			ctx.pco_neg := cpr.protConfigOptions;
+			setverdict(pass);
+		} else if (exp_cause != '80'O and exp_cause == cpr.cause.causevalue) {
+			if (ispresent(cpr.endUserAddress)) {
+				log("EUA received on createPDPContextResponse cause=" & oct2str(cpr.cause.causevalue));
+				setverdict(fail);
+			}
+			setverdict(pass);
+		} else {
+			setverdict(fail);
+		}
+	}
+
 	/* send a PDP context activation */
 	function f_pdp_ctx_act(inout PdpContext ctx, OCT1 exp_cause := '80'O) runs on GT_CT {
 		var Gtp1cUnitdata ud;
@@ -280,48 +325,7 @@
 		d := activate(pingpong());
 		alt {
 			[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctx.teic)) -> value ud {
-				var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse;
-				if (exp_cause == '80'O and exp_cause == cpr.cause.causevalue) {
-					/*  Check if EUA type corresponds to requested type */
-					if (match(ctx.eua, t_EuaIPv4(?)) and
-					    not match(cpr.endUserAddress, tr_EuaIPv4(?))){
-						setverdict(fail);
-					}
-					if (match(ctx.eua, t_EuaIPv6(?)) and
-					    not match(cpr.endUserAddress, tr_EuaIPv6(?))) {
-						setverdict(fail);
-					}
-					if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and
-					    not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) {
-						setverdict(fail);
-					}
-					/* Check if PCO response corresponds to request */
-					if (ispresent(ctx.pco_req)) {
-						if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and
-						    not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) {
-							log("IPv4 DNS Container requested, but missing");
-							setverdict(fail);
-						}
-						if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and
-						    not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) {
-							log("IPv6 DNS Container requested, but missing");
-							setverdict(fail);
-						}
-					}
-					ctx.teid_remote := cpr.teidDataI.teidDataI;
-					ctx.teic_remote := cpr.teidControlPlane.teidControlPlane;
-					ctx.eua := cpr.endUserAddress;
-					ctx.pco_neg := cpr.protConfigOptions;
-					setverdict(pass);
-				} else if (exp_cause != '80'O and exp_cause == cpr.cause.causevalue) {
-					if (ispresent(cpr.endUserAddress)) {
-						log("EUA received on createPDPContextResponse cause=" & oct2str(cpr.cause.causevalue));
-						setverdict(fail);
-					}
-					setverdict(pass);
-				} else {
-					setverdict(fail);
-				}
+				f_handle_create_req(ctx, ud, exp_cause);
 			}
 		}
 		deactivate(d);
@@ -1359,6 +1363,69 @@
 		f_pdp_ctx_del(ctx4, '1'B);
 	}
 
+	/* Validate if 2nd CtxCreateReq with increased Recovery IE causes ggsn to drop 1st one (while keeping 2nd one). */
+	testcase TC_pdp_act2_recovery() runs on GT_CT {
+		var Gtp1cUnitdata ud;
+		var default d;
+		var boolean ctxA_deleted := false;
+		var boolean ctxB_created := false;
+
+		f_init();
+		var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
+		var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
+		f_pdp_ctx_act(ctxA);
+
+		g_restart_ctr := int2oct(oct2int(g_restart_ctr) + 1, 1);
+
+		log("sending 2nd CreatePDP (recovery increased)");
+		f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctxB.imsi, g_restart_ctr,
+						  ctxB.teid, ctxB.teic, ctxB.nsapi, ctxB.eua, ctxB.apn,
+						  g_sgsn_ip_c, g_sgsn_ip_u, ctxB.msisdn, ctxB.pco_req));
+		T_default.start;
+		d := activate(pingpong());
+		alt {
+			[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctxB.teic)) -> value ud {
+				f_handle_create_req(ctxB, ud);
+				if (not ctxB_created) {
+					ctxB_created := true;
+					setverdict(pass);
+				} else {
+					setverdict(fail, "Repeated createPDPContextResponse(ctxB)");
+				}
+
+				if (not ctxA_deleted) {
+					repeat;
+				}
+			}
+			[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxA.teic)) -> value ud {
+				if (ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) {
+					setverdict(pass);
+				} else {
+					setverdict(fail);
+				}
+
+				if (not ctxA_deleted) {
+					ctxA_deleted := true;
+					setverdict(pass);
+				} else {
+					setverdict(fail, "Repeated deletePDPContextRequest(ctxA)");
+				}
+
+				if (not ctxB_created) {
+					repeat;
+				}
+			}
+			[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxB.teic)) -> value ud {
+				setverdict(fail, "GGSN dropping still valid pdp ctx");
+			}
+		}
+		deactivate(d);
+		T_default.stop;
+
+		f_pdp_ctx_del(ctxB, '1'B);
+	}
+
+
 	/* Send a duplicate echo req. osmo-ggsn maintains a queue for sent
 	   responses (60 seconds): If same delete req is sent and duplicate is
 	   detected, saved duplicate response should be sent back. */
@@ -1433,6 +1500,7 @@
 		execute(TC_pdp46_act_deact_apn4());
 
 		execute(TC_echo_req_resp());
+		execute(TC_pdp_act2_recovery());
 		execute(TC_act_deact_retrans_duplicate());
 
 		if (m_ggsn_supports_echo_interval) {
diff --git a/ggsn_tests/expected-results.xml b/ggsn_tests/expected-results.xml
index c31c14a..baa5b1f 100644
--- a/ggsn_tests/expected-results.xml
+++ b/ggsn_tests/expected-results.xml
@@ -23,6 +23,7 @@
   <testcase classname='GGSN_Tests' name='TC_pdp46_clients_interact' time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_pdp46_act_deact_apn4' time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_echo_req_resp' time='MASKED'/>
+  <testcase classname='GGSN_Tests' name='TC_pdp_act2_recovery' time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_act_deact_retrans_duplicate' time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_pdp_act_restart_ctr_echo' time='MASKED'/>
 </testsuite>

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15283
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I48c1bc9287ce8b820e5ea672dffbc5a8503f16d7
Gerrit-Change-Number: 15283
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190827/f19be4b2/attachment.html>


More information about the gerrit-log mailing list