pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37625?usp=email )

Change subject: sgsn: Introduce test TC_attach_pdp_act_pmm_idle_lost_pdp_status
......................................................................

sgsn: Introduce test TC_attach_pdp_act_pmm_idle_lost_pdp_status

Related: SYS#5435
Change-Id: I34a0dabc37ba24d0c9fb1ae2587e7ec8c1b606fa
---
M sgsn/BSSGP_ConnHdlr.ttcn
M sgsn/SGSN_Tests_Iu.ttcn
M sgsn/expected-results.xml
3 files changed, 80 insertions(+), 14 deletions(-)

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




diff --git a/sgsn/BSSGP_ConnHdlr.ttcn b/sgsn/BSSGP_ConnHdlr.ttcn
index 98e0e0e..0eb24e4 100644
--- a/sgsn/BSSGP_ConnHdlr.ttcn
+++ b/sgsn/BSSGP_ConnHdlr.ttcn
@@ -630,10 +630,12 @@
        }
 }

-function f_service_request(ServiceType service_type := SERVICE_TYPE_Signalling,
+function f_service_request(inout PdpActPars apars,
+                          ServiceType service_type := SERVICE_TYPE_Signalling,
                           template (value) OCT2 pdp_status := '0000'O,
+                          boolean exp_ggsn_pdp_del := false,
                           integer ran_index := 0,
-                          float Tval := 2.0) runs on BSSGP_ConnHdlr {
+                          float Tval := 5.0) runs on BSSGP_ConnHdlr {
        timer T := Tval;

        if (not is_iu(ran_index)) {
@@ -648,12 +650,23 @@
                  ran_index);

        T.start;
+
+       if (exp_ggsn_pdp_del) {
+               alt {
+               [] as_ggsn_gtp_ctx_del_req(apars) { setverdict(pass); }
+               [] T.timeout {
+                       Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+                               "Timeout completing the DeletePDPCtx 
procedure");
+                       }
+               }
+       }
+
        alt {
        [] as_service_request(ran_index) { setverdict(pass); }
        [] BSSAP.receive { repeat; }
        [] T.timeout {
                Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
-                       "Timeout completing the RAU procedure");
+                       "Timeout completing the Service Request procedure");
                }
        }
 }
@@ -795,6 +808,17 @@
        }
 }

+altstep as_ggsn_gtp_ctx_del_req(inout PdpActPars apars) runs on BSSGP_ConnHdlr 
{
+       var Gtp1cUnitdata g_ud;
+
+       [] GTP[GTP_GGSN_IDX].receive(tr_GTPC_MsgType(?, 
deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud {
+               var integer seq_nr := 
oct2int(g_ud.gtpc.opt_part.sequenceNumber);
+               GTP[GTP_GGSN_IDX].send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr,
+                                                            apars.sgsn_tei_c,
+                                                            
GTP_CAUSE_REQUEST_ACCEPTED));
+       }
+}
+
 altstep as_pdp_ctx_act_gb(inout PdpActPars apars, integer ran_index := 0) runs 
on BSSGP_ConnHdlr {
        var boolean exp_rej := ispresent(apars.exp_rej_cause);

@@ -886,15 +910,10 @@
        var Gtp1cUnitdata g_ud;

        f_send_l3(ts_SM_DEACT_PDP_REQ_MO(apars.tid, cause, false, omit), 
ran_index);
-       GTP[GTP_GGSN_IDX].receive(tr_GTPC_MsgType(?, deletePDPContextRequest, 
apars.ggsn_tei_c)) -> value g_ud {
-               var integer seq_nr := 
oct2int(g_ud.gtpc.opt_part.sequenceNumber);
-               if (is_gb(ran_index)) {
-                       BSSGP[ran_index].clear;
-               }
-               GTP[GTP_GGSN_IDX].send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr,
-                                                            apars.sgsn_tei_c,
-                                                            
GTP_CAUSE_REQUEST_ACCEPTED));
+       if (is_gb(ran_index)) {
+               BSSGP[ran_index].clear;
        }
+       as_ggsn_gtp_ctx_del_req(apars);
        alt {
        [is_gb(ran_index)] 
BSSGP[ran_index].receive(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid));
        [is_gb(ran_index)] as_xid(apars, ran_index);
diff --git a/sgsn/SGSN_Tests_Iu.ttcn b/sgsn/SGSN_Tests_Iu.ttcn
index 8806791..a6398eb 100644
--- a/sgsn/SGSN_Tests_Iu.ttcn
+++ b/sgsn/SGSN_Tests_Iu.ttcn
@@ -123,7 +123,7 @@
        /* first perform regular attach */
        f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, 
ran_index := 3);

-       f_service_request(ran_index := 3);
+       f_service_request(apars, ran_index := 3);

        f_pdp_ctx_act(apars, ran_index := 3);

@@ -151,7 +151,7 @@
        /* first perform regular attach */
        f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, 
ran_index := 3);

-       f_service_request(ran_index := 3);
+       f_service_request(apars, ran_index := 3);

        f_pdp_ctx_act(apars, ran_index := 3);

@@ -162,7 +162,7 @@

        /* Now UE tries to send new data after a while of being IDLE.
         * SGSN recreates the Iu ctx and recovers the Direct Tunnel RNC<->GGSN: 
*/
-       f_service_request(pdp_status := '2000'O /*NSAPI=5*/, ran_index := 3);
+       f_service_request(apars, pdp_status := '2000'O /*NSAPI=5*/, ran_index 
:= 3);
        as_ranap_rab_ass_req(apars);
        as_ggsn_gtp_ctx_upd_req(apars, exp_dir_tun := true, ran_index := 3);

@@ -179,6 +179,42 @@
        f_cleanup();
 }

+/* TODO: same as TC_attach_pdp_act_pmm_idle, but with pdp_status=0000, meaning 
UE lost status about previous PDP Ctx.
+ * We should see SGSN doing DeletePDPCtxReq towards GGSN instead of 
UdatePDPCtxReq, then probably re-create it. */
+private function f_TC_attach_pdp_act_pmm_idle_lost_pdp_status(charstring id) 
runs on BSSGP_ConnHdlr {
+       var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip, 
mp_ranap_cfg[0].sctp_addr.local_ip_addr));
+
+       /* first perform regular attach */
+       f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, 
ran_index := 3);
+
+       f_service_request(apars, ran_index := 3);
+
+       f_pdp_ctx_act(apars, ran_index := 3);
+
+       f_iu_release_req(ts_RanapCause_radio_conn_release);
+       /* Now UE is in PMM IDLE state at the SGSN.
+        * Expect SGSN to point GTPU at GGSN back to itself: */
+       as_ggsn_gtp_ctx_upd_req(apars, exp_dir_tun := false, ran_index := 3);
+
+       /* Now UE tries to send new data after a while of being IDLE.
+        * It forgot its previous pdp status, hence := 0000.
+        * SGSN will delete previous PDP ctx at the GGSN. */
+       f_service_request(apars, pdp_status := '0000'O /*NSAPI=5*/, 
exp_ggsn_pdp_del := true, ran_index := 3);
+       f_pdp_ctx_act(apars, ran_index := 3);
+
+       /* Now UE is in PMM ENABLED state, tear it down to clean up: */
+       f_pdp_ctx_deact_mo(apars, '00'O, ran_index := 3);
+       setverdict(pass);
+}
+testcase TC_attach_pdp_act_pmm_idle_lost_pdp_status() runs on test_CT {
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       f_sleep(1.0);
+       vc_conn := 
f_start_handler(refers(f_TC_attach_pdp_act_pmm_idle_lost_pdp_status), 
testcasename(), g_gb, 1006);
+       vc_conn.done;
+       f_cleanup();
+}
+
 control {
        execute( TC_iu_attach() );
        execute( TC_iu_attach_encr() );
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index 8b17802..7b38e99 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -94,6 +94,7 @@
   <testcase classname='SGSN_Tests_Iu' name='TC_geran_attach_iu_rau' 
time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_user' 
time='MASKED'/>
   <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_pmm_idle' 
time='MASKED'/>
+  <testcase classname='SGSN_Tests_Iu' 
name='TC_attach_pdp_act_pmm_idle_lost_pdp_status' time='MASKED'/>
   <!-- SGSN_Tests_NS (handle_sns == true) testcases start here -->
   <testcase classname='SGSN_Tests_NS' name='TC_SNS_size' time='MASKED'/>
   <testcase classname='SGSN_Tests_NS' name='TC_SNS_size_too_big' 
time='MASKED'/>

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37625?usp=email
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: I34a0dabc37ba24d0c9fb1ae2587e7ec8c1b606fa
Gerrit-Change-Number: 37625
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to