Added Service-based NF discovery

== Known limitation ==
Placing npcf-smpolicycontrol and pcf-policyauthorization
in different NFs is not supported. Both npcf-smpolicycontrol
and pcf-policyauthorization should be placed in the same NF.
This commit is contained in:
Sukchan Lee 2022-09-02 23:04:57 +09:00
parent b175394839
commit 5295c108ad
45 changed files with 474 additions and 406 deletions

View File

@ -98,6 +98,11 @@ logger:
# - npcf-smpolicycontrol
# - npcf-policyauthorization
#
# == NOTE ==
# Placing npcf-smpolicycontrol and pcf-policyauthorization
# in different NFs is not supported. Both npcf-smpolicycontrol
# and pcf-policyauthorization should be placed in the same NF.
#
# <NF Discovery Query Parameter>
#
# o (Default) If you do not set Query Parameter as shown below,

View File

@ -908,6 +908,52 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id)
return nf_instance;
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_e target_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(target_nf_type);
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (ogs_sbi_discovery_param_is_matched(
nf_instance, target_nf_type, discovery_option) == false)
continue;
return nf_instance;
}
return NULL;
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
ogs_sbi_service_type_e service_type)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
char *service_name = NULL;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
service_name = (char *)ogs_sbi_service_type_to_name(service_type);
ogs_assert(service_name);
discovery_option = ogs_sbi_discovery_option_new();
ogs_assert(discovery_option);
ogs_sbi_discovery_option_add_service_names(discovery_option, service_name);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
ogs_sbi_discovery_option_free(discovery_option);
return nf_instance;
}
bool ogs_sbi_nf_instance_maximum_number_is_reached()
{
return nf_instance_pool.avail <= 0;
@ -1082,10 +1128,10 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_name(
ogs_list_for_each(&nf_instance->nf_service_list, nf_service) {
ogs_assert(nf_service->name);
if (strcmp(nf_service->name, name) == 0)
break;
return nf_service;
}
return nf_service;
return NULL;
}
ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
@ -1460,29 +1506,6 @@ bool ogs_sbi_discovery_param_is_matched(
return true;
}
void ogs_sbi_select_nf(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
ogs_assert(sbi_object);
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (ogs_sbi_discovery_param_is_matched(
nf_instance, target_nf_type, discovery_option) == false)
continue;
OGS_SBI_SETUP_NF_INSTANCE(sbi_object, service_type, nf_instance);
break;
}
}
void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_client_t *client = NULL;
@ -1537,8 +1560,16 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
for (i = 0; i < OGS_SBI_MAX_NUM_OF_SERVICE_TYPE; i++) {
if (OGS_SBI_NF_INSTANCE(sbi_object, i))
ogs_sbi_nf_instance_remove(OGS_SBI_NF_INSTANCE(sbi_object, i));
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->service_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
for (i = 0; i < OGS_SBI_MAX_NUM_OF_NF_TYPE; i++) {
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->nf_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
}
@ -1639,8 +1670,8 @@ void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact)
ogs_assert(xact->t_response);
ogs_timer_delete(xact->t_response);
ogs_assert(xact->request);
ogs_sbi_request_free(xact->request);
if (xact->request)
ogs_sbi_request_free(xact->request);
ogs_list_remove(&sbi_object->xact_list, xact);
ogs_pool_free(&xact_pool, xact);

View File

@ -128,10 +128,6 @@ typedef struct ogs_sbi_nf_instance_s {
unsigned int reference_count; /* reference count for memory free */
} ogs_sbi_nf_instance_t;
typedef struct ogs_sbi_nf_instance_array_s {
ogs_sbi_nf_instance_t *nf_instance;
} ogs_sbi_nf_instance_array_t[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
typedef enum {
OGS_SBI_OBJ_BASE = 0,
@ -146,7 +142,10 @@ typedef struct ogs_sbi_object_s {
ogs_sbi_obj_type_e type;
ogs_sbi_nf_instance_array_t nf_instance_array;
struct {
ogs_sbi_nf_instance_t *nf_instance;
} nf_type_array[OGS_SBI_MAX_NUM_OF_NF_TYPE],
service_type_array[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
ogs_list_t xact_list;
@ -291,6 +290,11 @@ 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);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_e nf_type,
ogs_sbi_discovery_option_t *discovery_option);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
ogs_sbi_service_type_e service_type);
bool ogs_sbi_nf_instance_maximum_number_is_reached(void);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(
@ -328,25 +332,17 @@ void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void);
#define OGS_SBI_NF_INSTANCE(__sBIObject, __sERVICEType) \
(((__sBIObject)->nf_instance_array)[__sERVICEType].nf_instance)
#define OGS_SBI_SETUP_NF_INSTANCE(__sBIObject, __sERVICEType, __nFInstance) \
#define OGS_SBI_SETUP_NF_INSTANCE(__cTX, __nFInstance) \
do { \
ogs_assert((__sBIObject)); \
ogs_assert((__sERVICEType)); \
ogs_assert((__nFInstance)); \
ogs_assert(__nFInstance); \
\
if (OGS_SBI_NF_INSTANCE((__sBIObject), (__sERVICEType))) { \
ogs_warn("UE %s-EndPoint updated [%s]", \
ogs_sbi_service_type_to_name((__sERVICEType)), \
(__nFInstance)->id); \
ogs_sbi_nf_instance_remove( \
OGS_SBI_NF_INSTANCE((__sBIObject), (__sERVICEType))); \
if ((__cTX).nf_instance) { \
ogs_warn("NF Instance updated [%s]", (__nFInstance)->id); \
ogs_sbi_nf_instance_remove((__cTX).nf_instance); \
} \
\
OGS_OBJECT_REF(__nFInstance); \
OGS_SBI_NF_INSTANCE((__sBIObject), (__sERVICEType)) = (__nFInstance); \
((__cTX).nf_instance) = (__nFInstance); \
} while(0)
bool ogs_sbi_discovery_param_is_matched(
@ -358,11 +354,6 @@ bool ogs_sbi_discovery_option_is_matched(
ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_discovery_option_t *discovery_option);
void ogs_sbi_select_nf(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option);
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
ogs_sbi_xact_t *ogs_sbi_xact_add(

View File

@ -25,13 +25,6 @@ void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance)
ogs_assert(nf_instance);
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
} else if (NF_INSTANCE_ID_IS_OTHERS(nf_instance->id)) {
} else {
ogs_fatal("FSM is available in NRF or OTHERS");
ogs_assert_if_reached();
}
memset(&e, 0, sizeof(e));
e.sbi.data = nf_instance;

View File

@ -93,9 +93,9 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
NFProfile = ogs_calloc(1, sizeof(*NFProfile));
ogs_expect_or_return_val(NFProfile, NULL);
NFProfile->nf_instance_id = nf_instance->id;
NFProfile->nf_type = nf_instance->nf_type;
NFProfile->nf_status = nf_instance->nf_status;
NFProfile->nf_instance_id = nf_instance->id;
NFProfile->nf_type = nf_instance->nf_type;
NFProfile->nf_status = nf_instance->nf_status;
ogs_trace("[%s] ogs_nnrf_nfm_build_nf_profile()", nf_instance->id);
@ -806,7 +806,7 @@ 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_type = subscription->req_nf_type;
SubscriptionData->req_nf_instance_id = subscription->req_nf_instance_id;
OGS_SBI_FEATURES_SET(subscription->requester_features,
@ -874,17 +874,14 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id)
}
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e target_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(ogs_sbi_self()->nf_instance);

View File

@ -41,7 +41,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id);
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e target_nf_type,
ogs_sbi_discovery_option_t *discovery_option);
#ifdef __cplusplus

View File

@ -76,6 +76,60 @@ bool ogs_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance,
return true;
}
bool ogs_sbi_discover_only(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(client_cb);
discovery_option = xact->discovery_option;
/* NRF NF-Instance */
nf_instance = sbi_object->nf_type_array[OpenAPI_nf_type_NRF].nf_instance;
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_NRF, NULL);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
}
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
ogs_sbi_request_t *request = NULL;
ogs_warn("Try to discover [%s]",
ogs_sbi_service_type_to_name(service_type));
request = ogs_nnrf_disc_build_discover(
target_nf_type, discovery_option);
ogs_expect_or_return_val(request, false);
client = nf_instance->client;
ogs_assert(client);
return ogs_sbi_client_send_request(client, client_cb, request, xact);
}
ogs_error("Cannot discover [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
bool ogs_sbi_discover_and_send(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb)
{
@ -85,45 +139,33 @@ bool ogs_sbi_discover_and_send(
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(client_cb);
discovery_option = xact->discovery_option;
/* Target NF-Instance */
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
if (!nf_instance) {
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
}
if (nf_instance) {
return ogs_sbi_send_request(nf_instance, client_cb, xact);
}
/* NRF NF-Instance */
nf_instance = OGS_SBI_NF_INSTANCE(
sbi_object, OGS_SBI_SERVICE_TYPE_NNRF_DISC);
if (!nf_instance) {
ogs_sbi_select_nf(sbi_object, OGS_SBI_SERVICE_TYPE_NNRF_DISC, NULL);
nf_instance = OGS_SBI_NF_INSTANCE(
sbi_object, OGS_SBI_SERVICE_TYPE_NNRF_DISC);
}
if (nf_instance) {
ogs_warn("Try to discover [%s]",
ogs_sbi_service_type_to_name(service_type));
return ogs_nnrf_disc_send_nf_discover(
nf_instance, service_type, discovery_option, xact);
}
ogs_error("Cannot discover [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
return ogs_sbi_discover_only(xact, client_cb);
}
bool ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance)
@ -236,7 +278,7 @@ bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
bool ogs_nnrf_disc_send_nf_discover(
ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e target_nf_type,
ogs_sbi_discovery_option_t *discovery_option,
void *data)
{
@ -244,8 +286,9 @@ bool ogs_nnrf_disc_send_nf_discover(
ogs_sbi_request_t *request = NULL;
ogs_assert(nf_instance);
ogs_assert(target_nf_type);
request = ogs_nnrf_disc_build_discover(service_type, discovery_option);
request = ogs_nnrf_disc_build_discover(target_nf_type, discovery_option);
ogs_expect_or_return_val(request, false);
client = nf_instance->client;

View File

@ -28,6 +28,8 @@ extern "C" {
bool ogs_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact);
bool ogs_sbi_discover_only(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb);
bool ogs_sbi_discover_and_send(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb);
@ -45,10 +47,11 @@ bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
bool ogs_nnrf_disc_send_nf_discover(
ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e target_nf_type,
ogs_sbi_discovery_option_t *discovery_option,
void *data);
#define ogs_sbi_send_http_status_no_content(__sTREAM) \
ogs_sbi_send_response(__sTREAM, OGS_SBI_HTTP_STATUS_NO_CONTENT)
bool ogs_sbi_send_response(ogs_sbi_stream_t *stream, int status);

View File

@ -1799,7 +1799,11 @@ void amf_sbi_select_nf(
switch(sbi_object->type) {
case OGS_SBI_OBJ_UE_TYPE:
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
break;
case OGS_SBI_OBJ_SESS_TYPE:
sess = (amf_sess_t *)sbi_object;
@ -1818,7 +1822,8 @@ void amf_sbi_select_nf(
continue;
}
OGS_SBI_SETUP_NF_INSTANCE(sbi_object, service_type, nf_instance);
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
break;
}
break;

View File

@ -1064,30 +1064,20 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
if (!SESSION_CONTEXT_IN_SMF(sess)) {
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
ogs_sbi_service_type_e service_type =
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION;
discovery_option = ogs_sbi_discovery_option_new();
ogs_assert(discovery_option);
ogs_sbi_discovery_option_add_service_names(
discovery_option,
(char *)OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION);
nf_instance = OGS_SBI_NF_INSTANCE(
&sess->sbi,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION);
nf_instance = sess->sbi.
service_type_array[service_type].nf_instance;
if (!nf_instance) {
amf_sbi_select_nf(
&sess->sbi,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION,
discovery_option);
nf_instance = OGS_SBI_NF_INSTANCE(
&sess->sbi,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION);
nf_instance =
ogs_sbi_nf_instance_find_by_service_type(service_type);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sess->sbi.service_type_array[service_type],
nf_instance);
}
if (discovery_option)
ogs_sbi_discovery_option_free(discovery_option);
if (nf_instance) {
ogs_assert(true ==
amf_sess_sbi_discover_and_send(

View File

@ -25,6 +25,7 @@
void amf_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
@ -50,5 +51,48 @@ void amf_nnrf_handle_nf_discover(
amf_sbi_select_nf(sbi_object, service_type, discovery_option);
ogs_expect(true == amf_sbi_send_request(sbi_object, service_type, xact));
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
if (!nf_instance) {
amf_ue_t *amf_ue = NULL;
amf_sess_t *sess = NULL;
ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE &&
sbi_object->type < OGS_SBI_OBJ_TOP);
switch(sbi_object->type) {
case OGS_SBI_OBJ_UE_TYPE:
amf_ue = (amf_ue_t *)sbi_object;
ogs_assert(amf_ue);
ogs_error("[%s] (NF discover) No [%s]", amf_ue->suci,
ogs_sbi_service_type_to_name(service_type));
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
break;
case OGS_SBI_OBJ_SESS_TYPE:
sess = (amf_sess_t *)sbi_object;
ogs_assert(sess);
ogs_error("[%d:%d] (NF discover) No [%s]", sess->psi, sess->pti,
ogs_sbi_service_type_to_name(service_type));
if (sess->payload_container_type) {
ogs_assert(OGS_OK ==
nas_5gs_send_back_gsm_message(sess,
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
AMF_NAS_BACKOFF_TIME));
} else {
ogs_assert(OGS_OK ==
ngap_send_error_indication2(amf_ue,
NGAP_Cause_PR_transport,
NGAP_CauseTransport_transport_resource_unavailable));
}
break;
default:
ogs_fatal("(NF discover) Not implemented [%s:%d]",
ogs_sbi_service_type_to_name(service_type), sbi_object->type);
ogs_assert_if_reached();
}
return;
}
ogs_expect(true == amf_sbi_send_request(nf_instance, xact));
}

View File

@ -120,9 +120,8 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
SmContextCreateData.ue_time_zone = ogs_sbi_timezone_string(ogs_timezone());
ogs_expect_or_return_val(SmContextCreateData.ue_time_zone, NULL);
pcf_nf_instance = OGS_SBI_NF_INSTANCE(
&amf_ue->sbi,
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL);
pcf_nf_instance = amf_ue->sbi.service_type_array[
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL].nf_instance;
ogs_expect_or_return_val(pcf_nf_instance, NULL);
SmContextCreateData.pcf_id = pcf_nf_instance->id;

View File

@ -93,6 +93,7 @@ int amf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AMF);
@ -108,17 +109,6 @@ int amf_sbi_open(void)
ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_SMF);
}
/* Initialize SCP NF Instance */
nf_instance = ogs_sbi_self()->scp_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to SCP */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
}
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
@ -146,60 +136,11 @@ void amf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool amf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool amf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
ogs_assert(sbi_object);
ogs_assert(nf_instance);
ogs_assert(data);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
amf_ue_t *amf_ue = NULL;
amf_sess_t *sess = NULL;
ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE &&
sbi_object->type < OGS_SBI_OBJ_TOP);
switch(sbi_object->type) {
case OGS_SBI_OBJ_UE_TYPE:
amf_ue = (amf_ue_t *)sbi_object;
ogs_assert(amf_ue);
ogs_error("[%s] (NF discover) No [%s]", amf_ue->suci,
ogs_sbi_service_type_to_name(service_type));
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
break;
case OGS_SBI_OBJ_SESS_TYPE:
sess = (amf_sess_t *)sbi_object;
ogs_assert(sess);
ogs_error("[%d:%d] (NF discover) No [%s]", sess->psi, sess->pti,
ogs_sbi_service_type_to_name(service_type));
if (sess->payload_container_type) {
ogs_assert(OGS_OK ==
nas_5gs_send_back_gsm_message(sess,
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
AMF_NAS_BACKOFF_TIME));
} else {
ogs_assert(OGS_OK ==
ngap_send_error_indication2(amf_ue,
NGAP_Cause_PR_transport,
NGAP_CauseTransport_transport_resource_unavailable));
}
break;
default:
ogs_fatal("(NF discover) Not implemented [%s:%d]",
ogs_sbi_service_type_to_name(service_type), sbi_object->type);
ogs_assert_if_reached();
}
return false;
}
return ogs_sbi_send_request(nf_instance, client_cb, data);
}
@ -349,7 +290,7 @@ static int client_discover_cb(
amf_sbi_select_nf(&sess->sbi, service_type, discovery_option);
if (!OGS_SBI_NF_INSTANCE(&sess->sbi, service_type)) {
if (!sess->sbi.service_type_array[service_type].nf_instance) {
ogs_error("[%s:%d] (NF discover) No [%s]",
amf_ue->supi, sess->psi,
ogs_sbi_service_type_to_name(service_type));

View File

@ -34,10 +34,7 @@ extern "C" {
int amf_sbi_open(void);
void amf_sbi_close(void);
bool amf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool amf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool amf_ue_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -23,10 +23,12 @@
void ausf_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void ausf_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void ausf_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == ausf_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == ausf_sbi_send_request(nf_instance, xact));
}

View File

@ -86,6 +86,7 @@ int ausf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AUSF);
@ -128,21 +129,9 @@ void ausf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool ausf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool ausf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -29,10 +29,7 @@ extern "C" {
int ausf_sbi_open(void);
void ausf_sbi_close(void);
bool ausf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool ausf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool ausf_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -23,10 +23,12 @@
void bsf_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void bsf_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void bsf_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == bsf_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == bsf_sbi_send_request(nf_instance, xact));
}

View File

@ -86,6 +86,7 @@ int bsf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_BSF);
@ -128,21 +129,9 @@ void bsf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool bsf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool bsf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -29,10 +29,7 @@ extern "C" {
int bsf_sbi_open(void);
void bsf_sbi_close(void);
bool bsf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool bsf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool bsf_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -799,7 +799,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg)
ogs_assert(ret == 0);
mme_ue->network_access_mode = hdr->avp_value->i32;
} else {
mme_ue->network_access_mode = 0;
mme_ue->network_access_mode = 0;
ogs_warn("no subscribed Network-Access-Mode, defaulting to PACKET_AND_CIRCUIT (0)");
}
@ -1785,48 +1785,48 @@ int mme_fd_init(void)
mme_self()->diam_conf_path, mme_self()->diam_config);
ogs_assert(ret == 0);
/* Install objects definitions for this application */
ret = ogs_diam_s6a_init();
/* Install objects definitions for this application */
ret = ogs_diam_s6a_init();
ogs_assert(ret == OGS_OK);
/* Create handler for sessions */
ret = fd_sess_handler_create(&mme_s6a_reg, &state_cleanup, NULL, NULL);
ret = fd_sess_handler_create(&mme_s6a_reg, &state_cleanup, NULL, NULL);
ogs_assert(ret == 0);
/* Specific handler for Cancel-Location-Request */
data.command = ogs_diam_s6a_cmd_clr;
ret = fd_disp_register(mme_ogs_diam_s6a_clr_cb, DISP_HOW_CC, &data, NULL,
/* Specific handler for Cancel-Location-Request */
data.command = ogs_diam_s6a_cmd_clr;
ret = fd_disp_register(mme_ogs_diam_s6a_clr_cb, DISP_HOW_CC, &data, NULL,
&hdl_s6a_clr);
ogs_assert(ret == 0);
/* Specific handler for Insert-Subscriber-Data-Request */
data.command = ogs_diam_s6a_cmd_idr;
ret = fd_disp_register(mme_ogs_diam_s6a_idr_cb, DISP_HOW_CC, &data, NULL,
/* Specific handler for Insert-Subscriber-Data-Request */
data.command = ogs_diam_s6a_cmd_idr;
ret = fd_disp_register(mme_ogs_diam_s6a_idr_cb, DISP_HOW_CC, &data, NULL,
&hdl_s6a_idr);
ogs_assert(ret == 0);
/* Advertise the support for the application in the peer */
ret = fd_disp_app_support(ogs_diam_s6a_application, ogs_diam_vendor, 1, 0);
/* Advertise the support for the application in the peer */
ret = fd_disp_app_support(ogs_diam_s6a_application, ogs_diam_vendor, 1, 0);
ogs_assert(ret == 0);
ret = ogs_diam_start();
ogs_assert(ret == 0);
return 0;
return 0;
}
void mme_fd_final(void)
{
int ret;
ret = fd_sess_handler_destroy(&mme_s6a_reg, NULL);
ret = fd_sess_handler_destroy(&mme_s6a_reg, NULL);
ogs_assert(ret == OGS_OK);
if (hdl_s6a_clr)
(void) fd_disp_unregister(&hdl_s6a_clr, NULL);
(void) fd_disp_unregister(&hdl_s6a_clr, NULL);
if (hdl_s6a_idr)
(void) fd_disp_unregister(&hdl_s6a_idr, NULL);
(void) fd_disp_unregister(&hdl_s6a_idr, NULL);
ogs_diam_final();
}

View File

@ -80,19 +80,6 @@ static int client_notify_cb(
int nrf_sbi_open(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
/* Initialize SCP NF Instance */
nf_instance = ogs_sbi_self()->scp_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to SCP */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_notify_cb;
}
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
return OGS_ERROR;

View File

@ -82,6 +82,7 @@ int nssf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_NSSF);

View File

@ -41,6 +41,9 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
pcf_ue = sess->pcf_ue;
ogs_assert(pcf_ue);
nf_instance = data;
ogs_assert(nf_instance);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT;
@ -59,9 +62,8 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
ogs_expect_or_return_val(sess->dnn, NULL);
PcfBinding.dnn = sess->dnn;
nf_instance = ogs_sbi_self()->nf_instance;
ogs_expect_or_return_val(nf_instance, NULL);
nf_service = ogs_list_first(&nf_instance->nf_service_list);
nf_service = ogs_sbi_nf_service_find_by_name(
nf_instance, (char *)OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION);
ogs_expect_or_return_val(nf_service, NULL);
if (nf_service->fqdn)

View File

@ -23,10 +23,16 @@
void pcf_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
ogs_sbi_stream_t *stream = NULL;
pcf_ue_t *pcf_ue = NULL;
pcf_sess_t *sess = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,8 +41,11 @@ void pcf_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
stream = xact->assoc_stream;
SearchResult = recvmsg->SearchResult;
if (!SearchResult) {
@ -44,9 +53,50 @@ void pcf_nnrf_handle_nf_discover(
return;
}
if (sbi_object->type == OGS_SBI_OBJ_UE_TYPE) {
pcf_ue = (pcf_ue_t *)sbi_object;
ogs_assert(pcf_ue);
} else if (sbi_object->type == OGS_SBI_OBJ_SESS_TYPE) {
sess = (pcf_sess_t *)sbi_object;
ogs_assert(sess);
pcf_ue = sess->pcf_ue;
ogs_assert(pcf_ue);
} else {
ogs_fatal("(NF discover) Not implemented [%s:%d]",
ogs_sbi_service_type_to_name(service_type), sbi_object->type);
ogs_assert_if_reached();
}
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("[%s:%d] (NF discover) No [%s]",
pcf_ue ? pcf_ue->supi : "Unknown",
sess ? sess->psi : 0,
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == pcf_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
switch (service_type) {
case OGS_SBI_SERVICE_TYPE_NPCF_POLICYAUTHORIZATION:
ogs_sbi_xact_remove(xact);
ogs_assert(sess);
ogs_assert(stream);
ogs_assert(true ==
pcf_sess_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
pcf_nbsf_management_build_register,
sess, stream, nf_instance));
break;
default:
ogs_assert(xact->request);
ogs_expect(true == pcf_sbi_send_request(nf_instance, xact));
break;
}
}

View File

@ -186,6 +186,9 @@ bool pcf_nudr_dr_handle_query_sm_data(
SWITCH(recvmsg->h.resource.component[3])
CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
if (!recvmsg->SmPolicyData) {
strerror = ogs_msprintf("[%s:%d] No SmPolicyData",
pcf_ue->supi, sess->psi);
@ -193,10 +196,28 @@ bool pcf_nudr_dr_handle_query_sm_data(
goto cleanup;
}
ogs_assert(true ==
pcf_sess_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
pcf_nbsf_management_build_register, sess, stream, NULL));
service_type = OGS_SBI_SERVICE_TYPE_NPCF_POLICYAUTHORIZATION;
nf_instance = sess->sbi.service_type_array[service_type].nf_instance;
if (!nf_instance) {
nf_instance =
ogs_sbi_nf_instance_find_by_service_type(service_type);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sess->sbi.service_type_array[service_type],
nf_instance);
}
if (nf_instance) {
ogs_assert(true ==
pcf_sess_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
pcf_nbsf_management_build_register,
sess, stream, nf_instance));
} else {
ogs_expect(true ==
pcf_sess_sbi_discover_only(sess, stream, service_type));
}
return true;

View File

@ -87,6 +87,7 @@ int pcf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_PCF);
@ -156,43 +157,9 @@ void pcf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool pcf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool pcf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
pcf_ue_t *pcf_ue = NULL;
pcf_sess_t *sess = NULL;
ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE &&
sbi_object->type < OGS_SBI_OBJ_TOP);
switch(sbi_object->type) {
case OGS_SBI_OBJ_UE_TYPE:
pcf_ue = (pcf_ue_t *)sbi_object;
ogs_assert(pcf_ue);
ogs_error("[%s] (NF discover) No [%s]", pcf_ue->supi,
ogs_sbi_service_type_to_name(service_type));
break;
case OGS_SBI_OBJ_SESS_TYPE:
sess = (pcf_sess_t *)sbi_object;
ogs_assert(sess);
ogs_error("[%d] (NF discover) No [%s]", sess->psi,
ogs_sbi_service_type_to_name(service_type));
break;
default:
ogs_fatal("(NF discover) Not implemented [%s:%d]",
ogs_sbi_service_type_to_name(service_type), sbi_object->type);
ogs_assert_if_reached();
}
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}
@ -247,6 +214,23 @@ bool pcf_ue_sbi_discover_and_send(
return true;
}
bool pcf_sess_sbi_discover_only(
pcf_sess_t *sess, ogs_sbi_stream_t *stream,
ogs_sbi_service_type_e service_type)
{
ogs_sbi_xact_t *xact = NULL;
ogs_assert(sess);
ogs_assert(service_type);
xact = ogs_sbi_xact_add(&sess->sbi, service_type, NULL, NULL, NULL, NULL);
ogs_expect_or_return_val(xact, false);
xact->assoc_stream = stream;
return ogs_sbi_discover_only(xact, client_cb);
}
bool pcf_sess_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -33,10 +33,7 @@ extern "C" {
int pcf_sbi_open(void);
void pcf_sbi_close(void);
bool pcf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool pcf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool pcf_ue_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,
@ -47,6 +44,9 @@ bool pcf_sess_sbi_discover_and_send(
ogs_sbi_discovery_option_t *discovery_option,
ogs_sbi_request_t *(*build)(pcf_sess_t *sess, void *data),
pcf_sess_t *sess, ogs_sbi_stream_t *stream, void *data);
bool pcf_sess_sbi_discover_only(
pcf_sess_t *sess, ogs_sbi_stream_t *stream,
ogs_sbi_service_type_e service_type);
bool pcf_sbi_send_am_policy_control_notify(pcf_ue_t *pcf_ue);
bool pcf_sbi_send_smpolicycontrol_update_notify(

View File

@ -23,10 +23,12 @@
void scp_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void scp_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void scp_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
scp_sbi_send_request(sbi_object, service_type, xact);
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == scp_sbi_send_request(nf_instance, xact));
}

View File

@ -43,21 +43,11 @@ int scp_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_SCP);
/* Initialize SCP NF Instance */
nf_instance = ogs_sbi_self()->scp_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to SCP */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
}
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
@ -364,21 +354,9 @@ static int client_cb(int status, ogs_sbi_response_t *response, void *data)
return OGS_OK;
}
bool scp_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool scp_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -29,10 +29,7 @@ extern "C" {
int scp_sbi_open(void);
void scp_sbi_close(void);
bool scp_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool scp_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool scp_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -23,10 +23,12 @@
void smf_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void smf_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void smf_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == smf_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == smf_sbi_send_request(nf_instance, xact));
}

View File

@ -91,6 +91,7 @@ int smf_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_SMF);
@ -133,21 +134,9 @@ void smf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool smf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool smf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -33,10 +33,7 @@ extern "C" {
int smf_sbi_open(void);
void smf_sbi_close(void);
bool smf_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool smf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool smf_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -23,10 +23,12 @@
void udm_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void udm_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void udm_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == udm_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == udm_sbi_send_request(nf_instance, xact));
}

View File

@ -86,6 +86,7 @@ int udm_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_UDM);
@ -149,21 +150,9 @@ void udm_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool udm_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool udm_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -29,10 +29,7 @@ extern "C" {
int udm_sbi_open(void);
void udm_sbi_close(void);
bool udm_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool udm_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool udm_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -82,6 +82,7 @@ int udr_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_UDR);

View File

@ -450,7 +450,7 @@ void af_state_operational(ogs_fsm_t *s, af_event_t *e)
}
break;
case AF_EVT_SBI_LOCAL:
case AF_EVENT_SBI_LOCAL:
ogs_assert(e);
switch(e->local_id) {

View File

@ -50,8 +50,8 @@ const char *af_event_get_name(af_event_t *e)
case OGS_EVENT_SBI_TIMER:
return OGS_EVENT_NAME_SBI_TIMER;
case AF_EVT_SBI_LOCAL:
return "AF_EVT_SBI_LOCAL";
case AF_EVENT_SBI_LOCAL:
return "AF_EVENT_SBI_LOCAL";
default:
break;

View File

@ -29,11 +29,11 @@ extern "C" {
typedef struct af_sess_s af_sess_t;
typedef enum {
AF_EVT_BASE = OGS_MAX_NUM_OF_PROTO_EVENT,
AF_EVENT_BASE = OGS_MAX_NUM_OF_PROTO_EVENT,
AF_EVT_SBI_LOCAL,
AF_EVENT_SBI_LOCAL,
AF_EVT_TOP,
MAX_NUM_OF_AF_EVENT,
} af_event_e;

View File

@ -39,7 +39,7 @@ void af_local_discover_and_send(
int rv;
af_event_t *e = NULL;
e = af_event_new(AF_EVT_SBI_LOCAL);
e = af_event_new(AF_EVENT_SBI_LOCAL);
ogs_assert(e);
e->local_id = AF_LOCAL_DISCOVER_AND_SEND;
@ -66,7 +66,7 @@ void af_local_send_to_pcf(
int rv;
af_event_t *e = NULL;
e = af_event_new(AF_EVT_SBI_LOCAL);
e = af_event_new(AF_EVENT_SBI_LOCAL);
ogs_assert(e);
e->local_id = AF_LOCAL_SEND_TO_PCF;

View File

@ -23,10 +23,12 @@
void af_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -35,6 +37,8 @@ void af_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
discovery_option = xact->discovery_option;
@ -46,7 +50,16 @@ void af_nnrf_handle_nf_discover(
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_sbi_select_nf(sbi_object, service_type, discovery_option);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return;
}
ogs_expect(true == af_sbi_send_request(sbi_object, service_type, xact));
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
ogs_expect(true == af_sbi_send_request(nf_instance, xact));
}

View File

@ -85,6 +85,7 @@ int af_sbi_open(void)
/* Add SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
/* Build NF instance information. It will be transmitted to NRF. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_AF);
@ -116,21 +117,9 @@ void af_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool af_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data)
bool af_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(service_type);
nf_instance = OGS_SBI_NF_INSTANCE(sbi_object, service_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
}

View File

@ -30,10 +30,7 @@ extern "C" {
int af_sbi_open(void);
void af_sbi_close(void);
bool af_sbi_send_request(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
void *data);
bool af_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
void af_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,