Updated SBI module

- Introduced NF_INSTANCE_ID/NF_INSTANCE_TYPE
- Skip SCP in configuration validation
This commit is contained in:
Sukchan Lee 2022-10-08 11:48:12 +09:00
parent 3955e9ba8d
commit 704fe72d11
7 changed files with 38 additions and 31 deletions

View File

@ -124,6 +124,7 @@ static int ogs_sbi_context_validation(
switch (self.discovery_config.delegated) { switch (self.discovery_config.delegated) {
case OGS_SBI_DISCOVERY_DELEGATED_AUTO: case OGS_SBI_DISCOVERY_DELEGATED_AUTO:
if (strcmp(local, "nrf") != 0 && /* Skip NRF */ if (strcmp(local, "nrf") != 0 && /* Skip NRF */
strcmp(local, "scp") != 0 && /* Skip SCP */
strcmp(local, "smf") != 0 && /* Skip SMF since SMF can run 4G */ strcmp(local, "smf") != 0 && /* Skip SMF since SMF can run 4G */
ogs_sbi_self()->nrf_instance == NULL && ogs_sbi_self()->nrf_instance == NULL &&
ogs_sbi_self()->scp_instance == NULL) { ogs_sbi_self()->scp_instance == NULL) {

View File

@ -84,18 +84,20 @@ typedef struct ogs_sbi_nf_instance_s {
ogs_timer_t *t_no_heartbeat; /* check heartbeat */ ogs_timer_t *t_no_heartbeat; /* check heartbeat */
ogs_timer_t *t_validity; /* check validation */ ogs_timer_t *t_validity; /* check validation */
#define NF_INSTANCE_ID(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->id) : NULL)
#define NF_INSTANCE_ID_IS_SELF(_iD) \ #define NF_INSTANCE_ID_IS_SELF(_iD) \
(_iD) && ogs_sbi_self()->nf_instance && \ (_iD) && ogs_sbi_self()->nf_instance && \
strcmp((_iD), ogs_sbi_self()->nf_instance->id) == 0 strcmp((_iD), ogs_sbi_self()->nf_instance->id) == 0
#define NF_INSTANCE_ID_IS_OTHERS(_iD) \ #define NF_INSTANCE_ID_IS_OTHERS(_iD) \
(_iD) && ogs_sbi_self()->nf_instance && \ (_iD) && ogs_sbi_self()->nf_instance && \
strcmp((_iD), ogs_sbi_self()->nf_instance->id) != 0 strcmp((_iD), ogs_sbi_self()->nf_instance->id) != 0
char *id;
#define NF_INSTANCE_TYPE(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->nf_type) : OpenAPI_nf_type_NULL)
#define NF_INSTANCE_TYPE_IS_NRF(__nFInstance) \ #define NF_INSTANCE_TYPE_IS_NRF(__nFInstance) \
((__nFInstance->nf_type) == OpenAPI_nf_type_NRF) (NF_INSTANCE_TYPE(__nFInstance) == OpenAPI_nf_type_NRF)
char *id; /* NFInstanceId */
OpenAPI_nf_type_e nf_type; OpenAPI_nf_type_e nf_type;
OpenAPI_nf_status_e nf_status; OpenAPI_nf_status_e nf_status;

View File

@ -121,7 +121,6 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
nf_instance = e->sbi.data; nf_instance = e->sbi.data;
ogs_assert(nf_instance); ogs_assert(nf_instance);
ogs_assert(ogs_sbi_self()->nf_instance);
ogs_assert(NF_INSTANCE_TYPE_IS_NRF(nf_instance)); ogs_assert(NF_INSTANCE_TYPE_IS_NRF(nf_instance));
switch (e->id) { switch (e->id) {
@ -152,7 +151,7 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_registered); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_registered);
} else { } else {
ogs_error("[%s] HTTP Response Status Code [%d]", ogs_error("[%s] HTTP Response Status Code [%d]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->res_status); message->res_status);
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception);
} }
@ -160,14 +159,15 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
DEFAULT DEFAULT
ogs_error("[%s] Invalid resource name [%s]", ogs_error("[%s] Invalid resource name [%s]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.resource.component[0]); message->h.resource.component[0]);
END END
break; break;
DEFAULT DEFAULT
ogs_error("[%s] Invalid API name [%s]", ogs_error("[%s] Invalid API name [%s]",
ogs_sbi_self()->nf_instance->id, message->h.service.name); NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.service.name);
END END
break; break;
@ -180,7 +180,7 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
ogs_assert(addr); ogs_assert(addr);
ogs_warn("[%s] Retry to registration with NRF", ogs_warn("[%s] Retry to registration with NRF",
ogs_sbi_self()->nf_instance->id); NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
ogs_timer_start(nf_instance->t_registration_interval, ogs_timer_start(nf_instance->t_registration_interval,
ogs_app()->time.message.sbi.nf_register_interval); ogs_app()->time.message.sbi.nf_register_interval);
@ -190,7 +190,7 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
default: default:
ogs_error("[%s] Unknown timer[%s:%d]", ogs_error("[%s] Unknown timer[%s:%d]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
ogs_timer_get_name(e->timer_id), e->timer_id); ogs_timer_get_name(e->timer_id), e->timer_id);
} }
break; break;
@ -212,7 +212,6 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
nf_instance = e->sbi.data; nf_instance = e->sbi.data;
ogs_assert(nf_instance); ogs_assert(nf_instance);
ogs_assert(ogs_sbi_self()->nf_instance);
switch (e->id) { switch (e->id) {
case OGS_FSM_ENTRY_SIG: case OGS_FSM_ENTRY_SIG:
@ -220,7 +219,7 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
ogs_sbi_subscription_data_t *subscription_data = NULL; ogs_sbi_subscription_data_t *subscription_data = NULL;
ogs_info("[%s] NF registered [Heartbeat:%ds]", ogs_info("[%s] NF registered [Heartbeat:%ds]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
nf_instance->time.heartbeat_interval); nf_instance->time.heartbeat_interval);
if (nf_instance->time.heartbeat_interval) { if (nf_instance->time.heartbeat_interval) {
@ -242,7 +241,8 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
case OGS_FSM_EXIT_SIG: case OGS_FSM_EXIT_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) { if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_info("[%s] NF de-registered", ogs_sbi_self()->nf_instance->id); ogs_info("[%s] NF de-registered",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
if (nf_instance->time.heartbeat_interval) { if (nf_instance->time.heartbeat_interval) {
ogs_timer_stop(nf_instance->t_heartbeat_interval); ogs_timer_stop(nf_instance->t_heartbeat_interval);
@ -276,7 +276,7 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
no_heartbeat_margin)); no_heartbeat_margin));
} else { } else {
ogs_warn("[%s] HTTP response error [%d]", ogs_warn("[%s] HTTP response error [%d]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->res_status); message->res_status);
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception);
} }
@ -285,14 +285,15 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
DEFAULT DEFAULT
ogs_error("[%s] Invalid resource name [%s]", ogs_error("[%s] Invalid resource name [%s]",
ogs_sbi_self()->nf_instance->id, NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.resource.component[0]); message->h.resource.component[0]);
END END
break; break;
DEFAULT DEFAULT
ogs_error("[%s] Invalid API name [%s]", ogs_error("[%s] Invalid API name [%s]",
ogs_sbi_self()->nf_instance->id, message->h.service.name); NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.service.name);
END END
break; break;
@ -307,7 +308,8 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
break; break;
case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT: case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT:
ogs_error("[%s] No heartbeat", ogs_sbi_self()->nf_instance->id); ogs_error("[%s] No heartbeat",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register);
break; break;
@ -351,7 +353,8 @@ void ogs_sbi_nf_state_de_registered(ogs_fsm_t *s, ogs_event_t *e)
switch (e->id) { switch (e->id) {
case OGS_FSM_ENTRY_SIG: case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) { if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_info("[%s] NF de-registered", ogs_sbi_self()->nf_instance->id); ogs_info("[%s] NF de-registered",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
} }
break; break;
@ -406,7 +409,7 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
ogs_assert(addr); ogs_assert(addr);
ogs_warn("[%s] Retry to registration with NRF", ogs_warn("[%s] Retry to registration with NRF",
ogs_sbi_self()->nf_instance->id); NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register); OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register);
break; break;

View File

@ -34,9 +34,10 @@ ogs_sbi_request_t *amf_nnssf_nsselection_build_get(
message.h.resource.component[0] = message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION; (char *)OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION;
ogs_assert(ogs_sbi_self()->nf_instance); message.param.nf_id = NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
message.param.nf_id = ogs_sbi_self()->nf_instance->id; ogs_assert(message.param.nf_id);
message.param.nf_type = ogs_sbi_self()->nf_instance->nf_type; message.param.nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(message.param.nf_type);
message.param.slice_info_request_for_pdu_session_presence = true; message.param.slice_info_request_for_pdu_session_presence = true;
message.param.roaming_indication = OpenAPI_roaming_indication_NON_ROAMING; message.param.roaming_indication = OpenAPI_roaming_indication_NON_ROAMING;

View File

@ -51,8 +51,9 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
memset(&SmContextCreateData, 0, sizeof(SmContextCreateData)); memset(&SmContextCreateData, 0, sizeof(SmContextCreateData));
ogs_assert(ogs_sbi_self()->nf_instance); SmContextCreateData.serving_nf_id =
SmContextCreateData.serving_nf_id = ogs_sbi_self()->nf_instance->id; NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
ogs_expect_or_return_val(SmContextCreateData.serving_nf_id, NULL);
SmContextCreateData.serving_network = SmContextCreateData.serving_network =
ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id); ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id);

View File

@ -44,8 +44,8 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration(
memset(&Amf3GppAccessRegistration, 0, sizeof(Amf3GppAccessRegistration)); memset(&Amf3GppAccessRegistration, 0, sizeof(Amf3GppAccessRegistration));
ogs_assert(ogs_sbi_self()->nf_instance); Amf3GppAccessRegistration.amf_instance_id =
Amf3GppAccessRegistration.amf_instance_id = ogs_sbi_self()->nf_instance->id; NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
server = ogs_list_first(&ogs_sbi_self()->server_list); server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_assert(server); ogs_assert(server);
@ -163,7 +163,8 @@ ogs_sbi_request_t *amf_nudm_sdm_build_subscription(amf_ue_t *amf_ue, void *data)
memset(&SDMSubscription, 0, sizeof(SDMSubscription)); memset(&SDMSubscription, 0, sizeof(SDMSubscription));
SDMSubscription.nf_instance_id = ogs_sbi_self()->nf_instance->id; SDMSubscription.nf_instance_id =
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
server = ogs_list_first(&ogs_sbi_self()->server_list); server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_assert(server); ogs_assert(server);

View File

@ -43,9 +43,8 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue, void *data)
AuthenticationInfoRequest.serving_network_name = AuthenticationInfoRequest.serving_network_name =
ausf_ue->serving_network_name; ausf_ue->serving_network_name;
ogs_assert(ogs_sbi_self()->nf_instance);
AuthenticationInfoRequest.ausf_instance_id = AuthenticationInfoRequest.ausf_instance_id =
ogs_sbi_self()->nf_instance->id; NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
if (data) { if (data) {
OpenAPI_resynchronization_info_t *recvinfo = data; OpenAPI_resynchronization_info_t *recvinfo = data;
@ -89,8 +88,7 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform(
AuthEvent->time_stamp = ogs_sbi_localtime_string(ogs_time_now()); AuthEvent->time_stamp = ogs_sbi_localtime_string(ogs_time_now());
ogs_expect_or_return_val(AuthEvent->time_stamp, NULL); ogs_expect_or_return_val(AuthEvent->time_stamp, NULL);
ogs_assert(ogs_sbi_self()->nf_instance); AuthEvent->nf_instance_id = NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
AuthEvent->nf_instance_id = ogs_sbi_self()->nf_instance->id;
if (ausf_ue->auth_result == OpenAPI_auth_result_AUTHENTICATION_SUCCESS) if (ausf_ue->auth_result == OpenAPI_auth_result_AUTHENTICATION_SUCCESS)
AuthEvent->success = true; AuthEvent->success = true;
else else