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


Change subject: sgsn: TC_sgsn_context_req_in: match PDP Context IE
......................................................................

sgsn: TC_sgsn_context_req_in: match PDP Context IE

Change-Id: I965c0200ea380c55dc0cd8d3f8e5110883ce2646
Related: SYS#6603, OS#6294
---
M library/GTPv1C_Templates.ttcn
M sgsn/SGSN_Tests.ttcn
2 files changed, 82 insertions(+), 7 deletions(-)



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

diff --git a/library/GTPv1C_Templates.ttcn b/library/GTPv1C_Templates.ttcn
index 2eb1d7e..ecc84ad 100644
--- a/library/GTPv1C_Templates.ttcn
+++ b/library/GTPv1C_Templates.ttcn
@@ -464,6 +464,51 @@
                pdp_addresslength2 := omit,
                pdp_Address2 := omit
        }
+       template (present) PDP_Context_GTPC tr_PDP_Context_GTPC(template 
(present) octetstring pdp_addr := ?,
+                                                               template 
(present) octetstring ggsn_gsn_addr := ?,
+                                                               template 
(present) octetstring apn := ?,
+                                                               template 
(present) OCT4 ggsn_teic := ?,
+                                                               template 
(present) OCT4 ggsn_teid := ?) := {
+               type_gtpc := '82'O,
+               lengthf := ?, /* overwritten */
+               nsapi := ?,
+               order := ?,
+               asi := ?,
+               vaa := ?,
+               ea := ?,
+               sapi := ?,
+               spare1 := ?,
+               qos_subLength := ?, /* overwritten */
+               qos_sub := ?,
+               qos_reqLength := ?, /* overwritten */
+               qos_req := ?,
+               qos_negLength := ?, /* overwritten */
+               qos_neg := ?,
+               snd := ?,
+               snu := ?,
+               sendNPDUnum := ?,
+               receiveNPDUnum := ?,
+               uteidControlPlane := ggsn_teic,
+               uteidData1 := ggsn_teid,
+               pdpcontext := ?,
+               pdp_typeorg := ?,
+               spare2 := ?,
+               pdp_typenum := ?,
+               pdp_addressLength := ?, /* overwritten */
+               pdp_address := pdp_addr,
+               ggsn_addressControlPlaneLength := ?, /* overwritten */
+               ggsn_addressControlPlane := ggsn_gsn_addr,
+               ggsn_addressUserPlaneLength := ?, /* overwritten */
+               ggsn_addressUserPlane := ggsn_gsn_addr,
+               apnLength := ?, /* overwritten */
+               apn := apn,
+               transactionId := ?,
+               spare3 := ?,
+               transactionID_cont := ?,
+               pdp_typenum2 := *,
+               pdp_addresslength2 := *,
+               pdp_Address2 := *
+       }


        /* template matching reception of GTP-C unit-data */
@@ -1280,7 +1325,9 @@

        /* SGSN Context Response - 7.5.4 */
        template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) 
GTP_Cause cause := ?,
-                                                         template hexstring 
imsi := *) := {
+                                                          template hexstring 
imsi := *,
+                                                          template MM_Context 
mm_context := *,
+                                                          template 
PDP_Context_GTPC_List pdp_ctx_list := *) := {
                sgsn_ContextResponse := {
                        cause := tr_Cause_gtpc(cause),
                        imsi := f_tr_Imsi(imsi),
@@ -1290,8 +1337,8 @@
                        radioPriority := *,
                        packetFlowID := *,
                        charging_char := *,
-                       mm_Context := *,
-                       pdp_Context := *,
+                       mm_Context := mm_context,
+                       pdp_Context := pdp_ctx_list,
                        sgsn_addr_controlPlane := *,
                        pdpContextPriorization := *,
                        radioPriority_LCS := *,
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index da1511b..6d7079e 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -3730,6 +3730,7 @@
 /* SGSN terminated SGSN Context Request procedure (we request, SGSN responds)
  * 3GPP TS 23.401, Figure D.3.6-1: "Gn/Gp SGSN to MME Tracking Area Update 
procedure" */
 private function f_TC_sgsn_context_req_in(charstring id) runs on 
BSSGP_ConnHdlr {
+       var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
        var integer seq_nr := f_rnd_int(65535);
        var Gtp1cUnitdata gtpc_ud;
        timer T;
@@ -3742,6 +3743,8 @@

        /* The MS attaches to GERAN/UTRAN and enjoys the service */
        f_gmm_attach(false, false);
+       /* The MS activates a PDP context */
+       f_pdp_ctx_act(apars);

        /* The MS switches to an LTE cell and performs Tracking Area Update 
Request there.
         * The MME requests information about the MS by sending SGSN Context 
Request. */
@@ -3753,14 +3756,25 @@
                                        ptmsi_sig := ts_PTMSI_sig('010203'O));
        GTP.send(ts_GTPC_SGSNContextReq(peer, seq_nr, ctx_req));

+       /* Expected PDP Context parameters */
+       var template (present) PDP_Context_GTPC pdp_ctx;
+       pdp_ctx := tr_PDP_Context_GTPC(ggsn_gsn_addr := f_inet_addr(mp_ggsn_ip),
+                                      apn := ''O);
+       pdp_ctx.pdp_typeorg := apars.addr.pdpTypeOrg;
+       pdp_ctx.pdp_typenum := apars.addr.pdpTypeNum;
+       pdp_ctx.pdp_address := ''O; /* omit in t_AddrIPv4dyn */
+       pdp_ctx.nsapi := apars.nsapi;
+       pdp_ctx.sapi := apars.sapi;
+
        /* The SGSN responds with subscriber's IMSI */
        var template (present) GTPC_PDUs ctx_rsp;
        ctx_rsp := tr_SGSNContextRespPDU(cause := GTP_CAUSE_REQUEST_ACCEPTED,
-                                        imsi := g_pars.imsi);
+                                        imsi := g_pars.imsi,
+                                        pdp_ctx_list := { pdp_ctx });

        /* SGSN Address for Control Plane */
        var octetstring sgsn_addr := f_inet_addr(mp_sgsn_gtp_ip);
-       ctx_rsp.sgsn_ContextResponse.sgsn_addr_controlPlane := 
tr_GsnAddr(mp_sgsn_gtp_ip);
+       ctx_rsp.sgsn_ContextResponse.sgsn_addr_controlPlane := 
tr_GsnAddr(sgsn_addr);

        /* Match MM Context */
        if (ispresent(g_pars.vec)) {
@@ -3772,8 +3786,6 @@
                 * See also 3GPP TS 29.060, section 7.7.28 and Table 47A */
        }

-       /* TODO: match PDP Context */
-
        T.start(2.0);
        alt {
        [] GTP.receive(tr_GTPC_SGSNContextResp(?, ?, ctx_rsp)) -> value gtpc_ud 
{
@@ -3793,6 +3805,12 @@
        /* HLR/HSS tells SGSN to forget this MS/UE */
        GSUP.send(ts_GSUP_CL_REQ(g_pars.imsi, OSMO_GSUP_CANCEL_TYPE_UPDATE));
        GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi));
+
+       /* SGSN deletes the PDP context at GGSN */
+       GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, 
apars.ggsn_tei_c)) -> value gtpc_ud {
+               seq_nr := oct2int(gtpc_ud.gtpc.opt_part.sequenceNumber);
+               GTP.send(ts_GTPC_DeletePdpResp(gtpc_ud.peer, seq_nr, 
apars.sgsn_tei_c, '7F'O));
+       }
 }
 testcase TC_sgsn_context_req_in() runs on test_CT {
        var BSSGP_ConnHdlr vc_conn;

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36601?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: I965c0200ea380c55dc0cd8d3f8e5110883ce2646
Gerrit-Change-Number: 36601
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to