[M] Change in osmo-ttcn3-hacks[master]: sepp: Adapt to newer open5gs behavior
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44095?usp=email ) Change subject: sepp: Adapt to newer open5gs behavior ...................................................................... sepp: Adapt to newer open5gs behavior We should let the SEPP register with the NRF before attempting to negoatiate with it. Add a specific test to check the scenario when negotiating is done without prior NRF registering. Also, since SEPP may not re-register later on again with NRF once it was already registered, Make the NRF handling path in f_TC_security_cap_negotiation_server() optional. Related: https://github.com/open5gs/open5gs/pull/4985#issuecomment-6916101644 Change-Id: I93f7cb08bd2c68005835fc25ec47858db4fa85ab --- M sepp/ConnHdlr.ttcn M sepp/SEPP_Tests.ttcn M sepp/expected-results.xml 3 files changed, 46 insertions(+), 12 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/sepp/ConnHdlr.ttcn b/sepp/ConnHdlr.ttcn index 8d4a5d0..880b092 100644 --- a/sepp/ConnHdlr.ttcn +++ b/sepp/ConnHdlr.ttcn @@ -220,7 +220,8 @@ } /* 6.1.4.2 Operation: Security Capability Negotiation */ -function f_N32_Handshake_post_sec_cap_neg(template (value) SecurityCapability_enum sec_cap := NONE) +function f_N32_Handshake_post_sec_cap_neg(template (value) SecurityCapability_enum sec_cap := NONE, + integer exp_http2_resp_code := 200) runs on ConnHdlr { var HTTP2_Msg http2_tx; var HTTP2_Msg http2_rx; @@ -236,14 +237,24 @@ f_http2_adapter_connect_send_sepp_n32c(http2_tx, idx := http2_tx.conn_id); /* 3GPP TS 29.521 Table 5.3.2.3.1-3 */ - http2_exp_rx := - tr_HTTP2_Msg(http2_tx.conn_id, - http2_tx.stream_id, - tr_HTTP2_header_block(pseudo_headers := tr_HTTP2_pseudo_headers_Resp(200)), - tr_HTTP2_Data_frame(stream_id := http2_tx.stream_id, - end_stream_flag := true, - data := decmatch tr_SecNegotiateRspData(sender_ := mp_sepp_fqdn_sender, - selectedSecCapability := tr_SecurityCapability(sec_cap)))); + if (exp_http2_resp_code == 200) { /* OK */ + http2_exp_rx := + tr_HTTP2_Msg(http2_tx.conn_id, + http2_tx.stream_id, + tr_HTTP2_header_block(pseudo_headers := tr_HTTP2_pseudo_headers_Resp(200)), + tr_HTTP2_Data_frame(stream_id := http2_tx.stream_id, + end_stream_flag := true, + data := decmatch tr_SecNegotiateRspData(sender_ := mp_sepp_fqdn_sender, + selectedSecCapability := tr_SecurityCapability(sec_cap)))); + } else if (exp_http2_resp_code == 503) { /* Service Unavailable */ + http2_exp_rx := + tr_HTTP2_Msg(http2_tx.conn_id, + http2_tx.stream_id, + tr_HTTP2_header_block(pseudo_headers := tr_HTTP2_pseudo_headers_Resp(503)), + tr_HTTP2_Data_frame(stream_id := http2_tx.stream_id, + end_stream_flag := true, + data := ?)); + } as_http2_adapter_receive(http2_rx, http2_exp_rx, idx := http2_tx.conn_id); f_http2_adapter_close(idx := http2_tx.conn_id); diff --git a/sepp/SEPP_Tests.ttcn b/sepp/SEPP_Tests.ttcn index 8b75273..cd064ab 100644 --- a/sepp/SEPP_Tests.ttcn +++ b/sepp/SEPP_Tests.ttcn @@ -155,7 +155,24 @@ f_shutdown(); } +/* Peer SEPP tries to get IUT serving PLMN list before the IUT registered to its own NRF + * (it gets its PLMN list from there). IUT should answer with 503 Service Unavailable. */ +private function f_TC_security_cap_negotiation_tls_serving_plmn_list_unavailable() runs on ConnHdlr { + f_N32_Handshake_post_sec_cap_neg(TLS, exp_http2_resp_code := 503); + setverdict(pass); +} +testcase TC_security_cap_negotiation_tls_serving_plmn_list_unavailable() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(0); + f_init(); + vc_conn := f_start_handler(refers(f_TC_security_cap_negotiation_tls_serving_plmn_list_unavailable), pars); + vc_conn.done; + f_shutdown(); +} + private function f_TC_security_cap_negotiation_tls() runs on ConnHdlr { + as_Nnrf_NFM_put_nf_instance(); + as_Nnrf_NFM_get_nf_instances(); f_N32_Handshake_post_sec_cap_neg(TLS); f_N32_Handshake_post_sec_cap_neg(NONE); setverdict(pass); @@ -188,9 +205,13 @@ var HTTP2_Msg http2_rx; var template (present) HTTP2_Msg http2_exp_rx; - as_Nnrf_NFM_put_nf_instance(); - as_Nnrf_NFM_get_nf_instances(); - as_N32_Handshake_post_sec_cap_neg(); + alt { + [] as_Nnrf_NFM_put_nf_instance() { + as_Nnrf_NFM_get_nf_instances(); + repeat; + } + [] as_N32_Handshake_post_sec_cap_neg(); + } /* Test NF sendig data through IUT c-SEPP to our emulated SEPP and back: */ http2_tx := f_n35_prepare_get_authentication_subscription(); @@ -236,6 +257,7 @@ control { execute( TC_security_cap_negotiation_none() ); + execute( TC_security_cap_negotiation_tls_serving_plmn_list_unavailable() ); execute( TC_security_cap_negotiation_tls() ); execute( TC_security_cap_negotiation_prins() ); execute( TC_security_cap_negotiation_server() ); diff --git a/sepp/expected-results.xml b/sepp/expected-results.xml index bd9d091..242936c 100644 --- a/sepp/expected-results.xml +++ b/sepp/expected-results.xml @@ -1,6 +1,7 @@ <?xml version="1.0"?> <testsuite name='Titan' tests='4' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'> <testcase classname='SEPP_Tests' name='TC_security_cap_negotiation_none' time='MASKED'/> + <testcase classname='SEPP_Tests' name='TC_security_cap_negotiation_tls_serving_plmn_list_unavailable' time='MASKED'/> <testcase classname='SEPP_Tests' name='TC_security_cap_negotiation_tls' time='MASKED'/> <testcase classname='SEPP_Tests' name='TC_security_cap_negotiation_prins' time='MASKED'/> <testcase classname='SEPP_Tests' name='TC_security_cap_negotiation_server' time='MASKED'/> -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44095?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: I93f7cb08bd2c68005835fc25ec47858db4fa85ab Gerrit-Change-Number: 44095 Gerrit-PatchSet: 3 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