laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38209?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: s1gw: f_init_pfcp(): use 'PFCPEM' as the prefix
......................................................................
s1gw: f_init_pfcp(): use 'PFCPEM' as the prefix
Make it clear that it's the PFCP EMulation component.
Change-Id: Ia5413313cffb265f83ea0850e31dfb35274c28ba
---
M s1gw/S1GW_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, approved
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index b643f37..1f94477 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -105,7 +105,7 @@
role := UPF
};
- vc_PFCP := PFCP_Emulation_CT.create("PFCP-" & testcasename()) alive;
+ vc_PFCP := PFCP_Emulation_CT.create("PFCPEM-" & testcasename()) alive;
vc_PFCP.start(PFCP_Emulation.main(pfcp_cfg));
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38209?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: Ia5413313cffb265f83ea0850e31dfb35274c28ba
Gerrit-Change-Number: 38209
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38211?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: Revert "s1gw: cache PFCP Recovery Timestamp in ConnHdlr"
......................................................................
Revert "s1gw: cache PFCP Recovery Timestamp in ConnHdlr"
This reverts commit 7ad95e1cfb00d269069bd052c44a9cae9027f763.
A follow-up commit will remove the need for each ConnHdlr to call
f_ConnHdlr_register_pfcp(), that among with handling the PFCP
association retrieves a PFCP Recovery Timestamp from the PFCPEM.
Caching the PFCP Recovery Timestamp value is not really worth it,
since it's rarely used and can always be retrieved on demand.
Change-Id: I3b1c488e3ec251c7659cd9bc3197cca2f9d03144
---
M s1gw/S1GW_ConnHdlr.ttcn
M s1gw/S1GW_Tests.ttcn
2 files changed, 3 insertions(+), 5 deletions(-)
Approvals:
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index 8d1a2b2..a5638f8 100644
--- a/s1gw/S1GW_ConnHdlr.ttcn
+++ b/s1gw/S1GW_ConnHdlr.ttcn
@@ -44,7 +44,6 @@
var ConnHdlrPars g_pars;
port S1AP_CODEC_PT S1AP_ENB;
var ConnectionId g_s1ap_conn_id := -1;
- var integer g_pfcp_recovery_timestamp := -1;
};
type record of ConnHdlr ConnHdlrList;
@@ -238,7 +237,7 @@
PFCP.send(ts_PFCP_Assoc_Setup_Resp(rx.sequence_number,
ts_PFCP_Node_ID_fqdn("\07osmocom\03org"),
ts_PFCP_Cause(REQUEST_ACCEPTED),
- g_pfcp_recovery_timestamp));
+ f_PFCPEM_get_recovery_timestamp()));
}
function f_ConnHdlr_pfcp_expect(template (present) PDU_PFCP exp_rx := ?,
@@ -266,8 +265,6 @@
function f_ConnHdlr_register_pfcp() runs on ConnHdlr
{
- g_pfcp_recovery_timestamp := f_PFCPEM_get_recovery_timestamp();
-
/* First ConnHdlr answers the AssocSetup: */
if (g_pars.idx != 0) {
activate(as_pfcp_ignore(PFCP, tr_PFCP_Assoc_Setup_Req()));
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 2090478..8eadb66 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -314,12 +314,13 @@
}
function f_TC_pfcp_heartbeat(charstring id) runs on ConnHdlr {
+ 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(g_pfcp_recovery_timestamp));
+ PFCP.send(ts_PFCP_Heartbeat_Req(rts));
/* Expect Heartbeat Response
* TODO: validate the indicated Recovery Time Stamp against
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38211?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: I3b1c488e3ec251c7659cd9bc3197cca2f9d03144
Gerrit-Change-Number: 38211
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38212?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: s1gw: move PFCP association handling into a dedicated ConnHdlr
......................................................................
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(-)
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
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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38212?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: I5e1a14105a35b785bf598dc2a8c436ea6fb6b0f1
Gerrit-Change-Number: 38212
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38213?usp=email )
Change subject: s1gw: add multi-eNB variants of TC_e_rab_setup
......................................................................
s1gw: add multi-eNB variants of TC_e_rab_setup
The idea is to simulate multiple eNBs establishing one or more
E-RAB(s) simultaneously. In order to achieve that, use the new
Mutex API to ensure that only one ConnHdlr component is triggering
PFCP session establishment at any given time.
The problem is that there is no way for the PFCPEM component to
correlate which PFCP session belongs to which eNB when multiple
ConnHdlr instances establish E-RAB(s) in parallel. This can be
solved by making a part of the test scenario synchronous.
Change-Id: I9e2eb25a7ae78ff623b94802d881af4894d0cacd
---
M s1gw/S1GW_ConnHdlr.ttcn
M s1gw/S1GW_Tests.ttcn
M s1gw/expected-results.xml
M s1gw/gen_links.sh
4 files changed, 53 insertions(+), 20 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index e1e97e0..2833ce1 100644
--- a/s1gw/S1GW_ConnHdlr.ttcn
+++ b/s1gw/S1GW_ConnHdlr.ttcn
@@ -18,6 +18,7 @@
import from Native_Functions all;
import from IPL4asp_Types all;
import from Misc_Helpers all;
+import from Mutex all;
import from PFCP_Types all;
import from PFCP_Emulation all;
@@ -40,7 +41,7 @@
import from S1AP_Server all;
-type component ConnHdlr extends S1APSRV_ConnHdlr, PFCP_ConnHdlr, StatsD_ConnHdlr {
+type component ConnHdlr extends MutexCT, S1APSRV_ConnHdlr, PFCP_ConnHdlr, StatsD_ConnHdlr {
var ConnHdlrPars g_pars;
port S1AP_CODEC_PT S1AP_ENB;
var ConnectionId g_s1ap_conn_id := -1;
@@ -556,9 +557,16 @@
runs on ConnHdlr {
const OCT8 c_SEID0 := '0000000000000000'O;
- /* 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. */
+ /* This code block cannot be executed by more than one component at a time because
+ * the S1AP E-RAB SETUP 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__);
f_PFCPEM_subscribe_seid(c_SEID0);
+
log("eNB <- [S1GW <- MME]: E-RAB SETUP REQUEST");
f_ConnHdlr_tx_erab_setup_req(erabs);
for (var integer i := 0; i < lengthof(erabs); i := i + 1) {
@@ -571,8 +579,13 @@
log("UPF -> S1GW: PFCP Session Establishment Response for E-RAB ID ", erabs[i].erab_id);
f_ConnHdlr_tx_session_establish_resp(erabs[i], pdu);
}
- /* 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__);
+
log("[eNB <- S1GW] <- MME: E-RAB SETUP REQUEST");
f_ConnHdlr_rx_erab_setup_req(erabs);
}
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 40243ca..4120f2a 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -18,6 +18,7 @@
import from Native_Functions all;
import from IPL4asp_Types all;
import from Misc_Helpers all;
+import from Mutex all;
import from S1AP_CodecPort all;
import from S1AP_CodecPort_CtrlFunct all;
@@ -61,6 +62,7 @@
type component test_CT extends StatsD_Checker_CT {
timer g_Tguard;
+ var MutexDispCT vc_mutex_disp;
var S1AP_Server_CT vc_S1APSRV;
var PFCP_Emulation_CT vc_PFCP;
var StatsD_Checker_CT vc_STATSD;
@@ -78,6 +80,8 @@
g_Tguard.start(Tval);
activate(as_Tguard());
+ vc_mutex_disp := f_MutexDisp_start();
+
f_init_statsd("StatsDSRV", vc_STATSD, mp_local_statsd_ip, mp_local_statsd_port);
if (s1apsrv_start) {
@@ -178,6 +182,7 @@
connect(vc_conn:PFCP, vc_PFCP:CLIENT);
connect(vc_conn:PFCP_PROC, vc_PFCP:CLIENT_PROC);
}
+ f_MutexDisp_connect(vc_mutex_disp, vc_conn);
vc_conn.start(f_ConnHdlr_init(fn, id, pars));
return vc_conn;
@@ -301,25 +306,36 @@
f_ConnHdlr_s1ap_disconnect();
f_ConnHdlr_s1ap_unregister(g_pars.genb_id);
}
-/* 1 E-RAB at a time */
-testcase TC_e_rab_setup() runs on test_CT {
- var ConnHdlrPars pars := valueof(t_ConnHdlrPars(num_erabs := 1));
- var ConnHdlr vc_conn;
+private function f_TC_e_rab_setup_exec(integer num_enbs, integer num_erabs)
+runs on test_CT {
+ var ConnHdlrList vc_conns;
f_init();
- vc_conn := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
- vc_conn.done;
+ for (var integer i := 0; i < num_enbs; i := i + 1) {
+ var ConnHdlrPars pars := valueof(t_ConnHdlrPars(i, num_erabs));
+ vc_conns[i] := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
+ }
+
+ for (var integer i := 0; i < num_enbs; i := i + 1) {
+ vc_conns[i].done;
+ }
}
-/* 3 E-RABs at a time */
+/* 1 E-RAB at a time, single eNB */
+testcase TC_e_rab_setup() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := 1, num_erabs := 1);
+}
+/* 1 E-RAB at a time, multiple eNB connections */
+testcase TC_e_rab_setup_multi() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := mp_multi_enb_num, num_erabs := 1);
+}
+/* 3 E-RABs at a time, single eNB */
testcase TC_e_rab_setup3() runs on test_CT {
- var ConnHdlrPars pars := valueof(t_ConnHdlrPars(num_erabs := 3));
- var ConnHdlr vc_conn;
-
- f_init();
-
- vc_conn := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
- vc_conn.done;
+ f_TC_e_rab_setup_exec(num_enbs := 1, num_erabs := 3);
+}
+/* 3 E-RABs at a time, multiple eNB connections */
+testcase TC_e_rab_setup3_multi() runs on test_CT {
+ f_TC_e_rab_setup_exec(num_enbs := mp_multi_enb_num, num_erabs := 3);
}
function f_TC_pfcp_heartbeat(charstring id) runs on ConnHdlr {
@@ -352,6 +368,8 @@
execute( TC_conn_term_mme_unavail() );
execute( TC_e_rab_setup() );
execute( TC_e_rab_setup3() );
+ execute( TC_e_rab_setup_multi() );
+ execute( TC_e_rab_setup3_multi() );
execute( TC_pfcp_heartbeat() );
}
diff --git a/s1gw/expected-results.xml b/s1gw/expected-results.xml
index f7b0c3b..99a75d5 100644
--- a/s1gw/expected-results.xml
+++ b/s1gw/expected-results.xml
@@ -1,10 +1,12 @@
<?xml version="1.0"?>
-<testsuite name='S1GW_Tests' tests='7' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'>
+<testsuite name='S1GW_Tests' tests='9' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'>
<testcase classname='S1GW_Tests' name='TC_setup' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_setup_multi' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_conn_term_by_mme' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_conn_term_mme_unavail' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_e_rab_setup' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_e_rab_setup3' time='MASKED'/>
+ <testcase classname='S1GW_Tests' name='TC_e_rab_setup_multi' time='MASKED'/>
+ <testcase classname='S1GW_Tests' name='TC_e_rab_setup3_multi' time='MASKED'/>
<testcase classname='S1GW_Tests' name='TC_pfcp_heartbeat' time='MASKED'/>
</testsuite>
diff --git a/s1gw/gen_links.sh b/s1gw/gen_links.sh
index 919e7f8..f2fc81b 100755
--- a/s1gw/gen_links.sh
+++ b/s1gw/gen_links.sh
@@ -28,7 +28,7 @@
gen_links $DIR $FILES
DIR=../library
-FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
+FILES="Misc_Helpers.ttcn Mutex.ttcn General_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
FILES+="PFCP_CodecPort.ttcn PFCP_CodecPort_CtrlFunct.ttcn PFCP_CodecPort_CtrlFunctDef.cc PFCP_Emulation.ttcn PFCP_Templates.ttcn "
FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn "
FILES+="SCTP_Templates.ttcn "
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38213?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: I9e2eb25a7ae78ff623b94802d881af4894d0cacd
Gerrit-Change-Number: 38213
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38214?usp=email )
(
5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: s1gw: add f_ConnHdlrList_all_done()
......................................................................
s1gw: add f_ConnHdlrList_all_done()
Change-Id: I20c472dd8ce7f5a25c349cc079bd5bd873be2950
---
M s1gw/S1GW_Tests.ttcn
1 file changed, 10 insertions(+), 6 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 4120f2a..940944a 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -188,6 +188,14 @@
return vc_conn;
}
+/* wait for all ConnHdlr in the given list to be .done() */
+function f_ConnHdlrList_all_done(in ConnHdlrList vc_conns)
+runs on test_CT {
+ for (var integer i := 0; i < lengthof(vc_conns); i := i + 1) {
+ vc_conns[i].done;
+ }
+}
+
function f_TC_setup(charstring id) runs on ConnHdlr {
f_ConnHdlr_s1ap_register(g_pars.genb_id);
@@ -243,9 +251,7 @@
vc_conns[i] := f_ConnHdlr_spawn(refers(f_TC_setup_multi), pars);
}
- for (var integer i := 0; i < mp_multi_enb_num; i := i + 1) {
- vc_conns[i].done;
- }
+ f_ConnHdlrList_all_done(vc_conns);
}
@@ -317,9 +323,7 @@
vc_conns[i] := f_ConnHdlr_spawn(refers(f_TC_e_rab_setup), pars);
}
- for (var integer i := 0; i < num_enbs; i := i + 1) {
- vc_conns[i].done;
- }
+ f_ConnHdlrList_all_done(vc_conns);
}
/* 1 E-RAB at a time, single eNB */
testcase TC_e_rab_setup() runs on test_CT {
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38214?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: I20c472dd8ce7f5a25c349cc079bd5bd873be2950
Gerrit-Change-Number: 38214
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38206?usp=email )
Change subject: library: add generic Mutex API for parallel components
......................................................................
library: add generic Mutex API for parallel components
In certain scenarios, it's required to ensure that only one of multiple
parallel components executes a specific code block at any given time.
This, for example, is the case for the S1GW testsuite, where we want to
simulate multiple eNBs establishing E-RABs. Each new E-RAB triggers the
IUT (osmo-s1gw) to send a PFCP Session Establishment Request, and there
is no way for the PFCPEM to correlate which session belongs to which eNB.
This problem can be solved by ensuring that only one eNB is triggering
the PFCP Session Establishment Request(s) at a time.
This patch implements a generic Mutex API, which can also be used
by other testsuites that orchestrate multiple parallel components.
Change-Id: Id71f43bd5fc78d4bb4417d6c01fcff8112ea6032
---
A library/Mutex.ttcn
1 file changed, 135 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/library/Mutex.ttcn b/library/Mutex.ttcn
new file mode 100644
index 0000000..625090b
--- /dev/null
+++ b/library/Mutex.ttcn
@@ -0,0 +1,135 @@
+/* Generic Mutex API for parallel components.
+ *
+ * (C) 2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>
+ *
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+module Mutex {
+
+import from Misc_Helpers all;
+
+type component MutexCT {
+ port MutexPT LOCK; /* port for LOCKing the mutex */
+ port MutexPT UNLOCK; /* port for UNLOCKing the mutex */
+ var integer g_mutex_ref;
+};
+
+type port MutexPT procedure {
+ inout MUTEX_LOCK;
+ inout MUTEX_UNLOCK;
+} with { extension "internal" };
+
+private signature MUTEX_LOCK(out integer ref);
+private signature MUTEX_UNLOCK(in integer ref) noblock;
+
+type component MutexDispCT extends MutexCT { };
+
+private function f_MutexDisp_main()
+runs on MutexDispCT {
+ var boolean locked := false;
+ var MutexCT vc_conn;
+
+ g_mutex_ref := 0;
+
+ alt {
+ [not locked] LOCK.getcall(MUTEX_LOCK:{?}) -> sender vc_conn {
+ LOCK.reply(MUTEX_LOCK:{g_mutex_ref}) to vc_conn;
+ locked := true;
+ repeat;
+ }
+ [locked] UNLOCK.getcall(MUTEX_UNLOCK:{g_mutex_ref}) {
+ g_mutex_ref := g_mutex_ref + 1;
+ locked := false;
+ repeat;
+ }
+ [not locked] UNLOCK.getcall -> sender vc_conn {
+ setverdict(fail, __SCOPE__, "(): ",
+ "mutex unlock without prior lock from ", vc_conn);
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ [locked] UNLOCK.getcall(MUTEX_UNLOCK:{?}) -> sender vc_conn {
+ setverdict(fail, __SCOPE__, "(): ",
+ "mutex unlock was not unexpected from ", vc_conn);
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ }
+}
+
+/* used by the MTC to start the mutex dispatcher */
+function f_MutexDisp_start()
+return MutexDispCT {
+ var MutexDispCT vc_disp;
+
+ vc_disp := MutexDispCT.create("MutexDispCT-" & testcasename());
+ vc_disp.start(f_MutexDisp_main());
+
+ return vc_disp;
+}
+
+/* used by the MTC to connect a parallel component to the mutex dispatcher */
+function f_MutexDisp_connect(MutexDispCT vc_disp, MutexCT vc_conn)
+{
+ connect(vc_disp:LOCK, vc_conn:LOCK);
+ connect(vc_disp:UNLOCK, vc_conn:UNLOCK);
+}
+
+/* used by parallel components to lock the mutex (blocking) */
+function f_Mutex_lock(charstring file, integer line,
+ float Tval := 10.0)
+runs on MutexCT {
+ LOCK.call(MUTEX_LOCK:{-}, Tval) {
+ [] LOCK.getreply(MUTEX_LOCK:{?}) -> param(g_mutex_ref) {
+ log(__SCOPE__, "(): mutex acquired @ ", file, ":", line);
+ }
+ [] LOCK.catch(timeout) {
+ setverdict(fail, __SCOPE__, "(): timeout @ ", file, ":", line);
+ Misc_Helpers.f_shutdown(file, line);
+ }
+ }
+}
+
+/* used by parallel components to unlock the mutex (non-blocking) */
+function f_Mutex_unlock(charstring file, integer line)
+runs on MutexCT {
+ UNLOCK.call(MUTEX_UNLOCK:{g_mutex_ref});
+ log(__SCOPE__, "(): mutex released @ ", file, ":", line);
+}
+
+
+/* self-test for this module */
+private type component TestCT { };
+private type component TestChildCT extends MutexCT { };
+
+private function f_TC_selftest()
+runs on TestChildCT {
+ f_Mutex_lock(__BFILE__, __LINE__);
+ /* yay, we're the only one ruling this parallel world! */
+ f_Mutex_unlock(__BFILE__, __LINE__);
+ setverdict(pass);
+}
+
+testcase TC_selftest() runs on TestCT {
+ var TestChildCT vc_conns[42];
+ var MutexDispCT vc_disp;
+
+ vc_disp := f_MutexDisp_start();
+
+ for (var integer i := 0; i < sizeof(vc_conns); i := i + 1) {
+ vc_conns[i] := TestChildCT.create("TestChildCT-" & int2str(i));
+ f_MutexDisp_connect(vc_disp, vc_conns[i]);
+ vc_conns[i].start(f_TC_selftest());
+ }
+
+ for (var integer i := 0; i < sizeof(vc_conns); i := i + 1) {
+ vc_conns[i].done;
+ }
+}
+
+}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38206?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: Id71f43bd5fc78d4bb4417d6c01fcff8112ea6032
Gerrit-Change-Number: 38206
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38208?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: library: as_pfcp_ignore(): log SeqNr of received PDUs
......................................................................
library: as_pfcp_ignore(): log SeqNr of received PDUs
Printing the PFCP PDU template ('?' by default) is not very informative
when reading logs. Printing the message type of the received PDU is
not informative either, because message types are defined as numbers
in PFCP_Types.ttcn. Printing the whole PDU is way too verbose, and
would be redundant given that the PFCPEM component already does print
all received PDUs. Let's print the sequence number.
Change-Id: I803ff46def4ae0182310bc01e753fe0c05112836
---
M library/PFCP_Emulation.ttcn
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/library/PFCP_Emulation.ttcn b/library/PFCP_Emulation.ttcn
index edb1f9c..892670c 100644
--- a/library/PFCP_Emulation.ttcn
+++ b/library/PFCP_Emulation.ttcn
@@ -392,8 +392,10 @@
altstep as_pfcp_ignore(PFCPEM_PT pt, template PDU_PFCP pfcp_expect := ?)
{
- [] pt.receive(pfcp_expect) {
- log("Ignoring ", pfcp_expect);
+ var PDU_PFCP pdu;
+
+ [] pt.receive(pfcp_expect) -> value pdu {
+ log("Ignoring PFCP PDU (SeqNr := ", pdu.sequence_number, ")");
repeat;
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38208?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: I803ff46def4ae0182310bc01e753fe0c05112836
Gerrit-Change-Number: 38208
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>