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

Change subject: 5gc: Place PDU Session params into its own subrecord
......................................................................

5gc: Place PDU Session params into its own subrecord

This way we properly split between layers, plus the fact that we'll
probably want to hold several concurrent pdu sessions in each UE in the
future.

Change-Id: Ibb0c8d3f0901d53e4aa75855e602234410fd00f9
---
M 5gc/C5G_Tests.ttcn
M 5gc/ConnHdlr.ttcn
2 files changed, 62 insertions(+), 46 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/5gc/C5G_Tests.ttcn b/5gc/C5G_Tests.ttcn
index 608bcf8..f72fef8 100644
--- a/5gc/C5G_Tests.ttcn
+++ b/5gc/C5G_Tests.ttcn
@@ -78,6 +78,20 @@
        ping_hostname := mp_ping_hostname
 }

+template (value) PDUSessionParams ts_PDUSessionParams(template (value) 
PDUSessionID id,
+                                                     template (value) 
RunProgParams run_prog_pars,
+                                                     template (value) OCT4 
ran_gtpu_teid) :=
+{
+       id := id,
+       run_prog_pars := run_prog_pars,
+       ran_gtpu_ip := mp_local_gtpu_ip,
+       ran_gtpu_teid := ran_gtpu_teid,
+       cn_gtpu_ip := omit,
+       cn_gtpu_teid := omit,
+       qfi := omit,
+       ue_ip := omit
+};
+
 template (value) UeParams ts_UeParams(integer idx) :=
 {
        idx := idx,
@@ -88,14 +102,10 @@
        apn := mp_apn,
        ran_id := idx,
        amf_id := omit,
-       run_prog_pars := ts_RunProgParams(idx),
-       ran_gtpu_ip := mp_local_gtpu_ip,
-       ran_gtpu_teid := int2oct(idx + 1, 4),
-       cn_gtpu_ip := omit,
-       cn_gtpu_teid := omit,
-       qfi := omit,
-       ue_ip := omit,
-       guti := omit
+       guti := omit,
+       sess_pars := ts_PDUSessionParams(id := 1,
+                                        run_prog_pars := ts_RunProgParams(idx),
+                                        ran_gtpu_teid := int2oct(idx + 1, 4))
 }

 type component MTC_CT {
@@ -324,7 +334,7 @@
        f_register();
        f_pdu_sess_establish();
        f_sleep(1.0);
-       f_ping4(g_pars.ue_pars.run_prog_pars.ping_hostname);
+       f_ping4(g_pars.ue_pars.sess_pars.run_prog_pars.ping_hostname);
        f_pdu_sess_release();
        f_deregister();
 }
diff --git a/5gc/ConnHdlr.ttcn b/5gc/ConnHdlr.ttcn
index 2f3344b..dbec212 100644
--- a/5gc/ConnHdlr.ttcn
+++ b/5gc/ConnHdlr.ttcn
@@ -65,6 +65,17 @@
        OCT32 kamf
 };

+type record PDUSessionParams {
+       PDUSessionID id,
+       RunProgParams run_prog_pars,
+       charstring ran_gtpu_ip,
+       OCT4 ran_gtpu_teid,
+       charstring cn_gtpu_ip optional,
+       OCT4 cn_gtpu_teid optional,
+       OCT1 qfi optional,
+       charstring ue_ip optional
+};
+
 /* parameters of emulated UE */
 type record UeParams {
        integer idx,
@@ -75,14 +86,8 @@
        charstring apn,
        RAN_UE_NGAP_ID ran_id,
        AMF_UE_NGAP_ID amf_id optional,
-       RunProgParams run_prog_pars,
-       charstring ran_gtpu_ip,
-       OCT4 ran_gtpu_teid,
-       charstring cn_gtpu_ip optional,
-       OCT4 cn_gtpu_teid optional,
-       OCT1 qfi optional,
-       charstring ue_ip optional,
-       octetstring guti optional
+       octetstring guti optional,
+       PDUSessionParams sess_pars
 };

 type record RunProgParams {
@@ -277,15 +282,15 @@
        for (var integer i := 0; i < lengthof(setup_req_transf.protocolIEs); i 
:= i + 1) {
                if (setup_req_transf.protocolIEs[i].id == 
id_UL_NGU_UP_TNLInformation) {
                        var UPTransportLayerInformation utli := 
setup_req_transf.protocolIEs[i].value_.uPTransportLayerInformation;
-                       g_pars.ue_pars.cn_gtpu_ip := 
f_inet_ntoa(bit2oct(utli.gTPTunnel.transportLayerAddress));
-                       g_pars.ue_pars.cn_gtpu_teid := utli.gTPTunnel.gTP_TEID;
+                       g_pars.ue_pars.sess_pars.cn_gtpu_ip := 
f_inet_ntoa(bit2oct(utli.gTPTunnel.transportLayerAddress));
+                       g_pars.ue_pars.sess_pars.cn_gtpu_teid := 
utli.gTPTunnel.gTP_TEID;
                }
        }

        /* Prepare Response for it: */
        utla := m_uPTransportLayerInformation_gTPTunnel(
-                       m_gTPTunnel(p_tla := 
oct2bit(f_inet_addr(g_pars.ue_pars.ran_gtpu_ip)),
-                                       p_gtp_teid := 
g_pars.ue_pars.ran_gtpu_teid));
+                       m_gTPTunnel(p_tla := 
oct2bit(f_inet_addr(g_pars.ue_pars.sess_pars.ran_gtpu_ip)),
+                                       p_gtp_teid := 
g_pars.ue_pars.sess_pars.ran_gtpu_teid));
        qos := m_qosFlowPerTNLInformation(utla, { m_associatedQosFlowItem(1) });
        setup_resp_transf := 
valueof(m_pDUSessionResourceSetupResponseTransfer(qos));
        setup_trans_enc := 
enc_NGAP_PDUSessionResourceSetupResponseTransfer(setup_resp_transf)
@@ -335,15 +340,16 @@
        var template (value) NG_NAS_UL_Message_Type nas_ul_msg;
        var NAS_PDU nas_pdu;
        var NG_NAS_DL_Message_Type rx_nas, inner_nas;
+       var OCT1 pdu_sess_id := int2oct(g_pars.ue_pars.sess_pars.id, 1);

-       nas_ul_msg := 
cs_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(cs_NG_PDU_SessionIdV('01'O), '01'O,
+       nas_ul_msg := 
cs_NG_PDU_SESSION_ESTABLISHMENT_REQUEST(cs_NG_PDU_SessionIdV(pdu_sess_id), 
'01'O,
                                                              
p_IntegrityProtMaxDataRate := cs_IntegrityProtMaxDataRateV('FF'O, 'FF'O),
                                                              p_PDU_SessionType 
:= cs_PDU_SessionTypeTV('001'B), /* IPv4 */
                                                              p_SSC_Mode := 
cs_SSC_ModeTV('001'B));
        nas_pdu := enc_NG_NAS_UL_Message_Type(valueof(nas_ul_msg));
        nas_ul_msg := 
cs_NG_UL_NAS_TRANSPORT(cs_PayloadContainerType(tsc_PayloadContainerESMMsg),
                                             cs_PayloadContainerLV(nas_pdu),
-                                            p_PDU_SessionId := 
cs_NG_PDU_SessionIdTV('01'O),
+                                            p_PDU_SessionId := 
cs_NG_PDU_SessionIdTV(pdu_sess_id),
                                             p_RequestType := 
cs_NG_Request_TypeTV('001'B),
                                             p_DNN := 
cs_DNN_TLV(f_enc_dns_hostname(g_pars.ue_pars.apn)));
        NGAP.send(nas_ul_msg);
@@ -353,10 +359,10 @@
        NGAP.receive(cr_NG_DL_NAS_TRANSPORT) -> value rx_nas;
        inner_nas := 
f_dec_NG_NAS_DL_Message_Payload_Container(rx_nas.dl_Nas_Transport.payloadContainerType.container,
                                                               
rx_nas.dl_Nas_Transport.payload.payload);
-       g_pars.ue_pars.qfi := 
inner_nas.pdu_Session_Establishment_Accept.authorizedQoSRules.listofQoSRules[0].identifier;
-       g_pars.ue_pars.ue_ip := 
f_inet_ntoa(inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo);
-       log("5GC assigned CN GTPU Address: ", g_pars.ue_pars.cn_gtpu_ip, " 
TEID: ", g_pars.ue_pars.cn_gtpu_teid);
-       log("5GC assigned UE IP address: ", g_pars.ue_pars.ue_ip);
+       g_pars.ue_pars.sess_pars.qfi := 
inner_nas.pdu_Session_Establishment_Accept.authorizedQoSRules.listofQoSRules[0].identifier;
+       g_pars.ue_pars.sess_pars.ue_ip := 
f_inet_ntoa(inner_nas.pdu_Session_Establishment_Accept.pduAddress.adressInfo);
+       log("5GC assigned CN GTPU Address: ", 
g_pars.ue_pars.sess_pars.cn_gtpu_ip, " TEID: ", 
g_pars.ue_pars.sess_pars.cn_gtpu_teid);
+       log("5GC assigned UE IP address: ", g_pars.ue_pars.sess_pars.ue_ip);

        f_pdu_sess_create_tun();
 }
@@ -472,8 +478,8 @@

        nas_cause := oct2bit(cmd.pDUSessionResourceReleaseCommandTransfer);

-       g_pars.ue_pars.cn_gtpu_ip := omit;
-       g_pars.ue_pars.cn_gtpu_teid := omit;
+       g_pars.ue_pars.sess_pars.cn_gtpu_ip := omit;
+       g_pars.ue_pars.sess_pars.cn_gtpu_teid := omit;

        /* Prepare Response for it: */
        resp := 
valueof(m_pDUSessionResourceReleasedItemRelRes(cmd.pDUSessionID, 
bit2oct(nas_cause)));
@@ -523,9 +529,9 @@
        var template (value) NG_NAS_UL_Message_Type nas_ul_msg;
        var NAS_PDU nas_pdu;
        var NG_NAS_DL_Message_Type rx_nas, inner_nas;
-       var OCT1 pdu_sess_id := '01'O;
        var ProcedureTransactionIdentifier pti := '02'O;
        var NAS_CauseValue_Type cause_val := c_5GSM_Cause_RegularDeactivation;
+       var OCT1 pdu_sess_id := int2oct(g_pars.ue_pars.sess_pars.id, 1);

        nas_ul_msg := 
cs_NG_PDU_SESSION_RELEASE_REQUEST(cs_NG_PDU_SessionIdV(pdu_sess_id), pti,
                                                        p_Cause := 
cs_GMM_GSM_Cause('59'O, cause_val));
@@ -548,8 +554,8 @@
                                        log2str("Unexpected decoded NAS Payload 
Container ", inner_nas));
        }
 
-       g_pars.ue_pars.qfi := omit;
-       g_pars.ue_pars.ue_ip := omit;
+       g_pars.ue_pars.sess_pars.qfi := omit;
+       g_pars.ue_pars.sess_pars.ue_ip := omit;

        nas_ul_msg := 
cs_NG_PDU_SESSION_RELEASE_COMPLETE(cs_NG_PDU_SessionIdV(pdu_sess_id), pti,
                                                         p_Cause := 
cs_GMM_GSM_Cause('59'O, cause_val));
@@ -568,18 +574,18 @@
        var template (value) UECUPS_GtpExtHdr_PduSessContainer pdu_sess_cont;

        pdu_sess_cont := 
ts_UECUPS_GtpExtHdr_PduSessContainer(UECUPS_GtpExtHdr_PduSessContainer_Type_ul_pdu_sess_info,
-                                                             
oct2int(g_pars.ue_pars.qfi));
+                                                             
oct2int(g_pars.ue_pars.sess_pars.qfi));
        gtp_ext_hdr := ts_UECUPS_GtpExtHdr(pdu_session_container := 
pdu_sess_cont);

        uecups_create := ts_UECUPS_CreateTun(
-               tx_teid := oct2int(g_pars.ue_pars.cn_gtpu_teid),
-               rx_teid := oct2int(g_pars.ue_pars.ran_gtpu_teid),
+               tx_teid := oct2int(g_pars.ue_pars.sess_pars.cn_gtpu_teid),
+               rx_teid := oct2int(g_pars.ue_pars.sess_pars.ran_gtpu_teid),
                user_addr_type := IPV4,
-               user_addr := f_inet_addr(g_pars.ue_pars.ue_ip),
-               local_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.ran_gtpu_ip))),
-               remote_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.cn_gtpu_ip))),
-               tun_dev_name := g_pars.ue_pars.run_prog_pars.tun_dev_name,
-               tun_netns_name := g_pars.ue_pars.run_prog_pars.tun_netns_name,
+               user_addr := f_inet_addr(g_pars.ue_pars.sess_pars.ue_ip),
+               local_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.sess_pars.ran_gtpu_ip))),
+               remote_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.sess_pars.cn_gtpu_ip))),
+               tun_dev_name := 
g_pars.ue_pars.sess_pars.run_prog_pars.tun_dev_name,
+               tun_netns_name := 
g_pars.ue_pars.sess_pars.run_prog_pars.tun_netns_name,
                gtp_ext_hdr := gtp_ext_hdr
        );

@@ -590,8 +596,8 @@
 function f_pdu_sess_delete_tun() runs on ConnHdlr {
        var template (value) UECUPS_DestroyTun uecups_destroy;
        uecups_destroy := ts_UECUPS_DestroyTun(
-               local_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.ran_gtpu_ip))),
-               rx_teid := oct2int(g_pars.ue_pars.ran_gtpu_teid)
+               local_gtp_ep := 
valueof(ts_UECUPS_SockAddr(f_inet_addr(g_pars.ue_pars.sess_pars.ran_gtpu_ip))),
+               rx_teid := oct2int(g_pars.ue_pars.sess_pars.ran_gtpu_teid)
        );
        f_gtp1u_destroy_tunnel(uecups_destroy);
 }
@@ -601,8 +607,8 @@
        var template (value) UECUPS_StartProgram sprog := 
ts_UECUPS_StartProgram(
                command := command,
                environment := {},
-               run_as_user := g_pars.ue_pars.run_prog_pars.run_as_user,
-               tun_netns_name := g_pars.ue_pars.run_prog_pars.tun_netns_name
+               run_as_user := 
g_pars.ue_pars.sess_pars.run_prog_pars.run_as_user,
+               tun_netns_name := 
g_pars.ue_pars.sess_pars.run_prog_pars.tun_netns_name
        );
        return valueof(sprog);
 }
@@ -610,7 +616,7 @@
 private function f_run_prog_unique_log_path() runs on ConnHdlr return 
charstring
 {
        var charstring id := testcasename() & "-" & 
hex2str(g_pars.ue_pars.imsi) & "-" & int2str(g_start_prog_count);
-       var charstring prefix :=  g_pars.ue_pars.run_prog_pars.log_path_prefix 
& "/" & id;
+       var charstring prefix :=  
g_pars.ue_pars.sess_pars.run_prog_pars.log_path_prefix & "/" & id;
        g_start_prog_count := g_start_prog_count + 1;
        return prefix;
 }
@@ -620,7 +626,7 @@
 {
        /* command will be filled in by f_gtp1u_ping4() below: */
        var UECUPS_StartProgram sprog := f_run_prog_init("");
-       f_gtp1u_ping4(sprog, host, interval, count, g_pars.ue_pars.ue_ip,
+       f_gtp1u_ping4(sprog, host, interval, count, 
g_pars.ue_pars.sess_pars.ue_ip,
                      redirect_output := true,
                      redirect_output_path_prefix := 
f_run_prog_unique_log_path());
 }

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibb0c8d3f0901d53e4aa75855e602234410fd00f9
Gerrit-Change-Number: 40892
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>

Reply via email to