pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38674?usp=email )
Change subject: hnbgw: with-pfcp: Support running ConnHdlr concurrently
......................................................................
hnbgw: with-pfcp: Support running ConnHdlr concurrently
Use Mutex to serialize PFCP session establishment to workaround the
"Req with SEID=0" dispatching problem.
This same system is used in S1GW_Tests.
Change-Id: Ie19ee0bd1b811e9381e3c245a4b1208de8afcbce
---
M hnbgw/ConnHdlr.ttcn
M hnbgw/HNBGW_Tests.ttcn
M hnbgw/gen_links.sh
3 files changed, 29 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/74/38674/1
diff --git a/hnbgw/ConnHdlr.ttcn b/hnbgw/ConnHdlr.ttcn
index 9205599..e09c894 100644
--- a/hnbgw/ConnHdlr.ttcn
+++ b/hnbgw/ConnHdlr.ttcn
@@ -74,6 +74,8 @@
import from SCCPasp_Types all;
import from SCCP_Templates all;
+import from Mutex all;
+
/***********************************************************************
* code running inside per-UE ConnHdlr
***********************************************************************/
@@ -84,13 +86,15 @@
* MGCP_ConnHdlr (for the MGCP side, emulating the MGW)
* StatsD_ConnHdlr (for the statsd interface, verifying counters)
*/
-type component ConnHdlr extends RAN_ConnHdlr, MGCP_ConnHdlr, RUA_ConnHdlr, PFCP_ConnHdlr,
StatsD_ConnHdlr {
+type component ConnHdlr
+extends RAN_ConnHdlr, MGCP_ConnHdlr, RUA_ConnHdlr, PFCP_ConnHdlr, StatsD_ConnHdlr,
MutexCT {
var integer g_sccp_conn_id;
var TestHdlrParams g_pars;
timer g_Tguard;
port TELNETasp_PT HNBGWVTY;
}
+type record of ConnHdlr ConnHdlrList;
type record MgwResponse {
integer resp,
@@ -774,6 +778,15 @@
var RANAP_PDU rx;
var PDU_PFCP m;
+ /* This code block cannot be executed by more than one component at a time because
+ * the S1AP RAB Ass Request triggers the IUT to send PFCP Session Establishment
+ * Request PDU(s), with need to be routed to the respective ConnHdlr component (us).
+ * As per 3GPP TS 29.244, section 7.2.2.4.2, these PFCP PDUs shall all have SEID=0,
+ * so that the PFCPEM component cannot route them unambiguously. This is why we
+ * need to ensure that only one ConnHdlr is triggering PFCP session establishment
+ * at the given moment of time. */
+ f_Mutex_lock(__BFILE__, __LINE__);
+
/* Subscribe for PFCP Session Establishment Request PDU(s), which are
* expected to have SEID set to 0, as per 3GPP TS 29.244, section 7.2.2.4.2. */
f_PFCPEM_subscribe_seid(c_SEID0);
@@ -788,8 +801,11 @@
m := f_pfcp_expect(tr_PFCP_Session_Est_Req());
/* Ask PFCPEM to route PDUs with to be indicated F-SEID to us. */
f_PFCPEM_subscribe_seid(g_pars.pfcp_pars.upf_f_seid.seid);
- /* We no longer expect to receive PFCP Session Establishment Request PDU(s). */
+ /* We're done establishing PFCP sessions, so at this point we no longer expect to
+ * receive Session Establishment Request PDUs with SEID=0. Unregister and unlock
+ * the mutex, enabling other components to establish PFCP sessions after us. */
f_PFCPEM_unsubscribe_seid(c_SEID0);
+ f_Mutex_unlock(__BFILE__, __LINE__);
var PFCP_Session_Establishment_Request serq :=
m.message_body.pfcp_session_establishment_request;
/* Store HNBGW F-SEID for later: */
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index 97ae334..91bbb11 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -75,6 +75,7 @@
import from SCCPasp_Types all;
import from ConnHdlr all;
+import from Mutex all;
const integer NUM_MSC := 4;
const integer NUM_SGSN := 4;
@@ -275,6 +276,8 @@
var CounterNameValsList g_ctr_hnb;
var RanOps g_ran_ops := MSC_RanOps;
+
+ var MutexDispCT vc_mutex_disp;
}
/* global altstep for global guard timer; */
@@ -488,6 +491,8 @@
T_guard.start(guard_timeout);
activate(as_Tguard());
+ vc_mutex_disp := f_MutexDisp_start();
+
f_init_statsd("VirtHNBGW", vc_STATSD, mp_local_statsd_ip,
mp_local_statsd_port);
f_init_vty("VirtHNBGW");
f_ipa_ctrl_start_client(mp_hnbgw_ip, mp_hnbgw_ctrl_port);
@@ -586,7 +591,8 @@
pfcp_pars := t_PfcpParams(pfcp_enabled := mp_enable_pfcp_tests,
pfcp_local_addr := mp_pfcp_ip_local,
- pfcp_upf_node_id := mp_pfcp_upf_node_id);
+ pfcp_upf_node_id := mp_pfcp_upf_node_id,
+ upf_f_seid := 1000 + imsi_suffix);
pars := t_pars(imsi_suffix,
ps_domain := ps_domain,
expect_separate_sccp_cr := expect_separate_sccp_cr,
@@ -637,13 +643,15 @@
connect(vc_conn:PFCP, vc_PFCP:CLIENT);
connect(vc_conn:PFCP_PROC, vc_PFCP:CLIENT_PROC);
+ f_MutexDisp_connect(vc_mutex_disp, vc_conn);
+
return vc_conn;
}
private function f_start_handler_run(ConnHdlr vc_conn, void_fn fn, TestHdlrParams pars)
runs on test_CT {
var charstring id := testcasename(); // & int2str(pars.ran_idx);
pars.hnb := g_hnb_cfg[pars.hnb_idx];
- vc_conn.start(f_handler_init(fn, id, pars))
+ vc_conn.start(f_handler_init(fn, id, pars));
}
function f_start_handler_with_pars(void_fn fn, template (value) TestHdlrParams pars)
diff --git a/hnbgw/gen_links.sh b/hnbgw/gen_links.sh
index 51ce602..de173f1 100755
--- a/hnbgw/gen_links.sh
+++ b/hnbgw/gen_links.sh
@@ -105,6 +105,7 @@
FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn
StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcnpp "
FILES+="L3_Templates.ttcn L3_Common.ttcn "
FILES+="SCTP_Templates.ttcn "
+FILES+="Mutex.ttcn "
gen_links $DIR $FILES
ignore_pp_results
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38674?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: Ie19ee0bd1b811e9381e3c245a4b1208de8afcbce
Gerrit-Change-Number: 38674
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>