fixeria has uploaded this change for review.

View Change

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, 11 insertions(+), 20 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/12/38212/1
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index a5638f8..89d647a 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,23 +263,16 @@
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();
}
}

diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 8eadb66..dfd3d30 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -109,6 +109,11 @@

vc_PFCP := PFCP_Emulation_CT.create("PFCPEM-" & testcasename()) alive;
vc_PFCP.start(PFCP_Emulation.main(pfcp_cfg));
+
+ /* ensure that the PFCP association is set up */
+ var ConnHdlr vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler),
+ pars := valueof(t_ConnHdlrPars));
+ vc_conn.done;
}

template (value) ConnHdlrPars
@@ -170,7 +175,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 +209,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 +237,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 +263,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 +281,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 +317,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: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5e1a14105a35b785bf598dc2a8c436ea6fb6b0f1
Gerrit-Change-Number: 38212
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>