lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39262?usp=email )


Change subject: SGSN: add testcases for PDP Context Status
......................................................................

SGSN: add testcases for PDP Context Status

Both the network and the UE can add a TLV which
describes the active PDPs from their perspective.

Change-Id: I5a29e667f53cc2834fbddd2c5dc901d3e6ae72c7
---
M library/L3_Templates.ttcn
M sgsn/SGSN_Tests.ttcn
2 files changed, 219 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/62/39262/1

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 9551845..1f868db 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -341,12 +341,33 @@
 };

 /* TS 24.008 10.5.7.1 PDPContextStatus */
-template (value) PDPContextStatusTLV ts_PDPContextStatusTLV(template (value) 
OCT2 status := '0000'O /* all inactive */) := {
-       elementIdentifier := '32'O,
-       lengthIndicator := 0, /* overwritten */
-       valueField := status
-};
+function tr_PDPContextStatusTLV(template OCT2 status := *) return template 
PDPContextStatusTLV {
+       if (istemplatekind(status, "omit")) {
+               return omit;
+       } else if (istemplatekind(status, "*")) {
+               return *;
+       } else {
+               var template PDPContextStatusTLV ret := {
+                       elementIdentifier := '32'O,
+                       lengthIndicator := ?,
+                       valueField := status
+               };
+               return ret;
+       }
+}

+function ts_PDPContextStatusTLV(template (omit) OCT2 status := omit) return 
template (omit) PDPContextStatusTLV {
+       if (istemplatekind(status, "omit")) {
+               return omit;
+       } else {
+               var template (omit) PDPContextStatusTLV ret := {
+                       elementIdentifier := '32'O,
+                       lengthIndicator := 0, /* overwritten */
+                       valueField := status
+               };
+               return ret;
+       }
+}

 /* Send template for LOCATION UPDATING REQUEST */
 template (value) PDU_ML3_MS_NW ts_LU_REQ(template (value) LocationUpdatingType 
lu_type,
@@ -2648,7 +2669,8 @@
                          template (omit) P_TMSI_TypeTV p_tmsi_type := omit,
                          template (omit) MobileIdentityTLV add_p_tmsi := omit,
                          template (omit) RoutingAreaIdentification2TLV add_rai 
:= omit,
-                         template (omit) MSNetworkCapabilityV ms_network_cap 
:= omit
+                         template (omit) MSNetworkCapabilityV ms_network_cap 
:= omit,
+                         template (omit) OCT2 pdp_status := omit
                ) := {
        discriminator := '0000'B, /* overwritten */
        tiOrSkip := {
@@ -2668,7 +2690,7 @@
                                tmsiStatus := omit,
                                ptmsi := ts_MI_TMSI_TLV(p_tmsi),
                                mSNetworkCapability := 
ts_GMM_MsNetCapTLV(ms_network_cap),
-                               pdpContextStatus := omit, /* TODO */
+                               pdpContextStatus := 
ts_PDPContextStatusTLV(pdp_status),
                                pC_LCSCapability := omit,
                                mBMS_ContextStatus := omit,
                                uENetworkCapability := omit,
@@ -2715,7 +2737,9 @@

 template PDU_L3_SGSN_MS tr_GMM_RAU_ACCEPT(template BIT3 res := ?,
                                          template RoutingAreaIdentificationV 
ra := ?,
-                                         template OCT4 ptmsi := *) := {
+                                         template OCT4 ptmsi := *,
+                                         template OCT2 pdp_status := *
+                               ) := {
        discriminator := '1000'B,
        tiOrSkip := {
                skipIndicator := '0000'B
@@ -2737,7 +2761,7 @@
                                t3302 := *,
                                cellNotification := *,
                                equivalentPLMNs := *,
-                               pdpContextStatus := *,
+                               pdpContextStatus := 
tr_PDPContextStatusTLV(pdp_status),
                                networkFeatureSupport := *,
                                emergencyNumberList := *,
                                mBMS_ContextStatus := *,
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index ca99a02..6efc446 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -2579,6 +2579,189 @@
        f_cleanup();
 }

+private function f_TC_attach_pdp_act_rau_pdp_ctx_status_same(charstring id) 
runs on BSSGP_ConnHdlr {
+       var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+       var PDU_L3_SGSN_MS l3_mt;
+       var integer ran_index := 0;
+
+       /* first perform regular attach */
+       f_TC_attach(id);
+       /* then activate PDP context */
+       f_pdp_ctx_act(apars);
+
+       f_send_l3(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, old_ra := 
g_pars.ra, pdp_status := '2000'O /* NSAPI 5 */), ran_index);
+
+       timer T := 2.0;
+       T.start;
+       alt {
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT(pdp_status := '2000'O)) 
-> value l3_mt {
+               
f_process_rau_accept(l3_mt.msgs.gprs_mm.routingAreaUpdateAccept, ran_index);
+               f_send_l3(ts_GMM_RAU_COMPL, ran_index);
+               setverdict(pass);
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT) {
+               setverdict(fail, "Rx RAU ACCEPT with wrong PDP status");
+               mtc.stop;
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_REJECT);
+       [] BSSGP[ran_index].receive(tr_LLC_XID_MT_CMD(?, ?)) {
+               /* Ignore XID Reset */
+               repeat;
+               }
+       [] as_gmm_auth(ran_index := ran_index, expect_sai := true) { repeat; };
+       [] T.timeout {
+               setverdict(fail, "Timeout rx RAU Reject");
+               mtc.stop;
+               }
+       }
+}
+
+/* Attach, RAU with PDP Ctx Status */
+testcase TC_attach_pdp_act_rau_pdp_ctx_status_same() runs on test_CT {
+       /* MS <-> SGSN: Attach Procedure
+        * MS <-> SGSN: PDP Activate
+        * MS  -> SGSN: RAU Request with PDP Ctx status
+        * MS <-> SGSN: Auth...
+        * MS <-  SGSN: RAU Accept with PDP Ctx status
+        * MS  -> SGSN: RAU Complete
+        */
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       vc_conn := 
f_start_handler(refers(f_TC_attach_pdp_act_rau_pdp_ctx_status_same), 
testcasename(), g_gb, 26);
+       vc_conn.done;
+       f_cleanup();
+}
+
+private function f_TC_attach_pdp_act_rau_pdp_ctx_status_ue_more(charstring id) 
runs on BSSGP_ConnHdlr {
+       var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+       var PDU_L3_SGSN_MS l3_mt;
+       var integer ran_index := 0;
+
+       /* first perform regular attach */
+       f_TC_attach(id);
+       /* then activate PDP context */
+       f_pdp_ctx_act(apars);
+
+       f_send_l3(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, old_ra := 
g_pars.ra, pdp_status := '6000'O /* NSAPI 5,6 */), ran_index);
+
+       timer T := 2.0;
+       T.start;
+       alt {
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT(pdp_status := '2000'O)) 
-> value l3_mt {
+               
f_process_rau_accept(l3_mt.msgs.gprs_mm.routingAreaUpdateAccept, ran_index);
+               f_send_l3(ts_GMM_RAU_COMPL, ran_index);
+               setverdict(pass);
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT) {
+               setverdict(fail, "Rx RAU ACCEPT with wrong PDP status");
+               mtc.stop;
+               }
+       [] BSSGP[ran_index].receive(tr_SM_DEACT_PDP_REQ_MT(?, ?)) {
+               setverdict(fail, "Rx unexpected Deact PDP Req");
+               mtc.stop;
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_REJECT);
+       [] BSSGP[ran_index].receive(tr_LLC_XID_MT_CMD(?, ?)) {
+               /* Ignore XID Reset */
+               repeat;
+               }
+       [] as_gmm_auth(ran_index := ran_index, expect_sai := true) { repeat; };
+       [] T.timeout {
+               setverdict(fail, "Timeout rx RAU Reject");
+               mtc.stop;
+               }
+       }
+}
+
+/* Attach, RAU with PDP Ctx Status */
+testcase TC_attach_pdp_act_rau_pdp_ctx_status_ue_more() runs on test_CT {
+       /* MS <-> SGSN: Attach Procedure
+        * MS <-> SGSN: PDP Activate
+        * MS  -> SGSN: RAU Request with PDP Ctx status (more PDP Ctx than 
expected)
+        * MS <-> SGSN: Auth...
+        * MS <-  SGSN: RAU Accept with PDP Ctx status
+        * MS  -> SGSN: RAU Complete
+        */
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       vc_conn := 
f_start_handler(refers(f_TC_attach_pdp_act_rau_pdp_ctx_status_ue_more), 
testcasename(), g_gb, 26);
+       vc_conn.done;
+       f_cleanup();
+}
+
+private function f_TC_attach_pdp_act_rau_pdp_ctx_status_ue_less(charstring id) 
runs on BSSGP_ConnHdlr {
+       var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+       var PDU_L3_SGSN_MS l3_mt;
+       var integer ran_index := 0;
+
+       /* first perform regular attach */
+       f_TC_attach(id);
+       /* then activate PDP context */
+       f_pdp_ctx_act(apars);
+
+       f_send_l3(ts_GMM_RAU_REQ(f_mi_get_lv(), GPRS_UPD_T_RA, old_ra := 
g_pars.ra, pdp_status := '0000'O), ran_index);
+
+       timer T := 2.0;
+       T.start;
+       alt {
+       [] as_ggsn_gtp_ctx_del_req(apars) {}
+       [] as_gmm_auth(ran_index := ran_index, expect_sai := true) { repeat; };
+       [] BSSGP[ran_index].receive(tr_LLC_XID_MT_CMD(?, ?)) {
+               /* Ignore XID Reset */
+               repeat;
+               }
+       [] T.timeout {
+               setverdict(fail, "Timeout rx RAU Reject");
+               mtc.stop;
+               }
+       }
+
+       T.start;
+       alt {
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT(pdp_status := '0000'O)) 
-> value l3_mt {
+               
f_process_rau_accept(l3_mt.msgs.gprs_mm.routingAreaUpdateAccept, ran_index);
+               f_send_l3(ts_GMM_RAU_COMPL, ran_index);
+               setverdict(pass);
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_ACCEPT) {
+               setverdict(fail, "Rx RAU ACCEPT with wrong PDP status");
+               mtc.stop;
+               }
+       [] BSSGP[ran_index].receive(tr_SM_DEACT_PDP_REQ_MT(?, ?)) {
+               setverdict(fail, "Rx unexpected Deact PDP Req");
+               mtc.stop;
+               }
+       [] BSSGP[ran_index].receive(tr_GMM_RAU_REJECT);
+       [] BSSGP[ran_index].receive(tr_LLC_XID_MT_CMD(?, ?)) {
+               /* Ignore XID Reset */
+               repeat;
+               }
+       [] as_gmm_auth(ran_index := ran_index, expect_sai := true) { repeat; };
+       [] T.timeout {
+               setverdict(fail, "Timeout rx RAU Reject");
+               mtc.stop;
+               }
+       }
+}
+
+/* Attach, RAU with PDP Ctx Status */
+testcase TC_attach_pdp_act_rau_pdp_ctx_status_ue_less() runs on test_CT {
+       /* MS <-> SGSN: Attach Procedure
+        * MS <-> SGSN: PDP Activate
+        * MS  -> SGSN: RAU Request with PDP Ctx status (less PDP Ctx than 
expected)
+        * MS <-> SGSN: Auth...
+        * SGSN -> GGSN: close PDP without notifing the MS
+        * MS <-  SGSN: RAU Accept with PDP Ctx status
+        * MS  -> SGSN: RAU Complete
+        */
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       vc_conn := 
f_start_handler(refers(f_TC_attach_pdp_act_rau_pdp_ctx_status_ue_less), 
testcasename(), g_gb, 26);
+       vc_conn.done;
+       f_cleanup();
+}
+
+
 private function f_TC_attach_req_id_req_ra_update(charstring id) runs on 
BSSGP_ConnHdlr {
        var RoutingAreaIdentificationV old_ra := f_random_RAI();
        var RoutingAreaIdentificationV new_ra := f_random_RAI();
@@ -3475,6 +3658,9 @@
        execute( TC_attach_pdp_act_deact_gtp_retrans_resp() );
        execute( TC_attach_pdp_act_user_error_ind_ggsn() );
        execute( TC_attach_pdp_act_gmm_detach() );
+       execute( TC_attach_pdp_act_rau_pdp_ctx_status_same() );
+       execute( TC_attach_pdp_act_rau_pdp_ctx_status_ue_more() );
+       execute( TC_attach_pdp_act_rau_pdp_ctx_status_ue_less() );
        execute( TC_attach_gmm_attach_req_while_gmm_attach() );
        execute( TC_attach_gmm_attach_req_while_gmm_attach_retransmit() );
        execute( TC_attach_gmm_attach_req_while_gmm_attach_changed() );

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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5a29e667f53cc2834fbddd2c5dc901d3e6ae72c7
Gerrit-Change-Number: 39262
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>

Reply via email to