[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:
# - 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>>
#
# o NGAP Server(all address available)

View File

@ -94,6 +94,30 @@ logger:
# service_name:
# - 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:
sbi:
- addr: 127.0.0.11

View File

@ -96,6 +96,30 @@ logger:
# service_name:
# - 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:
sbi:
- addr: 127.0.0.15

View File

@ -144,6 +144,30 @@ logger:
# service_name:
# - 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:
sbi:
- addr: 127.0.0.14

View File

@ -98,6 +98,30 @@ logger:
# - npcf-smpolicycontrol
# - 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:
sbi:
- addr: 127.0.0.13

View File

@ -96,26 +96,30 @@ logger:
# - addr: 127.0.1.11
# port: 7777
#
# <Discovery>
# <For Indirect Communication with Delegated Discovery>
#
# o NF Discovery and Selection
# 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.
# o (Default) If you do not set Delegated Discovery as shown below,
#
# next_scp:
# sbi:
# - addr: 127.0.1.11
# port: 7777
# discovery:
# delegated: auto|yes|no
# sbi:
# - addr: 127.0.1.10
# port: 7777
#
# - 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:
sbi:

View File

@ -94,6 +94,31 @@ logger:
# service_name:
# - 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>
#
# o PFCP Server(127.0.0.4:8805, ::1:8805)

View File

@ -96,6 +96,30 @@ logger:
# - nudm-uecm
# - 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:
sbi:
- addr: 127.0.0.12

View File

@ -96,6 +96,30 @@ logger:
# service_name:
# - 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:
sbi:
- addr: 127.0.0.20

View File

@ -106,63 +106,29 @@ smf:
- identity: pcrf.localdomain
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>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# amf:
# sbi:
# - addr: 127.0.0.5
# port: 7777
# sbi:
# - addr: 127.0.0.5
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# amf:
# sbi:
# - addr: 127.0.0.5
# port: 7777
# discovery:
# delegated: auto
# sbi:
# - addr: 127.0.0.5
# port: 7777
# discovery:
# delegated: auto
#
# 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.
# delegated: no
# delegated: no
#
amf:
sbi:

View File

@ -235,6 +235,37 @@ char *ogs_supi_from_suci(char *suci)
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 *token, *p, *tmp;
@ -242,15 +273,26 @@ char *ogs_id_get_type(char *str)
ogs_assert(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;
token = strsep(&p, "-");
ogs_assert(token);
if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
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;
}
@ -261,17 +303,31 @@ char *ogs_id_get_value(char *str)
ogs_assert(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;
token = strsep(&p, "-");
ogs_assert(token);
if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
token = strsep(&p, "-");
ogs_assert(token);
if (!token) {
ogs_error("strsep[%s] failed", str);
goto cleanup;
}
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;
}

View File

@ -177,6 +177,7 @@ ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id,
/************************************
* SUPI/SUCI */
char *ogs_supi_from_suci(char *suci);
char *ogs_supi_from_supi_or_suci(char *supi_or_suci);
/************************************
* 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_info("NF Service [%s]", nf_service->name);
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,
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;
cJSON *item = NULL;

View File

@ -823,6 +823,8 @@ int amf_context_parse_config(void)
/* handle config in sbi library */
} else if (!strcmp(amf_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(amf_key, "discovery")) {
/* handle config in sbi library */
} else
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_discovery_option_free(discovery_option);
if (discovery_option)
ogs_sbi_discovery_option_free(discovery_option);
if (nf_instance) {
ogs_assert(true ==

View File

@ -104,6 +104,8 @@ int ausf_context_parse_config(void)
/* handle config in sbi library */
} else if (!strcmp(ausf_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(ausf_key, "discovery")) {
/* handle config in sbi library */
} else
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_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_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 */
} else if (!strcmp(bsf_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(bsf_key, "discovery")) {
/* handle config in sbi library */
} else
ogs_warn("unknown key `%s`", bsf_key);
}

View File

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

View File

@ -119,6 +119,8 @@ int pcf_context_parse_config(void)
/* handle config in sbi library */
} else if (!strcmp(pcf_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(pcf_key, "discovery")) {
/* handle config in sbi library */
} else
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) {
pcf_ue = pcf_ue_find_by_supi(
message.SmPolicyContextData->supi);
if (pcf_ue) {
if (message.SmPolicyContextData->pdu_session_id) {
sess = pcf_sess_find_by_psi(pcf_ue, message.
SmPolicyContextData->pdu_session_id);
if (!sess) {
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);
}
if (!pcf_ue) {
pcf_ue = pcf_ue_add(
message.SmPolicyContextData->supi);
ogs_assert(pcf_ue);
}
if (message.SmPolicyContextData->pdu_session_id) {
sess = pcf_sess_find_by_psi(pcf_ue, message.
SmPolicyContextData->pdu_session_id);
if (!sess) {
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 */
} else if (!strcmp(scp_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(scp_key, "discovery")) {
/* handle config in sbi library */
} else
ogs_warn("unknown key `%s`", scp_key);
}

View File

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

View File

@ -104,6 +104,8 @@ int udm_context_parse_config(void)
/* handle config in sbi library */
} else if (!strcmp(udm_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(udm_key, "discovery")) {
/* handle config in sbi library */
} else
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_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_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 */
} else if (!strcmp(udr_key, "service_name")) {
/* handle config in sbi library */
} else if (!strcmp(udr_key, "discovery")) {
/* handle config in sbi library */
} else
ogs_warn("unknown key `%s`", udr_key);
}

View File

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