lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2024

  • 1 participants
  • 1983 discussions
[XS] Change in osmo-ttcn3-hacks[master]: s1gw: f_init_pfcp(): use 'PFCPEM' as the prefix
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: Revert "s1gw: cache PFCP Recovery Timestamp in ConnHdlr"
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: s1gw: move PFCP association handling into a dedicated ConnHdlr
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: s1gw: add multi-eNB variants of TC_e_rab_setup
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: s1gw: add f_ConnHdlrList_all_done()
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: library: add generic Mutex API for parallel components
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: library: as_pfcp_ignore(): log SeqNr of received PDUs
by laforge 26 Sep '24

26 Sep '24
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>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: library/PFCP_Emulation: a better PDU routing concept
by laforge 26 Sep '24

26 Sep '24
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38207?usp=email ) Change subject: library/PFCP_Emulation: a better PDU routing concept ...................................................................... library/PFCP_Emulation: a better PDU routing concept In recently merged 2962d170 I wrongly assumed, that SEID of outgoing PFCP PDUs can be used to correlate and route the incoming PDUs. In fact, the PFCP peers use two different SEID values, negotiating them using the F-SEID IE. We could have implemented a logic to look for F-SEID in the outgoing PDUs, store and then use it for routing. However, a more flexible approach is to allow the the PFCP_ConnHdlr components to subscribe and unsubscribe to/from specific SEID values explicitly. In this spirit, let's allow the PFCP_ConnHdlr components to subscribe and unsubscribe to/from broadcast PDUs (i.e. those, for which the PFCPEM component could not find a single recipient) explicitly. Implicit routing using the SeqNr remains unchanged and will be performed by the PFCPEM component automatically like before. Change-Id: I25802471519fa297ad4cb2b056adaa6748b00af2 Related: 2962d170 "library/PFCP_Emulation: fix routing of incoming PDUs" --- M hnbgw/HNBGW_Tests.ttcn M library/PFCP_Emulation.ttcn M s1gw/S1GW_ConnHdlr.ttcn 3 files changed, 215 insertions(+), 38 deletions(-) Approvals: pespin: Looks good to me, approved laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn index 86a4f3f..203b11e 100644 --- a/hnbgw/HNBGW_Tests.ttcn +++ b/hnbgw/HNBGW_Tests.ttcn @@ -1942,12 +1942,15 @@ } friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams pars) runs on ConnHdlr { + const OCT8 c_SEID0 := '0000000000000000'O; + const OCT8 c_SEID1 := '1111111111111111'O; var RANAP_PDU tx; var RANAP_PDU rx; f_init_handler(pars); - f_pfcp_register(); + /* ask PFCPEM to route all PDUs to us */ + f_PFCPEM_subscribe_bcast(); var PDU_PFCP m; var Node_ID upf_node_id := valueof(ts_PFCP_Node_ID_fqdn("\07osmocom\03org")); @@ -1956,6 +1959,13 @@ PFCP.send(ts_PFCP_Assoc_Setup_Resp(m.sequence_number, upf_node_id, ts_PFCP_Cause(REQUEST_ACCEPTED), 1234)); + /* 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); + + /* ask PFCPEM to *not* route all PDUs to us anymore */ + f_PFCPEM_unsubscribe_bcast(); + tx := f_build_initial_ue(g_pars); f_iuh2iu_connect(tx); @@ -1969,12 +1979,17 @@ /* Expect PFCP Session Establishment Request. */ 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(c_SEID1); + /* We no longer expect to receive PFCP Session Establishment Request PDU(s). */ + f_PFCPEM_unsubscribe_seid(c_SEID0); + var PFCP_Session_Establishment_Request serq := m.message_body.pfcp_session_establishment_request; var F_SEID hnbgw_f_seid := serq.CP_F_SEID; /* Acting as UPF, invent a new PFCP SEID to send to HNBGW. Respond to the Session Establishment. * The PFCP response must have the same sequence_number as the request. */ - var template F_SEID up_f_seid := ts_PFCP_F_SEID_ipv4(f_inet_addr("127.0.0.1"), '1111111111111111'O); + var template F_SEID up_f_seid := ts_PFCP_F_SEID_ipv4(f_inet_addr("127.0.0.1"), c_SEID1); var template F_TEID f_teid1 := ts_PFCP_F_TEID_ipv4(gtp_pars.core.local.teid, f_inet_addr(gtp_pars.core.local.addr)); var template F_TEID f_teid2 := ts_PFCP_F_TEID_ipv4(gtp_pars.access.local.teid, @@ -2020,6 +2035,9 @@ m := f_pfcp_expect(tr_PFCP_Session_Del_Req(up_f_seid.seid)); PFCP.send(ts_PFCP_Session_Del_Resp(m.sequence_number, hnbgw_f_seid.seid)); + /* ask PFCPEM to *not* route PDUs with this specific SEID to us */ + f_PFCPEM_unsubscribe_seid(c_SEID1); + f_sleep(2.0); } @@ -2050,7 +2068,8 @@ f_init_handler(pars); - f_pfcp_register(); + /* ask PFCPEM to route all PDUs to us */ + f_PFCPEM_subscribe_bcast(); activate(as_disallow_pfcp()); tx := f_build_initial_ue(g_pars); diff --git a/library/PFCP_Emulation.ttcn b/library/PFCP_Emulation.ttcn index c917157..edb1f9c 100644 --- a/library/PFCP_Emulation.ttcn +++ b/library/PFCP_Emulation.ttcn @@ -1,6 +1,6 @@ /* PFCP Emulation in TTCN-3 * - * (C) 2022 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2022-2024 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * All rights reserved. * * Released under the terms of GNU General Public License, Version 2 or @@ -14,6 +14,8 @@ import from IPL4asp_Types all; import from General_Types all; import from Osmocom_Types all; +import from Misc_Helpers all; + import from PFCP_Types all; import from PFCP_Templates all; import from PFCP_CodecPort all; @@ -53,7 +55,12 @@ var integer g_pfcp_conn_id; var integer g_recovery_timestamp; - var PFCPEM_conns g_conns; + /* List of PFCP_ConnHdlr subscribed for broadcast */ + var PFCPEM_conns g_conns_bcast; + /* List of PFCP_ConnHdlr subscribed for SEID */ + var PFCPEM_conns g_conns_seqnr; + /* List of PFCP_ConnHdlr subscribed for SeqNr */ + var PFCPEM_conns g_conns_seid; var integer g_next_sequence_nr_state; }; @@ -69,16 +76,16 @@ type record PFCPEM_conn { PFCP_ConnHdlr vc_conn, OCT8 seid optional, - LIN3_BO_LAST pfcp_msg_sequence_number optional + LIN3_BO_LAST seqnr optional }; type record of PFCPEM_conn PFCPEM_conns; private function f_PFCPEM_conn_by_seqnr(LIN3_BO_LAST seqnr) runs on PFCP_Emulation_CT return PFCP_ConnHdlr { - for (var integer i := 0; i < lengthof(g_conns); i := i + 1) { - if (seqnr == g_conns[i].pfcp_msg_sequence_number) { - return g_conns[i].vc_conn; + for (var integer i := 0; i < lengthof(g_conns_seqnr); i := i + 1) { + if (seqnr == g_conns_seqnr[i].seqnr) { + return g_conns_seqnr[i].vc_conn; } } return null; @@ -86,9 +93,9 @@ private function f_PFCPEM_conn_by_seid(OCT8 seid) runs on PFCP_Emulation_CT return PFCP_ConnHdlr { - for (var integer i := 0; i < lengthof(g_conns); i := i + 1) { - if (seid == g_conns[i].seid) { - return g_conns[i].vc_conn; + for (var integer i := 0; i < lengthof(g_conns_seid); i := i + 1) { + if (seid == g_conns_seid[i].seid) { + return g_conns_seid[i].vc_conn; } } return null; @@ -100,6 +107,7 @@ vc_conn := f_PFCPEM_conn_by_seqnr(pdu.sequence_number); if (vc_conn != null) { + f_PFCPEM_conns_seqnr_del(pdu.sequence_number); return vc_conn; } @@ -111,16 +119,97 @@ return vc_conn; }; -private function f_PFCPEM_conn_add_or_update(in PFCPEM_conn conn) -runs on PFCP_Emulation_CT { - for (var integer i := 0; i < lengthof(g_conns); i := i + 1) { - if (g_conns[i].vc_conn == conn.vc_conn) { - g_conns[i] := conn; /* update */ - return; +/* subscribe/unsubscribe for/from broadcast PDUs */ +private function f_PFCPEM_conns_bcast_add(PFCP_ConnHdlr vc_conn) +runs on PFCP_Emulation_CT return boolean { + for (var integer i := 0; i < lengthof(g_conns_bcast); i := i + 1) { + if (g_conns_bcast[i].vc_conn == vc_conn) { + log(__SCOPE__, "(): vc_conn ", vc_conn, " is already in the list"); + return false; } } - /* Not in the list yet, add. */ - g_conns := g_conns & { conn }; + g_conns_bcast := g_conns_bcast & {{vc_conn, omit, omit}}; + log(__SCOPE__, "(): vc_conn ", vc_conn, " subscribed for broadcast"); + return true; +} +private function f_PFCPEM_conns_bcast_del(PFCP_ConnHdlr vc_conn) +runs on PFCP_Emulation_CT return boolean { + var PFCPEM_conns conns := { }; + + for (var integer i := 0; i < lengthof(g_conns_bcast); i := i + 1) { + if (g_conns_bcast[i].vc_conn != vc_conn) { + conns := conns & { g_conns_bcast[i] }; + } + } + if (lengthof(conns) == lengthof(g_conns_bcast)) { + log(__SCOPE__, "(): vc_conn ", vc_conn, " was not in the list"); + return false; + } + log(__SCOPE__, "(): vc_conn ", vc_conn, " unsubscribed from broadcast"); + g_conns_bcast := conns; + return true; +} + +/* subscribe/unsubscribe for/from PDUs with the given SeqNr value */ +private function f_PFCPEM_conns_seqnr_add(PFCP_ConnHdlr vc_conn, + LIN3_BO_LAST seqnr) +runs on PFCP_Emulation_CT return boolean { + for (var integer i := 0; i < lengthof(g_conns_seqnr); i := i + 1) { + if (g_conns_seqnr[i].seqnr == seqnr) { + log(__SCOPE__, "(): SeqNr ", seqnr, " is already claimed", + " by vc_conn ", g_conns_seqnr[i].vc_conn); + return false; + } + } + g_conns_seqnr := g_conns_seqnr & { {vc_conn, omit, seqnr} }; + return true; +} +private function f_PFCPEM_conns_seqnr_del(LIN3_BO_LAST seqnr) +runs on PFCP_Emulation_CT return boolean { + var PFCPEM_conns conns := { }; + + for (var integer i := 0; i < lengthof(g_conns_seqnr); i := i + 1) { + if (g_conns_seqnr[i].seqnr != seqnr) { + conns := conns & { g_conns_seqnr[i] }; + } + } + if (lengthof(conns) == lengthof(g_conns_seqnr)) { + log(__SCOPE__, "(): SeqNr ", seqnr, " was not in the list"); + return false; + } + g_conns_seqnr := conns; + return true; +} + +/* subscribe/unsubscribe for/from PDUs with the given SEID value */ +private function f_PFCPEM_conns_seid_add(PFCP_ConnHdlr vc_conn, + OCT8 seid) +runs on PFCP_Emulation_CT return boolean { + for (var integer i := 0; i < lengthof(g_conns_seid); i := i + 1) { + if (g_conns_seid[i].seid == seid) { + log(__SCOPE__, "(): SEID ", seid, " is already claimed", + " by vc_conn ", g_conns_seid[i].vc_conn); + return false; + } + } + g_conns_seid := g_conns_seid & { {vc_conn, seid, omit} }; + return true; +} +private function f_PFCPEM_conns_seid_del(OCT8 seid) +runs on PFCP_Emulation_CT return boolean { + var PFCPEM_conns conns := { }; + + for (var integer i := 0; i < lengthof(g_conns_seid); i := i + 1) { + if (g_conns_seid[i].seid != seid) { + conns := conns & { g_conns_seid[i] }; + } + } + if (lengthof(conns) == lengthof(g_conns_seid)) { + log(__SCOPE__, "(): SEID ", seid, " was not in the list"); + return false; + } + g_conns_seid := conns; + return true; } private function f_init(PFCP_Emulation_Cfg cfg) runs on PFCP_Emulation_CT { @@ -133,7 +222,9 @@ g_recovery_timestamp := f_rnd_int(4294967296); g_pfcp_cfg := cfg; - g_conns := {}; + g_conns_bcast := { }; + g_conns_seqnr := { }; + g_conns_seid := { }; g_next_sequence_nr_state := (1 + f_rnd_int(1000)) * 10000; } @@ -142,6 +233,7 @@ var PFCP_ConnHdlr vc_conn; var PFCP_Unitdata ud; var PDU_PFCP pdu; + var OCT8 seid; f_init(cfg); @@ -162,9 +254,9 @@ log("found destination ", vc_conn); CLIENT.send(ud.pdu) to vc_conn; } else { - log("sending to all conns: ", g_conns); - for (var integer i := 0; i < lengthof(g_conns); i := i + 1) { - CLIENT.send(ud.pdu) to g_conns[i].vc_conn; + for (var integer i := 0; i < lengthof(g_conns_bcast); i := i + 1) { + log("broadcasting to ", g_conns_bcast[i].vc_conn); + CLIENT.send(ud.pdu) to g_conns_bcast[i].vc_conn; } } } @@ -183,19 +275,33 @@ pdu := pdu }; - f_PFCPEM_conn_add_or_update({vc_conn, pdu.seid, pdu.sequence_number}); + /* route the response back to this vc_conn */ + f_PFCPEM_conns_seqnr_add(vc_conn, pdu.sequence_number); PFCP.send(ud); } - [] CLIENT_PROC.getcall(PFCPEM_register:{}) -> sender vc_conn { - log("PFCP_Emulation main() CLIENT_PROC.getcall(PFCPEM_register)"); - f_PFCPEM_conn_add_or_update({vc_conn, omit, omit}); - CLIENT_PROC.reply(PFCPEM_register:{}) to vc_conn; + /* subscribe/unsubscribe for/from broadcast PDUs */ + [] CLIENT_PROC.getcall(PFCPEM_subscribe_bcast:{?}) -> sender vc_conn { + var boolean res := f_PFCPEM_conns_bcast_add(vc_conn); + CLIENT_PROC.reply(PFCPEM_subscribe_bcast:{res}) to vc_conn; + } + [] CLIENT_PROC.getcall(PFCPEM_unsubscribe_bcast:{?}) -> sender vc_conn { + var boolean res := f_PFCPEM_conns_bcast_del(vc_conn); + CLIENT_PROC.reply(PFCPEM_unsubscribe_bcast:{res}) to vc_conn; + } + + /* subscribe/unsubscribe for/from PDUs with the given SEID value */ + [] CLIENT_PROC.getcall(PFCPEM_subscribe_seid:{?, ?}) -> param(seid := seid) sender vc_conn { + var boolean res := f_PFCPEM_conns_seid_add(vc_conn, seid); + CLIENT_PROC.reply(PFCPEM_subscribe_seid:{seid, res}) to vc_conn; + } + [] CLIENT_PROC.getcall(PFCPEM_unsubscribe_seid:{?, ?}) -> param(seid := seid) sender vc_conn { + var boolean res := f_PFCPEM_conns_seid_del(seid); + CLIENT_PROC.reply(PFCPEM_unsubscribe_seid:{seid, res}) to vc_conn; } [] CLIENT_PROC.getcall(PFCPEM_get_recovery_timestamp:{?}) -> sender vc_conn { - log("PFCP_Emulation main() CLIENT_PROC.getcall(PFCPEM_get_recovery_timestamp)"); CLIENT_PROC.reply(PFCPEM_get_recovery_timestamp:{g_recovery_timestamp}) to vc_conn; } } @@ -210,11 +316,17 @@ inout PDU_PFCP; } with { extension "internal" }; -signature PFCPEM_register(); +signature PFCPEM_subscribe_bcast(out boolean success); +signature PFCPEM_unsubscribe_bcast(out boolean success); +signature PFCPEM_subscribe_seid(in OCT8 seid, out boolean success); +signature PFCPEM_unsubscribe_seid(in OCT8 seid, out boolean success); signature PFCPEM_get_recovery_timestamp(out integer rts); type port PFCPEM_PROC_PT procedure { - inout PFCPEM_register; + inout PFCPEM_subscribe_bcast; + inout PFCPEM_unsubscribe_bcast; + inout PFCPEM_subscribe_seid; + inout PFCPEM_unsubscribe_seid; inout PFCPEM_get_recovery_timestamp; } with { extension "internal" }; @@ -227,13 +339,47 @@ port PFCPEM_PROC_PT PFCP_PROC; }; -function f_pfcp_register() runs on PFCP_ConnHdlr { - PFCP_PROC.call(PFCPEM_register:{}) { - [] PFCP_PROC.getreply(PFCPEM_register:{}); +/* subscribe/unsubscribe for/from broadcast PDUs */ +function f_PFCPEM_subscribe_bcast() runs on PFCP_ConnHdlr { + PFCP_PROC.call(PFCPEM_subscribe_bcast:{-}) { + [] PFCP_PROC.getreply(PFCPEM_subscribe_bcast:{true}); + [] PFCP_PROC.getreply(PFCPEM_subscribe_bcast:{false}) { + setverdict(fail, __SCOPE__, "() failed"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__); + } + } +} +function f_PFCPEM_unsubscribe_bcast() runs on PFCP_ConnHdlr { + PFCP_PROC.call(PFCPEM_unsubscribe_bcast:{-}) { + [] PFCP_PROC.getreply(PFCPEM_unsubscribe_bcast:{true}); + [] PFCP_PROC.getreply(PFCPEM_unsubscribe_bcast:{false}) { + setverdict(fail, __SCOPE__, "() failed"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__); + } } } -function f_pfcp_get_recovery_timestamp() +/* subscribe/unsubscribe for/from PDUs with the given SEID value */ +function f_PFCPEM_subscribe_seid(in OCT8 seid) runs on PFCP_ConnHdlr { + PFCP_PROC.call(PFCPEM_subscribe_seid:{seid, -}) { + [] PFCP_PROC.getreply(PFCPEM_subscribe_seid:{seid, true}); + [] PFCP_PROC.getreply(PFCPEM_subscribe_seid:{seid, false}) { + setverdict(fail, __SCOPE__, "() failed"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__); + } + } +} +function f_PFCPEM_unsubscribe_seid(in OCT8 seid) runs on PFCP_ConnHdlr { + PFCP_PROC.call(PFCPEM_unsubscribe_seid:{seid, -}) { + [] PFCP_PROC.getreply(PFCPEM_unsubscribe_seid:{seid, true}); + [] PFCP_PROC.getreply(PFCPEM_unsubscribe_seid:{seid, false}) { + setverdict(fail, __SCOPE__, "() failed"); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__); + } + } +} + +function f_PFCPEM_get_recovery_timestamp() runs on PFCP_ConnHdlr return integer { var integer rts; diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index 5b2e7bb..8d1a2b2 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -232,7 +232,9 @@ { var PDU_PFCP rx; + f_PFCPEM_subscribe_bcast(); /* ask PFCPEM to route all PDUs to us */ rx := f_ConnHdlr_pfcp_expect(tr_PFCP_Assoc_Setup_Req, Tval := 10.0); + f_PFCPEM_unsubscribe_bcast(); /* ask PFCPEM to *not* route all PDUs to us */ PFCP.send(ts_PFCP_Assoc_Setup_Resp(rx.sequence_number, ts_PFCP_Node_ID_fqdn("\07osmocom\03org"), ts_PFCP_Cause(REQUEST_ACCEPTED), @@ -264,8 +266,7 @@ function f_ConnHdlr_register_pfcp() runs on ConnHdlr { - f_pfcp_register(); - g_pfcp_recovery_timestamp := f_pfcp_get_recovery_timestamp(); + g_pfcp_recovery_timestamp := f_PFCPEM_get_recovery_timestamp(); /* First ConnHdlr answers the AssocSetup: */ if (g_pars.idx != 0) { @@ -561,6 +562,11 @@ function f_ConnHdlr_erab_setup_req(inout ERabList erabs) 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. */ + 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) { @@ -568,9 +574,13 @@ var PDU_PFCP pdu := f_ConnHdlr_rx_session_establish_req(erabs[i]); /* store peer's SEID, so that it can be used in outgoing PDUs later */ erabs[i].pfcp_rem_seid := pdu.message_body.pfcp_session_establishment_request.CP_F_SEID.seid; + /* ask PFCPEM to route PDUs with the local SEID to us */ + f_PFCPEM_subscribe_seid(erabs[i].pfcp_loc_seid); 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). */ + f_PFCPEM_unsubscribe_seid(c_SEID0); log("[eNB <- S1GW] <- MME: E-RAB SETUP REQUEST"); f_ConnHdlr_rx_erab_setup_req(erabs); } @@ -598,6 +608,8 @@ var PDU_PFCP pdu := f_ConnHdlr_rx_session_delete_req(erabs[i]); log("UPF -> S1GW: PFCP Session Deletion Response for E-RAB ID ", erabs[i].erab_id); f_ConnHdlr_tx_session_delete_resp(erabs[i], pdu); + /* ask PFCPEM to *not* route PDUs with this SEID to us */ + f_PFCPEM_unsubscribe_seid(erabs[i].pfcp_loc_seid); } f_ConnHdlr_rx_erab_release_cmd(erabs, cause); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38207?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: I25802471519fa297ad4cb2b056adaa6748b00af2 Gerrit-Change-Number: 38207 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>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: s1gw: add multi-eNB variants of TC_e_rab_setup
by laforge 26 Sep '24

26 Sep '24
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38213?usp=email ) Change subject: s1gw: add multi-eNB variants of TC_e_rab_setup ...................................................................... Patch Set 6: Code-Review+2 -- 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: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I9e2eb25a7ae78ff623b94802d881af4894d0cacd Gerrit-Change-Number: 38213 Gerrit-PatchSet: 6 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> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Sep 2024 21:25:34 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: s1gw: make number of eNBs configurable via module params
by laforge 26 Sep '24

26 Sep '24
Attention is currently required from: fixeria, pespin. laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38210?usp=email ) Change subject: s1gw: make number of eNBs configurable via module params ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38210?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ia80b9118e66a5d6721b89d3ba068227d30dcc01f Gerrit-Change-Number: 38210 Gerrit-PatchSet: 4 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> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Thu, 26 Sep 2024 21:25:15 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • ...
  • 199
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.