[SBI] Fixed nf_instance memory leak

- Rollback commit ed3444eef5
- Do not modify reference count when REGISTER/DEREGISTER notified from NRF
This commit is contained in:
Sukchan Lee 2022-08-02 09:44:13 +09:00
parent 7031856cd7
commit 7231dafbf1
54 changed files with 309 additions and 153 deletions

View File

@ -6,11 +6,11 @@ jobs:
name: Build and Test on MacOS Latest
runs-on: macos-latest
steps:
- name: Install MongoDB with Package Manager
run: |
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
# - name: Install MongoDB with Package Manager
# run: |
# brew tap mongodb/brew
# brew install mongodb-community
# brew services start mongodb-community
- name: Create the TUN device with the interface name `ogstun`.
run: |
sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
@ -33,6 +33,7 @@ jobs:
sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
- name: Install the dependencies for building the source code.
run: brew install mongo-c-driver libidn libmicrohttpd nghttp2 bison libusrsctp libtins talloc meson
- name: Check out repository code

View File

@ -35,7 +35,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: amf.key
@ -85,9 +85,18 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - namf-comm
#
# <NGAP Server>>
#
# o NGAP Server(all address avaiable)
# o NGAP Server(all address available)
# ngap:
#
# o NGAP Server(0.0.0.0:38412)
@ -104,7 +113,7 @@ logger:
# - addr: 127.0.0.5
# port: 38413
#
# o NGAP Server(address avaiable in `eth0` interface)
# o NGAP Server(address available in `eth0` interface)
# ngap:
# dev: eth0
#

View File

@ -35,7 +35,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: ausf.key
@ -85,6 +85,15 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nausf-auth
#
ausf:
sbi:
- addr: 127.0.0.11

View File

@ -37,7 +37,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: bsf.key
@ -87,6 +87,15 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nbsf-management
#
bsf:
sbi:
- addr: 127.0.0.15

View File

@ -26,7 +26,7 @@ logger:
#
# <S1AP Server>>
#
# o S1AP Server(all address avaiable)
# o S1AP Server(all address available)
# s1ap:
#
# o S1AP Server(0.0.0.0:36412)
@ -43,7 +43,7 @@ logger:
# - addr: 127.0.0.2
# port: 36413
#
# o S1AP Server(address avaiable in `eth0` interface)
# o S1AP Server(address available in `eth0` interface)
# s1ap:
# dev: eth0
#
@ -86,7 +86,7 @@ logger:
#
# <GTP-C Server>>
#
# o GTP-C Server(all address avaiable)
# o GTP-C Server(all address available)
# gtpc:
#
# o GTP-C Server(127.0.0.2:2123, [::1]:2123)

View File

@ -38,7 +38,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# tls:
# key: nrf.key
@ -77,6 +77,16 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nnrf-nfm
# - nnrf-disc
#
nrf:
sbi:
addr:

View File

@ -35,7 +35,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: nssf.key
@ -85,7 +85,7 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <List of avaiable Network Slice Instance(NSI)>
# <List of available Network Slice Instance(NSI)>
#
# o One NSI
# - NRF[http://::1:7777/nnrf-nfm/v1/nf-instances]
@ -134,6 +134,16 @@ logger:
# so_linger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nnssf-nsselection
#
nssf:
sbi:
- addr: 127.0.0.14

View File

@ -37,7 +37,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: pcf.key
@ -87,6 +87,17 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - npcf-am-policy-control
# - npcf-smpolicycontrol
# - npcf-policyauthorization
#
pcf:
sbi:
- addr: 127.0.0.13

View File

@ -38,7 +38,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: scp.key
@ -103,7 +103,7 @@ logger:
#
# o delegated:
# o auto: (Default)
# Use next-hop SCP if next-hop SCP avaiable. Otherwise NRF is used.
# 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.

View File

@ -35,7 +35,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: smf.key
@ -85,6 +85,15 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nsmf-pdusession
#
# <PFCP Server>
#
# o PFCP Server(127.0.0.4:8805, ::1:8805)

View File

@ -35,7 +35,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: udm.key
@ -85,6 +85,17 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nudm-sdm
# - nudm-uecm
# - nudm-ueau
#
udm:
sbi:
- addr: 127.0.0.12

View File

@ -37,7 +37,7 @@ logger:
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# o SBI Server(https://<all address available>:443)
# sbi:
# - tls:
# key: udr.key
@ -87,6 +87,15 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <NF Service>
#
# o NF Service Name(Default : all NF services available)
# service_name:
#
# o NF Service Name(Only some NF services are available)
# service_name:
# - nudr-dr
#
udr:
sbi:
- addr: 127.0.0.20

View File

@ -400,6 +400,27 @@ int ogs_sbi_context_parse_config(
ogs_socknode_remove_all(&list);
ogs_socknode_remove_all(&list6);
}
} else if (!strcmp(local_key, "service_name")) {
ogs_yaml_iter_t service_name_iter;
ogs_yaml_iter_recurse(&local_iter, &service_name_iter);
ogs_assert(ogs_yaml_iter_type(
&service_name_iter) != YAML_MAPPING_NODE);
do {
const char *v = NULL;
if (ogs_yaml_iter_type(&service_name_iter) ==
YAML_SEQUENCE_NODE) {
if (!ogs_yaml_iter_next(&service_name_iter))
break;
}
v = ogs_yaml_iter_value(&service_name_iter);
if (v && strlen(v))
self.service_name[self.num_of_service_name++] = v;
} while (ogs_yaml_iter_type(
&service_name_iter) == YAML_SEQUENCE_NODE);
}
}
} else if (nrf && !strcmp(root_key, nrf)) {
@ -706,6 +727,24 @@ int ogs_sbi_context_parse_config(
return OGS_OK;
}
bool ogs_sbi_nf_service_is_available(const char *name)
{
int i;
ogs_assert(name);
if (self.num_of_service_name == 0)
/* If no service name is configured, all services are available */
return true;
for (i = 0; i < self.num_of_service_name; i++)
/* Only services in the configuration are available */
if (strcmp(self.service_name[i], name) == 0)
return true;
return false;
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
@ -856,7 +895,7 @@ bool ogs_sbi_nf_instance_maximum_number_is_reached()
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(
ogs_sbi_nf_instance_t *nf_instance,
char *id, char *name, OpenAPI_uri_scheme_e scheme)
char *id, const char *name, OpenAPI_uri_scheme_e scheme)
{
ogs_sbi_nf_service_t *nf_service = NULL;
@ -888,7 +927,7 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(
}
void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service,
char *in_uri, char *full, char *expiry)
const char *in_uri, const char *full, const char *expiry)
{
ogs_assert(nf_service);
@ -1148,7 +1187,7 @@ void ogs_sbi_nf_instance_build_default(
}
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
ogs_sbi_nf_instance_t *nf_instance, char *name)
ogs_sbi_nf_instance_t *nf_instance, const char *name)
{
ogs_sbi_server_t *server = NULL;
ogs_sbi_nf_service_t *nf_service = NULL;

View File

@ -68,6 +68,8 @@ typedef struct ogs_sbi_context_s {
void (*client_wait_expire)(void *data);
ogs_fsm_handler_t nf_state_registered;
int num_of_service_name;
const char *service_name[OGS_MAX_NUM_OF_NF_SERVICE];
} ogs_sbi_context_t;
typedef struct ogs_sbi_nf_instance_s {
@ -271,6 +273,8 @@ ogs_sbi_context_t *ogs_sbi_self(void);
int ogs_sbi_context_parse_config(
const char *local, const char *nrf, const char *scp);
bool ogs_sbi_nf_service_is_available(const char *name);
ogs_sbi_nf_instance_t *ogs_sbi_scp_instance(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void);
@ -287,10 +291,12 @@ void ogs_sbi_nf_instance_remove_all(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id);
bool ogs_sbi_nf_instance_maximum_number_is_reached(void);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(ogs_sbi_nf_instance_t *nf_instance,
char *id, char *name, OpenAPI_uri_scheme_e scheme);
void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service,
char *in_uri, char *full, char *expiry);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(
ogs_sbi_nf_instance_t *nf_instance,
char *id, const char *name, OpenAPI_uri_scheme_e scheme);
void ogs_sbi_nf_service_add_version(
ogs_sbi_nf_service_t *nf_service,
const char *in_uri, const char *full, const char *expiry);
void ogs_sbi_nf_service_add_allowed_nf_type(
ogs_sbi_nf_service_t *nf_service, OpenAPI_nf_type_e allowed_nf_type);
void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service);
@ -309,7 +315,7 @@ void ogs_sbi_nf_info_remove_all(ogs_list_t *list);
void ogs_sbi_nf_instance_build_default(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
ogs_sbi_nf_instance_t *nf_instance, char *name);
ogs_sbi_nf_instance_t *nf_instance, const char *name);
ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version);

View File

@ -122,7 +122,6 @@ extern "C" {
#define OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION "nsmf-pdusession"
#define OGS_SBI_RESOURCE_NAME_SM_CONTEXTS "sm-contexts"
#define OGS_SBI_SERVICE_NAME_NSMF_EVENT_EXPOSURE "nsmf-event-exposure"
#define OGS_SBI_RESOURCE_NAME_MODIFY "modify"
#define OGS_SBI_RESOURCE_NAME_RELEASE "release"

View File

@ -821,6 +821,8 @@ int amf_context_parse_config(void)
self.amf_name = ogs_yaml_iter_value(&amf_iter);
} else if (!strcmp(amf_key, "sbi")) {
/* handle config in sbi library */
} else if (!strcmp(amf_key, "service_name")) {
/* handle config in sbi library */
} else
ogs_warn("unknown key `%s`", amf_key);
}

View File

@ -203,6 +203,7 @@ struct ran_ue_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
amf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -210,7 +211,6 @@ struct ran_ue_s {
OGS_FSM_TRAN(&_nFInstance->sm, amf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
struct amf_ue_s {

View File

@ -183,8 +183,6 @@ bool amf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, amf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -314,8 +312,6 @@ void amf_nnrf_handle_nf_discover_search_result(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, amf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -91,12 +91,14 @@ int amf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SMF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NAMF_COMM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NAMF_COMM)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NAMF_COMM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
}
/* Initialize SCP NF Instance */
nf_instance = ogs_sbi_self()->scp_instance;

View File

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

View File

@ -70,6 +70,7 @@ struct ausf_ue_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
ausf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -77,7 +78,6 @@ struct ausf_ue_s {
OGS_FSM_TRAN(&_nFInstance->sm, ausf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
};

View File

@ -180,8 +180,6 @@ bool ausf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, ausf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -292,8 +290,6 @@ void ausf_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, ausf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -88,12 +88,14 @@ int ausf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NAUSF_AUTH);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NAUSF_AUTH)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NAUSF_AUTH);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -48,6 +48,7 @@ typedef struct bsf_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
bsf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -55,7 +56,6 @@ typedef struct bsf_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, bsf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
typedef struct bsf_sess_s bsf_sess_t;

View File

@ -181,8 +181,6 @@ bool bsf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, bsf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -293,8 +291,6 @@ void bsf_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, bsf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -88,12 +88,14 @@ int bsf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_PCF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_PCF);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_PCF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

@ -96,6 +96,8 @@ int nssf_context_parse_config(void)
ogs_assert(nssf_key);
if (!strcmp(nssf_key, "sbi")) {
/* handle config in sbi library */
} else if (!strcmp(nssf_key, "service_name")) {
/* 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

@ -47,6 +47,7 @@ typedef struct nssf_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
nssf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -54,7 +55,6 @@ typedef struct nssf_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, nssf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
void nssf_context_init(void);

View File

@ -180,8 +180,6 @@ bool nssf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, nssf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -88,12 +88,15 @@ int nssf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V2,
(char*)OGS_SBI_API_V2_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
if (ogs_sbi_nf_service_is_available(
OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V2, OGS_SBI_API_V2_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -53,6 +53,7 @@ typedef struct pcf_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
pcf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -60,7 +61,6 @@ typedef struct pcf_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, pcf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
struct pcf_ue_s {

View File

@ -181,8 +181,6 @@ bool pcf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, pcf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -294,8 +292,6 @@ void pcf_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, pcf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -91,22 +91,38 @@ int pcf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_NEF);
if (ogs_sbi_nf_service_is_available(
OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_NEF);
}
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_NEF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AF);
if (ogs_sbi_nf_service_is_available(
OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_NEF);
}
if (ogs_sbi_nf_service_is_available(
OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_NEF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -45,6 +45,7 @@ typedef struct scp_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
scp_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -52,7 +53,6 @@ typedef struct scp_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, scp_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
typedef struct scp_conn_s scp_conn_t;

View File

@ -181,8 +181,6 @@ bool scp_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, scp_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -293,8 +291,6 @@ void scp_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, scp_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

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

View File

@ -132,6 +132,7 @@ typedef struct smf_ue_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
smf_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -139,7 +140,6 @@ typedef struct smf_ue_s {
OGS_FSM_TRAN(&_nFInstance->sm, smf_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
#define SMF_SESS_CLEAR(__sESS) \
do { \

View File

@ -181,8 +181,6 @@ bool smf_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, smf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -293,8 +291,6 @@ void smf_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, smf_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -90,12 +90,14 @@ int smf_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -79,6 +79,7 @@ struct udm_ue_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
udm_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -86,7 +87,6 @@ struct udm_ue_s {
OGS_FSM_TRAN(&_nFInstance->sm, udm_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
};

View File

@ -181,8 +181,6 @@ bool udm_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, udm_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -293,8 +291,6 @@ void udm_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, udm_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -90,25 +90,33 @@ int udm_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AUSF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NUDM_UEAU);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AUSF);
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NUDM_UECM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NUDM_SDM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V2,
(char*)OGS_SBI_API_V2_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDM_UEAU)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NUDM_UEAU);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AUSF);
}
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDM_UECM)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NUDM_UECM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
}
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDM_SDM)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NUDM_SDM);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V2, OGS_SBI_API_V2_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AMF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -47,6 +47,7 @@ typedef struct udr_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
udr_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -54,7 +55,6 @@ typedef struct udr_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, udr_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
void udr_context_init(void);

View File

@ -181,8 +181,6 @@ bool udr_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, udr_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -89,13 +89,15 @@ int udr_sbi_open(void)
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_UDM);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NUDR_DR);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_PCF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_UDM);
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDR_DR)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NUDR_DR);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_PCF);
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_UDM);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {

View File

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

View File

@ -52,6 +52,7 @@ typedef struct af_context_s {
if ((_nFInstance)->reference_count == 1) { \
ogs_info("[%s] (%s) NF removed", (_nFInstance)->id, (_cAUSE)); \
af_nf_fsm_fini((_nFInstance)); \
ogs_sbi_nf_instance_remove(_nFInstance); \
} else { \
/* There is an assocation with other context */ \
ogs_info("[%s:%d] (%s) NF suspended", \
@ -59,7 +60,6 @@ typedef struct af_context_s {
OGS_FSM_TRAN(&_nFInstance->sm, af_nf_state_de_registered); \
ogs_fsm_dispatch(&_nFInstance->sm, NULL); \
} \
ogs_sbi_nf_instance_remove(_nFInstance); \
} while(0)
typedef struct af_sess_s af_sess_t;

View File

@ -185,8 +185,6 @@ bool af_nnrf_handle_nf_status_notify(
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, af_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);
@ -297,8 +295,6 @@ void af_nnrf_handle_nf_discover(
ogs_info("[%s] (NF-discover) NF registered", nf_instance->id);
} else {
nf_instance->reference_count++;
OGS_FSM_TRAN(&nf_instance->sm, af_nf_state_registered);
ogs_fsm_dispatch(&nf_instance->sm, NULL);

View File

@ -87,11 +87,14 @@ int af_sbi_open(void)
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AF);
/* Build NF service information. It will be transmitted to NRF. */
service = ogs_sbi_nf_service_build_default(nf_instance,
(char*)OGS_SBI_SERVICE_NAME_NAF_EVENTEXPOSURE);
ogs_assert(service);
ogs_sbi_nf_service_add_version(service, (char*)OGS_SBI_API_V1,
(char*)OGS_SBI_API_V1_0_0, NULL);
if (ogs_sbi_nf_service_is_available(
OGS_SBI_SERVICE_NAME_NAF_EVENTEXPOSURE)) {
service = ogs_sbi_nf_service_build_default(
nf_instance, OGS_SBI_SERVICE_NAME_NAF_EVENTEXPOSURE);
ogs_assert(service);
ogs_sbi_nf_service_add_version(
service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL);
}
/* Initialize NRF NF Instance */
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {