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


Change subject: WIP
......................................................................

WIP

Change-Id: I816c8357ec1404f9435a98e196a84c7e5234d910
---
M deps/Makefile
M library/PFCP_Templates.ttcn
M smf/SMF_Session_CT.ttcn
M smf/SMF_Tests.cfg
M smf/SMF_Tests.ttcn
M smf/gen_links.sh
M smf/regen_makefile.sh
7 files changed, 222 insertions(+), 22 deletions(-)



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

diff --git a/deps/Makefile b/deps/Makefile
index 8abd962..b84fb68 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -107,7 +107,7 @@
 titan.ProtocolModules.SUA_commit=              R.5.A-5-gcf1137a
 titan.ProtocolModules.TCP_commit=              R.3.A-5-g39e5f45
 titan.ProtocolModules.UDP_commit=              R.4.A-5-geea8aa3
-titan.ProtocolModules.PFCP_v15.1.0_commit=     
f2e70e48265386264b3fad1b92de484c344e0656
+titan.ProtocolModules.PFCP_v15.1.0_commit=     
5dab1784365253eacde7819b4e0a4b07e97b5177
 titan.TestPorts.AF_PACKET_commit=              0.1-5-g89ebea6
 titan.TestPorts.Common_Components.Socket-API_commit=   R.6.A-6-gf4380d0
 titan.TestPorts.Common_Components.Abstract_Socket_commit=      R.9.B-4-gbd41994
diff --git a/library/PFCP_Templates.ttcn b/library/PFCP_Templates.ttcn
index 5e2ea77..0525796 100644
--- a/library/PFCP_Templates.ttcn
+++ b/library/PFCP_Templates.ttcn
@@ -190,6 +190,92 @@
        spare:= '0'B
 }

+/* 8.2.41 Usage Report Trigger */
+template (value) Usage_Report_Trigger
+ts_Usage_Report_Trigger(template (value) BIT1 perio := '0'B,
+                       template (value) BIT1 volth := '0'B,
+                       template (value) BIT1 timth := '0'B,
+                       template (value) BIT1 quhti := '0'B,
+                       template (value) BIT1 start_ := '0'B,
+                       template (value) BIT1 stop_ := '0'B,
+                       template (value) BIT1 droth := '0'B,
+                       template (value) BIT1 immer := '0'B,
+                       template (value) BIT1 volqu := '0'B,
+                       template (value) BIT1 timqu := '0'B,
+                       template (value) BIT1 liusa := '0'B,
+                       template (value) BIT1 termr := '0'B,
+                       template (value) BIT1 monit := '0'B,
+                       template (value) BIT1 envcl := '0'B,
+                       template (value) BIT1 macar := '0'B,
+                       template (value) BIT1 eveth := '0'B,
+                       template (value) BIT1 evequ := '0'B,
+                       template (value) BIT1 tebur := '0'B,
+                       template (value) BIT1 ipmjl := '0'B,
+                       template (value) BIT1 quvti := '0'B,
+                       template (value) BIT1 emrre := '0'B,
+                       template (value) BIT1 upint := '0'B,
+                       template (value) BIT1 spare7_7 := '0'B,
+                       template (value) BIT1 spare7_8 := '0'B) := {
+       elementIdentifier := 63,
+       lengthIndicator := 0, /* overwritten */
+       perio := perio,
+       volth := volth,
+       timth := timth,
+       quhti := quhti,
+       start_ := start_,
+       stop_ := stop_,
+       droth := droth,
+       immer := immer,
+       volqu := volqu,
+       timqu := timqu,
+       liusa := liusa,
+       termr := termr,
+       monit := monit,
+       envcl := envcl,
+       macar := macar,
+       eveth := eveth,
+       evequ := evequ,
+       tebur := tebur,
+       ipmjl := ipmjl,
+       quvti := quvti,
+       emrre := emrre,
+       upint := upint,
+       spare7_7 := spare7_7,
+       spare7_8 := spare7_8
+}
+
+/*  8.2.52 Start Time */
+template (value) Start_Time
+ts_PFCP_Start_Time(template (value) OCT4 start_time) := {
+       elementIdentifier := 75,
+       lengthIndicator := 0,
+       start_time := start_time
+};
+function f_ts_PFCP_Start_Time_omit(template (omit) OCT4 start_time)
+return template (omit) Start_Time
+{
+       if (isvalue(start_time)) {
+               return ts_PFCP_Start_Time(valueof(start_time))
+       }
+       return omit;
+}
+
+/*  8.2.53 End Time */
+template (value) End_Time
+ts_PFCP_End_Time(template (value) OCT4 end_time) := {
+       elementIdentifier := 76,
+       lengthIndicator := 0,
+       end_time := end_time
+};
+function f_ts_PFCP_End_Time_omit(template (omit) OCT4 end_time)
+return template (omit) End_Time
+{
+       if (isvalue(end_time)) {
+               return ts_PFCP_End_Time(valueof(end_time))
+       }
+       return omit;
+}
+
 /* 8.2.65 Recovery Time Stamp */
 template (value) Recovery_Time_Stamp
 ts_PFCP_Recovery_Timestamp(template (value) LIN4_BO_LAST time_value) := {
@@ -204,6 +290,14 @@
        time_value := time_value
 };

+/* 8.2.71 UR-SEQN */
+template (value) UR_SEQN
+ts_UR_SEQN(template (value) LIN4_BO_LAST ur_seqn) := {
+  elementIdentifier := 104,
+  lengthIndicator := 0, /* overwritten */
+  ur_seqn := ur_seqn
+}
+
 template (value) PDU_PFCP ts_PDU_PFCP_ := {
        s_flag := '0'B,
        mp := '0'B,
@@ -1082,10 +1176,12 @@
 }

 /* 7.5.7 PFCP Session Deletion Response */
+
 template (value) PDU_PFCP
 ts_PFCP_Session_Del_Resp(template (value) LIN3_BO_LAST seq_nr,
                         template (value) OCT8 seid,
-                        template (value) Cause cause := 
ts_PFCP_Cause(REQUEST_ACCEPTED))
+                        template (value) Cause cause := 
ts_PFCP_Cause(REQUEST_ACCEPTED),
+                        template (omit) Usage_Report_Deletion_Response_list 
usage_report := omit)
 modifies ts_PDU_PFCP_ := {
        seid := seid,
        sequence_number := seq_nr,
@@ -1095,13 +1191,14 @@
                        offending_IE := omit,
                        load_control_information := omit,
                        overload_control_information := omit,
-                       usage_report := omit
+                       usage_report := usage_report
                }
        }
 }
 template (present) PDU_PFCP
 tr_PFCP_Session_Del_Resp(template (present) OCT8 seid,
-                        template (present) Cause cause := 
tr_PFCP_Cause(REQUEST_ACCEPTED))
+                        template (present) Cause cause := 
tr_PFCP_Cause(REQUEST_ACCEPTED),
+                        template Usage_Report_Deletion_Response_list 
usage_report := *)
 modifies tr_PDU_PFCP_ := {
        seid := seid,
        message_body := {
@@ -1110,9 +1207,37 @@
                        offending_IE := *,
                        load_control_information := *,
                        overload_control_information := *,
-                       usage_report := *
+                       usage_report := usage_report
                }
        }
 }

+/* 7.5.7.2 Usage Report IE within PFCP Session Deletion Response */
+template (value) Usage_Report_Deletion_Response
+ts_Usage_Report_Deletion_Response(template (value) URR_ID urr_id,
+                                 template (value) LIN4_BO_LAST ur_seqn,
+                                 template (value) Usage_Report_Trigger 
usage_report_trigger,
+                                 template (omit) Start_Time start_time := omit,
+                                 template (omit) End_Time end_time := omit,
+                                 template (omit) Volume_Measurement 
volume_measurement := omit,
+                                 template (omit) Duration_Measurement 
duration_measurement := omit,
+                                 template (omit) Time_of_First_Packet 
time_of_first_packet := omit,
+                                 template (omit) Time_of_Last_Packet 
time_of_last_packet := omit,
+                                 template (omit) Usage_Information 
usage_information := omit) := {
+       elementIdentifier := 79,
+       lengthIndicator := 0,
+       grouped_ie := {
+               urr_id := urr_id,
+               ur_seqn := ts_UR_SEQN(ur_seqn),
+               usage_report_trigger := usage_report_trigger,
+               start_time := start_time,
+               end_time := end_time,
+               volume_measurement := volume_measurement,
+               duration_measurement := duration_measurement,
+               time_of_first_packet := time_of_first_packet,
+               time_of_last_packet := time_of_last_packet,
+               usage_information := usage_information
+       }
+}
+
 }
diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn
index e322435..5d312a2 100644
--- a/smf/SMF_Session_CT.ttcn
+++ b/smf/SMF_Session_CT.ttcn
@@ -28,6 +28,8 @@
 import from PFCP_Templates all;
 import from PFCP_CodecPort all;

+import from NTP_Functions all;
+
 import from Mutex all;

 import from SMF_Tests all;
@@ -105,11 +107,22 @@
        }
 }

+type record Session_URR {
+       URR_ID urr_id,
+       integer ur_seqn
+}
+type record of Session_URR Session_URR_List;
+template (value) Session_URR
+ts_Session_URR(template (value) URR_ID urr_id) := {
+       urr_id := urr_id,
+       ur_seqn := 0
+}
 type record PfcpParameters {
        charstring pfcp_local_addr,
        Node_ID local_node_id,
        F_SEID local_f_seid,
        F_SEID remote_cp_f_seid optional,
+       Session_URR_List urr_list optional,
        Gtp1uParameters gtp1u_pars
 }

@@ -124,6 +137,7 @@
                local_node_id := local_node_id,
                local_f_seid := 
ts_PFCP_F_SEID_ipv4(f_inet_addr(pfcp_local_addr), int2oct(local_f_seid, 8)),
                remote_cp_f_seid := omit,
+               urr_list := omit,
                gtp1u_pars := t_Gtp1uParameters_default(idx, pfcp_local_addr)
        }
        return valueof(pfcp_pars);
@@ -405,8 +419,7 @@
 ///////////////////////
        var PDU_PFCP m;
        /* Expect PFCP Session Establishment Request. */
-       m := f_pfcp_expect(tr_PFCP_Session_Est_Req());
-       log("PFCP Session Establishment Request received!", m)
+       as_pfcp_sess_est_req();
        /* Ask PFCPEM to route PDUs with to be indicated F-SEID to us. */
        f_PFCPEM_subscribe_seid(g_pars.pfcp_pars.local_f_seid.seid);
        /* We're done establishing PFCP sessions, so at this point we no longer 
expect to
@@ -416,7 +429,6 @@
        f_Mutex_unlock(__BFILE__, __LINE__);

        log("DONE PROCESSING PFCP Session Establishment Request")
-       f_pfcp_sess_est_resp(m);
 ///////////////////////


@@ -536,6 +548,9 @@
                                          teid_list := {}, bearer_id := 
g_pars.bearer.ebi);

        GTP2.send(g2c);
+
+       as_pfcp_sess_del_req();
+
        if (DIAMETER[DIA_Gx].checkstate("Connected") and expect_diameter) {
                as_DIA_Gx_CCR(TERMINATION_REQUEST);
        }
@@ -579,25 +594,74 @@
        return rx;
 }

+private altstep as_pfcp_sess_est_req()
+runs on SMF_Session_CT {
+       var PDU_PFCP req;
+       [] PFCP.receive(tr_PFCP_Session_Est_Req()) -> value req {
+               f_pfcp_sess_est_resp(req);
+       }
+}
+
 function f_pfcp_sess_est_resp(PDU_PFCP req) runs on SMF_Session_CT {
-       //TODO: send SessEstResp back!!!! See hnbgw/ConnHdlr.ttcn:
+       var template PDU_PFCP resp;
+       var PFCP_Session_Establishment_Response.created_PDR_list pdrs := {};
        var PFCP_Session_Establishment_Request serq := 
req.message_body.pfcp_session_establishment_request;
+
        /* Store peer's F-SEID for later: */
        g_pars.pfcp_pars.remote_cp_f_seid := serq.CP_F_SEID;

+       for (var integer i := 0; i < lengthof(serq.create_URR_list); i := i + 
1) {
+               g_pars.pfcp_pars.urr_list[i] := 
valueof(ts_Session_URR(serq.create_URR_list[i].grouped_ie.urr_id));
+       }
+
+
        /* Acting as UPF, invent a new PFCP SEID to send to the peer. Respond 
to the Session Establishment.
         * The PFCP response must have the same sequence_number as the request. 
*/
        var Gtp1uParameters gtp1_pars := g_pars.pfcp_pars.gtp1u_pars;
-       var template Created_PDR pdr1 := ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[0].grouped_ie.pdr_id,
-                                                            local_F_TEID := 
gtp1_pars.core.local);
-       var template Created_PDR pdr2 := ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[1].grouped_ie.pdr_id,
-                                                            local_F_TEID := 
gtp1_pars.access.local);
-       var template PDU_PFCP r := ts_PFCP_Session_Est_Resp(seq_nr := 
req.sequence_number,
-                                                           node_id := 
g_pars.pfcp_pars.local_node_id,
-                                                           seid := 
g_pars.pfcp_pars.remote_cp_f_seid.seid,
-                                                           f_seid := 
g_pars.pfcp_pars.local_f_seid,
-                                                           created_pdr := 
{pdr1, pdr2});
-       PFCP.send(r);
+       /* Core N6: */
+       pdrs := pdrs & { valueof(ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[0].grouped_ie.pdr_id,
+                                                    local_F_TEID := 
gtp1_pars.core.local)) };
+       /* Access N3: */
+       pdrs := pdrs & { valueof(ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[1].grouped_ie.pdr_id,
+                                                     local_F_TEID := 
gtp1_pars.access.local)) };
+       /* CP Function: */
+       pdrs := pdrs & { valueof(ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[2].grouped_ie.pdr_id,
+                                                    local_F_TEID := 
gtp1_pars.core.local)) };
+       /* Set UE-to-CP Flow-Description: */
+       pdrs := pdrs & { valueof(ts_PFCP_Created_PDR(pdr_id := 
serq.create_PDR_list[3].grouped_ie.pdr_id,
+                                                    local_F_TEID := 
gtp1_pars.access.local)) };
+
+       resp := ts_PFCP_Session_Est_Resp(seq_nr := req.sequence_number,
+                                        node_id := 
g_pars.pfcp_pars.local_node_id,
+                                        seid := 
g_pars.pfcp_pars.remote_cp_f_seid.seid,
+                                        f_seid := 
g_pars.pfcp_pars.local_f_seid,
+                                        created_pdr := pdrs);
+       PFCP.send(resp);
+}
+
+private altstep as_pfcp_sess_del_req(template (value) PFCP_Types.Cause 
resp_cause := ts_PFCP_Cause(REQUEST_ACCEPTED))
+runs on SMF_Session_CT {
+       var PDU_PFCP req;
+       [] 
PFCP.receive(tr_PFCP_Session_Del_Req(g_pars.pfcp_pars.local_f_seid.seid)) -> 
value req {
+               f_pfcp_sess_del_resp(req, resp_cause);
+       }
+}
+
+private function f_pfcp_sess_del_resp(PDU_PFCP req,
+                                     template (value) PFCP_Types.Cause 
resp_cause := ts_PFCP_Cause(REQUEST_ACCEPTED)) runs on SMF_Session_CT {
+               var template (present) PDU_PFCP resp;
+               var Usage_Report_Deletion_Response_list usage_reports := {};
+
+               for(var integer i := 0; i < 
lengthof(g_pars.pfcp_pars.urr_list); i := i +1) {
+                       var Session_URR urr := g_pars.pfcp_pars.urr_list[i];
+                       usage_reports[i] := 
valueof(ts_Usage_Report_Deletion_Response(urr.urr_id,
+                                                                               
      urr.ur_seqn,
+                                                                               
      ts_Usage_Report_Trigger(termr := '1'B),
+                                                                               
      start_time := ts_PFCP_Start_Time(int2oct(f_time_ntp32_now() - 1, 4)),
+                                                                               
      end_time := ts_PFCP_End_Time(int2oct(f_time_ntp32_now(), 4))));
+               }
+               resp := ts_PFCP_Session_Del_Resp(req.sequence_number, 
g_pars.pfcp_pars.remote_cp_f_seid.seid, resp_cause, usage_report := 
usage_reports)
+               PFCP.send(resp);
 }

 }
diff --git a/smf/SMF_Tests.cfg b/smf/SMF_Tests.cfg
index 9568e2e..caf94b8 100644
--- a/smf/SMF_Tests.cfg
+++ b/smf/SMF_Tests.cfg
@@ -7,6 +7,8 @@
 # Local configuration below

 [LOGGING]
+FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
+mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;

 [TESTPORT_PARAMETERS]

@@ -21,4 +23,10 @@
 [MAIN_CONTROLLER]

 [EXECUTE]
-SMF_Tests.control
+#SMF_Tests.control
+#SMF_Tests.TC_createSession
+#SMF_Tests.TC_createSession
+#SMF_Tests.TC_createSession
+SMF_Tests.TC_createSession_deleteSession
+SMF_Tests.TC_createSession_deleteSession
+SMF_Tests.TC_createSession_deleteSession
diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn
index a2cd432..d736f78 100644
--- a/smf/SMF_Tests.ttcn
+++ b/smf/SMF_Tests.ttcn
@@ -219,7 +219,8 @@
        /* the non-nightly path can be removed once osmo-hnbgw >1.8.1 is 
released. */
        //if (Misc_Helpers.f_osmo_repo_is("nightly")) {
        
f_pfcp_force_assoc_setup_req(ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local)),
-                                    fail_timeout := true);
+                                    fail_timeout := true,
+                                    up_function_features := 
ts_PFCP_UP_Function_Features(ftup := '1'B));
        //} else {
        //      if (not f_statsd_pfcp_associated()) {
        //              f_pfcp_wait_assoc_setup_req(mp_pfcp_upf_node_id, 
fail_timeout := true);
diff --git a/smf/gen_links.sh b/smf/gen_links.sh
index a733486..96e562f 100755
--- a/smf/gen_links.sh
+++ b/smf/gen_links.sh
@@ -7,6 +7,7 @@
 DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
 FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn 
TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
 FILES+=" TCCEncoding_Functions.ttcn TCCEncoding.cc " # BCD coding
+FILES+="TCCDateTime.cc TCCDateTime_Functions.ttcn "
 gen_links $DIR $FILES

 DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
@@ -67,7 +68,7 @@
 FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn 
DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc 
DIAMETER_Emulation.ttcn "
 FILES+="DIAMETER_Templates.ttcn DIAMETER_rfc4004_Templates.ttcn 
DIAMETER_rfc5447_Templates.ttcn DIAMETER_ts29_212_Templates.ttcn 
DIAMETER_ts29_212_Templates.ttcn DIAMETER_ts29_229_Templates.ttcn 
DIAMETER_ts29_272_Templates.ttcn DIAMETER_ts29_273_Templates.ttcn 
DIAMETER_ts32_299_Templates.ttcn "
 FILES+="SCTP_Templates.ttcn "
-FILES+="PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn 
PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn PFCP_Templates.ttcn "
+FILES+="PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn 
PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn PFCP_Templates.ttcn 
NTP_Functions.ttcn "
 FILES+="Mutex.ttcn "
 gen_links $DIR $FILES

diff --git a/smf/regen_makefile.sh b/smf/regen_makefile.sh
index ba3bb6a..a2cb4bc 100755
--- a/smf/regen_makefile.sh
+++ b/smf/regen_makefile.sh
@@ -20,6 +20,7 @@
        IP_EncDec.cc
        Native_FunctionDefs.cc
        TCCConversion.cc
+       TCCDateTime.cc
        TCCInterface.cc
        TCCEncoding.cc
        UDP_EncDec.cc

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

Reply via email to