[SBI] Add function to request NF Instance from NRF by providing it's Instance Id
This commit is contained in:
parent
83b28b5649
commit
9a958d7af8
|
@ -1341,6 +1341,26 @@ void ogs_sbi_select_nf(
|
|||
}
|
||||
}
|
||||
|
||||
void ogs_sbi_select_nf_by_instanceid(
|
||||
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state,
|
||||
char *nf_instance_id)
|
||||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_assert(sbi_object);
|
||||
ogs_assert(nf_type);
|
||||
ogs_assert(state);
|
||||
|
||||
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, state) &&
|
||||
(nf_instance->nf_type == nf_type) &&
|
||||
(!(strcmp(nf_instance->id, nf_instance_id)))) {
|
||||
OGS_SBI_SETUP_NF(sbi_object, nf_type, nf_instance);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
|
|
@ -339,6 +339,9 @@ OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void);
|
|||
|
||||
void ogs_sbi_select_nf(
|
||||
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state);
|
||||
void ogs_sbi_select_nf_by_instanceid(
|
||||
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state,
|
||||
char *nf_instance_id);
|
||||
|
||||
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
|
||||
|
||||
|
|
|
@ -480,6 +480,26 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
|||
return request;
|
||||
}
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id)
|
||||
{
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_assert(nf_instance_id);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET;
|
||||
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||
message.h.api.version = (char *)OGS_SBI_API_V1;
|
||||
message.h.resource.component[0] =
|
||||
(char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES;
|
||||
message.h.resource.component[1] = nf_instance_id;
|
||||
|
||||
request = ogs_sbi_build_request(&message);
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
|
||||
OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
|||
ogs_sbi_subscription_t *subscription);
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
||||
ogs_sbi_subscription_t *subscription);
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id);
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
|
||||
OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type);
|
||||
|
|
|
@ -141,6 +141,51 @@ bool ogs_nnrf_nfm_send_nf_register(
|
|||
return ogs_sbi_scp_send_request(client, client->cb, request, nf_instance);
|
||||
}
|
||||
|
||||
bool ogs_sbi_discover_by_nf_instanceid_and_send(ogs_sbi_xact_t *xact,
|
||||
ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb,
|
||||
char *nf_instance_id)
|
||||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_assert(xact);
|
||||
ogs_assert(xact->sbi_object);
|
||||
ogs_assert(xact->target_nf_type);
|
||||
ogs_assert(nf_state_registered);
|
||||
ogs_assert(client_cb);
|
||||
ogs_assert(nf_instance_id);
|
||||
|
||||
/* Target NF-Instance - search by NF Instance Id */
|
||||
ogs_assert(xact->target_nf_type != OpenAPI_nf_type_NRF);
|
||||
ogs_sbi_select_nf_by_instanceid(
|
||||
xact->sbi_object, xact->target_nf_type, nf_state_registered,
|
||||
nf_instance_id);
|
||||
|
||||
nf_instance = OGS_SBI_NF_INSTANCE(
|
||||
xact->sbi_object, xact->target_nf_type);
|
||||
|
||||
if (nf_instance) {
|
||||
return ogs_sbi_send(nf_instance, client_cb, xact);
|
||||
}
|
||||
|
||||
/* NRF NF-Instance */
|
||||
nf_instance = OGS_SBI_NF_INSTANCE(xact->sbi_object, OpenAPI_nf_type_NRF);
|
||||
if (!nf_instance) {
|
||||
ogs_sbi_select_nf(
|
||||
xact->sbi_object, OpenAPI_nf_type_NRF, nf_state_registered);
|
||||
nf_instance = OGS_SBI_NF_INSTANCE(
|
||||
xact->sbi_object, OpenAPI_nf_type_NRF);
|
||||
}
|
||||
|
||||
if (nf_instance) {
|
||||
ogs_warn("Try to retrieve [%s]", nf_instance_id);
|
||||
return ogs_nnrf_nfm_send_nf_profile_retrieve(nf_instance,
|
||||
nf_instance_id, xact);
|
||||
}
|
||||
|
||||
ogs_error("Cannot retrieve [%s]", nf_instance_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
@ -171,6 +216,24 @@ bool ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance)
|
|||
return ogs_sbi_scp_send_request(client, client->cb, request, nf_instance);
|
||||
}
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_profile_retrieve(ogs_sbi_nf_instance_t *nf_instance,
|
||||
char *nf_instance_id, void *data)
|
||||
{
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
ogs_assert(nf_instance);
|
||||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
ogs_assert(nf_instance_id);
|
||||
|
||||
request = ogs_nnrf_nfm_build_profile_retrieve(nf_instance_id);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
|
||||
return ogs_sbi_client_send_request(
|
||||
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)
|
||||
|
|
|
@ -30,11 +30,16 @@ bool ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance,
|
|||
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact);
|
||||
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact,
|
||||
ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb);
|
||||
bool ogs_sbi_discover_by_nf_instanceid_and_send(ogs_sbi_xact_t *xact,
|
||||
ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb,
|
||||
char *nf_instance_id);
|
||||
|
||||
bool ogs_nnrf_nfm_send_nf_register(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_request_t *(*build)(void));
|
||||
bool ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance);
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue