pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43902?usp=email )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: smf: Introduce test TC_createSession_pfcp_sess_est_timeout ......................................................................
smf: Introduce test TC_createSession_pfcp_sess_est_timeout
Change-Id: I005cc6c6afd3f9aba15790e8cd67eeaa2f4d4b89 --- M library/GTPv2_Templates.ttcn M smf/SMF_Session_CT_4G.ttcn M smf/SMF_Tests.ttcn M smf/expected-results.xml 4 files changed, 72 insertions(+), 18 deletions(-)
Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/library/GTPv2_Templates.ttcn b/library/GTPv2_Templates.ttcn index 3073a64..1664f9a 100644 --- a/library/GTPv2_Templates.ttcn +++ b/library/GTPv2_Templates.ttcn @@ -176,6 +176,7 @@ New_PDN_type_due_to_single_address_bearer_only (19), /* ... */ Context_Not_Found (64), + System_Failure (72), APN_access_denied__no_subscription (93) } with { variant "FIELDLENGTH(8)" encode "RAW" };
diff --git a/smf/SMF_Session_CT_4G.ttcn b/smf/SMF_Session_CT_4G.ttcn index 35a2b5f..c2cf3d7 100644 --- a/smf/SMF_Session_CT_4G.ttcn +++ b/smf/SMF_Session_CT_4G.ttcn @@ -165,6 +165,20 @@ } }
+function f_DIA_handle_delete_session() runs on SMF_Session_CT +{ + var boolean do_s6b := is_s2b_iface(); + if (do_s6b and DIAMETER[DIA_S6b].checkstate("Connected")) { + as_DIA_S6b_STR(); + } + if (DIAMETER[DIA_Gx].checkstate("Connected")) { + as_DIA_Gx_CCR(TERMINATION_REQUEST); + } + if (DIAMETER[DIA_Gy].checkstate("Connected")) { + as_DIA_Gy_CCR(TERMINATION_REQUEST); + } +} + /* GTPv2C */ private function is_s2b_iface() runs on SMF_Session_CT return boolean { return (g_pars.rat_type == GTP2C_RAT_WLAN or g_pars.rat_type == GTP2C_RAT_Virtual); @@ -433,15 +447,8 @@ as_pfcp_sess_del_req(); }
- if (is_s2b_iface() and DIAMETER[DIA_S6b].checkstate("Connected") and expect_diameter) { - as_DIA_S6b_STR(); - } - - if (DIAMETER[DIA_Gx].checkstate("Connected") and expect_diameter) { - as_DIA_Gx_CCR(TERMINATION_REQUEST); - } - if (DIAMETER[DIA_Gy].checkstate("Connected") and expect_diameter) { - as_DIA_Gy_CCR(TERMINATION_REQUEST); + if (expect_diameter) { + f_DIA_handle_delete_session(); } alt { [] GTP2.receive(tr_GTP2C_DeleteSessionResp(d_teid := g_pars.teic_local, cause := exp_cause)) { @@ -496,15 +503,8 @@ rx_pdu.gtpcv2_pdu.deleteBearerRequest.epsBearerIdentity[0].ePS_Bearer_ID_Value, Request_accepted); GTP2.send(tx_pdu);
- if (is_s2b_iface() and DIAMETER[DIA_S6b].checkstate("Connected") and expect_diameter) { - as_DIA_S6b_STR(); - } - - if (DIAMETER[DIA_Gx].checkstate("Connected") and expect_diameter) { - as_DIA_Gx_CCR(TERMINATION_REQUEST); - } - if (DIAMETER[DIA_Gy].checkstate("Connected") and expect_diameter) { - as_DIA_Gy_CCR(TERMINATION_REQUEST); + if (expect_diameter) { + f_DIA_handle_delete_session(); } setverdict(pass); } diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 3a6b1d6..d737688 100644 --- a/smf/SMF_Tests.ttcn +++ b/smf/SMF_Tests.ttcn @@ -428,6 +428,57 @@ f_TC_createSession_deleteSession_250(c_PFCP_PDN_Type_IPv4v6); }
+/* create an IPv4 session, then delete it again */ +private function f_TC_createSession_pfcp_sess_est_timeout() runs on SMF_Session_CT { + var PrometheusExpects expects0 := valueof({ + ts_PrometheusExpect("ues_active", GAUGE, min := 0, max := 0), + ts_PrometheusExpect("gtp2_sessions_active", GAUGE, min := 0, max := 0) + }); + var PrometheusExpects expects1 := valueof({ + ts_PrometheusExpect("ues_active", GAUGE, min := 1, max := 1), + ts_PrometheusExpect("gtp2_sessions_active", GAUGE, min := 1, max := 1) + }); + f_prometheus_expect(expects0, wait_converge := true); + + + /* 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_s5s8_tx_create_session_req(f_s5s8_fteid_c_ie(), + f_s5s8_fteid_u_ie(), + f_s5s8_UserLocationInfo()); + f_DIA_handle_create_sesion(); + + f_prometheus_expect(expects1, wait_converge := true); + + log("Waiting 1st PFCP Sess Est Req"); + PFCP.receive(f_Session_tr_PFCP_Session_Est_Req()); + log("RX 1st PFCP Sess Est Req"); + PFCP.receive(f_Session_tr_PFCP_Session_Est_Req()); + log("RX 2nd PFCP Sess Est Req"); + PFCP.receive(f_Session_tr_PFCP_Session_Est_Req()); + log("RX 3rd PFCP Sess Est Req"); + + f_DIA_handle_delete_session(); + /* This currently may fail to be transmitted due to: + * https://github.com/open5gs/open5gs/issues/4876 + * */ + GTP2.receive(tr_GTP2C_CreateSessionResp(d_teid := g_pars.teic_local, + cause := System_Failure)); + f_prometheus_expect(expects0, wait_converge := true); + setverdict(pass); +} +testcase TC_createSession_pfcp_sess_est_timeout() runs on SMF_Test_CT { + var SMF_Session_CT vc_conn; + var SessionPars pars := f_SessionPars(11); + f_init(); + vc_conn := f_start_handler(refers(f_TC_createSession_pfcp_sess_est_timeout), pars); + vc_conn.done; + f_shutdown(); +} + /* send a DeleteSessionReq for an unknown/invalid TEID */ private function f_TC_deleteSession_unknown() runs on SMF_Session_CT { g_pars.teic_remote := f_rnd_octstring(4); @@ -766,6 +817,7 @@ execute( TC_createSession_deleteSession_250() ); execute( TC_createSession_deleteSession_250_ipv6() ); execute( TC_createSession_deleteSession_250_ipv4v6() ); + execute( TC_createSession_pfcp_sess_est_timeout() ); execute( TC_deleteSession_unknown() ); execute( TC_gy_charging_cc_time() ); execute( TC_gy_ccr_update_rejected() ); diff --git a/smf/expected-results.xml b/smf/expected-results.xml index aab8202..1493d31 100644 --- a/smf/expected-results.xml +++ b/smf/expected-results.xml @@ -7,6 +7,7 @@ <testcase classname='SMF_Tests' name='TC_createSession_deleteSession_250' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_createSession_deleteSession_250_ipv6' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_createSession_deleteSession_250_ipv4v6' time='MASKED'/> + <testcase classname='SMF_Tests' name='TC_createSession_pfcp_sess_est_timeout' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_deleteSession_unknown' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_gy_charging_cc_time' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_gy_ccr_update_rejected' time='MASKED'/>