[M] Change in osmo-ttcn3-hacks[master]: smf: Introduce test TC_pfcp_heartbeat_timeout
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43873?usp=email ) Change subject: smf: Introduce test TC_pfcp_heartbeat_timeout ...................................................................... smf: Introduce test TC_pfcp_heartbeat_timeout This test showcases how open5gs-smfd doesn't release UE sessions when the only UPF becomes unavailable. Related: https://github.com/open5gs/open5gs/issues/4860 Change-Id: I27daa6636e45909d6d83a46af094108e71efc552 --- M smf/SMF_Tests.ttcn M smf/expected-results.xml 2 files changed, 60 insertions(+), 0 deletions(-) Approvals: fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/smf/SMF_Tests.ttcn b/smf/SMF_Tests.ttcn index 9341de4..b868ac7 100644 --- a/smf/SMF_Tests.ttcn +++ b/smf/SMF_Tests.ttcn @@ -574,6 +574,63 @@ f_shutdown(); } + +/* Validate IUT detects PFCP Heartbeat timeout and recovers from it tearing down + * existing subscriber connections: */ +private template (value) PrometheusExpects t_Metrics_Expect(integer pfcp_peers_active, integer ues_active) := { + ts_PrometheusExpect("pfcp_peers_active", GAUGE, min := pfcp_peers_active, max := pfcp_peers_active), + ts_PrometheusExpect("ues_active", GAUGE, min := ues_active, max := ues_active), + ts_PrometheusExpect("gtp2_sessions_active", GAUGE, min := ues_active, max := ues_active) +}; +private function f_TC_pfcp_heartbeat_timeout() runs on SMF_Session_CT { + var PDU_PFCP m; + var integer rts := f_PFCPEM_get_recovery_timestamp(); + + f_prometheus_expect(valueof(t_Metrics_Expect(1, 0)), wait_converge := true); + + /* Drop all received Hearbeat requests from IUT: */ + f_PFCPEM_subscribe_bcast(); + var default d := activate(as_pfcp_ignore(PFCP, tr_PFCP_Heartbeat_Req)); + + f_s5s8_create_session(); + f_prometheus_expect(valueof(t_Metrics_Expect(1, 1)), wait_converge := true); + + /* Wait for IUT to detect peer went down after Heartbeat timeout, ie. wait for a 2nd ASSOC SETUP REQ + * after Heartbeat timeout: + * TODO: Handle tear down indication towards SGW-C (s5/s8c), PCRF (Gx) and OCS (Gy) */ + PFCP.receive(tr_PFCP_Assoc_Setup_Req()) -> value m; + deactivate(d); + activate(as_pfcp_handle_heartbeat_req(rts, do_repeat := true)); + f_prometheus_expect(valueof(t_Metrics_Expect(0, 1)), wait_converge := true); + PFCP.send(ts_PFCP_Assoc_Setup_Resp(m.sequence_number, + ts_PFCP_Node_ID_ipv4(f_inet_addr(mp_pfcp_ip_local)), + ts_PFCP_Cause(REQUEST_ACCEPTED), + rts, + up_function_features := ts_PFCP_UP_Function_Features(ftup := '1'B, + vtime := '1'B))); + + /* After we answer the ASSOC SETUP RESP, IUT detects peer up: */ + /* FIXME: https://github.com/open5gs/open5gs/issues/4860 + * Instead of the commented line below, since open5gs-smfd is not tearing down the session, + * then delete the session to avoid leaving it dandling and open5gs-smfd trying to restore it (PFCP Sess Est Req) + * on other tests executed afterwards and making them fail due to unexpected msg received: + */ + // f_prometheus_expect(valueof(t_Metrics_Expect(1, 0)), wait_converge := true); + // setverdict(pass); + f_s5s8_delete_session(omit, Request_accepted); + setverdict(fail, "https://github.com/open5gs/open5gs/issues/4860"); +} +testcase TC_pfcp_heartbeat_timeout() runs on SMF_Test_CT { + var SMF_Session_CT vc_conn; + var SessionPars pars := f_SessionPars(800); + g_pfcp_answer_heartbeat_req := false; + f_init(guard_timeout := 60.0); + vc_conn := f_start_handler(refers(f_TC_pfcp_heartbeat_timeout), pars); + vc_conn.done; + f_shutdown(); +} + + /* create an IPv4 session from 5G AMF, then delete it again */ private function f_TC_n11_createSession_deleteSession() runs on SMF_Session_CT { var PrometheusExpects expects0 := valueof({ @@ -675,6 +732,8 @@ execute( TC_s2b_createSession_v4_noapco() ); execute( TC_s2b_createSession_v4_apco() ); + execute( TC_pfcp_heartbeat_timeout() ); + execute( TC_n11_createSession_deleteSession() ); execute( TC_n11_createSession_deleteSession_ipv6() ); execute( TC_n11_createSession_deleteSession_ipv4v6() ); diff --git a/smf/expected-results.xml b/smf/expected-results.xml index b610ee8..1deaf2c 100644 --- a/smf/expected-results.xml +++ b/smf/expected-results.xml @@ -12,6 +12,7 @@ <testcase classname='SMF_Tests' name='TC_gy_ccr_update_rejected' time='MASKED'/> <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_pfcp_heartbeat_timeout' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession_ipv6' time='MASKED'/> <testcase classname='SMF_Tests' name='TC_n11_createSession_deleteSession_ipv4v6' time='MASKED'/> -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43873?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: I27daa6636e45909d6d83a46af094108e71efc552 Gerrit-Change-Number: 43873 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
pespin