summaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-08-23 18:58:53 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-08-23 19:13:34 +0200
commitfa1ca02d34f407be3dac2edb8b38ac2ab221e91d (patch)
tree15c9f6afea0a0a03fc31e9985f978778b6cc3f73 /ggsn_tests
parent6916ec46489eef46f84cb286666f25a3c707b67e (diff)
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
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn152
-rw-r--r--ggsn_tests/expected-results.xml1
2 files changed, 111 insertions, 42 deletions
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 @@ module GGSN_Tests {
}
}
+ 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 @@ module GGSN_Tests {
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 @@ module GGSN_Tests {
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 @@ module GGSN_Tests {
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>