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

Change subject: smf: Introduce initial PFCP support
......................................................................

smf: Introduce initial PFCP support

With this commit PFCP association setup procedure already succeeds.

Change-Id: I3fb988b5ad351b40e18f02f9bfca7bbd267bb6a4
---
M smf/SMF_Tests.ttcn
M smf/gen_links.sh
M smf/regen_makefile.sh
3 files changed, 51 insertions(+), 1 deletion(-)

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




diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn
index 1e11337..c94e851 100644
--- a/smf/SMF_Tests.ttcn
+++ b/smf/SMF_Tests.ttcn
@@ -23,6 +23,11 @@
 import from DIAMETER_ts32_299_Templates all;
 import from DIAMETER_Emulation all;

+import from PFCP_Types all;
+import from PFCP_Emulation all;
+import from PFCP_Templates all;
+import from PFCP_CodecPort all;
+
 import from SMF_Session_CT all;

 modulepar {
@@ -40,10 +45,14 @@
        integer mp_aaa_local_port := 3870;

        charstring mp_diam_realm := "localdomain";
+
+       /* IP address at which we listen for PFCP to emulate a UPF in ttcn3 */
+       charstring mp_pfcp_ip_local := "127.0.0.7";
+       charstring mp_pfcp_upf_node_id := "\07osmocom\03org";
 }

 /* main component, we typically have one per testcase */
-type component SMF_Test_CT extends GTP2_ConnHdlr {
+type component SMF_Test_CT extends GTP2_ConnHdlr, PFCP_ConnHdlr {
        var GTPv2_Emulation_CT vc_GTP2;
        port GTP2EM_PT TEIC0;
        var GTPv1U_Emulation_CT vc_GTP1U;
@@ -61,6 +70,11 @@
        var DIAMETER_Emulation_CT vc_S6b;
        port DIAMETER_PT S6b_UNIT;
        port DIAMETEREM_PROC_PT S6b_PROC;
+
+       /* emulated UPF */
+       var PFCP_Emulation_CT vc_PFCP;
+       var boolean g_pfcp_answer_heartbeat_req := true;
+
        /* global test case guard timer (actual timeout value is set in 
f_init()) */
        timer T_guard;
 }
@@ -178,13 +192,41 @@
        vc_GTP1U.start(GTPv1U_Emulation.main(cfg));
 }

+function f_init_pfcp(charstring id) runs on SMF_Test_CT {
+       id := id & "-PFCP";
+
+       var PFCP_Emulation_Cfg pfcp_cfg := {
+               pfcp_bind_ip := mp_pfcp_ip_local,
+               pfcp_bind_port := PFCP_PORT,
+               pfcp_remote_ip := mp_smf_hostname,
+               pfcp_remote_port := PFCP_PORT,
+               role := UPF,
+               answer_heartbeat_req := g_pfcp_answer_heartbeat_req
+       };
+
+       vc_PFCP := PFCP_Emulation_CT.create(id) alive;
+       vc_PFCP.start(PFCP_Emulation.main(pfcp_cfg));
+
+       /* Temporarily hook to PFCP to make sure we are back to PFCP Associated 
state: */
+       connect(self:PFCP, vc_PFCP:CLIENT);
+       connect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC);
+       
f_pfcp_force_assoc_setup_req(ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local)),
+                                    fail_timeout := true);
+       disconnect(self:PFCP, vc_PFCP:CLIENT);
+       disconnect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC);
+
+}
+
 private function f_init(float guard_timeout := 60.0) runs on SMF_Test_CT {
        T_guard.start(guard_timeout);
        activate(as_Tguard());
+       var charstring id := testcasename();

        f_init_gtp2c();
        f_init_gtp1u();

+       f_init_pfcp(id);
+
        if (mp_pcrf_local_ip != "") {
                f_init_diameter(testcasename());
        }
diff --git a/smf/gen_links.sh b/smf/gen_links.sh
index 1f56b9c..3b4fe2a 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 " # NTP_Functions (NTP 
timestamp)
 gen_links $DIR $FILES

 DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
@@ -49,6 +50,10 @@
 FILES="GTPv2_Types.ttcn"
 gen_links $DIR $FILES

+DIR=$BASEDIR/titan.ProtocolModules.PFCP_v15.1.0/src
+FILES="PFCP_Types.ttcn"
+gen_links $DIR $FILES
+
 DIR=$BASEDIR/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator/src
 FILES="DIAMETER_EncDec.cc"
 gen_links $DIR $FILES
@@ -63,6 +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+="NTP_Functions.ttcn PFCP_Templates.ttcn PFCP_CodecPort.ttcn 
PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc 
PFCP_Emulation.ttcn "
 gen_links $DIR $FILES

 gen_links_finish
diff --git a/smf/regen_makefile.sh b/smf/regen_makefile.sh
index 51a50d4..a2cb4bc 100755
--- a/smf/regen_makefile.sh
+++ b/smf/regen_makefile.sh
@@ -20,9 +20,11 @@
        IP_EncDec.cc
        Native_FunctionDefs.cc
        TCCConversion.cc
+       TCCDateTime.cc
        TCCInterface.cc
        TCCEncoding.cc
        UDP_EncDec.cc
+       PFCP_CodecPort_CtrlFunctDef.cc
 "

 CPPFLAGS_TTCN3=""

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43308?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: I3fb988b5ad351b40e18f02f9bfca7bbd267bb6a4
Gerrit-Change-Number: 43308
Gerrit-PatchSet: 6
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to