laforge submitted this change.

View Change



3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve
s1gw: move PFCP association handling into a dedicated ConnHdlr

Previously, the PFCP association request from the IUT was handled by
the first ConnHdlr component (idx := 0). While this approach has
worked, it fails when multiple ConnHdlr instances (idx > 0) are spawned.

The problem arises when other ConnHdlr (idx > 0) instances initiate
PFCP procedures before the first ConnHdlr (idx := 0) has established
the association, so we end up playing races.

This patch introduces a dedicated ConnHdlr component to handle the
PFCP association independently. Once the association is established,
the actual test ConnHdlr instances are spawned, ensuring a more
reliable and orderly process.

Change-Id: I5e1a14105a35b785bf598dc2a8c436ea6fb6b0f1
---
M s1gw/S1GW_ConnHdlr.ttcn
M s1gw/S1GW_Tests.ttcn
2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index a5638f8..e1e97e0 100644
--- a/s1gw/S1GW_ConnHdlr.ttcn
+++ b/s1gw/S1GW_ConnHdlr.ttcn
@@ -226,7 +226,7 @@
}
}

-private function f_pfcp_handle_assoc_setup_req()
+private function f_ConnHdlr_pfcp_assoc_setup()
runs on ConnHdlr
{
var PDU_PFCP rx;
@@ -263,24 +263,19 @@
return pdu;
}

-function f_ConnHdlr_register_pfcp() runs on ConnHdlr
-{
- /* First ConnHdlr answers the AssocSetup: */
- if (g_pars.idx != 0) {
- activate(as_pfcp_ignore(PFCP, tr_PFCP_Assoc_Setup_Req()));
- return;
- }
-
- var StatsDMetricKeys statsd_keys := {
- valueof(ts_StatsDMetricKey(g_pars.statsd_prefix & "gauge.pfcp.associated.value", "g"))
- };
+function f_ConnHdlr_pfcp_assoc_handler(charstring id)
+runs on ConnHdlr {
+ var charstring key_name := g_pars.statsd_prefix & "gauge.pfcp.associated.value";
+ var StatsDMetricKeys statsd_keys := { valueof(ts_StatsDMetricKey(key_name, "g")) };
var StatsDMetrics statsd_snapshot := f_statsd_snapshot(statsd_keys, since_last_snapshot := false);
var boolean pfcp_associated := statsd_snapshot[0].val == 1;

if (not pfcp_associated) {
log("Waiting for IUT to associate over PFCP");
- f_pfcp_handle_assoc_setup_req();
+ f_ConnHdlr_pfcp_assoc_setup();
}
+
+ setverdict(pass);
}

/* 256 is maxnoofE-RABs (see S1AP_Constants.asn) */
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 8eadb66..40243ca 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -85,6 +85,7 @@
}
if (upf_start) {
f_init_pfcp();
+ f_pfcp_assoc();
}
}

@@ -111,6 +112,19 @@
vc_PFCP.start(PFCP_Emulation.main(pfcp_cfg));
}

+/* ensure that the PFCP association is set up */
+function f_pfcp_assoc() runs on test_CT {
+ var verdicttype verdict;
+ var ConnHdlr vc_conn;
+
+ vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler),
+ pars := valueof(t_ConnHdlrPars));
+ vc_conn.done -> value verdict;
+ if (verdict != pass) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+}
+
template (value) ConnHdlrPars
t_ConnHdlrPars(integer idx := 0,
integer num_erabs := 1,
@@ -170,7 +184,6 @@
}

function f_TC_setup(charstring id) runs on ConnHdlr {
- f_ConnHdlr_register_pfcp();
f_ConnHdlr_s1ap_register(g_pars.genb_id);

/* Expected values relative to snapshot: */
@@ -205,7 +218,6 @@
}

function f_TC_setup_multi(charstring id) runs on ConnHdlr {
- f_ConnHdlr_register_pfcp();
f_ConnHdlr_s1ap_register(g_pars.genb_id);

f_ConnHdlr_s1ap_connect(mp_enb_bind_ip, mp_s1gw_enb_ip);
@@ -234,7 +246,6 @@

/* MME terminates connection, expect S1GW to terminate the eNB connection */
function f_TC_conn_term_by_mme(charstring id) runs on ConnHdlr {
- f_ConnHdlr_register_pfcp();
f_ConnHdlr_s1ap_register(g_pars.genb_id);

f_ConnHdlr_s1ap_connect(mp_enb_bind_ip, mp_s1gw_enb_ip);
@@ -261,7 +272,6 @@

/* MME is not available, expect S1GW to terminate the eNB connection */
function f_TC_conn_term_mme_unavail(charstring id) runs on ConnHdlr {
- f_ConnHdlr_register_pfcp();
/* establish an eNB connection to the S1GW */
f_ConnHdlr_s1ap_connect(mp_enb_bind_ip, mp_s1gw_enb_ip);
/* expect our eNB connection to be released gracefully */
@@ -280,7 +290,6 @@

/* Test E-RAB SETUP [and RELEASE] procedures */
function f_TC_e_rab_setup(charstring id) runs on ConnHdlr {
- f_ConnHdlr_register_pfcp();
f_ConnHdlr_s1ap_register(g_pars.genb_id);
f_ConnHdlr_s1ap_connect(mp_enb_bind_ip, mp_s1gw_enb_ip);
f_ConnHdlr_s1ap_setup(g_pars.genb_id);
@@ -317,8 +326,6 @@
var integer rts := f_PFCPEM_get_recovery_timestamp();
var PDU_PFCP pfcp_pdu;

- f_ConnHdlr_register_pfcp();
-
/* Tx Heartbeat Request */
PFCP.send(ts_PFCP_Heartbeat_Req(rts));


To view, visit change 38212. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5e1a14105a35b785bf598dc2a8c436ea6fb6b0f1
Gerrit-Change-Number: 38212
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>