[SBI] Added config for service-names discovery

This commit is contained in:
Sukchan Lee 2022-08-27 10:49:07 +09:00
parent f020732ce9
commit 9f98d421a0
26 changed files with 332 additions and 85 deletions

View File

@ -94,6 +94,30 @@ logger:
# service_name: # service_name:
# - namf-comm # - namf-comm
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.5
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.5
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <NGAP Server>> # <NGAP Server>>
# #
# o NGAP Server(all address available) # o NGAP Server(all address available)

View File

@ -94,6 +94,30 @@ logger:
# service_name: # service_name:
# - nausf-auth # - nausf-auth
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.11
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.11
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
ausf: ausf:
sbi: sbi:
- addr: 127.0.0.11 - addr: 127.0.0.11

View File

@ -96,6 +96,30 @@ logger:
# service_name: # service_name:
# - nbsf-management # - nbsf-management
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.15
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.15
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
bsf: bsf:
sbi: sbi:
- addr: 127.0.0.15 - addr: 127.0.0.15

View File

@ -144,6 +144,30 @@ logger:
# service_name: # service_name:
# - nnssf-nsselection # - nnssf-nsselection
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.14
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.14
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
nssf: nssf:
sbi: sbi:
- addr: 127.0.0.14 - addr: 127.0.0.14

View File

@ -98,6 +98,30 @@ logger:
# - npcf-smpolicycontrol # - npcf-smpolicycontrol
# - npcf-policyauthorization # - npcf-policyauthorization
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.13
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.13
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
pcf: pcf:
sbi: sbi:
- addr: 127.0.0.13 - addr: 127.0.0.13

View File

@ -96,26 +96,30 @@ logger:
# - addr: 127.0.1.11 # - addr: 127.0.1.11
# port: 7777 # port: 7777
# #
# <Discovery> # <For Indirect Communication with Delegated Discovery>
# #
# o NF Discovery and Selection # o (Default) If you do not set Delegated Discovery as shown below,
# for indirect communication with Delegated Discovery;
#
# o delegated:
# o auto: (Default)
# Use next-hop SCP if next-hop SCP available. Otherwise NRF is used.
# => App fails if both next-hop SCP and NRF are unavailable.
# o yes: Use next-hop SCP always.
# => App fails if no next-hop SCP available.
# o no: Don't use next-hop SCP server.
# => App fails if no NRF available.
# #
# next_scp: # next_scp:
# sbi: # sbi:
# - addr: 127.0.1.11 # - addr: 127.0.1.10
# port: 7777 # port: 7777
# discovery: #
# delegated: auto|yes|no # - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# next_scp:
# sbi:
# - addr: 127.0.1.10
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
# #
scp: scp:
sbi: sbi:

View File

@ -94,6 +94,31 @@ logger:
# service_name: # service_name:
# - nsmf-pdusession # - nsmf-pdusession
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.4
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.4
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
#
# <PFCP Server> # <PFCP Server>
# #
# o PFCP Server(127.0.0.4:8805, ::1:8805) # o PFCP Server(127.0.0.4:8805, ::1:8805)

View File

@ -96,6 +96,30 @@ logger:
# - nudm-uecm # - nudm-uecm
# - nudm-ueau # - nudm-ueau
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.12
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.12
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
udm: udm:
sbi: sbi:
- addr: 127.0.0.12 - addr: 127.0.0.12

View File

@ -96,6 +96,30 @@ logger:
# service_name: # service_name:
# - nudr-dr # - nudr-dr
# #
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# sbi:
# - addr: 127.0.0.20
# port: 7777
#
# - 'service-names' is included.
#
# sbi:
# - addr: 127.0.0.20
# port: 7777
# discovery:
# option:
# no_service_names: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
udr: udr:
sbi: sbi:
- addr: 127.0.0.20 - addr: 127.0.0.20

View File

@ -106,63 +106,29 @@ smf:
- identity: pcrf.localdomain - identity: pcrf.localdomain
addr: 127.0.0.9 addr: 127.0.0.9
#
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,
#
# amf:
# sbi:
# - addr: 127.0.0.5
# port: 7777
#
# - 'service-names' is included.
# - 'requester-nf-instance-id' is NOT included.
#
# amf:
# sbi:
# - addr: 127.0.0.5
# port: 7777
# discovery:
# option:
# no_service_names: false
# prefer_requester_nf_instance_id: false
#
# o To remove 'service-names' from URI query parameters in NS Discovery
# no_service_names: true
#
# * For Indirect Communication with Delegated Discovery,
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# o To add 'requester-nf-instance-id' from URI query parameters in NS Discovery
# prefer_requester_nf_instance_id: true
#
# #
# <For Indirect Communication with Delegated Discovery> # <For Indirect Communication with Delegated Discovery>
# #
# o (Default) If you do not set Delegated Discovery as shown below, # o (Default) If you do not set Delegated Discovery as shown below,
# #
# amf: # sbi:
# sbi: # - addr: 127.0.0.5
# - addr: 127.0.0.5 # port: 7777
# port: 7777
# #
# - Use SCP if SCP avaiable. Otherwise NRF is used. # - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable. # => App fails if both NRF and SCP are unavailable.
# #
# amf: # sbi:
# sbi: # - addr: 127.0.0.5
# - addr: 127.0.0.5 # port: 7777
# port: 7777 # discovery:
# discovery: # delegated: auto
# delegated: auto
# #
# o To use SCP always => App fails if no SCP available. # o To use SCP always => App fails if no SCP available.
# delegated: yes # delegated: yes
# #
# o Don't use SCP server => App fails if no NRF available. # o Don't use SCP server => App fails if no NRF available.
# delegated: no # delegated: no
# #
amf: amf:
sbi: sbi:

View File

@ -235,6 +235,37 @@ char *ogs_supi_from_suci(char *suci)
return supi; return supi;
} }
char *ogs_supi_from_supi_or_suci(char *supi_or_suci)
{
char *type = NULL;
char *supi = NULL;
ogs_assert(supi_or_suci);
type = ogs_id_get_type(supi_or_suci);
if (!type) {
ogs_error("ogs_id_get_type[%s] failed", supi_or_suci);
goto cleanup;
}
SWITCH(type)
CASE("imsi")
supi = ogs_strdup(supi_or_suci);
ogs_expect(supi);
break;
CASE("suci")
supi = ogs_supi_from_suci(supi_or_suci);
ogs_expect(supi);
break;
DEFAULT
ogs_error("Not implemented [%s]", type);
break;
END
cleanup:
if (type)
ogs_free(type);
return supi;
}
char *ogs_id_get_type(char *str) char *ogs_id_get_type(char *str)
{ {
char *token, *p, *tmp; char *token, *p, *tmp;
@ -242,15 +273,26 @@ char *ogs_id_get_type(char *str)
ogs_assert(str); ogs_assert(str);
tmp = ogs_strdup(str); tmp = ogs_strdup(str);
ogs_expect_or_return_val(tmp, NULL); if (!tmp) {
ogs_error("ogs_strdup[%s] failed", str);
goto cleanup;
}
p = tmp; p = tmp;
token = strsep(&p, "-"); token = strsep(&p, "-");
ogs_assert(token); if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
type = ogs_strdup(token); type = ogs_strdup(token);
ogs_expect_or_return_val(type, NULL); if (!type) {
ogs_error("ogs_strdup[%s:%s] failed", str, token);
goto cleanup;
}
ogs_free(tmp); cleanup:
if (tmp)
ogs_free(tmp);
return type; return type;
} }
@ -261,17 +303,31 @@ char *ogs_id_get_value(char *str)
ogs_assert(str); ogs_assert(str);
tmp = ogs_strdup(str); tmp = ogs_strdup(str);
ogs_expect_or_return_val(tmp, NULL); if (!tmp) {
ogs_error("ogs_strdup[%s] failed", str);
goto cleanup;
}
p = tmp; p = tmp;
token = strsep(&p, "-"); token = strsep(&p, "-");
ogs_assert(token); if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
token = strsep(&p, "-"); token = strsep(&p, "-");
ogs_assert(token); if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
ueid = ogs_strdup(token); ueid = ogs_strdup(token);
ogs_expect_or_return_val(ueid, NULL); if (!ueid) {
ogs_error("ogs_strdup[%s:%s] failed", str, token);
goto cleanup;
}
ogs_free(tmp); cleanup:
if (tmp)
ogs_free(tmp);
return ueid; return ueid;
} }

View File

@ -177,6 +177,7 @@ ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id,
/************************************ /************************************
* SUPI/SUCI */ * SUPI/SUCI */
char *ogs_supi_from_suci(char *suci); char *ogs_supi_from_suci(char *suci);
char *ogs_supi_from_supi_or_suci(char *supi_or_suci);
/************************************ /************************************
* SUPI/GPSI */ * SUPI/GPSI */

View File

@ -1307,6 +1307,8 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
ogs_assert(nf_service->fqdn); ogs_assert(nf_service->fqdn);
} }
ogs_info("NF Service [%s]", nf_service->name);
return nf_service; return nf_service;
} }

View File

@ -303,7 +303,8 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID, OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID,
discovery_option->requester_nf_instance_id); discovery_option->requester_nf_instance_id);
} }
if (discovery_option->num_of_service_names) { if (ogs_sbi_self()->discovery_config.no_service_names == false &&
discovery_option->num_of_service_names) {
char *v = NULL; char *v = NULL;
cJSON *item = NULL; cJSON *item = NULL;

View File

@ -823,6 +823,8 @@ int amf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(amf_key, "service_name")) { } else if (!strcmp(amf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(amf_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", amf_key); ogs_warn("unknown key `%s`", amf_key);
} }

View File

@ -1085,7 +1085,8 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION); OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION);
} }
ogs_sbi_discovery_option_free(discovery_option); if (discovery_option)
ogs_sbi_discovery_option_free(discovery_option);
if (nf_instance) { if (nf_instance) {
ogs_assert(true == ogs_assert(true ==

View File

@ -104,6 +104,8 @@ int ausf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(ausf_key, "service_name")) { } else if (!strcmp(ausf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(ausf_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", ausf_key); ogs_warn("unknown key `%s`", ausf_key);
} }
@ -135,7 +137,7 @@ ausf_ue_t *ausf_ue_add(char *suci)
ogs_assert(ausf_ue->suci); ogs_assert(ausf_ue->suci);
ogs_hash_set(self.suci_hash, ausf_ue->suci, strlen(ausf_ue->suci), ausf_ue); ogs_hash_set(self.suci_hash, ausf_ue->suci, strlen(ausf_ue->suci), ausf_ue);
ausf_ue->supi = ogs_supi_from_suci(ausf_ue->suci); ausf_ue->supi = ogs_supi_from_supi_or_suci(ausf_ue->suci);
ogs_assert(ausf_ue->supi); ogs_assert(ausf_ue->supi);
ogs_hash_set(self.supi_hash, ausf_ue->supi, strlen(ausf_ue->supi), ausf_ue); ogs_hash_set(self.supi_hash, ausf_ue->supi, strlen(ausf_ue->supi), ausf_ue);

View File

@ -106,6 +106,8 @@ int bsf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(bsf_key, "service_name")) { } else if (!strcmp(bsf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(bsf_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", bsf_key); ogs_warn("unknown key `%s`", bsf_key);
} }

View File

@ -98,6 +98,8 @@ int nssf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(nssf_key, "service_name")) { } else if (!strcmp(nssf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(nssf_key, "discovery")) {
/* handle config in sbi library */
} else if (!strcmp(nssf_key, "nsi")) { } else if (!strcmp(nssf_key, "nsi")) {
ogs_list_t list, list6; ogs_list_t list, list6;
ogs_socknode_t *node = NULL, *node6 = NULL; ogs_socknode_t *node = NULL, *node6 = NULL;

View File

@ -119,6 +119,8 @@ int pcf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(pcf_key, "service_name")) { } else if (!strcmp(pcf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(pcf_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", pcf_key); ogs_warn("unknown key `%s`", pcf_key);
} }

View File

@ -179,17 +179,20 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
message.SmPolicyContextData->supi) { message.SmPolicyContextData->supi) {
pcf_ue = pcf_ue_find_by_supi( pcf_ue = pcf_ue_find_by_supi(
message.SmPolicyContextData->supi); message.SmPolicyContextData->supi);
if (pcf_ue) { if (!pcf_ue) {
if (message.SmPolicyContextData->pdu_session_id) { pcf_ue = pcf_ue_add(
sess = pcf_sess_find_by_psi(pcf_ue, message. message.SmPolicyContextData->supi);
SmPolicyContextData->pdu_session_id); ogs_assert(pcf_ue);
if (!sess) { }
sess = pcf_sess_add(pcf_ue, message. if (message.SmPolicyContextData->pdu_session_id) {
SmPolicyContextData->pdu_session_id); sess = pcf_sess_find_by_psi(pcf_ue, message.
ogs_assert(sess); SmPolicyContextData->pdu_session_id);
ogs_debug("[%s:%d] PCF session added", if (!sess) {
pcf_ue->supi, sess->psi); sess = pcf_sess_add(pcf_ue, message.
} SmPolicyContextData->pdu_session_id);
ogs_assert(sess);
ogs_debug("[%s:%d] PCF session added",
pcf_ue->supi, sess->psi);
} }
} }
} }

View File

@ -98,6 +98,8 @@ int scp_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(scp_key, "service_name")) { } else if (!strcmp(scp_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(scp_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", scp_key); ogs_warn("unknown key `%s`", scp_key);
} }

View File

@ -833,6 +833,8 @@ int smf_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(smf_key, "service_name")) { } else if (!strcmp(smf_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(smf_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", smf_key); ogs_warn("unknown key `%s`", smf_key);
} }

View File

@ -104,6 +104,8 @@ int udm_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(udm_key, "service_name")) { } else if (!strcmp(udm_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(udm_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", udm_key); ogs_warn("unknown key `%s`", udm_key);
} }
@ -135,7 +137,7 @@ udm_ue_t *udm_ue_add(char *suci)
ogs_assert(udm_ue->suci); ogs_assert(udm_ue->suci);
ogs_hash_set(self.suci_hash, udm_ue->suci, strlen(udm_ue->suci), udm_ue); ogs_hash_set(self.suci_hash, udm_ue->suci, strlen(udm_ue->suci), udm_ue);
udm_ue->supi = ogs_supi_from_suci(udm_ue->suci); udm_ue->supi = ogs_supi_from_supi_or_suci(udm_ue->suci);
ogs_assert(udm_ue->supi); ogs_assert(udm_ue->supi);
ogs_hash_set(self.supi_hash, udm_ue->supi, strlen(udm_ue->supi), udm_ue); ogs_hash_set(self.supi_hash, udm_ue->supi, strlen(udm_ue->supi), udm_ue);

View File

@ -86,6 +86,8 @@ int udr_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(udr_key, "service_name")) { } else if (!strcmp(udr_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(udr_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", udr_key); ogs_warn("unknown key `%s`", udr_key);
} }

View File

@ -113,6 +113,8 @@ int af_context_parse_config(void)
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(af_key, "service_name")) { } else if (!strcmp(af_key, "service_name")) {
/* handle config in sbi library */ /* handle config in sbi library */
} else if (!strcmp(af_key, "discovery")) {
/* handle config in sbi library */
} else } else
ogs_warn("unknown key `%s`", af_key); ogs_warn("unknown key `%s`", af_key);
} }