pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44068?usp=email )

Change subject: Introduce nssf testsuite
......................................................................

Introduce nssf testsuite

Related: SYS#7073
Change-Id: I49c271104f668c59ef7d4a010846a16dd169c0a8
---
M Makefile
A library/TS29531_Nnssf_NSSAIAvailability_Templates.ttcn
A library/TS29531_Nnssf_NSSelection_Templates.ttcn
A nssf/ConnHdlr.ttcn
A nssf/NSSF_Tests.cfg
A nssf/NSSF_Tests.default
A nssf/NSSF_Tests.ttcn
A nssf/README.md
A nssf/expected-results.xml
A nssf/gen_links.sh
A nssf/open5gs-eir.yaml
A nssf/open5gs-nssf.yaml
A nssf/regen_makefile.sh
A nssf/testenv.cfg
A nssf/testsrcdir.cfg
15 files changed, 705 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified




diff --git a/Makefile b/Makefile
index 544cbaa..3baeddd 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,7 @@
        mme \
        msc \
        ns \
+       nssf \
        pcap-client \
        pcu \
        pcf \
diff --git a/library/TS29531_Nnssf_NSSAIAvailability_Templates.ttcn 
b/library/TS29531_Nnssf_NSSAIAvailability_Templates.ttcn
new file mode 100644
index 0000000..4aa38d0
--- /dev/null
+++ b/library/TS29531_Nnssf_NSSAIAvailability_Templates.ttcn
@@ -0,0 +1,7 @@
+module TS29531_Nnssf_NSSAIAvailability_Templates {
+
+import from TS29531_Nnssf_NSSAIAvailability all;
+
+const charstring c_Nnssf_NSSAIAvailability_path_api_prefix := 
"/nnssf-nssaiavailability/v1";
+
+}
diff --git a/library/TS29531_Nnssf_NSSelection_Templates.ttcn 
b/library/TS29531_Nnssf_NSSelection_Templates.ttcn
new file mode 100644
index 0000000..74d8fb4
--- /dev/null
+++ b/library/TS29531_Nnssf_NSSelection_Templates.ttcn
@@ -0,0 +1,187 @@
+module TS29531_Nnssf_NSSelection_Templates {
+
+import from TS29531_Nnssf_NSSelection all;
+
+const charstring c_Nnssf_NSSelection_path_api_prefix := 
"/nnssf-nsselection/v2";
+
+/* 6.1.3.2 Resource: Network Slice Information */
+const charstring c_Nnssf_NSSelection_path_net_slice_info
+:= c_Nnssf_NSSelection_path_api_prefix & "/network-slice-information";
+
+template (value) NFType
+ts_NFType(template (value) NFType_enum enum_val) := {
+       enum_val := enum_val
+}
+
+template (value) RoamingIndication
+ts_RoamingIndication(template (value) RoamingIndication_enum enum_val) := {
+       enum_val := enum_val
+}
+
+template (value) Snssai
+ts_Snssai(template (value) integer sst,
+         template (omit) charstring sd := omit) := {
+       sst := sst,
+       sd := sd
+}
+
+type TS29531_Nnssf_NSSelection.SliceInfoForRegistration.subscribedNssai 
SubscribedNssaiList;
+type TS29531_Nnssf_NSSelection.SliceInfoForRegistration.mappingOfNssai 
MappingOfNssaiList;
+type TS29531_Nnssf_NSSelection.SliceInfoForRegistration.sNssaiForMapping 
SNssaiForMappingList;
+type TS29531_Nnssf_NSSelection.SliceInfoForRegistration.requestedNssai 
RequestedNssaiList;
+template (value) SliceInfoForRegistration
+ts_SliceInfoForRegistration(template (omit) SubscribedNssaiList 
subscribedNssai := omit,
+                           template (omit) AllowedNssai 
allowedNssaiCurrentAccess := omit,
+                           template (omit) AllowedNssai 
allowedNssaiOtherAccess := omit,
+                           template (omit) SNssaiForMappingList 
sNssaiForMapping := omit,
+                           template (omit) RequestedNssaiList requestedNssai 
:= omit,
+                           template (omit) boolean defaultConfiguredSnssaiInd 
:= omit,
+                           template (omit) MappingOfNssaiList mappingOfNssai 
:= omit,
+                           template (omit) boolean requestMapping := omit,
+                           template (omit) boolean ueSupNssrgInd := omit,
+                           template (omit) boolean suppressNssrgInd := omit,
+                           template (omit) boolean nsagSupported := omit) := {
+       subscribedNssai := subscribedNssai,
+       allowedNssaiCurrentAccess := allowedNssaiCurrentAccess,
+       allowedNssaiOtherAccess := allowedNssaiOtherAccess,
+       sNssaiForMapping := sNssaiForMapping,
+       requestedNssai := requestedNssai,
+       defaultConfiguredSnssaiInd := defaultConfiguredSnssaiInd,
+       mappingOfNssai := mappingOfNssai,
+       requestMapping := requestMapping,
+       ueSupNssrgInd := ueSupNssrgInd,
+       suppressNssrgInd := suppressNssrgInd,
+       nsagSupported := nsagSupported
+}
+
+template (value) SliceInfoForPDUSession
+ts_SliceInfoForPDUSession(template (value) Snssai sNssai,
+                         template (value) RoamingIndication roamingIndication,
+                         template (omit) Snssai homeSnssai := omit) := {
+       sNssai := sNssai,
+       roamingIndication := roamingIndication,
+       homeSnssai := homeSnssai
+}
+
+/* Table 6.1.3.2.3.1-1 */
+type set NetworkSliceInformationParams {
+       NFType nFType,
+       NfInstanceId nFInstanceId,
+       SliceInfoForRegistration sliceInfoForRegistration optional,
+       SliceInfoForPDUSession sliceInfoForPDUSession optional,
+       Snssai_list sliceInfoRequestForPdnConnection optional,
+       Snssai_list sliceInfoRequestForOtherPurpose optional,
+       PlmnId homePlmnId optional,
+       Tai tai optional,
+       SupportedFeatures supportedFeatures optional
+};
+
+template (value) NetworkSliceInformationParams
+ts_NetworkSliceInformationParams(
+       template (value) NFType nFType,
+       template (value) NfInstanceId nFInstanceId,
+       template (omit) SliceInfoForRegistration sliceInfoForRegistration := 
omit,
+       template (omit) SliceInfoForPDUSession sliceInfoForPDUSession := omit,
+       template (omit) Snssai_list sliceInfoRequestForPdnConnection := omit,
+       template (omit) Snssai_list sliceInfoRequestForOtherPurpose := omit,
+       template (omit) PlmnId homePlmnId := omit,
+       template (omit) Tai tai := omit,
+       template (omit) SupportedFeatures supportedFeatures := omit) := {
+       nFType := nFType,
+       nFInstanceId := nFInstanceId,
+       sliceInfoForRegistration := sliceInfoForRegistration,
+       sliceInfoForPDUSession := sliceInfoForPDUSession,
+       sliceInfoRequestForPdnConnection := sliceInfoRequestForPdnConnection,
+       sliceInfoRequestForOtherPurpose := sliceInfoRequestForOtherPurpose,
+       homePlmnId := homePlmnId,
+       tai := tai,
+       supportedFeatures := supportedFeatures
+};
+
+function f_enc_NetworkSliceInformationParams(NetworkSliceInformationParams 
val) return charstring
+{
+       var charstring nftype := oct2char(f_enc_NFType(val.nFType));
+       nftype := substr(nftype, 1, lengthof(nftype) - 2); /* Get rid of quote 
characters. */
+       var charstring enc := "?nf-type=" & nftype;
+       enc := enc & "&nf-id=" & val.nFInstanceId;
+       if (ispresent(val.sliceInfoForRegistration)) {
+               enc := enc & "&slice-info-request-for-registration=" &
+                      
oct2char(f_enc_SliceInfoForRegistration(val.sliceInfoForRegistration));
+       }
+       if (ispresent(val.sliceInfoForPDUSession)) {
+               enc := enc & "&slice-info-request-for-pdu-session=" &
+                      
oct2char(f_enc_SliceInfoForPDUSession(val.sliceInfoForPDUSession));
+       }
+       if (ispresent(val.sliceInfoRequestForPdnConnection)) {
+               enc := enc & "&slice-info-request-for-pdn-connection=" &
+                      
oct2char(f_enc_Snssai_list(val.sliceInfoRequestForPdnConnection));
+       }
+       if (ispresent(val.sliceInfoRequestForOtherPurpose)) {
+               enc := enc & 
"&slice-info-request-for-pdu-sessionother-purpose=" &
+                      
oct2char(f_enc_Snssai_list(val.sliceInfoRequestForOtherPurpose));
+       }
+       if (ispresent(val.homePlmnId)) {
+               enc := enc & "&home-plmn-id=" &
+                      oct2char(f_enc_PlmnId(val.homePlmnId));
+       }
+       if (ispresent(val.tai)) {
+               enc := enc & "&tai=" &
+                      oct2char(f_enc_Tai(val.tai));
+       }
+       if (ispresent(val.supportedFeatures)) {
+               enc := enc & "&supported-features=" &
+                      oct2char(f_enc_SupportedFeatures(val.supportedFeatures));
+       }
+       return enc;
+}
+
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.allowedNssaiList 
AllowedNssaiList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.configuredNssai 
ConfiguredNssaiList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.candidateAmfList 
CandidateAmfList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.rejectedNssaiInPlmn 
RejectedNssaiInPlmnList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.rejectedNssaiInTa 
RejectedNssaiInTaList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.nrfOauth2Required 
NrfOauth2RequiredMap;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.targetNssai 
TargetNssaiList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.nsagInfos 
NsagInfoList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.mappingOfNssai 
MappingOfNssaiAuthorizedList;
+type TS29531_Nnssf_NSSelection.AuthorizedNetworkSliceInfo.snssaiInfoRspData 
SnssaiInfoRspDataMap;
+
+template (present) AuthorizedNetworkSliceInfo
+tr_AuthorizedNetworkSliceInfo(template AllowedNssaiList allowedNssaiList := *,
+                             template ConfiguredNssaiList configuredNssai := *,
+                             template charstring targetAmfSet := *,
+                             template CandidateAmfList candidateAmfList := *,
+                             template RejectedNssaiInPlmnList 
rejectedNssaiInPlmn := *,
+                             template RejectedNssaiInTaList rejectedNssaiInTa 
:= *,
+                             template NsiInformation nsiInformation := *,
+                             template SupportedFeatures supportedFeatures := *,
+                             template Uri nrfAmfSet := *,
+                             template Uri nrfAmfSetNfMgtUri := *,
+                             template Uri nrfAmfSetAccessTokenUri := *,
+                             template NrfOauth2RequiredMap nrfOauth2Required 
:= *,
+                             template NfServiceSetId targetAmfServiceSet := *,
+                             template TargetNssaiList targetNssai := *,
+                             template NsagInfoList nsagInfos := *,
+                             template MappingOfNssaiAuthorizedList 
mappingOfNssai := *,
+                             template SnssaiInfoRspDataMap snssaiInfoRspData 
:= *) := {
+       allowedNssaiList := allowedNssaiList,
+       configuredNssai := configuredNssai,
+       targetAmfSet := targetAmfSet,
+       candidateAmfList := candidateAmfList,
+       rejectedNssaiInPlmn := rejectedNssaiInPlmn,
+       rejectedNssaiInTa := rejectedNssaiInTa,
+       nsiInformation := nsiInformation,
+       supportedFeatures := supportedFeatures,
+       nrfAmfSet := nrfAmfSet,
+       nrfAmfSetNfMgtUri := nrfAmfSetNfMgtUri,
+       nrfAmfSetAccessTokenUri := nrfAmfSetAccessTokenUri,
+       nrfOauth2Required := nrfOauth2Required,
+       targetAmfServiceSet := targetAmfServiceSet,
+       targetNssai := targetNssai,
+       nsagInfos := nsagInfos,
+       mappingOfNssai := mappingOfNssai,
+       snssaiInfoRspData := snssaiInfoRspData
+}
+
+
+}
diff --git a/nssf/ConnHdlr.ttcn b/nssf/ConnHdlr.ttcn
new file mode 100644
index 0000000..096e810
--- /dev/null
+++ b/nssf/ConnHdlr.ttcn
@@ -0,0 +1,149 @@
+/* NSSF test suite in TTCN-3 (3GPP TS 29.531), 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 TS29531_Nnssf_NSSAIAvailability all;
+import from TS29531_Nnssf_NSSAIAvailability_Templates all;
+import from TS29531_Nnssf_NSSelection all;
+import from TS29531_Nnssf_NSSelection_Templates all;
+
+import from NSSF_Tests all;
+
+const integer HTTP2_CONN_SCP := 0;
+
+type record ConnHdlrPars {
+       integer idx
+}
+
+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 template (value) ConnHdlrPars pars := {
+               idx := idx
+       };
+       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 */
+       f_http2_adapter_init();
+
+       fn.apply();
+}
+
+function f_http2_adapter_connect_nssf(integer idx := 0)
+runs on ConnHdlr {
+       f_http2_adapter_connect(mp_nssf_hostname, mp_nssf_sbi_port, 
mp_amf_local_ip, idx := idx);
+}
+
+function f_http2_adapter_connect_send_nssf(template (value) HTTP2_Msg 
http2_msg, integer idx := 0)
+runs on ConnHdlr {
+       f_http2_adapter_connect_nssf(idx := idx);
+       f_http2_adapter_send(http2_msg);
+}
+
+/********************************************
+ * 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;
+
+/***********************************************************************
+ * N22 Nnssf_NSSelection (SBI): Emulated AMF, 3GPP TS 29.531
+ ***********************************************************************/
+const charstring c_Nnssf_NSSelection_uri_hostport := mp_nssf_hostname & ":" & 
int2str(mp_nssf_sbi_port);
+const charstring c_Nnssf_NSSelection_uri_prefix := "http://"; & 
c_Nnssf_NSSelection_uri_hostport;
+
+/* 3GPP TS 29.531 6.1.3.2 6.1.3.2 Resource: Network Slice Information (GET) */
+private function 
f_n22_prepare_get_equipment_status(NetworkSliceInformationParams 
net_slice_info_pars)
+runs on ConnHdlr return HTTP2_Msg {
+       var charstring path;
+       var integer http2_idx;
+       var integer http2_stream_id;
+       var template (value) HTTP2_Msg http2_tx;
+
+       path := c_Nnssf_NSSelection_path_net_slice_info &
+               f_enc_NetworkSliceInformationParams(net_slice_info_pars);
+
+       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 := "GET",
+                                                                               
      scheme := "http",
+                                                                               
      authority := c_Nnssf_NSSelection_uri_hostport,
+                                                                               
      path := path),
+                                       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 := omit);
+       return valueof(http2_tx);
+}
+
+/* 3GPP TS 29.531 5.2.2.2.2 Get service operation of Nnssf_NSSelection service
+ * 3GPP TS 29.531 6.1.3.2 6.1.3.2 Resource: Network Slice Information (GET) */
+function f_n22_get_network_slice_info(template (value) 
NetworkSliceInformationParams net_slice_info_pars)
+runs on ConnHdlr {
+       var HTTP2_Msg http2_tx;
+       var HTTP2_Msg http2_rx;
+       var template (present) HTTP2_Msg http2_exp_rx;
+
+       http2_tx := 
f_n22_prepare_get_equipment_status(valueof(net_slice_info_pars));
+       f_http2_adapter_connect_send_nssf(http2_tx, idx := http2_tx.conn_id);
+
+       /* 3GPP TS 29.531 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(200)),
+                            tr_HTTP2_Data_frame(stream_id := 
http2_tx.stream_id,
+                                                end_stream_flag := true,
+                                                data := decmatch 
tr_AuthorizedNetworkSliceInfo));
+       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);
+}
+
+}
diff --git a/nssf/NSSF_Tests.cfg b/nssf/NSSF_Tests.cfg
new file mode 100644
index 0000000..7304492
--- /dev/null
+++ b/nssf/NSSF_Tests.cfg
@@ -0,0 +1,23 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./NSSF_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+NSSF_Tests.mp_nssf_hostname := "127.0.0.14";
+NSSF_Tests.mp_nssf_sbi_port := 7777;
+NSSF_Tests.mp_scp_local_ip := "127.0.0.200";
+NSSF_Tests.mp_scp_local_port := 7777;
+NSSF_Tests.mp_amf_local_ip := "127.0.0.6";
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+NSSF_Tests.control
diff --git a/nssf/NSSF_Tests.default b/nssf/NSSF_Tests.default
new file mode 100644
index 0000000..b03f59e
--- /dev/null
+++ b/nssf/NSSF_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/nssf/NSSF_Tests.ttcn b/nssf/NSSF_Tests.ttcn
new file mode 100644
index 0000000..bc005cc
--- /dev/null
+++ b/nssf/NSSF_Tests.ttcn
@@ -0,0 +1,177 @@
+/* NSSF test suite in TTCN-3 (3GPP TS 29.531)
+ * (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 NSSF_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 TS29531_Nnssf_NSSelection all;
+import from TS29531_Nnssf_NSSelection_Templates all;
+
+import from ConnHdlr all;
+
+modulepar {
+       charstring mp_nssf_hostname := "127.0.0.14";
+       integer mp_nssf_sbi_port := 7777;
+
+       charstring mp_scp_local_ip := "127.0.0.200";
+       integer mp_scp_local_port := 7777;
+
+       /* IP address used as originator of our emulated AMF/SMF requests 
towards the UIT. */
+       charstring mp_amf_local_ip := "127.0.0.6";
+}
+
+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(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.531 5.2.2.2.2 Get service operation of Nnssf_NSSelection service 
*/
+private function f_TC_slice_selection_information_registration() runs on 
ConnHdlr {
+       var template (value) NetworkSliceInformationParams query;
+       query := ts_NetworkSliceInformationParams(nFType := ts_NFType(AMF),
+                                                 nFInstanceId := 
"ttcn3-amf-instance-id",
+                                                 sliceInfoForRegistration := 
ts_SliceInfoForRegistration());
+       f_n22_get_network_slice_info(net_slice_info_pars := query);
+       setverdict(pass);
+}
+testcase TC_slice_selection_information_registration() runs on MTC_CT {
+       var ConnHdlr vc_conn;
+       var ConnHdlrPars pars := f_ConnHdlrPars(0);
+       f_init();
+       vc_conn := 
f_start_handler(refers(f_TC_slice_selection_information_registration), pars);
+       vc_conn.done;
+       f_shutdown();
+}
+
+/* 3GPP TS 29.531 5.2.2.2.3 Get service operation of Nnssf_NSSelection service
+ * during the PDU session establishment */
+private function f_TC_slice_selection_information_pdu_session() runs on 
ConnHdlr {
+       var template (value) NetworkSliceInformationParams query;
+       var template (value) SliceInfoForPDUSession pdu_sess;
+
+       pdu_sess := ts_SliceInfoForPDUSession(sNssai := ts_Snssai(1),
+                                             roamingIndication := 
ts_RoamingIndication(NON_ROAMING))
+
+       query := ts_NetworkSliceInformationParams(nFType := ts_NFType(AMF),
+                                                 nFInstanceId := 
"ttcn3-smf-instance-id",
+                                                 sliceInfoForPDUSession := 
pdu_sess
+                                                 );
+       f_n22_get_network_slice_info(net_slice_info_pars := query);
+       setverdict(pass);
+}
+testcase TC_slice_selection_information_pdu_session() runs on MTC_CT {
+       var ConnHdlr vc_conn;
+       var ConnHdlrPars pars := f_ConnHdlrPars(0);
+       f_init();
+       vc_conn := 
f_start_handler(refers(f_TC_slice_selection_information_pdu_session), pars);
+       vc_conn.done;
+       f_shutdown();
+}
+
+/* TODO Nnssf_NSSelection Service: */
+/* 5.2.2.2.4 Get service operation of Nnssf_NSSelection service during UE 
configuration update procedure */
+/* 5.2.2.2.5 Get service operation of Nnssf_NSSelection service during the PDN 
Connection Establishment */
+/* 5.2.2.2.6 Get service operation of Nnssf_NSSelection service to retrieve 
the network slice information */
+
+/* TODO Nnssf_NSSAIAvailability: */
+/* 5.3.2.2 Update Service Operation */
+/* 5.3.2.3 Subscribe Service Operation */
+/* 5.3.2.4 Unsubscribe Service Operation */
+/* 5.3.2.5 Notify Service Operation */
+/* 5.3.2.6 Delete Service Operation */
+/* 5.3.2.7 Options Service Operation */
+
+control {
+       execute( TC_slice_selection_information_registration() );
+       execute( TC_slice_selection_information_pdu_session() );
+}
+
+}
diff --git a/nssf/README.md b/nssf/README.md
new file mode 100644
index 0000000..866710e
--- /dev/null
+++ b/nssf/README.md
@@ -0,0 +1,18 @@
+# NSSF_Tests.ttcn
+
+* external interfaces
+    * N22: SBI (emulates AMF)
+    * N31: SBI (emulates peer NSSF)
+    * N34: SBI (emulates NWDAF)
+
+{% dot nssf_tests.svg
+digraph G {
+  rankdir=LR;
+  ATS [label="ATS\nNSSF_Tests.ttcn"];
+  NSSF [label="AMF\open5gs-nssfd",shape="box"];
+
+  ATS -> NSSF [label="N22"];
+  ATS -> NSSF [label="N31"];
+  ATS -> NSSF [label="N34"];
+}
+%}
diff --git a/nssf/expected-results.xml b/nssf/expected-results.xml
new file mode 100644
index 0000000..42e2d11
--- /dev/null
+++ b/nssf/expected-results.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<testsuite name='Titan' tests='2' failures='0' errors='0' skipped='0' 
inconc='0' time='MASKED'>
+  <testcase classname='NSSF_Tests' 
name='TC_slice_selection_information_registration' time='MASKED'/>
+  <testcase classname='NSSF_Tests' 
name='TC_slice_selection_information_pdu_session' time='MASKED'/>
+</testsuite>
diff --git a/nssf/gen_links.sh b/nssf/gen_links.sh
new file mode 100755
index 0000000..f30e997
--- /dev/null
+++ b/nssf/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="TS29531_Nnssf_NSSAIAvailability.ttcn TS29531_Nnssf_NSSelection.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+="TS29531_Nnssf_NSSAIAvailability_Templates.ttcn 
TS29531_Nnssf_NSSelection_Templates.ttcn "
+gen_links $DIR $FILES
+
+gen_links_finish
diff --git a/nssf/open5gs-eir.yaml b/nssf/open5gs-eir.yaml
new file mode 100644
index 0000000..efbef3a
--- /dev/null
+++ b/nssf/open5gs-eir.yaml
@@ -0,0 +1,18 @@
+db_uri: mongodb://127.0.0.103/open5gs
+logger:
+  level: debug
+
+global:
+  max:
+    ue: 1024
+
+eir:
+  sbi:
+    server:
+      - address: 127.0.0.21
+        port: 7777
+    client:
+#      nrf:
+#        - uri: http://127.0.0.10:7777
+      scp:
+        - uri: http://127.0.0.200:7777
diff --git a/nssf/open5gs-nssf.yaml b/nssf/open5gs-nssf.yaml
new file mode 100644
index 0000000..41c4086
--- /dev/null
+++ b/nssf/open5gs-nssf.yaml
@@ -0,0 +1,21 @@
+logger:
+  level: debug
+
+global:
+  max:
+    ue: 1024
+
+nssf:
+  sbi:
+    server:
+      - address: 127.0.0.14
+        port: 7777
+    client:
+#      nrf:
+#        - uri: http://127.0.0.10:7777
+      scp:
+        - uri: http://127.0.0.200:7777
+      nsi:
+        - uri: http://127.0.0.10:7777
+          s_nssai:
+            sst: 1
diff --git a/nssf/regen_makefile.sh b/nssf/regen_makefile.sh
new file mode 100755
index 0000000..f4775d7
--- /dev/null
+++ b/nssf/regen_makefile.sh
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+NAME=NSSF_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/nssf/testenv.cfg b/nssf/testenv.cfg
new file mode 100644
index 0000000..44b4157
--- /dev/null
+++ b/nssf/testenv.cfg
@@ -0,0 +1,10 @@
+[testsuite]
+program=NSSF_Tests
+config=NSSF_Tests.cfg
+
+[nssf]
+program=open5gs-nssfd -c open5gs-nssf.yaml
+make=open5gs
+package=open5gs-nssf
+copy=open5gs-nssf.yaml
+
diff --git a/nssf/testsrcdir.cfg b/nssf/testsrcdir.cfg
new file mode 100644
index 0000000..7f19289
--- /dev/null
+++ b/nssf/testsrcdir.cfg
@@ -0,0 +1,2 @@
+[testsrcdir]
+max_jobs_per_gb_ram=0.3

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44068?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: I49c271104f668c59ef7d4a010846a16dd169c0a8
Gerrit-Change-Number: 44068
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to