pespin has uploaded this change for review. ( 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, 59 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/08/43308/1
diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 1e11337..15b0390 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,51 @@ 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 access Statsd during test startup: */ + //connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); + + connect(self:PFCP, vc_PFCP:CLIENT); + connect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC); + /* 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); + //} else { + // if (not f_statsd_pfcp_associated()) { + // f_pfcp_wait_assoc_setup_req(mp_pfcp_upf_node_id, fail_timeout := true); + // } + //} + disconnect(self:PFCP, vc_PFCP:CLIENT); + disconnect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC); + + //disconnect(self:STATSD_PROC, vc_STATSD:STATSD_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..bd3ecd8 100755 --- a/smf/gen_links.sh +++ b/smf/gen_links.sh @@ -49,6 +49,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 +67,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 " gen_links $DIR $FILES
gen_links_finish diff --git a/smf/regen_makefile.sh b/smf/regen_makefile.sh index 51a50d4..ba3bb6a 100755 --- a/smf/regen_makefile.sh +++ b/smf/regen_makefile.sh @@ -23,6 +23,7 @@ TCCInterface.cc TCCEncoding.cc UDP_EncDec.cc + PFCP_CodecPort_CtrlFunctDef.cc "
CPPFLAGS_TTCN3=""