pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43960?usp=email )


Change subject: WIP: Introduce ausf testsuite
......................................................................

WIP: Introduce ausf testsuite

Change-Id: Ife5af76587b4416767535875e27b02236ee5e1d9
---
M Makefile
A ausf/AUSF_Tests.cfg
A ausf/AUSF_Tests.default
A ausf/AUSF_Tests.ttcn
A ausf/ConnHdlr.ttcn
A ausf/README.md
A ausf/expected-results.xml
A ausf/gen_links.sh
A ausf/open5gs-ausf.yaml
A ausf/regen_makefile.sh
A ausf/testenv.cfg
A ausf/testsrcdir.cfg
A library/TS29509_Nausf_UEAuthentication_Templates.ttcn
13 files changed, 732 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/60/43960/1

diff --git a/Makefile b/Makefile
index ed02e18..459929a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@
 SUBDIRS= \
        5gc \
        asterisk \
+       ausf \
        bsc \
        bsc-nat \
        bts \
diff --git a/ausf/AUSF_Tests.cfg b/ausf/AUSF_Tests.cfg
new file mode 100644
index 0000000..c23657a
--- /dev/null
+++ b/ausf/AUSF_Tests.cfg
@@ -0,0 +1,23 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./AUSF_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+AUSF_Tests.mp_ausf_hostname := "127.0.0.11";
+AUSF_Tests.mp_ausf_sbi_port := 7777;
+AUSF_Tests.mp_scp_local_ip := "127.0.0.200";
+AUSF_Tests.mp_scp_local_port := 7777;
+AUSF_Tests.mp_ausf_local_ip := "127.0.0.6";
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+AUSF_Tests.control
diff --git a/ausf/AUSF_Tests.default b/ausf/AUSF_Tests.default
new file mode 100644
index 0000000..b03f59e
--- /dev/null
+++ b/ausf/AUSF_Tests.default
@@ -0,0 +1,12 @@
+[LOGGING]
+FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
+
+[TESTPORT_PARAMETERS]
+*.TCP.noDelay := "yes" // turn off nagle
+*.HTTP.use_notification_ASPs := "yes"
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
diff --git a/ausf/AUSF_Tests.ttcn b/ausf/AUSF_Tests.ttcn
new file mode 100644
index 0000000..3638e87
--- /dev/null
+++ b/ausf/AUSF_Tests.ttcn
@@ -0,0 +1,137 @@
+/* AUSF test suite in TTCN-3 (3GPP TS 29.503, 3GPP TS 29.509)
+ * (C) 2026 by sysmocom - s.f.m.c. GmbH <[email protected]>
+ * All rights reserved.
+ * Author: Pau Espin Pedrol <[email protected]>
+ *
+ * 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 AUSF_Tests {
+
+import from General_Types all;
+import from Native_Functions all;
+import from IPL4asp_Types all;
+import from Misc_Helpers all;
+
+import from Osmocom_Types all;
+import from GSM_Types all;
+
+import from TCCEncoding_Functions all;
+
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
+import from ConnHdlr all;
+
+modulepar {
+       charstring mp_ausf_hostname := "127.0.0.11";
+       integer mp_ausf_sbi_port := 7777;
+
+       charstring mp_scp_local_ip := "127.0.0.200";
+       integer mp_scp_local_port := 7777;
+
+       /* IP address at which we listen for HTTP2/SBI to emulate a AUSF in 
ttcn3 */
+       charstring mp_ausf_local_ip := "127.0.0.6";
+
+       GsmMcc mp_mcc := '999'H;
+       GsmMnc mp_mnc := '70'H;
+       HEX15n mp_imsi := '999700000000000'H;
+}
+
+type component MTC_CT extends HTTP2_CT, HTTP2_ConnHdlr {
+       /* emulated SCP */
+       var HTTP2_Server_Emulation_CT vc_HTTP2_SRV_SCP;
+
+       timer g_Tguard := 30.0;
+}
+
+private function f_init_http2_srv(charstring id) runs on MTC_CT {
+       id := id & "-HTTP2SRV";
+
+       var Http2ServerEmulationCfg http2_srv_cfg := {
+               http2_bind_ip := mp_scp_local_ip,
+               http2_bind_port := mp_scp_local_port,
+               one_req_per_conn := false
+       };
+
+       vc_HTTP2_SRV_SCP := HTTP2_Server_Emulation_CT.create(id) alive;
+       vc_HTTP2_SRV_SCP.start(HTTP2_Server_Emulation.main(http2_srv_cfg));
+
+       connect(self:HTTP2_CONN_PROC[HTTP2_CONN_SCP], 
vc_HTTP2_SRV_SCP:CONN_PROC);
+}
+
+
+private function f_init(integer imsi_suffix := 0, float t_guard := 30.0) runs 
on MTC_CT {
+       var charstring id := testcasename();
+
+       g_Tguard.start(t_guard);
+       activate(as_Tguard());
+
+       f_init_http2_srv(id);
+}
+
+private function f_shutdown() runs on MTC_CT {
+       f_http2_server_close_conn_all();
+       setverdict(pass);
+}
+
+private function f_start_handler_create()
+runs on MTC_CT return ConnHdlr
+{
+       var ConnHdlr vc_conn;
+       var charstring id := testcasename();
+
+       vc_conn := ConnHdlr.create(id);
+
+       if (isbound(vc_HTTP2_SRV_SCP)) {
+               connect(vc_conn:HTTP2_CONN[HTTP2_CONN_SCP], 
vc_HTTP2_SRV_SCP:CONN);
+               connect(vc_conn:HTTP2_CONN_PROC[HTTP2_CONN_SCP], 
vc_HTTP2_SRV_SCP:CONN_PROC);
+       }
+
+       return vc_conn;
+}
+
+private function f_start_handler_run(ConnHdlr vc_conn, void_fn fn, 
ConnHdlrPars pars) runs on MTC_CT
+{
+       vc_conn.start(f_ConnHdlr_init(fn, pars));
+}
+
+/* start a connection handler with given parameters */
+private function f_start_handler(void_fn fn, ConnHdlrPars pars)
+runs on MTC_CT return ConnHdlr {
+       var ConnHdlr vc_conn;
+       vc_conn := f_start_handler_create();
+       f_start_handler_run(vc_conn, fn, pars);
+       return vc_conn;
+}
+
+private altstep as_Tguard() runs on MTC_CT {
+       [] g_Tguard.timeout {
+               Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard 
timeout");
+       }
+}
+
+/* 3GPP TS 29.509 5.2.2.2.2 5G AKA */
+private function f_TC_5g_aka() runs on ConnHdlr {
+       f_n12_post_ue_authentications();
+       f_n12_put_5g_aka_confirmation();
+       setverdict(pass);
+}
+testcase TC_5g_aka() runs on MTC_CT {
+       var ConnHdlr vc_conn;
+       var ConnHdlrPars pars := f_ConnHdlrPars(0);
+       f_init();
+       vc_conn := f_start_handler(refers(f_TC_5g_aka), pars);
+       vc_conn.done;
+       f_shutdown();
+}
+
+
+control {
+       execute( TC_5g_aka() );
+}
+
+}
diff --git a/ausf/ConnHdlr.ttcn b/ausf/ConnHdlr.ttcn
new file mode 100644
index 0000000..64c0b66
--- /dev/null
+++ b/ausf/ConnHdlr.ttcn
@@ -0,0 +1,339 @@
+/* AUSF test suite in TTCN-3 (3GPP TS 29.503, 3GPP TS 29.509), ConnHdlr
+ * (C) 2026 by sysmocom - s.f.m.c. GmbH <[email protected]>
+ * All rights reserved.
+ * Author: Pau Espin Pedrol <[email protected]>
+ *
+ * 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 ConnHdlr {
+
+import from TCCEncoding_Functions all;
+
+import from General_Types all;
+import from Native_Functions all;
+import from IPL4asp_Types all;
+import from Misc_Helpers all;
+
+import from Osmocom_Types all;
+import from GSM_Types all;
+
+import from HTTP2_Types all;
+import from HTTP2_Templates all;
+import from HTTP2_Functions all;
+import from HTTP2_Msg all;
+import from HTTP2_Adapter all;
+import from HTTP2_Server_Emulation all;
+
+import from Prometheus_Checker all;
+
+import from TS29571_CommonData_Templates all;
+import from TS29503_Nudm_UEAU all;
+import from TS29503_Nudm_UEAU_Templates all;
+import from TS29509_Nausf_UEAuthentication all;
+import from TS29509_Nausf_UEAuthentication_Templates all;
+
+import from AUSF_Tests all;
+
+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 ConnHdlr return charstring {
+       var charstring imsi_match := "*imsi-" & g_pars.imsi_str & "*";
+       return imsi_match;
+}
+
+type record ConnHdlrPars {
+       integer idx,
+       hexstring imsi,
+       charstring imsi_str,
+       charstring serving_network,
+       charstring nudm_ueau_auth_ctx_id optional
+}
+
+type component ConnHdlr extends HTTP2_CT, HTTP2_ConnHdlr, 
Prometheus_Checker_CT {
+       var ConnHdlrPars g_pars;
+}
+
+type function void_fn() runs on ConnHdlr;
+
+function f_ConnHdlrPars(integer idx := 0) return ConnHdlrPars
+{
+       var hexstring imsi := f_concat_pad(lengthof(mp_imsi), substr(mp_imsi, 
0, lengthof(mp_imsi) - 6), idx);
+       var charstring imsi_str := f_dec_TBCD(imsi_hex2oct(imsi));
+       var template (value) ConnHdlrPars pars := {
+               idx := idx,
+               imsi := imsi,
+               imsi_str := imsi_str,
+               serving_network := "5G:mnc070.mcc999.3gppnetwork.org", /* TODO: 
set based on mp_mcc and mp_mnc */
+               nudm_ueau_auth_ctx_id := omit
+       };
+       return valueof(pars);
+}
+
+function f_ConnHdlr_init(void_fn fn, ConnHdlrPars pars) runs on ConnHdlr {
+       /* make parameters available via component variable */
+       g_pars := pars;
+
+       /* Setup */
+       /* 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);
+       f_http2_adapter_init();
+
+       fn.apply();
+
+       /* Cleanup */
+       f_http2_server_emu_unregister(f_http2_server_path_match(), idx := 
HTTP2_CONN_SCP);
+}
+
+/********************************************
+ * SCP
+/*******************************************/
+const charstring c_SCP_uri_hostport := mp_scp_local_ip & ":" & 
int2str(mp_scp_local_port);
+const charstring c_SCP_uri_prefix := "http://"; & c_SCP_uri_hostport;
+
+/***********************************************************************
+ * N12 Nausf_UEAuthentication (SBI): Emulated AMF, 3GPP TS 29.509 A.2
+ ***********************************************************************/
+const charstring c_Nausf_uri_hostport := mp_ausf_hostname & ":" & 
int2str(mp_ausf_sbi_port);
+const charstring c_Nausf_uri_prefix := "http://"; & c_Nausf_uri_hostport;
+
+/* 3GPP TS 29.509 6.1.3.2.3.1 Resource: ue-authentications (POST) */
+private function f_n12_prepare_post_ue_authentications(AuthenticationInfo 
auth_info)
+runs on ConnHdlr return HTTP2_Msg {
+       var octetstring auth_info_enc;
+       var integer http2_idx;
+       var integer http2_stream_id;
+       var template (value) HTTP2_Msg http2_tx;
+
+       auth_info_enc := f_enc_AuthenticationInfo(auth_info);
+
+       http2_idx := f_http2_adapter_find_free_idx();
+       http2_stream_id := f_http2_adapter_next_stream_id(http2_idx);
+       http2_tx := ts_HTTP2_Msg(http2_idx,
+                                http2_stream_id,
+                                hb := {
+                                       pseudo_headers := 
ts_HTTP2_pseudo_headers_Req(method := "POST",
+                                                                               
      scheme := "http",
+                                                                               
      authority := c_Nausf_uri_hostport,
+                                                                               
      path := c_Nausf_UEAuthentication_path_ue_authentications),
+                                       headers := {
+                                               
ts_HTTP2_Hdr_content_type("application/json"),
+                                               
ts_HTTP2_Hdr_accept("application/json"),
+                                               
ts_HTTP2_Hdr_user_agent("ttcn3-ausf"),
+                                               
ts_HTTP2_Hdr_accept_encoding("gzip")
+                                       }
+                                },
+                                body := ts_HTTP2_Data_frame(http2_stream_id,
+                                                            end_stream_flag := 
true,
+                                                            data := 
auth_info_enc));
+       return valueof(http2_tx);
+}
+
+/* 3GPP TS 29.509 6.1.3.2.3.1 Resource: ue-authentications (POST) */
+function f_n12_post_ue_authentications()
+runs on ConnHdlr {
+       var HTTP2_Msg http2_tx;
+       var HTTP2_Msg http2_rx;
+       var template (present) HTTP2_Msg http2_exp_rx;
+       var template (value) AuthenticationInfo auth_info;
+
+       auth_info := ts_AuthenticationInfo(supiOrSuci := 
ts_sbi_Supi(g_pars.imsi_str),
+                                          servingNetworkName := 
g_pars.serving_network);
+
+       http2_tx := f_n12_prepare_post_ue_authentications(valueof(auth_info));
+       f_http2_adapter_connect(mp_ausf_hostname, mp_ausf_sbi_port, 
mp_ausf_local_ip, idx := http2_tx.conn_id);
+       f_http2_adapter_send(http2_tx);
+
+       as_Nudm_UEAU_post_generate_auth_data();
+
+       /* 3GPP TS 29.509 Table 6.1.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(201)),
+                            tr_HTTP2_Data_frame(stream_id := 
http2_tx.stream_id,
+                                                end_stream_flag := true,
+                                                data := decmatch 
tr_UEAuthenticationCtx));
+       as_http2_adapter_receive(http2_rx, http2_exp_rx, idx := 
http2_tx.conn_id);
+
+       /* Store obtained authCtxId:*/
+       var charstring created_location := 
valueof(f_HTTP2_header_list_find_header(http2_rx.hb.headers, 
c_HTTP2_HDR_location));
+       g_pars.nudm_ueau_auth_ctx_id := regexp(created_location, 
c_Nausf_uri_prefix & c_Nausf_UEAuthentication_path_ue_authentications & 
"/(?+)", 0);
+
+
+       f_http2_adapter_close(idx := http2_tx.conn_id);
+       setverdict(pass);
+}
+
+/* 3GPP TS 29.509 6.1.3.3.3.1 Resource: 5g-aka-confirmation (PUT) */
+private function f_n12_prepare_put_5g_aka_confirmation(ConfirmationData 
conf_data)
+runs on ConnHdlr return HTTP2_Msg {
+       var octetstring conf_data_enc;
+       var integer http2_idx;
+       var integer http2_stream_id;
+       var template (value) HTTP2_Msg http2_tx;
+
+       conf_data_enc := f_enc_ConfirmationData(conf_data);
+
+       http2_idx := f_http2_adapter_find_free_idx();
+       http2_stream_id := f_http2_adapter_next_stream_id(http2_idx);
+       http2_tx := ts_HTTP2_Msg(http2_idx,
+                                http2_stream_id,
+                                hb := {
+                                       pseudo_headers := 
ts_HTTP2_pseudo_headers_Req(method := "PUT",
+                                                                               
      scheme := "http",
+                                                                               
      authority := c_Nausf_uri_hostport,
+                                                                               
      path := 
ts_Nausf_UEAuthentication_path_5g_aka_confirmation(g_pars.nudm_ueau_auth_ctx_id)),
+                                       headers := {
+                                               
ts_HTTP2_Hdr_content_type("application/json"),
+                                               
ts_HTTP2_Hdr_accept("application/json"),
+                                               
ts_HTTP2_Hdr_user_agent("ttcn3-ausf"),
+                                               
ts_HTTP2_Hdr_accept_encoding("gzip")
+                                       }
+                                },
+                                body := ts_HTTP2_Data_frame(http2_stream_id,
+                                                            end_stream_flag := 
true,
+                                                            data := 
conf_data_enc));
+       return valueof(http2_tx);
+}
+
+/* 3GPP TS 29.509 6.1.3.3.3.1 Resource: 5g-aka-confirmation (PUT) */
+function f_n12_put_5g_aka_confirmation()
+runs on ConnHdlr {
+       var HTTP2_Msg http2_tx;
+       var HTTP2_Msg http2_rx;
+       var template (present) HTTP2_Msg http2_exp_rx;
+       var template (value) ConfirmationData conf_data;
+
+       conf_data := ts_ConfirmationData(resStar := ts_ResStar(""));
+
+       http2_tx := f_n12_prepare_put_5g_aka_confirmation(valueof(conf_data));
+       f_http2_adapter_connect(mp_ausf_hostname, mp_ausf_sbi_port, 
mp_ausf_local_ip, idx := http2_tx.conn_id);
+       f_http2_adapter_send(http2_tx);
+
+       as_Nudm_UEAU_post_auth_events();
+
+       /* 3GPP TS 29.503 Table 6.3.3.2.4.2.2-2 */
+       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_ConfirmationDataResponse));
+       as_http2_adapter_receive(http2_rx, http2_exp_rx, idx := 
http2_tx.conn_id);
+
+       f_http2_adapter_close(idx := http2_tx.conn_id);
+       setverdict(pass);
+}
+
+/****************************************************
+ * N13 Nudm_UEAU (SBI): Emulated UDM, 3GPP TS 29.503
+ ****************************************************/
+const charstring Nudm_uri_hostport := mp_scp_local_ip & ":" & 
int2str(mp_scp_local_port);
+const charstring Nudm_uri_prefix := "http://"; & Nudm_uri_hostport;
+
+template (value) charstring
+ts_Nudm_UEAU_uri_indivdual_auth_event(template (value) charstring imsi,
+                                     template (value) charstring auth_event_id)
+:= Nudm_uri_prefix & "/" & 
valueof(ts_Nudm_UEAU_path_indivdual_auth_event(imsi, auth_event_id));
+
+/* 3GPP TS 29.503 6.3.3.2.4.2 Operation: generate-auth-data (POST) */
+function f_tr_Nudm_UEAU_post_generate_auth_data()
+runs on ConnHdlr return template (present) HTTP2_Msg {
+       var template (present) HTTP2_Msg http2_msg;
+       var template (present) HTTP2_header_block hb;
+       var template (present) HTTP2_pseudo_headers pseudo_headers;
+       var template HTTP2_header_list headers := *;
+
+       pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "POST",
+                                                     path := 
tr_Nudm_UEAU_path_generate_auth_data(g_pars.imsi_str));
+       hb := tr_HTTP2_header_block(pseudo_headers, headers);
+       http2_msg := tr_HTTP2_Msg(?, ?, hb := hb,
+                                 body := tr_HTTP2_Data_frame(data := decmatch 
tr_AuthenticationInfoRequest1));
+       return http2_msg;
+}
+
+/* 3GPP TS 29.503 6.3.3.2.4.2 Operation: generate-auth-data */
+altstep as_Nudm_UEAU_post_generate_auth_data()
+runs on ConnHdlr {
+       var HTTP2_Msg http2_rx;
+       [] 
HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Nudm_UEAU_post_generate_auth_data()) -> 
value http2_rx {
+               var template (value) AuthenticationInfoResult1 auth_info_res;
+               var template (value) Av5GHeAka1 aka;
+               var octetstring body_enc;
+               var template (value) HTTP2_Msg http2_tx;
+
+               aka := ts_Av5GHeAka1(avType := ts_AvType1(FiveG_HE_AKA),
+                                    rand := "22fd7b017a00a3d10a7fa43bcdb38737",
+                                    xresStar := 
"7fd887a888a0711e2bf090b3e83ecc41",
+                                    autn := "39e2eeb667fe8000df925c009944031b",
+                                    kausf := 
"9f4319e9b73df525fd1d4212dabd0642ca73de96d485252fde7e664a8b59f739");
+               auth_info_res := ts_AuthenticationInfoResult1(authType := 
ts_AuthType1(FiveG_AKA),
+                                                             
authenticationVector := ts_AuthenticationVector1_5GHeAka(aka),
+                                                             supi := 
ts_sbi_Supi(g_pars.imsi_str));
+               body_enc := 
f_enc_AuthenticationInfoResult1(valueof(auth_info_res));
+
+               http2_tx := ts_HTTP2_Msg_200_OK(http2_rx.conn_id,
+                                               http2_rx.stream_id,
+                                               headers := {
+                                                       
ts_HTTP2_Hdr_content_type("application/json")
+                                               },
+                                               body := 
ts_HTTP2_Data_frame(http2_rx.stream_id,
+                                                                           
end_stream_flag := true,
+                                                                           
data := body_enc));
+               HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+               setverdict(pass);
+       }
+}
+
+/* 3GPP TS 29.503 6.3.3.3.3.1 Resource: AuthEvents (POST) */
+function f_tr_Nudm_UEAU_post_auth_events()
+runs on ConnHdlr return template (present) HTTP2_Msg {
+       var template (present) HTTP2_Msg http2_msg;
+       var template (present) HTTP2_header_block hb;
+       var template (present) HTTP2_pseudo_headers pseudo_headers;
+       var template HTTP2_header_list headers := *;
+
+       pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "POST",
+                                                     path := 
tr_Nudm_UEAU_path_auth_events(g_pars.imsi_str));
+       hb := tr_HTTP2_header_block(pseudo_headers, headers);
+       http2_msg := tr_HTTP2_Msg(?, ?, hb := hb,
+                                 body := tr_HTTP2_Data_frame(data := decmatch 
tr_AuthEvent1));
+       return http2_msg;
+}
+
+/* 3GPP TS 29.503 5.4.2.3.2 Authentication Confirmation */
+altstep as_Nudm_UEAU_post_auth_events()
+runs on ConnHdlr {
+       var HTTP2_Msg http2_rx;
+       [] 
HTTP2_CONN[HTTP2_CONN_SCP].receive(f_tr_Nudm_UEAU_post_auth_events()) -> value 
http2_rx {
+               var AuthEvent1 auth_event;
+               var octetstring body_enc;
+               var template (value) HTTP2_Msg http2_tx;
+
+               /* 3GPP TS 29.503 Table 6.3.3.3.3.1-3 */
+               f_dec_AuthEvent1(http2_rx.body.data, auth_event); // TODO: 
check return code
+               body_enc := f_enc_AuthEvent1(valueof(auth_event));
+
+               http2_tx := ts_HTTP2_Msg_201_Created(http2_rx.conn_id,
+                                                    http2_rx.stream_id,
+                                                    headers := {
+                                                       
ts_HTTP2_Hdr_content_type("application/json"),
+                                                       
ts_HTTP2_Hdr_location(ts_Nudm_UEAU_uri_indivdual_auth_event(g_pars.imsi_str,
+                                                                               
                                    int2str(g_pars.idx)))
+                                                    },
+                                                    body := 
ts_HTTP2_Data_frame(http2_rx.stream_id,
+                                                                               
 end_stream_flag := true,
+                                                                               
 data := body_enc));
+               HTTP2_CONN[HTTP2_CONN_SCP].send(http2_tx);
+               setverdict(pass);
+       }
+}
+
+}
diff --git a/ausf/README.md b/ausf/README.md
new file mode 100644
index 0000000..52877c8
--- /dev/null
+++ b/ausf/README.md
@@ -0,0 +1,16 @@
+# AUSF_Tests.ttcn
+
+* external interfaces
+    * N12: SBI (emulates AMF)
+    * N13: SBI (emulates UDM)
+
+{% dot ausf_tests.svg
+digraph G {
+  rankdir=LR;
+  ATS [label="ATS\nAUSF_Tests.ttcn"];
+  UDM [label="AMF\open5gs-ausfd",shape="box"];
+
+  ATS -> UDM [label="N12"];
+  ATS -> UDM [label="N13"];
+}
+%}
diff --git a/ausf/expected-results.xml b/ausf/expected-results.xml
new file mode 100644
index 0000000..7e1d439
--- /dev/null
+++ b/ausf/expected-results.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<testsuite name='Titan' tests='1' failures='0' errors='0' skipped='0' 
inconc='0' time='MASKED'>
+  <testcase classname='AUSF_Tests' name='TC_5g_aka' time='MASKED'/>
+</testsuite>
diff --git a/ausf/gen_links.sh b/ausf/gen_links.sh
new file mode 100755
index 0000000..f505654
--- /dev/null
+++ b/ausf/gen_links.sh
@@ -0,0 +1,52 @@
+#!/bin/bash -e
+
+BASEDIR=../deps
+
+. ../_buildsystem/gen_links.inc.sh
+
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn 
TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
+FILES+=" TCCEncoding_Functions.ttcn TCCEncoding.cc " # GSM 7-bit coding
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
+FILES="Socket_API_Definitions.ttcn"
+gen_links $DIR $FILES
+
+# Required by MGCP and IPA
+DIR=$BASEDIR/titan.TestPorts.IPL4asp/src
+FILES="IPL4asp_Functions.ttcn  IPL4asp_PT.cc  IPL4asp_PT.hh 
IPL4asp_PortType.ttcn  IPL4asp_Types.ttcn  IPL4asp_discovery.cc 
IPL4asp_protocol_L234.hh"
+gen_links $DIR $FILES
+
+# Needed by HTTP_Adapter (Prometheus_Checker.ttcn metrics):
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Abstract_Socket/src
+FILES="Abstract_Socket.cc Abstract_Socket.hh "
+gen_links $DIR $FILES
+
+# Needed by HTTP_Adapter (Prometheus_Checker.ttcn metrics):
+DIR=$BASEDIR/titan.TestPorts.HTTPmsg/src
+FILES="HTTPmsg_MessageLen.ttcn HTTPmsg_MessageLen_Function.cc HTTPmsg_PT.cc 
HTTPmsg_PT.hh HTTPmsg_PortType.ttcn HTTPmsg_Types.ttcn "
+gen_links $DIR $FILES
+
+# Needed by HTTP2_Adapter:
+DIR=$BASEDIR/titan.ProtocolModules.HTTP2/src
+FILES="HTTP2_EncDec.cc HTTP2_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.JSON_v07_2006/src
+FILES="JSON_Generic_Null_Def.asn JSON_Generic.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/osmo-ttcn3-openapi-generator/openapi-specs/3GPP_5GC_Rel19/ttcn3
+FILES="TS29571_CommonData.ttcn TS29503_Nudm_UEAU.ttcn 
TS29509_Nausf_UEAuthentication.ttcn "
+gen_links $DIR $FILES
+
+DIR=../library
+FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn 
Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn 
IPCP_Templates.ttcn "
+FILES+="SCTP_Templates.ttcn "
+FILES+="HTTP2_CodecPort.ttcn HTTP2_CodecPort_CtrlFunct.ttcn 
HTTP2_CodecPort_CtrlFunctDef.cc HTTP2_Templates.ttcn HTTP2_Functions.ttcn 
HTTP2_Msg.ttcn HTTP2_Adapter.ttcn HTTP2_Server_Emulation.ttcn "
+FILES+="HTTP_Adapter.ttcn Prometheus_Checker.ttcn "
+FILES+="TS29571_CommonData_Templates.ttcn TS29503_Nudm_UEAU_Templates.ttcn 
TS29509_Nausf_UEAuthentication_Templates.ttcn "
+gen_links $DIR $FILES
+
+gen_links_finish
diff --git a/ausf/open5gs-ausf.yaml b/ausf/open5gs-ausf.yaml
new file mode 100644
index 0000000..8296fa2
--- /dev/null
+++ b/ausf/open5gs-ausf.yaml
@@ -0,0 +1,19 @@
+# See https://github.com/open5gs/open5gs/blob/main/configs/open5gs/ausf.yaml.in
+
+logger:
+  level: debug
+
+global:
+  max:
+    ue: 1024
+
+ausf:
+  sbi:
+    server:
+      - address: 127.0.0.11
+        port: 7777
+    client:
+#      nrf:
+#        - uri: http://127.0.0.10:7777
+      scp:
+        - uri: http://127.0.0.200:7777
diff --git a/ausf/regen_makefile.sh b/ausf/regen_makefile.sh
new file mode 100755
index 0000000..e019abe
--- /dev/null
+++ b/ausf/regen_makefile.sh
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+NAME=AUSF_Tests
+
+FILES="
+       *.asn
+       *.ttcn
+       Abstract_Socket.cc
+       HTTPmsg_MessageLen_Function.cc
+       HTTPmsg_PT.cc
+       HTTP2_EncDec.cc
+       HTTP2_CodecPort_CtrlFunctDef.cc
+       IPL4asp_PT.cc
+       IPL4asp_discovery.cc
+       Native_FunctionDefs.cc
+       TCCConversion.cc
+       TCCEncoding.cc
+       TCCInterface.cc
+"
+
+. ../_buildsystem/regen_makefile.inc.sh
+
+sed -i -e 's/^LINUX_LIBS = -lxml2 -lsctp/LINUX_LIBS = -lxml2 -lsctp -lgnutls/' 
Makefile
diff --git a/ausf/testenv.cfg b/ausf/testenv.cfg
new file mode 100644
index 0000000..4a021cc
--- /dev/null
+++ b/ausf/testenv.cfg
@@ -0,0 +1,10 @@
+[testsuite]
+program=AUSF_Tests
+config=AUSF_Tests.cfg
+
+[ausf]
+program=open5gs-ausfd -c open5gs-ausf.yaml
+make=open5gs
+package=open5gs-ausf
+copy=open5gs-ausf.yaml
+
diff --git a/ausf/testsrcdir.cfg b/ausf/testsrcdir.cfg
new file mode 100644
index 0000000..7f19289
--- /dev/null
+++ b/ausf/testsrcdir.cfg
@@ -0,0 +1,2 @@
+[testsrcdir]
+max_jobs_per_gb_ram=0.3
diff --git a/library/TS29509_Nausf_UEAuthentication_Templates.ttcn 
b/library/TS29509_Nausf_UEAuthentication_Templates.ttcn
new file mode 100644
index 0000000..1dd052b
--- /dev/null
+++ b/library/TS29509_Nausf_UEAuthentication_Templates.ttcn
@@ -0,0 +1,94 @@
+module TS29509_Nausf_UEAuthentication_Templates {
+
+import from TS29509_Nausf_UEAuthentication all;
+
+const charstring c_Nausf_UEAuthentication_path_api_prefix := "/nausf-auth/v1";
+
+/* 3GPP TS 29.503 6.1.3.2 Resource: ue-authentications (Collection) */
+const charstring c_Nausf_UEAuthentication_path_ue_authentications
+:= c_Nausf_UEAuthentication_path_api_prefix & "/ue-authentications" ;
+
+template (value) charstring
+ts_Nausf_UEAuthentication_path_individual_ue_authentication(template (value) 
charstring auth_ctx_id)
+:= c_Nausf_UEAuthentication_path_ue_authentications & "/" & 
valueof(auth_ctx_id);
+
+/* 3GPP TS 29.509 6.1.3.3 Resource: 5g-aka-confirmation */
+template (value) charstring
+ts_Nausf_UEAuthentication_path_5g_aka_confirmation(template (value) charstring 
auth_ctx_id)
+:= 
valueof(ts_Nausf_UEAuthentication_path_individual_ue_authentication(auth_ctx_id))
 & "/5g-aka-confirmation";
+
+template (value) AuthType
+ts_AuthType(AuthType_enum enum_val) := {
+       enum_val := enum_val
+}
+
+template (value) ResStar
+ts_ResStar(template (value) charstring val) := {
+       val := val
+}
+
+type TS29509_Nausf_UEAuthentication.AuthenticationInfo.cellCagInfo CagIdList;
+template (value) AuthenticationInfo
+ts_AuthenticationInfo(template (value) SupiOrSuci supiOrSuci,
+                     template (value) ServingNetworkName servingNetworkName,
+                     template (omit) ResynchronizationInfo 
resynchronizationInfo := omit,
+                     template (omit) Pei pei := omit,
+                     template (omit) TraceData traceData := omit,
+                     template (omit) NfGroupId udmGroupId := omit,
+                     template (omit) charstring routingIndicator := omit,
+                     template (omit) CagIdList cellCagInfo := omit,
+                     template (omit) boolean n5gcInd := omit,
+                     template (omit) SupportedFeatures supportedFeatures := 
omit,
+                     template (omit) boolean nswoInd := omit,
+                     template (omit) boolean disasterRoamingInd := omit,
+                     template (omit) boolean onboardingInd := omit,
+                     template (omit) boolean aun3Ind := omit) := {
+       supiOrSuci := supiOrSuci,
+       servingNetworkName := servingNetworkName,
+       resynchronizationInfo := resynchronizationInfo,
+       pei := pei,
+       traceData := traceData,
+       udmGroupId := udmGroupId,
+       routingIndicator := routingIndicator,
+       cellCagInfo := cellCagInfo,
+       n5gcInd := n5gcInd,
+       supportedFeatures := supportedFeatures,
+       nswoInd := nswoInd,
+       disasterRoamingInd := disasterRoamingInd,
+       onboardingInd := onboardingInd,
+       aun3Ind  := aun3Ind
+}
+
+type TS29509_Nausf_UEAuthentication.UEAuthenticationCtx.fivegAuthData 
FivegAuthDataUnion;
+type TS29509_Nausf_UEAuthentication.UEAuthenticationCtx.links LinksMap;
+template (present) UEAuthenticationCtx
+tr_UEAuthenticationCtx(template (present) AuthType authType := ?,
+                      template (present) FivegAuthDataUnion fivegAuthData := ?,
+                      template (present) LinksMap links := ?,
+                      template ServingNetworkName servingNetworkName := *) := {
+       authType := authType,
+       fivegAuthData := fivegAuthData,
+       links := links,
+       servingNetworkName := servingNetworkName
+}
+
+template (value) ConfirmationData
+ts_ConfirmationData(template (value) ResStar resStar,
+                   template (omit) SupportedFeatures supportedFeatures := 
omit) := {
+       resStar := resStar,
+       supportedFeatures := supportedFeatures
+}
+
+type TS29509_Nausf_UEAuthentication.ConfirmationDataResponse.pvsInfo 
ServerAddressingInfoList;
+template (present) ConfirmationDataResponse
+tr_ConfirmationDataResponse(template (present) AuthResult authResult := ?,
+                           template Supi supi  := *,
+                           template Kseaf kseaf  := *,
+                           template ServerAddressingInfoList pvsInfo  := *) := 
{
+       authResult := authResult,
+       supi := supi,
+       kseaf := kseaf,
+       pvsInfo := pvsInfo
+}
+
+}

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43960?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: Ife5af76587b4416767535875e27b02236ee5e1d9
Gerrit-Change-Number: 43960
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to