[M] Change in osmo-ttcn3-hacks[master]: smf: Support concurrent sessions
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43714?usp=email ) Change subject: smf: Support concurrent sessions ...................................................................... smf: Support concurrent sessions Change-Id: I10157c936162ea001b81c054041fb9325a0e5d96 --- M library/HTTP2_Server_Emulation.ttcn M smf/SMF_Session_CT.ttcn M smf/SMF_Session_CT_4G.ttcn M smf/SMF_Session_CT_5G.ttcn M smf/SMF_Tests.ttcn M smf/expected-results.xml M smf/open5gs-smf.yaml 7 files changed, 51 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/14/43714/1 diff --git a/library/HTTP2_Server_Emulation.ttcn b/library/HTTP2_Server_Emulation.ttcn index 96eb8dc..5b558bd 100644 --- a/library/HTTP2_Server_Emulation.ttcn +++ b/library/HTTP2_Server_Emulation.ttcn @@ -26,7 +26,7 @@ import from Native_Functions all; import from Misc_Helpers all; -const integer HTTP2_SERVER_EMU_MAX_NUM_CONNS := 16; +const integer HTTP2_SERVER_EMU_MAX_NUM_CONNS := 250; const integer HTTP2_SERVER_EMU_MAX_NUM_CONNHDLR := HTTP2_SERVER_EMU_MAX_NUM_CONNS * 3; /********************* diff --git a/smf/SMF_Session_CT.ttcn b/smf/SMF_Session_CT.ttcn index e7a78fc..e581251 100644 --- a/smf/SMF_Session_CT.ttcn +++ b/smf/SMF_Session_CT.ttcn @@ -296,6 +296,7 @@ f_handler_init_5G(); fn.apply(); + f_handler_cleanup_5G(); } /******* diff --git a/smf/SMF_Session_CT_4G.ttcn b/smf/SMF_Session_CT_4G.ttcn index 06a7e37..d041e19 100644 --- a/smf/SMF_Session_CT_4G.ttcn +++ b/smf/SMF_Session_CT_4G.ttcn @@ -225,7 +225,7 @@ * 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_Mutex_lock(__BFILE__, __LINE__, Tval := 30.0); /* 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); diff --git a/smf/SMF_Session_CT_5G.ttcn b/smf/SMF_Session_CT_5G.ttcn index f213944..0f01549 100644 --- a/smf/SMF_Session_CT_5G.ttcn +++ b/smf/SMF_Session_CT_5G.ttcn @@ -44,10 +44,24 @@ /* Index in SMF_Session_CT inherited HTTP2_ConnHdlr ports HTTP2_CONN[] and HTTP2_CONN_PROC[] */ const integer HTTP2_CONN_SCP := 0; +/* These are a preset of path matches which can be applied through the entire lifecycle of the session: */ +function f_http2_server_path_match() +runs on SMF_Session_CT return charstring { + var charstring imsi_match := "*imsi-" & g_pars.imsi_str & "*"; + var charstring sm_policy_id_match := valueof(ts_Npcf_SMPolicyControl_path_individual_sm_policy(g_pars.npcf.sm_policy_id)) & "/*"; + var charstring path_match := "(" & imsi_match & ")|(" & sm_policy_id_match & ")"; + return path_match; +} + function f_handler_init_5G() runs on SMF_Session_CT { - /* Create SCP HTTP2 sever, where IUT will send all SBI requests: */ - f_http2_server_emu_register(idx := HTTP2_CONN_SCP); + /* Register SCP HTTP2 sever, where IUT will send all SBI requests: */ + f_http2_server_emu_register(f_http2_server_path_match(), idx := HTTP2_CONN_SCP); +} + +function f_handler_cleanup_5G() +runs on SMF_Session_CT { + f_http2_server_emu_unregister(f_http2_server_path_match(), idx := HTTP2_CONN_SCP); } /******************************************** @@ -206,13 +220,17 @@ * 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_Mutex_lock(__BFILE__, __LINE__, Tval := 30.0); /* 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); f_http2_adapter_send(http2_tx); + /* PCF: register to rx generic path. We take advantage of the fact that + * we are inside a mutual exclusion zone, so only one session can be here at a time. */ + f_http2_server_emu_register(Npcf_SMPolicyControl_path_sm_policies, idx := HTTP2_CONN_SCP); + /* Expect UDM to receive GET sm-data: */ as_nudm_sdm_get_sm_data(); /* Expect UDM to receive POST sdm-subscriptions: */ @@ -230,11 +248,15 @@ /* Store obtained smContextRef:*/ var charstring created_location := valueof(f_HTTP2_header_list_find_header(http2_rx.hb.headers, c_HTTP2_HDR_location)); g_pars.nsmf.smContextRef := regexp(created_location, Nsmf_uri_prefix & Nsmf_PDUSession_path_sm_contexts & "/(?+)", 0); + /* Prepare expect for the smContextRef: */ + f_http2_server_emu_register(valueof(ts_Nsmf_PDUSession_path_sm_contexts(g_pars.nsmf.smContextRef)), + idx := HTTP2_CONN_SCP); /* Close HTTP2 conn: */ f_http2_adapter_close(idx := http2_idx); /* Expect PCF to receive POST sm-policies: */ as_npcf_smpolicycontrol_post_sm_policies(); + f_http2_server_emu_unregister(Npcf_SMPolicyControl_path_sm_policies, idx := HTTP2_CONN_SCP); /* Expect PFCP Session Establishment Request. */ as_pfcp_sess_est_req(); @@ -364,6 +386,8 @@ /* Successful answer with no content: */ as_http2_adapter_receive(http2_rx, tr_HTTP2_Msg_204_No_Content(), idx := http2_idx); + f_http2_server_emu_unregister(valueof(ts_Nsmf_PDUSession_path_sm_contexts(g_pars.nsmf.smContextRef)), + idx := HTTP2_CONN_SCP); f_http2_adapter_close(idx := http2_idx); setverdict(pass); } diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 32af169..1c9cf5a 100644 --- a/smf/SMF_Tests.ttcn +++ b/smf/SMF_Tests.ttcn @@ -501,6 +501,22 @@ vc_conn.done; } +testcase TC_n11_createSession_deleteSession_250() runs on SMF_Test_CT { + var SMF_Session_CT vc_conn[250]; + var integer i; + + f_init(); + + for (i := 0; i < sizeof(vc_conn); i := i + 1) { + var SessionPars pars := f_SessionPars(idx := i); + vc_conn[i] := f_start_handler(refers(f_TC_n11_createSession_deleteSession), pars); + } + + for (i := 0; i < sizeof(vc_conn); i := i + 1) { + vc_conn[i].done; + } +} + control { execute( TC_tx_echo() ); execute( TC_createSession_deleteSession() ); @@ -511,6 +527,8 @@ execute( TC_s2b_createSession_v4_apco() ); execute( TC_n11_createSession_deleteSession() ); + + execute( TC_n11_createSession_deleteSession_250() ); } diff --git a/smf/expected-results.xml b/smf/expected-results.xml index a167103..c8f6931 100644 --- a/smf/expected-results.xml +++ b/smf/expected-results.xml @@ -8,4 +8,5 @@ <testcase classname='SMF_Tests' name='TC_s2b_createSession_v4_noapco' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_s2b_createSession_v4_apco' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession' time='MASKED'/> + <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession_250' time='MASKED'/> </testsuite> diff --git a/smf/open5gs-smf.yaml b/smf/open5gs-smf.yaml index f37de82..c5dbea1 100644 --- a/smf/open5gs-smf.yaml +++ b/smf/open5gs-smf.yaml @@ -70,3 +70,5 @@ max: time: + message: + duration: 20000 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43714?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: I10157c936162ea001b81c054041fb9325a0e5d96 Gerrit-Change-Number: 43714 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>
participants (1)
-
pespin