forked from acouzens/open5gs
Support service-based NF subscription
This commit is contained in:
parent
87cd34d300
commit
f54bccacf5
|
@ -26,7 +26,7 @@ static int context_initialized = 0;
|
|||
static OGS_POOL(nf_instance_pool, ogs_sbi_nf_instance_t);
|
||||
static OGS_POOL(nf_service_pool, ogs_sbi_nf_service_t);
|
||||
static OGS_POOL(xact_pool, ogs_sbi_xact_t);
|
||||
static OGS_POOL(subscription_pool, ogs_sbi_subscription_t);
|
||||
static OGS_POOL(subscription_data_pool, ogs_sbi_subscription_data_t);
|
||||
static OGS_POOL(smf_info_pool, ogs_sbi_smf_info_t);
|
||||
static OGS_POOL(nf_info_pool, ogs_sbi_nf_info_t);
|
||||
|
||||
|
@ -51,8 +51,8 @@ void ogs_sbi_context_init(void)
|
|||
|
||||
ogs_pool_init(&xact_pool, ogs_app()->pool.xact);
|
||||
|
||||
ogs_list_init(&self.subscription_list);
|
||||
ogs_pool_init(&subscription_pool, ogs_app()->pool.subscription);
|
||||
ogs_list_init(&self.subscription_data_list);
|
||||
ogs_pool_init(&subscription_data_pool, ogs_app()->pool.subscription);
|
||||
|
||||
ogs_pool_init(&smf_info_pool, ogs_app()->pool.nf);
|
||||
|
||||
|
@ -74,8 +74,8 @@ void ogs_sbi_context_final(void)
|
|||
{
|
||||
ogs_assert(context_initialized == 1);
|
||||
|
||||
ogs_sbi_subscription_remove_all();
|
||||
ogs_pool_final(&subscription_pool);
|
||||
ogs_sbi_subscription_data_remove_all();
|
||||
ogs_pool_final(&subscription_data_pool);
|
||||
|
||||
ogs_pool_final(&xact_pool);
|
||||
|
||||
|
@ -737,17 +737,6 @@ int ogs_sbi_context_parse_config(
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
void ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_e nf_type)
|
||||
{
|
||||
ogs_assert(nf_type);
|
||||
|
||||
if (self.num_of_to_be_notified_nf_type < OGS_SBI_MAX_NUM_OF_NF_TYPE) {
|
||||
self.to_be_notified_nf_type[self.num_of_to_be_notified_nf_type] =
|
||||
nf_type;
|
||||
self.num_of_to_be_notified_nf_type++;
|
||||
}
|
||||
}
|
||||
|
||||
bool ogs_sbi_nf_service_is_available(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
@ -830,6 +819,29 @@ void ogs_sbi_nf_instance_add_allowed_nf_type(
|
|||
}
|
||||
}
|
||||
|
||||
bool ogs_sbi_nf_instance_is_allowed_nf_type(
|
||||
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e allowed_nf_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
ogs_assert(nf_instance);
|
||||
ogs_assert(allowed_nf_type);
|
||||
|
||||
if (!nf_instance->num_of_allowed_nf_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < nf_instance->num_of_allowed_nf_type; i++) {
|
||||
if (nf_instance->allowed_nf_type[i] == allowed_nf_type)
|
||||
return true;
|
||||
}
|
||||
|
||||
ogs_error("Not allowed nf-type[%s] in nf-instance[%s]",
|
||||
OpenAPI_nf_type_ToString(allowed_nf_type),
|
||||
OpenAPI_nf_type_ToString(nf_instance->nf_type));
|
||||
return false;
|
||||
}
|
||||
|
||||
void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
int i;
|
||||
|
@ -875,7 +887,7 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
|
|||
ogs_sbi_nf_instance_clear(nf_instance);
|
||||
|
||||
if (nf_instance->id) {
|
||||
ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id);
|
||||
ogs_sbi_subscription_data_remove_all_by_nf_instance_id(nf_instance->id);
|
||||
ogs_free(nf_instance->id);
|
||||
}
|
||||
|
||||
|
@ -1031,6 +1043,30 @@ void ogs_sbi_nf_service_add_allowed_nf_type(
|
|||
}
|
||||
}
|
||||
|
||||
bool ogs_sbi_nf_service_is_allowed_nf_type(
|
||||
ogs_sbi_nf_service_t *nf_service, OpenAPI_nf_type_e allowed_nf_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
ogs_assert(nf_service);
|
||||
ogs_assert(allowed_nf_type);
|
||||
|
||||
if (!nf_service->num_of_allowed_nf_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < nf_service->num_of_allowed_nf_type; i++) {
|
||||
if (nf_service->allowed_nf_type[i] == allowed_nf_type)
|
||||
return true;
|
||||
}
|
||||
|
||||
ogs_assert(nf_service->name);
|
||||
ogs_error("Not allowed nf-type[%s] in nf-service[%s]",
|
||||
OpenAPI_nf_type_ToString(allowed_nf_type),
|
||||
nf_service->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service)
|
||||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
@ -1449,9 +1485,11 @@ static void nf_service_associate_client_all(ogs_sbi_nf_instance_t *nf_instance)
|
|||
|
||||
bool ogs_sbi_discovery_option_is_matched(
|
||||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
OpenAPI_nf_type_e requester_nf_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option)
|
||||
{
|
||||
ogs_assert(nf_instance);
|
||||
ogs_assert(requester_nf_type);
|
||||
ogs_assert(discovery_option);
|
||||
|
||||
if (discovery_option->target_nf_instance_id &&
|
||||
|
@ -1472,8 +1510,11 @@ bool ogs_sbi_discovery_option_is_matched(
|
|||
discovery_option->service_names[i] &&
|
||||
strcmp(nf_service->name,
|
||||
discovery_option->service_names[i]) == 0) {
|
||||
exist = true;
|
||||
break;
|
||||
if (ogs_sbi_nf_service_is_allowed_nf_type(
|
||||
nf_service, requester_nf_type) == true) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exist == true) break;
|
||||
|
@ -1489,8 +1530,13 @@ bool ogs_sbi_discovery_param_is_matched(
|
|||
OpenAPI_nf_type_e target_nf_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option)
|
||||
{
|
||||
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
|
||||
|
||||
ogs_assert(nf_instance);
|
||||
ogs_assert(target_nf_type);
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
requester_nf_type = ogs_sbi_self()->nf_instance->nf_type;
|
||||
ogs_assert(requester_nf_type);
|
||||
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered))
|
||||
return false;
|
||||
|
@ -1500,7 +1546,7 @@ bool ogs_sbi_discovery_param_is_matched(
|
|||
|
||||
if (discovery_option &&
|
||||
ogs_sbi_discovery_option_is_matched(
|
||||
nf_instance, discovery_option) == false)
|
||||
nf_instance, requester_nf_type, discovery_option) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -1692,90 +1738,136 @@ ogs_sbi_xact_t *ogs_sbi_xact_cycle(ogs_sbi_xact_t *xact)
|
|||
return ogs_pool_cycle(&xact_pool, xact);
|
||||
}
|
||||
|
||||
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void)
|
||||
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_pool_alloc(&subscription_pool, &subscription);
|
||||
ogs_assert(subscription);
|
||||
memset(subscription, 0, sizeof(ogs_sbi_subscription_t));
|
||||
ogs_pool_alloc(&subscription_data_pool, &subscription_data);
|
||||
ogs_assert(subscription_data);
|
||||
memset(subscription_data, 0, sizeof(ogs_sbi_subscription_data_t));
|
||||
|
||||
subscription->time.validity_duration =
|
||||
subscription_data->time.validity_duration =
|
||||
ogs_app()->time.subscription.validity_duration;
|
||||
|
||||
ogs_list_add(&ogs_sbi_self()->subscription_list, subscription);
|
||||
ogs_list_add(&ogs_sbi_self()->subscription_data_list, subscription_data);
|
||||
|
||||
return subscription;
|
||||
return subscription_data;
|
||||
}
|
||||
|
||||
void ogs_sbi_subscription_set_id(ogs_sbi_subscription_t *subscription, char *id)
|
||||
void ogs_sbi_subscription_data_set_id(
|
||||
ogs_sbi_subscription_data_t *subscription_data, char *id)
|
||||
{
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription_data);
|
||||
ogs_assert(id);
|
||||
|
||||
subscription->id = ogs_strdup(id);
|
||||
ogs_assert(subscription->id);
|
||||
subscription_data->id = ogs_strdup(id);
|
||||
ogs_assert(subscription_data->id);
|
||||
}
|
||||
|
||||
void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription)
|
||||
void ogs_sbi_subscription_data_remove(
|
||||
ogs_sbi_subscription_data_t *subscription_data)
|
||||
{
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_list_remove(&ogs_sbi_self()->subscription_list, subscription);
|
||||
ogs_list_remove(&ogs_sbi_self()->subscription_data_list, subscription_data);
|
||||
|
||||
if (subscription->id)
|
||||
ogs_free(subscription->id);
|
||||
if (subscription_data->id)
|
||||
ogs_free(subscription_data->id);
|
||||
|
||||
if (subscription->notification_uri)
|
||||
ogs_free(subscription->notification_uri);
|
||||
if (subscription_data->notification_uri)
|
||||
ogs_free(subscription_data->notification_uri);
|
||||
|
||||
if (subscription->req_nf_instance_id)
|
||||
ogs_free(subscription->req_nf_instance_id);
|
||||
if (subscription_data->req_nf_instance_id)
|
||||
ogs_free(subscription_data->req_nf_instance_id);
|
||||
|
||||
if (subscription->t_validity)
|
||||
ogs_timer_delete(subscription->t_validity);
|
||||
if (subscription_data->subscr_cond.service_name)
|
||||
ogs_free(subscription_data->subscr_cond.service_name);
|
||||
|
||||
if (subscription->client)
|
||||
ogs_sbi_client_remove(subscription->client);
|
||||
if (subscription_data->t_validity)
|
||||
ogs_timer_delete(subscription_data->t_validity);
|
||||
|
||||
ogs_pool_free(&subscription_pool, subscription);
|
||||
if (subscription_data->client)
|
||||
ogs_sbi_client_remove(subscription_data->client);
|
||||
|
||||
ogs_pool_free(&subscription_data_pool, subscription_data);
|
||||
}
|
||||
|
||||
void ogs_sbi_subscription_remove_all_by_nf_instance_id(char *nf_instance_id)
|
||||
void ogs_sbi_subscription_data_remove_all_by_nf_instance_id(
|
||||
char *nf_instance_id)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL, *next_subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_subscription_data_t *next_subscription_data = NULL;
|
||||
|
||||
ogs_assert(nf_instance_id);
|
||||
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_list,
|
||||
next_subscription, subscription) {
|
||||
if (subscription->req_nf_instance_id &&
|
||||
strcmp(subscription->req_nf_instance_id, nf_instance_id) == 0) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_data_list,
|
||||
next_subscription_data, subscription_data) {
|
||||
if (subscription_data->req_nf_instance_id &&
|
||||
strcmp(subscription_data->req_nf_instance_id,
|
||||
nf_instance_id) == 0) {
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ogs_sbi_subscription_remove_all(void)
|
||||
void ogs_sbi_subscription_data_remove_all(void)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL, *next_subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_subscription_data_t *next_subscription_data = NULL;
|
||||
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_list,
|
||||
next_subscription, subscription)
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_data_list,
|
||||
next_subscription_data, subscription_data)
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
}
|
||||
|
||||
ogs_sbi_subscription_t *ogs_sbi_subscription_find(char *id)
|
||||
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_find(char *id)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_assert(id);
|
||||
|
||||
ogs_list_for_each(&ogs_sbi_self()->subscription_list, subscription) {
|
||||
ogs_assert(subscription->id);
|
||||
if (strcmp(subscription->id, id) == 0)
|
||||
ogs_list_for_each(&ogs_sbi_self()->subscription_data_list,
|
||||
subscription_data) {
|
||||
ogs_assert(subscription_data->id);
|
||||
if (strcmp(subscription_data->id, id) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return subscription;
|
||||
return subscription_data;
|
||||
}
|
||||
|
||||
void ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_e nf_type, const char *service_name)
|
||||
{
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL, *nrf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(nf_type);
|
||||
|
||||
nrf_instance = ogs_sbi_self()->nrf_instance;
|
||||
if (!nrf_instance) {
|
||||
ogs_warn("[%s:%s] has no NRF",
|
||||
OpenAPI_nf_type_ToString(nf_type), service_name);
|
||||
return;
|
||||
}
|
||||
|
||||
client = nrf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
ogs_assert(nf_instance->id);
|
||||
ogs_assert(nf_instance->nf_type);
|
||||
|
||||
subscription_data = ogs_sbi_subscription_data_add();
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
OGS_SBI_SETUP_CLIENT(subscription_data, client);
|
||||
subscription_data->req_nf_type = nf_instance->nf_type;
|
||||
if (nf_instance->id)
|
||||
subscription_data->req_nf_instance_id = ogs_strdup(nf_instance->id);
|
||||
subscription_data->subscr_cond.nf_type = nf_type;
|
||||
if (service_name)
|
||||
subscription_data->subscr_cond.service_name = ogs_strdup(service_name);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef struct ogs_sbi_context_s {
|
|||
ogs_uuid_t uuid;
|
||||
|
||||
ogs_list_t nf_instance_list;
|
||||
ogs_list_t subscription_list;
|
||||
ogs_list_t subscription_data_list;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance; /* SELF NF Instance */
|
||||
ogs_sbi_nf_instance_t *nrf_instance; /* NRF Instance */
|
||||
|
@ -67,10 +67,6 @@ typedef struct ogs_sbi_context_s {
|
|||
|
||||
int num_of_service_name;
|
||||
const char *service_name[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
|
||||
|
||||
#define OGS_SBI_MAX_NUM_OF_NF_TYPE 128
|
||||
int num_of_to_be_notified_nf_type;
|
||||
OpenAPI_nf_type_e to_be_notified_nf_type[OGS_SBI_MAX_NUM_OF_NF_TYPE];
|
||||
} ogs_sbi_context_t;
|
||||
|
||||
typedef struct ogs_sbi_nf_instance_s {
|
||||
|
@ -112,6 +108,7 @@ typedef struct ogs_sbi_nf_instance_s {
|
|||
ogs_sockaddr_t *ipv6[OGS_SBI_MAX_NUM_OF_IP_ADDRESS];
|
||||
|
||||
int num_of_allowed_nf_type;
|
||||
#define OGS_SBI_MAX_NUM_OF_NF_TYPE 128
|
||||
OpenAPI_nf_type_e allowed_nf_type[OGS_SBI_MAX_NUM_OF_NF_TYPE];
|
||||
|
||||
#define OGS_SBI_DEFAULT_PRIORITY 0
|
||||
|
@ -206,7 +203,7 @@ typedef struct ogs_sbi_nf_service_s {
|
|||
void *client;
|
||||
} ogs_sbi_nf_service_t;
|
||||
|
||||
typedef struct ogs_sbi_subscription_s {
|
||||
typedef struct ogs_sbi_subscription_data_s {
|
||||
ogs_lnode_t lnode;
|
||||
|
||||
struct {
|
||||
|
@ -223,13 +220,14 @@ typedef struct ogs_sbi_subscription_s {
|
|||
|
||||
struct {
|
||||
OpenAPI_nf_type_e nf_type; /* nfType */
|
||||
char *service_name; /* ServiceName */
|
||||
} subscr_cond;
|
||||
|
||||
uint64_t requester_features;
|
||||
uint64_t nrf_supported_features;
|
||||
|
||||
void *client; /* only used in SERVER */
|
||||
} ogs_sbi_subscription_t;
|
||||
} ogs_sbi_subscription_data_t;
|
||||
|
||||
typedef struct ogs_sbi_smf_info_s {
|
||||
int num_of_slice;
|
||||
|
@ -272,8 +270,6 @@ ogs_sbi_context_t *ogs_sbi_self(void);
|
|||
int ogs_sbi_context_parse_config(
|
||||
const char *local, const char *nrf, const char *scp);
|
||||
|
||||
void ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_e nf_type);
|
||||
|
||||
bool ogs_sbi_nf_service_is_available(const char *name);
|
||||
|
||||
ogs_sbi_nf_instance_t *ogs_sbi_scp_instance(void);
|
||||
|
@ -286,6 +282,8 @@ void ogs_sbi_nf_instance_set_status(
|
|||
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_status_e nf_status);
|
||||
void ogs_sbi_nf_instance_add_allowed_nf_type(
|
||||
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e allowed_nf_type);
|
||||
bool ogs_sbi_nf_instance_is_allowed_nf_type(
|
||||
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e allowed_nf_type);
|
||||
void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance);
|
||||
void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance);
|
||||
void ogs_sbi_nf_instance_remove_all(void);
|
||||
|
@ -305,6 +303,8 @@ void ogs_sbi_nf_service_add_version(
|
|||
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);
|
||||
bool ogs_sbi_nf_service_is_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);
|
||||
void ogs_sbi_nf_service_remove(ogs_sbi_nf_service_t *nf_service);
|
||||
void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance);
|
||||
|
@ -352,6 +352,7 @@ bool ogs_sbi_discovery_param_is_matched(
|
|||
|
||||
bool ogs_sbi_discovery_option_is_matched(
|
||||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
OpenAPI_nf_type_e requester_nf_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option);
|
||||
|
||||
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
|
||||
|
@ -365,13 +366,17 @@ void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact);
|
|||
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object);
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_cycle(ogs_sbi_xact_t *xact);
|
||||
|
||||
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void);
|
||||
void ogs_sbi_subscription_set_id(
|
||||
ogs_sbi_subscription_t *subscription, char *id);
|
||||
void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription);
|
||||
void ogs_sbi_subscription_remove_all_by_nf_instance_id(char *nf_instance_id);
|
||||
void ogs_sbi_subscription_remove_all(void);
|
||||
ogs_sbi_subscription_t *ogs_sbi_subscription_find(char *id);
|
||||
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void);
|
||||
void ogs_sbi_subscription_data_set_id(
|
||||
ogs_sbi_subscription_data_t *subscription_data, char *id);
|
||||
void ogs_sbi_subscription_data_remove(
|
||||
ogs_sbi_subscription_data_t *subscription_data);
|
||||
void ogs_sbi_subscription_data_remove_all_by_nf_instance_id(
|
||||
char *nf_instance_id);
|
||||
void ogs_sbi_subscription_data_remove_all(void);
|
||||
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_find(char *id);
|
||||
void ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_e nf_type, const char *service_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -204,7 +204,6 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
|
|||
void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
|
||||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -218,15 +217,12 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
|
|||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
|
||||
int i;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_info("[%s] NF registered [Heartbeat:%ds]",
|
||||
ogs_sbi_self()->nf_instance->id,
|
||||
nf_instance->time.heartbeat_interval);
|
||||
|
||||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
@ -236,13 +232,10 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
|
|||
ogs_app()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
for (i = 0;
|
||||
i < ogs_sbi_self()->num_of_to_be_notified_nf_type; i++) {
|
||||
ogs_list_for_each(
|
||||
&ogs_sbi_self()->subscription_data_list, subscription_data) {
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
ogs_sbi_self()->nf_instance->id,
|
||||
ogs_sbi_self()->to_be_notified_nf_type[i]));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -51,7 +51,8 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void)
|
|||
|
||||
OGS_SBI_FEATURES_SET(supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
ogs_sbi_self()->nf_instance, NULL, supported_features);
|
||||
ogs_sbi_self()->nf_instance,
|
||||
NULL, NULL, supported_features);
|
||||
ogs_expect_or_return_val(NFProfile, NULL);
|
||||
|
||||
message.NFProfile = NFProfile;
|
||||
|
@ -65,6 +66,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void)
|
|||
|
||||
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
||||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
const char *service_name,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
uint64_t supported_features)
|
||||
{
|
||||
|
@ -178,6 +180,10 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
|||
ogs_list_for_each(&nf_instance->nf_service_list, nf_service) {
|
||||
OpenAPI_nf_service_t *NFService = NULL;
|
||||
|
||||
if (service_name && nf_service->name &&
|
||||
strcmp(service_name, nf_service->name) != 0)
|
||||
continue;
|
||||
|
||||
if (discovery_option && discovery_option->num_of_service_names) {
|
||||
for (i = 0; i < discovery_option->num_of_service_names; i++) {
|
||||
if (nf_service->name &&
|
||||
|
@ -770,7 +776,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(void)
|
|||
}
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||
ogs_sbi_subscription_t *subscription)
|
||||
ogs_sbi_subscription_data_t *subscription_data)
|
||||
{
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_header_t header;
|
||||
|
@ -780,8 +786,8 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
|||
OpenAPI_subscription_data_t *SubscriptionData = NULL;
|
||||
OpenAPI_subscription_data_subscr_cond_t SubscrCond;
|
||||
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription->req_nf_type);
|
||||
ogs_assert(subscription_data);
|
||||
ogs_assert(subscription_data->req_nf_type);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
|
@ -806,18 +812,23 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
|||
ogs_expect_or_return_val(
|
||||
SubscriptionData->nf_status_notification_uri, NULL);
|
||||
|
||||
SubscriptionData->req_nf_type = subscription->req_nf_type;
|
||||
SubscriptionData->req_nf_instance_id = subscription->req_nf_instance_id;
|
||||
SubscriptionData->req_nf_type = subscription_data->req_nf_type;
|
||||
SubscriptionData->req_nf_instance_id =
|
||||
subscription_data->req_nf_instance_id;
|
||||
|
||||
OGS_SBI_FEATURES_SET(subscription->requester_features,
|
||||
OGS_SBI_FEATURES_SET(subscription_data->requester_features,
|
||||
OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
SubscriptionData->requester_features =
|
||||
ogs_uint64_to_string(subscription->requester_features);
|
||||
ogs_uint64_to_string(subscription_data->requester_features);
|
||||
ogs_expect_or_return_val(SubscriptionData->requester_features, NULL);
|
||||
|
||||
memset(&SubscrCond, 0, sizeof(SubscrCond));
|
||||
if (subscription->subscr_cond.nf_type) {
|
||||
SubscrCond.nf_type = subscription->subscr_cond.nf_type;
|
||||
if (subscription_data->subscr_cond.nf_type) {
|
||||
SubscrCond.nf_type = subscription_data->subscr_cond.nf_type;
|
||||
SubscriptionData->subscr_cond = &SubscrCond;
|
||||
}
|
||||
if (subscription_data->subscr_cond.service_name) {
|
||||
SubscrCond.service_name = subscription_data->subscr_cond.service_name;
|
||||
SubscriptionData->subscr_cond = &SubscrCond;
|
||||
}
|
||||
|
||||
|
@ -833,12 +844,13 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
|||
}
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
||||
ogs_sbi_subscription_t *subscription)
|
||||
ogs_sbi_subscription_data_t *subscription_data)
|
||||
{
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription_data);
|
||||
ogs_assert(subscription_data->id);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
|
||||
|
@ -846,7 +858,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
|||
message.h.api.version = (char *)OGS_SBI_API_V1;
|
||||
message.h.resource.component[0] =
|
||||
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
|
||||
message.h.resource.component[1] = subscription->id;
|
||||
message.h.resource.component[1] = subscription_data->id;
|
||||
|
||||
request = ogs_sbi_build_request(&message);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
|
||||
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
||||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
const char *service_name,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
uint64_t supported_features);
|
||||
void ogs_nnrf_nfm_free_nf_profile(OpenAPI_nf_profile_t *NFProfile);
|
||||
|
@ -35,9 +36,9 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_update(void);
|
|||
ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(void);
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||
ogs_sbi_subscription_t *subscription);
|
||||
ogs_sbi_subscription_data_t *subscription_data);
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
||||
ogs_sbi_subscription_t *subscription);
|
||||
ogs_sbi_subscription_data_t *subscription_data);
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id);
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
|
||||
|
|
|
@ -452,14 +452,15 @@ static void handle_smf_info(
|
|||
}
|
||||
|
||||
void ogs_nnrf_handle_nf_status_subscribe(
|
||||
ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *recvmsg)
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
OpenAPI_subscription_data_t *SubscriptionData = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(recvmsg);
|
||||
ogs_assert(subscription);
|
||||
client = subscription->client;
|
||||
ogs_assert(subscription_data);
|
||||
client = subscription_data->client;
|
||||
ogs_assert(client);
|
||||
|
||||
SubscriptionData = recvmsg->SubscriptionData;
|
||||
|
@ -472,15 +473,15 @@ void ogs_nnrf_handle_nf_status_subscribe(
|
|||
ogs_error("No SubscriptionId");
|
||||
return;
|
||||
}
|
||||
ogs_sbi_subscription_set_id(
|
||||
subscription, SubscriptionData->subscription_id);
|
||||
ogs_sbi_subscription_data_set_id(
|
||||
subscription_data, SubscriptionData->subscription_id);
|
||||
|
||||
/* SBI Features */
|
||||
if (SubscriptionData->nrf_supported_features) {
|
||||
subscription->nrf_supported_features =
|
||||
subscription_data->nrf_supported_features =
|
||||
ogs_uint64_from_string(SubscriptionData->nrf_supported_features);
|
||||
} else {
|
||||
subscription->nrf_supported_features = 0;
|
||||
subscription_data->nrf_supported_features = 0;
|
||||
}
|
||||
|
||||
if (SubscriptionData->validity_time) {
|
||||
|
@ -491,13 +492,13 @@ void ogs_nnrf_handle_nf_status_subscribe(
|
|||
duration = time - ogs_time_now();
|
||||
if (duration < VALIDITY_MINIMUM) {
|
||||
duration = VALIDITY_MINIMUM;
|
||||
ogs_warn("[%s] Forced to %lld seconds", subscription->id,
|
||||
ogs_warn("[%s] Forced to %lld seconds", subscription_data->id,
|
||||
(long long)ogs_time_sec(VALIDITY_MINIMUM));
|
||||
}
|
||||
subscription->t_validity = ogs_timer_add(ogs_app()->timer_mgr,
|
||||
ogs_timer_subscription_validity, subscription);
|
||||
ogs_assert(subscription->t_validity);
|
||||
ogs_timer_start(subscription->t_validity, duration);
|
||||
subscription_data->t_validity = ogs_timer_add(ogs_app()->timer_mgr,
|
||||
ogs_timer_subscription_validity, subscription_data);
|
||||
ogs_assert(subscription_data->t_validity);
|
||||
ogs_timer_start(subscription_data->t_validity, duration);
|
||||
} else {
|
||||
ogs_error("Cannot parse validitiyTime [%s]",
|
||||
SubscriptionData->validity_time);
|
||||
|
|
|
@ -30,7 +30,8 @@ void ogs_sbi_nnrf_handle_nf_profile(
|
|||
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_profile_t *NFProfile);
|
||||
|
||||
void ogs_nnrf_handle_nf_status_subscribe(
|
||||
ogs_sbi_subscription_t *subscription, ogs_sbi_message_t *recvmsg);
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
ogs_sbi_message_t *recvmsg);
|
||||
bool ogs_nnrf_handle_nf_status_notify(
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
|
||||
|
||||
|
|
|
@ -231,49 +231,40 @@ bool ogs_nnrf_nfm_send_nf_profile_retrieve(ogs_sbi_nf_instance_t *nf_instance,
|
|||
client, client->cb, request, data);
|
||||
}
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client,
|
||||
OpenAPI_nf_type_e req_nf_type, char *req_nf_instance_id,
|
||||
OpenAPI_nf_type_e subscr_cond_nf_type)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
|
||||
ogs_assert(client);
|
||||
|
||||
subscription = ogs_sbi_subscription_add();
|
||||
ogs_assert(subscription);
|
||||
|
||||
OGS_SBI_SETUP_CLIENT(subscription, client);
|
||||
subscription->req_nf_type = req_nf_type;
|
||||
if (req_nf_instance_id) {
|
||||
subscription->req_nf_instance_id = ogs_strdup(req_nf_instance_id);
|
||||
ogs_expect_or_return_val(req_nf_instance_id, false);
|
||||
}
|
||||
subscription->subscr_cond.nf_type = subscr_cond_nf_type;
|
||||
|
||||
request = ogs_nnrf_nfm_build_status_subscribe(subscription);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
|
||||
return ogs_sbi_scp_send_request(
|
||||
client, client->cb, request, subscription);
|
||||
}
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
|
||||
ogs_sbi_subscription_t *subscription)
|
||||
bool ogs_nnrf_nfm_send_nf_status_subscribe(
|
||||
ogs_sbi_subscription_data_t *subscription_data)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
request = ogs_nnrf_nfm_build_status_unsubscribe(subscription);
|
||||
request = ogs_nnrf_nfm_build_status_subscribe(subscription_data);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
|
||||
client = subscription->client;
|
||||
client = subscription_data->client;
|
||||
ogs_assert(client);
|
||||
|
||||
return ogs_sbi_scp_send_request(
|
||||
client, client->cb, request, subscription);
|
||||
client, client->cb, request, subscription_data);
|
||||
}
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
|
||||
ogs_sbi_subscription_data_t *subscription_data)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
request = ogs_nnrf_nfm_build_status_unsubscribe(subscription_data);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
|
||||
client = subscription_data->client;
|
||||
ogs_assert(client);
|
||||
|
||||
return ogs_sbi_scp_send_request(
|
||||
client, client->cb, request, subscription_data);
|
||||
}
|
||||
|
||||
bool ogs_nnrf_disc_send_nf_discover(
|
||||
|
|
|
@ -39,11 +39,10 @@ bool ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance);
|
|||
bool ogs_nnrf_nfm_send_nf_profile_retrieve(ogs_sbi_nf_instance_t *nf_instance,
|
||||
char *nf_instance_id, void *data);
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client,
|
||||
OpenAPI_nf_type_e req_nf_type, char *req_nf_instance_id,
|
||||
OpenAPI_nf_type_e subscr_cond_nf_type);
|
||||
bool ogs_nnrf_nfm_send_nf_status_subscribe(
|
||||
ogs_sbi_subscription_data_t *subscription_data);
|
||||
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
|
||||
ogs_sbi_subscription_t *subscription);
|
||||
ogs_sbi_subscription_data_t *subscription_data);
|
||||
|
||||
bool ogs_nnrf_disc_send_nf_discover(
|
||||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
|
|
|
@ -71,7 +71,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *sbi_response = NULL;
|
||||
ogs_sbi_message_t sbi_message;
|
||||
|
||||
|
@ -284,28 +284,28 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(sbi_message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &sbi_message);
|
||||
subscription_data, &sbi_message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, sbi_message.res_status);
|
||||
subscription_data->id, sbi_message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (sbi_message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, sbi_message.res_status);
|
||||
subscription_data->id, sbi_message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -570,18 +570,15 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -82,14 +82,6 @@ int amf_sbi_open(void)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_nf_service_t *service = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_AUSF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDM);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_NSSF);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -98,6 +90,7 @@ int amf_sbi_open(void)
|
|||
/* Build NF instance information. It will be transmitted to NRF. */
|
||||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NAMF_COMM)) {
|
||||
|
@ -124,6 +117,20 @@ int amf_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_AUSF, OGS_SBI_SERVICE_NAME_NAUSF_AUTH);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_UDM, OGS_SBI_SERVICE_NAME_NUDM_UECM);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_UDM, OGS_SBI_SERVICE_NAME_NUDM_SDM);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_PCF, OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_SMF, OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_NSSF, OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -208,34 +208,34 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
ogs_error("[%s] Invalid HTTP method [%s]",
|
||||
subscription->id, message.h.method);
|
||||
subscription_data->id, message.h.method);
|
||||
ogs_assert_if_reached();
|
||||
END
|
||||
break;
|
||||
|
@ -339,18 +339,15 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -79,10 +79,6 @@ int ausf_sbi_open(void)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_nf_service_t *service = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDM);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -91,6 +87,7 @@ int ausf_sbi_open(void)
|
|||
/* Build NF instance information. It will be transmitted to NRF. */
|
||||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AUSF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NAUSF_AUTH)) {
|
||||
|
@ -117,6 +114,10 @@ int ausf_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_UDM, OGS_SBI_SERVICE_NAME_NUDM_UEAU);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -229,15 +229,15 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -246,7 +246,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -323,18 +323,15 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("Subscription validity expired [%s]", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -79,10 +79,6 @@ int bsf_sbi_open(void)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_nf_service_t *service = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDM);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -91,6 +87,8 @@ int bsf_sbi_open(void)
|
|||
/* Build NF instance information. It will be transmitted to NRF. */
|
||||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_BSF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT)) {
|
||||
|
@ -100,6 +98,7 @@ int bsf_sbi_open(void)
|
|||
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_AF);
|
||||
}
|
||||
|
||||
/* Initialize NRF NF Instance */
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct ogs_sbi_request_s ogs_sbi_request_t;
|
|||
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
|
||||
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
|
||||
typedef struct ogs_sbi_nf_instance_s ogs_sbi_nf_instance_t;
|
||||
typedef struct ogs_sbi_subscription_s ogs_sbi_subscription_t;
|
||||
typedef struct ogs_sbi_subscription_data_s ogs_sbi_subscription_data_t;
|
||||
|
||||
typedef enum {
|
||||
NRF_EVT_BASE = OGS_MAX_NUM_OF_PROTO_EVENT,
|
||||
|
@ -56,7 +56,7 @@ typedef struct nrf_event_s {
|
|||
} sbi;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance;
|
||||
ogs_sbi_subscription_t *subscription;
|
||||
ogs_sbi_subscription_data_t *subscription_data;
|
||||
} nrf_event_t;
|
||||
|
||||
void nrf_event_init(void);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "nnrf-build.h"
|
||||
|
||||
ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
|
||||
ogs_sbi_subscription_t *subscription,
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
|
@ -32,14 +32,14 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
|
|||
|
||||
OpenAPI_notification_data_t *NotificationData = NULL;
|
||||
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription_data);
|
||||
ogs_assert(event);
|
||||
ogs_assert(nf_instance);
|
||||
ogs_assert(nf_instance->id);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
message.h.uri = subscription->notification_uri;
|
||||
message.h.uri = subscription_data->notification_uri;
|
||||
|
||||
message.http.accept = (char *)OGS_SBI_CONTENT_PROBLEM_TYPE;
|
||||
|
||||
|
@ -63,7 +63,10 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
|
|||
if (event != OpenAPI_notification_event_type_NF_DEREGISTERED) {
|
||||
NotificationData->nf_profile =
|
||||
ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, NULL, subscription->requester_features);
|
||||
nf_instance,
|
||||
subscription_data->subscr_cond.service_name,
|
||||
NULL,
|
||||
subscription_data->requester_features);
|
||||
ogs_expect_or_return_val(NotificationData->nf_profile, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
|
||||
ogs_sbi_subscription_t *subscription,
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance);
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
OpenAPI_subscription_data_t *SubscriptionData = NULL;
|
||||
OpenAPI_subscription_data_subscr_cond_t *SubscrCond = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
||||
|
@ -194,15 +194,16 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
ogs_uuid_get(&uuid);
|
||||
ogs_uuid_format(id, &uuid);
|
||||
|
||||
subscription = ogs_sbi_subscription_add();
|
||||
ogs_assert(subscription);
|
||||
ogs_sbi_subscription_set_id(subscription, id);
|
||||
ogs_assert(subscription->id);
|
||||
subscription_data = ogs_sbi_subscription_data_add();
|
||||
ogs_assert(subscription_data);
|
||||
ogs_sbi_subscription_data_set_id(subscription_data, id);
|
||||
ogs_assert(subscription_data->id);
|
||||
|
||||
subscription_data->req_nf_type = SubscriptionData->req_nf_type;
|
||||
if (SubscriptionData->req_nf_instance_id) {
|
||||
subscription->req_nf_instance_id =
|
||||
subscription_data->req_nf_instance_id =
|
||||
ogs_strdup(SubscriptionData->req_nf_instance_id);
|
||||
ogs_expect_or_return_val(subscription->req_nf_instance_id, NULL);
|
||||
ogs_expect_or_return_val(subscription_data->req_nf_instance_id, NULL);
|
||||
}
|
||||
|
||||
if (SubscriptionData->subscription_id) {
|
||||
|
@ -210,42 +211,45 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
SubscriptionData->subscription_id);
|
||||
ogs_free(SubscriptionData->subscription_id);
|
||||
}
|
||||
SubscriptionData->subscription_id = ogs_strdup(subscription->id);
|
||||
SubscriptionData->subscription_id = ogs_strdup(subscription_data->id);
|
||||
ogs_expect_or_return_val(SubscriptionData->subscription_id, NULL);
|
||||
|
||||
if (SubscriptionData->requester_features) {
|
||||
subscription->requester_features =
|
||||
subscription_data->requester_features =
|
||||
ogs_uint64_from_string(SubscriptionData->requester_features);
|
||||
|
||||
/* No need to send SubscriptionData->requester_features to the NF */
|
||||
ogs_free(SubscriptionData->requester_features);
|
||||
SubscriptionData->requester_features = NULL;
|
||||
} else {
|
||||
subscription->requester_features = 0;
|
||||
subscription_data->requester_features = 0;
|
||||
}
|
||||
|
||||
OGS_SBI_FEATURES_SET(subscription->nrf_supported_features,
|
||||
OGS_SBI_FEATURES_SET(subscription_data->nrf_supported_features,
|
||||
OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
SubscriptionData->nrf_supported_features =
|
||||
ogs_uint64_to_string(subscription->nrf_supported_features);
|
||||
ogs_uint64_to_string(subscription_data->nrf_supported_features);
|
||||
ogs_expect_or_return_val(SubscriptionData->nrf_supported_features, NULL);
|
||||
|
||||
SubscrCond = SubscriptionData->subscr_cond;
|
||||
if (SubscrCond) {
|
||||
subscription->subscr_cond.nf_type = SubscrCond->nf_type;
|
||||
subscription_data->subscr_cond.nf_type = SubscrCond->nf_type;
|
||||
if (SubscrCond->service_name)
|
||||
subscription_data->subscr_cond.service_name =
|
||||
ogs_strdup(SubscrCond->service_name);
|
||||
}
|
||||
|
||||
subscription->notification_uri =
|
||||
subscription_data->notification_uri =
|
||||
ogs_strdup(SubscriptionData->nf_status_notification_uri);
|
||||
ogs_assert(subscription->notification_uri);
|
||||
ogs_assert(subscription_data->notification_uri);
|
||||
|
||||
addr = ogs_sbi_getaddr_from_uri(subscription->notification_uri);
|
||||
addr = ogs_sbi_getaddr_from_uri(subscription_data->notification_uri);
|
||||
if (!addr) {
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(
|
||||
stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST,
|
||||
recvmsg, "Invalid URI", subscription->notification_uri));
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
recvmsg, "Invalid URI", subscription_data->notification_uri));
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -254,21 +258,21 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
client = ogs_sbi_client_add(addr);
|
||||
ogs_assert(client);
|
||||
}
|
||||
OGS_SBI_SETUP_CLIENT(subscription, client);
|
||||
OGS_SBI_SETUP_CLIENT(subscription_data, client);
|
||||
|
||||
ogs_freeaddrinfo(addr);
|
||||
|
||||
if (subscription->time.validity_duration) {
|
||||
if (subscription_data->time.validity_duration) {
|
||||
SubscriptionData->validity_time = ogs_sbi_localtime_string(
|
||||
ogs_time_now() + ogs_time_from_sec(
|
||||
subscription->time.validity_duration));
|
||||
subscription_data->time.validity_duration));
|
||||
ogs_assert(SubscriptionData->validity_time);
|
||||
|
||||
subscription->t_validity = ogs_timer_add(ogs_app()->timer_mgr,
|
||||
nrf_timer_subscription_validity, subscription);
|
||||
ogs_assert(subscription->t_validity);
|
||||
ogs_timer_start(subscription->t_validity,
|
||||
ogs_time_from_sec(subscription->time.validity_duration));
|
||||
subscription_data->t_validity = ogs_timer_add(ogs_app()->timer_mgr,
|
||||
nrf_timer_subscription_validity, subscription_data);
|
||||
ogs_assert(subscription_data->t_validity);
|
||||
ogs_timer_start(subscription_data->t_validity,
|
||||
ogs_time_from_sec(subscription_data->time.validity_duration));
|
||||
}
|
||||
|
||||
recvmsg->http.location = recvmsg->h.uri;
|
||||
|
@ -284,14 +288,15 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
bool nrf_nnrf_handle_nf_status_unsubscribe(
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_assert(stream);
|
||||
ogs_assert(recvmsg);
|
||||
|
||||
subscription = ogs_sbi_subscription_find(recvmsg->h.resource.component[1]);
|
||||
if (subscription) {
|
||||
subscription_data = ogs_sbi_subscription_data_find(
|
||||
recvmsg->h.resource.component[1]);
|
||||
if (subscription_data) {
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
|
||||
response = ogs_sbi_build_response(
|
||||
recvmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
|
||||
|
@ -315,7 +320,6 @@ bool nrf_nnrf_handle_nf_list_retrieval(
|
|||
ogs_sbi_server_t *server = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_discovery_option_t *discovery_option = NULL;
|
||||
int i = 0;
|
||||
|
||||
ogs_sbi_links_t *links = NULL;
|
||||
|
@ -333,9 +337,6 @@ bool nrf_nnrf_handle_nf_list_retrieval(
|
|||
|
||||
links->self = ogs_sbi_server_uri(server, &recvmsg->h);
|
||||
|
||||
if (recvmsg->param.discovery_option)
|
||||
discovery_option = recvmsg->param.discovery_option;
|
||||
|
||||
i = 0;
|
||||
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
|
||||
|
||||
|
@ -343,11 +344,6 @@ bool nrf_nnrf_handle_nf_list_retrieval(
|
|||
recvmsg->param.nf_type != nf_instance->nf_type)
|
||||
continue;
|
||||
|
||||
if (discovery_option &&
|
||||
ogs_sbi_discovery_option_is_matched(
|
||||
nf_instance, discovery_option) == false)
|
||||
continue;
|
||||
|
||||
if (!recvmsg->param.limit ||
|
||||
(recvmsg->param.limit && i < recvmsg->param.limit)) {
|
||||
char *str = ogs_msprintf("%s/%s", links->self, nf_instance->id);
|
||||
|
@ -385,7 +381,6 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
|
|||
ogs_sbi_message_t sendmsg;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_discovery_option_t *discovery_option = NULL;
|
||||
uint64_t supported_features = 0;
|
||||
|
||||
ogs_assert(stream);
|
||||
|
@ -402,14 +397,11 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (recvmsg->param.discovery_option)
|
||||
discovery_option = recvmsg->param.discovery_option;
|
||||
|
||||
memset(&sendmsg, 0, sizeof(sendmsg));
|
||||
|
||||
OGS_SBI_FEATURES_SET(supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
sendmsg.NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, discovery_option, supported_features);
|
||||
nf_instance, NULL, NULL, supported_features);
|
||||
ogs_expect_or_return_val(sendmsg.NFProfile, NULL);
|
||||
|
||||
response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
|
||||
|
@ -492,9 +484,15 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
if (nf_instance->nf_type != recvmsg->param.target_nf_type)
|
||||
continue;
|
||||
|
||||
if (ogs_sbi_nf_instance_is_allowed_nf_type(
|
||||
nf_instance, recvmsg->param.requester_nf_type) == false)
|
||||
continue;
|
||||
|
||||
if (discovery_option &&
|
||||
ogs_sbi_discovery_option_is_matched(
|
||||
nf_instance, discovery_option) == false)
|
||||
nf_instance,
|
||||
recvmsg->param.requester_nf_type,
|
||||
discovery_option) == false)
|
||||
continue;
|
||||
|
||||
if (recvmsg->param.limit && i >= recvmsg->param.limit)
|
||||
|
@ -509,7 +507,7 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
OGS_SBI_FEATURES_SET(
|
||||
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, discovery_option, supported_features);
|
||||
nf_instance, NULL, discovery_option, supported_features);
|
||||
OpenAPI_list_add(SearchResult->nf_instances, NFProfile);
|
||||
|
||||
i++;
|
||||
|
|
|
@ -43,7 +43,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_assert(e);
|
||||
|
||||
|
@ -251,11 +251,12 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
break;
|
||||
|
||||
case NRF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->subscription;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->subscription_data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("[%s] Subscription validity expired",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -92,19 +92,20 @@ void nrf_sbi_close(void)
|
|||
ogs_sbi_server_stop_all();
|
||||
}
|
||||
|
||||
bool nrf_nnrf_nfm_send_nf_status_notify(ogs_sbi_subscription_t *subscription,
|
||||
bool nrf_nnrf_nfm_send_nf_status_notify(
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(subscription);
|
||||
client = subscription->client;
|
||||
ogs_assert(subscription_data);
|
||||
client = subscription_data->client;
|
||||
ogs_assert(client);
|
||||
|
||||
request = nrf_nnrf_nfm_build_nf_status_notify(
|
||||
subscription, event, nf_instance);
|
||||
subscription_data, event, nf_instance);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
|
||||
return ogs_sbi_scp_send_request(client, client_notify_cb, request, NULL);
|
||||
|
@ -114,23 +115,41 @@ bool nrf_nnrf_nfm_send_nf_status_notify_all(
|
|||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_assert(nf_instance);
|
||||
|
||||
ogs_list_for_each(&ogs_sbi_self()->subscription_list, subscription) {
|
||||
ogs_list_for_each(
|
||||
&ogs_sbi_self()->subscription_data_list, subscription_data) {
|
||||
|
||||
if (subscription->req_nf_instance_id &&
|
||||
strcmp(subscription->req_nf_instance_id, nf_instance->id) == 0)
|
||||
if (subscription_data->req_nf_instance_id &&
|
||||
strcmp(subscription_data->req_nf_instance_id, nf_instance->id) == 0)
|
||||
continue;
|
||||
|
||||
if (subscription->subscr_cond.nf_type &&
|
||||
subscription->subscr_cond.nf_type != nf_instance->nf_type)
|
||||
if (subscription_data->subscr_cond.nf_type &&
|
||||
subscription_data->subscr_cond.nf_type != nf_instance->nf_type)
|
||||
continue;
|
||||
|
||||
if (subscription_data->req_nf_type &&
|
||||
ogs_sbi_nf_instance_is_allowed_nf_type(
|
||||
nf_instance, subscription_data->req_nf_type) == false)
|
||||
continue;
|
||||
|
||||
if (subscription_data->subscr_cond.service_name) {
|
||||
ogs_sbi_nf_service_t *nf_service =
|
||||
ogs_sbi_nf_service_find_by_name(nf_instance,
|
||||
subscription_data->subscr_cond.service_name);
|
||||
if (nf_service == NULL) continue;
|
||||
|
||||
if (subscription_data->req_nf_type &&
|
||||
ogs_sbi_nf_service_is_allowed_nf_type(
|
||||
nf_service, subscription_data->req_nf_type) == false)
|
||||
continue;
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
nrf_nnrf_nfm_send_nf_status_notify(
|
||||
subscription, event, nf_instance),
|
||||
subscription_data, event, nf_instance),
|
||||
false);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ extern "C" {
|
|||
int nrf_sbi_open(void);
|
||||
void nrf_sbi_close(void);
|
||||
|
||||
bool nrf_nnrf_nfm_send_nf_status_notify(ogs_sbi_subscription_t *subscription,
|
||||
bool nrf_nnrf_nfm_send_nf_status_notify(
|
||||
ogs_sbi_subscription_data_t *subscription_data,
|
||||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance);
|
||||
bool nrf_nnrf_nfm_send_nf_status_notify_all(
|
||||
|
|
|
@ -48,7 +48,7 @@ static void timer_send_event(int timer_id, void *data)
|
|||
case NRF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
e = nrf_event_new(NRF_EVT_SBI_TIMER);
|
||||
e->timer_id = timer_id;
|
||||
e->subscription = data;
|
||||
e->subscription_data = data;
|
||||
break;
|
||||
default:
|
||||
ogs_fatal("Unknown timer id[%d]", timer_id);
|
||||
|
|
|
@ -46,7 +46,7 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
|
||||
|
@ -172,34 +172,34 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
ogs_error("[%s] Invalid HTTP method [%s]",
|
||||
subscription->id, message.h.method);
|
||||
subscription_data->id, message.h.method);
|
||||
ogs_assert_if_reached();
|
||||
END
|
||||
break;
|
||||
|
@ -240,18 +240,15 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -87,6 +87,7 @@ int nssf_sbi_open(void)
|
|||
/* Build NF instance information. It will be transmitted to NRF. */
|
||||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_NSSF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(
|
||||
|
|
|
@ -42,7 +42,7 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
|
||||
|
@ -323,34 +323,34 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
ogs_error("[%s] Invalid HTTP method [%s]",
|
||||
subscription->id, message.h.method);
|
||||
subscription_data->id, message.h.method);
|
||||
ogs_assert_if_reached();
|
||||
END
|
||||
break;
|
||||
|
@ -570,18 +570,15 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("[%s] Subscription validity expired",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -82,11 +82,6 @@ int pcf_sbi_open(void)
|
|||
bool smpolicycontrol_enabled = false;
|
||||
bool policyauthorization_enabled = false;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_BSF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDR);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -96,8 +91,7 @@ int pcf_sbi_open(void)
|
|||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_NEF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(
|
||||
|
@ -108,7 +102,6 @@ int pcf_sbi_open(void)
|
|||
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);
|
||||
}
|
||||
|
||||
if (ogs_sbi_nf_service_is_available(
|
||||
|
@ -119,7 +112,6 @@ int pcf_sbi_open(void)
|
|||
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);
|
||||
|
||||
smpolicycontrol_enabled = true;
|
||||
}
|
||||
|
@ -131,8 +123,6 @@ int pcf_sbi_open(void)
|
|||
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);
|
||||
|
||||
policyauthorization_enabled = true;
|
||||
}
|
||||
|
@ -171,6 +161,12 @@ int pcf_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_BSF, OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_UDR, OGS_SBI_SERVICE_NAME_NUDR_DR);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -29,17 +29,6 @@ int scp_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_AUSF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_BSF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_NSSF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDM);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDR);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -63,6 +52,16 @@ int scp_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_AMF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_AUSF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_BSF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_NSSF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_PCF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_SMF, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_UDM, NULL);
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_UDR, NULL);
|
||||
|
||||
if (ogs_sbi_server_start_all(request_handler) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -229,15 +229,15 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -246,7 +246,7 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -323,18 +323,15 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("Subscription validity expired [%s]", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -81,13 +81,6 @@ int smf_sbi_open(void)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_nf_service_t *service = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDM);
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UPF);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -96,6 +89,7 @@ int smf_sbi_open(void)
|
|||
/* Build NF instance information. It will be transmitted to NRF. */
|
||||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION)) {
|
||||
|
@ -122,6 +116,14 @@ int smf_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_AMF, OGS_SBI_SERVICE_NAME_NAMF_COMM);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_PCF, OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL);
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_UDM, OGS_SBI_SERVICE_NAME_NUDM_SDM);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_sbi_request_t *sbi_request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *sbi_response = NULL;
|
||||
ogs_sbi_message_t sbi_message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -667,15 +667,15 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(sbi_message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &sbi_message);
|
||||
subscription_data, &sbi_message);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
sbi_message.res_status);
|
||||
|
@ -685,7 +685,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (sbi_message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
sbi_message.res_status);
|
||||
|
@ -801,18 +801,15 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("Subscription validity expired [%s]", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -79,10 +79,6 @@ int udm_sbi_open(void)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_nf_service_t *service = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_UDR);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -93,6 +89,7 @@ int udm_sbi_open(void)
|
|||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SMF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AUSF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDM_UEAU)) {
|
||||
|
@ -138,6 +135,9 @@ int udm_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(OpenAPI_nf_type_UDR, NULL);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -240,34 +240,34 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
ogs_error("[%s] Invalid HTTP method [%s]",
|
||||
subscription->id, message.h.method);
|
||||
subscription_data->id, message.h.method);
|
||||
ogs_assert_if_reached();
|
||||
END
|
||||
break;
|
||||
|
@ -381,18 +381,15 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("[%s] Subscription validity expired",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -88,6 +88,7 @@ int udr_sbi_open(void)
|
|||
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_UDR);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_PCF);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_UDM);
|
||||
ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP);
|
||||
|
||||
/* Build NF service information. It will be transmitted to NRF. */
|
||||
if (ogs_sbi_nf_service_is_available(OGS_SBI_SERVICE_NAME_NUDR_DR)) {
|
||||
|
|
|
@ -44,7 +44,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
|
||||
|
@ -221,34 +221,34 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status ==
|
||||
OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
subscription->id, message.res_status);
|
||||
subscription_data->id, message.res_status);
|
||||
}
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
ogs_error("[%s] Invalid HTTP method [%s]",
|
||||
subscription->id, message.h.method);
|
||||
subscription_data->id, message.h.method);
|
||||
ogs_assert_if_reached();
|
||||
END
|
||||
break;
|
||||
|
@ -288,18 +288,15 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("[%s] Subscription validity expired", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("[%s] Subscription validity expired",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -48,7 +48,7 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_subscription_t *subscription = NULL;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
|
@ -223,15 +223,15 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
SWITCH(message.h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
|
||||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_nnrf_handle_nf_status_subscribe(
|
||||
subscription, &message);
|
||||
subscription_data, &message);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -240,7 +240,7 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
|
|||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (message.res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
} else {
|
||||
ogs_error("HTTP response error : %d",
|
||||
message.res_status);
|
||||
|
@ -411,18 +411,15 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
subscription = e->h.sbi.data;
|
||||
ogs_assert(subscription);
|
||||
subscription_data = e->h.sbi.data;
|
||||
ogs_assert(subscription_data);
|
||||
|
||||
ogs_assert(ogs_sbi_self()->nf_instance);
|
||||
ogs_assert(true ==
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription->client,
|
||||
ogs_sbi_self()->nf_instance->nf_type,
|
||||
subscription->req_nf_instance_id,
|
||||
subscription->subscr_cond.nf_type));
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
|
||||
|
||||
ogs_info("Subscription validity expired [%s]", subscription->id);
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
ogs_info("Subscription validity expired [%s]",
|
||||
subscription_data->id);
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
break;
|
||||
|
||||
case OGS_TIMER_SBI_CLIENT_WAIT:
|
||||
|
|
|
@ -78,10 +78,6 @@ int af_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
/* To be notified when NF Instances registered/deregistered in NRF
|
||||
* or when their profile is modified */
|
||||
ogs_sbi_add_to_be_notified_nf_type(OpenAPI_nf_type_BSF);
|
||||
|
||||
/* Add SELF NF instance */
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -105,6 +101,10 @@ int af_sbi_open(void)
|
|||
ogs_sbi_nf_fsm_init(nf_instance);
|
||||
}
|
||||
|
||||
/* Build Subscription-Data */
|
||||
ogs_sbi_subscription_data_build_default(
|
||||
OpenAPI_nf_type_BSF, OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT);
|
||||
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"name": "open5gs",
|
||||
"version": "2.4.3",
|
||||
"version": "2.4.7",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"axios": "^0.16.2",
|
||||
|
|
Loading…
Reference in New Issue