forked from acouzens/open5gs
[SBI,NF] Don't treat SBI connection errors as asserts
This commit is contained in:
parent
8973a0bfdc
commit
474b2d4134
|
@ -165,7 +165,7 @@ static int client_discover_cb(
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
||||
int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
|
||||
|
@ -226,7 +226,7 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
rc = ogs_sbi_getaddr_from_uri(&scheme, &addr, request->h.uri);
|
||||
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
|
||||
ogs_error("Invalid URL [%s]", request->h.uri);
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
client = ogs_sbi_client_find(scheme, addr);
|
||||
ogs_freeaddrinfo(addr);
|
||||
|
@ -255,7 +255,7 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, ogs_sbi_client_handler, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
return (rc == true) ? OGS_OK : OGS_ERROR;
|
||||
|
||||
} else {
|
||||
/*
|
||||
|
@ -281,7 +281,7 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
if (!v) {
|
||||
ogs_error("ogs_uint64_to_string[0x%llx] failed",
|
||||
(long long)discovery_option->requester_features);
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ogs_sbi_header_set(request->http.headers,
|
||||
|
@ -292,7 +292,7 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_discover_cb, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
return (rc == true) ? OGS_OK : OGS_ERROR;
|
||||
}
|
||||
|
||||
} else if (client) {
|
||||
|
@ -304,7 +304,7 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
rc = ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
return (rc == true) ? OGS_OK : OGS_ERROR;
|
||||
|
||||
} else {
|
||||
/**********************************************
|
||||
|
@ -313,10 +313,10 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
return ogs_sbi_discover_only(xact);
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
||||
int ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
||||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
|
@ -351,14 +351,14 @@ bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
|||
client = NF_INSTANCE_CLIENT(nf_instance);
|
||||
if (!client) {
|
||||
ogs_error("No Client");
|
||||
return false;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
request = ogs_nnrf_disc_build_discover(
|
||||
target_nf_type, requester_nf_type, discovery_option);
|
||||
if (!request) {
|
||||
ogs_error("ogs_nnrf_disc_build_discover() failed");
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_client_send_request(
|
||||
|
@ -367,13 +367,13 @@ bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
|||
|
||||
ogs_sbi_request_free(request);
|
||||
|
||||
return rc;
|
||||
return (rc == true) ? OGS_OK : OGS_ERROR;
|
||||
}
|
||||
|
||||
ogs_error("Cannot discover [%s]",
|
||||
ogs_sbi_service_type_to_name(service_type));
|
||||
|
||||
return false;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
bool ogs_sbi_send_request_to_nf_instance(
|
||||
|
|
|
@ -30,8 +30,8 @@ int ogs_sbi_server_handler(ogs_sbi_request_t *request, void *data);
|
|||
int ogs_sbi_client_handler(
|
||||
int status, ogs_sbi_response_t *response, void *data);
|
||||
|
||||
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact);
|
||||
bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact);
|
||||
int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact);
|
||||
int ogs_sbi_discover_only(ogs_sbi_xact_t *xact);
|
||||
|
||||
bool ogs_sbi_send_request_to_nf_instance(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
|
|
|
@ -761,17 +761,20 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
|
|||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
@ -788,6 +791,7 @@ int gmm_handle_authentication_response(amf_ue_t *amf_ue,
|
|||
ogs_nas_authentication_response_parameter_t
|
||||
*authentication_response_parameter = NULL;
|
||||
uint8_t hxres_star[OGS_MAX_RES_LEN];
|
||||
int r;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(authentication_response);
|
||||
|
@ -822,10 +826,11 @@ int gmm_handle_authentication_response(amf_ue_t *amf_ue,
|
|||
memcpy(amf_ue->xres_star, authentication_response_parameter->res,
|
||||
authentication_response_parameter->length);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate_confirmation, amf_ue, 0, NULL));
|
||||
amf_nausf_auth_build_authenticate_confirmation, amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
@ -1200,16 +1205,18 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
}
|
||||
|
||||
if (nf_instance) {
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_create_sm_context,
|
||||
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL));
|
||||
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NNSSF_NSSELECTION, NULL,
|
||||
amf_nnssf_nsselection_build_get, sess, 0, NULL));
|
||||
amf_nnssf_nsselection_build_get, sess, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1218,12 +1225,13 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
param.release = 1;
|
||||
param.cause = OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_DUPLICATED_PDU_SESSION_ID,
|
||||
¶m));
|
||||
¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1246,18 +1254,20 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
param.ue_location = true;
|
||||
param.ue_timezone = true;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_N1_RELEASED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_N1_RELEASED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_MODIFIED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_MODIFIED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
switch (gsm_header->message_type) {
|
||||
|
|
125
src/amf/gmm-sm.c
125
src/amf/gmm-sm.c
|
@ -262,11 +262,12 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_ue->data_change_subscription_id = NULL;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
|
||||
amf_nudm_uecm_build_registration_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_fatal("Invalid state [%d]", state);
|
||||
ogs_assert_if_reached();
|
||||
|
@ -326,12 +327,13 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
|
||||
state == AMF_UE_INITIATED_DE_REGISTERED) {
|
||||
if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
@ -616,17 +618,20 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
state = AMF_NETWORK_INITIATED_IMPLICIT_DE_REGISTERED;
|
||||
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -745,11 +750,12 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_ue->data_change_subscription_id = NULL;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
|
||||
amf_nudm_uecm_build_registration_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_fatal("Invalid state [%d]", state);
|
||||
ogs_assert_if_reached();
|
||||
|
@ -820,12 +826,13 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1019,12 +1026,13 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
|
||||
if (!PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_create,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &gmm_state_initial_context_setup);
|
||||
break;
|
||||
}
|
||||
|
@ -1047,11 +1055,12 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_authentication);
|
||||
|
@ -1130,11 +1139,12 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_authentication);
|
||||
|
@ -1308,11 +1318,12 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
case OGS_5GMM_CAUSE_NGKSI_ALREADY_IN_USE:
|
||||
ogs_warn("Authentication failure(ngKSI already in use)");
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
|
||||
case OGS_5GMM_CAUSE_SYNCH_FAILURE:
|
||||
|
@ -1322,11 +1333,12 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
authentication_failure_parameter->length);
|
||||
break;
|
||||
}
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, authentication_failure_parameter->auts));
|
||||
amf_ue, 0, authentication_failure_parameter->auts);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -1357,10 +1369,11 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate, amf_ue, 0, NULL));
|
||||
amf_nausf_auth_build_authenticate, amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
case OGS_NAS_5GS_5GMM_STATUS:
|
||||
|
@ -1569,10 +1582,11 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_kdf_nh_gnb(amf_ue->kamf, amf_ue->kgnb, amf_ue->nh);
|
||||
amf_ue->nhcc = 1;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
|
||||
amf_nudm_uecm_build_registration, amf_ue, 0, NULL));
|
||||
amf_nudm_uecm_build_registration, amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST) {
|
||||
OGS_FSM_TRAN(s, &gmm_state_initial_context_setup);
|
||||
|
@ -1606,10 +1620,11 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate, amf_ue, 0, NULL));
|
||||
amf_nausf_auth_build_authenticate, amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_authentication);
|
||||
break;
|
||||
|
@ -1731,12 +1746,13 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
SWITCH(sbi_message->h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_PUT)
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_get,
|
||||
amf_ue, state,
|
||||
(char *)OGS_SBI_RESOURCE_NAME_AM_DATA));
|
||||
(char *)OGS_SBI_RESOURCE_NAME_AM_DATA);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
|
@ -1945,11 +1961,12 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
OGS_FSM_TRAN(s, &gmm_state_authentication);
|
||||
break;
|
||||
|
@ -2149,12 +2166,13 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
|
||||
if (!PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_create,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &gmm_state_initial_context_setup);
|
||||
break;
|
||||
}
|
||||
|
@ -2177,11 +2195,12 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_authentication);
|
||||
|
|
|
@ -613,17 +613,20 @@ int amf_namf_callback_handle_dereg_notify(
|
|||
}
|
||||
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
@ -941,17 +944,20 @@ int amf_namf_callback_handle_sdm_data_change_notify(
|
|||
}
|
||||
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (ambr_changed) {
|
||||
|
|
|
@ -966,11 +966,12 @@ void ngap_handle_initial_context_setup_response(
|
|||
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP;
|
||||
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -1927,11 +1928,12 @@ void ngap_handle_pdu_session_resource_setup_response(
|
|||
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP;
|
||||
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -2052,11 +2054,12 @@ void ngap_handle_pdu_session_resource_setup_response(
|
|||
amf_ue->deactivation.group = NGAP_Cause_PR_nas;
|
||||
amf_ue->deactivation.cause = NGAP_CauseNas_normal_release;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_SETUP_FAIL, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_SETUP_FAIL, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -2244,11 +2247,12 @@ void ngap_handle_pdu_session_resource_modify_response(
|
|||
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP;
|
||||
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_MODIFIED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_MODIFIED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -2430,11 +2434,12 @@ void ngap_handle_pdu_session_resource_release_response(
|
|||
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP;
|
||||
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_N2_RELEASED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_N2_RELEASED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -2875,11 +2880,12 @@ void ngap_handle_path_switch_request(
|
|||
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ;
|
||||
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_PATH_SWITCH_REQUEST, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_PATH_SWITCH_REQUEST, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -3218,11 +3224,12 @@ void ngap_handle_handover_required(
|
|||
param.hoState = OpenAPI_ho_state_PREPARING;
|
||||
param.TargetID = TargetID;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_REQUIRED, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_REQUIRED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -3457,11 +3464,12 @@ void ngap_handle_handover_request_ack(
|
|||
|
||||
param.hoState = OpenAPI_ho_state_PREPARED;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_REQ_ACK, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_REQ_ACK, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_pkbuf_free(param.n2smbuf);
|
||||
}
|
||||
|
@ -3716,11 +3724,12 @@ void ngap_handle_handover_cancel(
|
|||
param.ngApCause.group = Cause->present;
|
||||
param.ngApCause.value = (int)Cause->choice.radioNetwork;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_CANCEL, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_CANCEL, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4012,11 +4021,12 @@ void ngap_handle_handover_notification(
|
|||
memset(¶m, 0, sizeof(param));
|
||||
param.hoState = OpenAPI_ho_state_COMPLETED;
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_NOTIFY, ¶m));
|
||||
sess, AMF_UPDATE_SM_CONTEXT_HANDOVER_NOTIFY, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,10 +93,12 @@ int amf_nnssf_nsselection_handle_get(
|
|||
memset(¶m, 0, sizeof(param));
|
||||
param.nrf_uri.nrf.id = sess->nssf.nrf.id;
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_create_sm_context,
|
||||
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
rc = ogs_sbi_getaddr_from_uri(&scheme, &addr, NsiInformation->nrf_id);
|
||||
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
|
||||
|
@ -118,8 +120,10 @@ int amf_nnssf_nsselection_handle_get(
|
|||
OGS_SBI_SETUP_CLIENT(&sess->nssf.nrf, client);
|
||||
ogs_freeaddrinfo(addr);
|
||||
|
||||
ogs_assert(true == amf_sess_sbi_discover_by_nsi(
|
||||
sess, OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL));
|
||||
r = amf_sess_sbi_discover_by_nsi(
|
||||
sess, OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return OGS_OK;
|
||||
|
|
|
@ -241,12 +241,13 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
AMF_UPDATE_SM_CONTEXT_REGISTRATION_REQUEST)) {
|
||||
|
||||
if (!PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_create,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
|
@ -593,10 +594,12 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ogs_warn("[%s:%d] Receive Update SM context"
|
||||
"(DUPLICATED_PDU_SESSION_ID)", amf_ue->supi, sess->psi);
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_create_sm_context,
|
||||
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (state == AMF_UPDATE_SM_CONTEXT_PATH_SWITCH_REQUEST) {
|
||||
|
||||
|
@ -855,11 +858,12 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
amf_ue, AMF_UPDATE_SM_CONTEXT_REGISTRATION_REQUEST)) {
|
||||
|
||||
if (!PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL, NULL,
|
||||
amf_npcf_am_policy_control_build_create,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
|
@ -923,17 +927,20 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 6. UEContextReleaseComplete
|
||||
*/
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
@ -990,17 +997,20 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 7. UEContextReleaseComplete
|
||||
*/
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_exception)) {
|
||||
|
@ -1025,17 +1035,20 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 7. UEContextReleaseComplete
|
||||
*/
|
||||
if (UDM_SDM_SUBSCRIBED(amf_ue)) {
|
||||
ogs_assert(true == amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (PCF_AM_POLICY_ASSOCIATED(amf_ue)) {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL,
|
||||
NULL,
|
||||
amf_npcf_am_policy_control_build_delete,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
@ -1044,11 +1057,12 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
} else if (OGS_FSM_CHECK(&amf_ue->sm,
|
||||
gmm_state_authentication)) {
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
|
||||
amf_nausf_auth_build_authenticate,
|
||||
amf_ue, 0, NULL));
|
||||
amf_ue, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (OGS_FSM_CHECK(
|
||||
&amf_ue->sm, gmm_state_security_mode)) {
|
||||
|
|
|
@ -150,11 +150,12 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_get,
|
||||
amf_ue, state, (char *)OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA));
|
||||
amf_ue, state, (char *)OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
|
||||
|
@ -223,12 +224,13 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
}
|
||||
}
|
||||
}
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_get,
|
||||
amf_ue, state,
|
||||
(char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA));
|
||||
(char *)OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
|
||||
|
@ -236,18 +238,20 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
if (amf_ue->data_change_subscription_id) {
|
||||
/* we already have a SDM subscription to UDM; continue without
|
||||
* subscribing again */
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL, NULL,
|
||||
amf_npcf_am_policy_control_build_create,
|
||||
amf_ue, state, NULL));
|
||||
amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
else {
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
amf_nudm_sdm_build_subscription,
|
||||
amf_ue, state, (char *)OGS_SBI_RESOURCE_NAME_AM_DATA));
|
||||
amf_ue, state, (char *)OGS_SBI_RESOURCE_NAME_AM_DATA);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -299,10 +303,11 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
|
||||
ogs_sbi_header_free(&header);
|
||||
|
||||
ogs_assert(true ==
|
||||
amf_ue_sbi_discover_and_send(
|
||||
r = amf_ue_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL, NULL,
|
||||
amf_npcf_am_policy_control_build_create, amf_ue, state, NULL));
|
||||
amf_npcf_am_policy_control_build_create, amf_ue, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
DEFAULT
|
||||
|
|
|
@ -86,13 +86,14 @@ bool amf_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
bool amf_ue_sbi_discover_and_send(
|
||||
int amf_ue_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data),
|
||||
amf_ue_t *amf_ue, int state, void *data)
|
||||
{
|
||||
int r;
|
||||
int rv;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
||||
ogs_assert(service_type);
|
||||
|
@ -108,31 +109,33 @@ bool amf_ue_sbi_discover_and_send(
|
|||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->state = state;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
rv = ogs_sbi_discover_and_send(xact);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("amf_ue_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
bool amf_sess_sbi_discover_and_send(
|
||||
int amf_sess_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data),
|
||||
amf_sess_t *sess, int state, void *data)
|
||||
{
|
||||
int r;
|
||||
int rv;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
||||
ogs_assert(service_type);
|
||||
|
@ -148,22 +151,23 @@ bool amf_sess_sbi_discover_and_send(
|
|||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->state = state;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
rv = ogs_sbi_discover_and_send(xact);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("amf_sess_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
static int client_discover_cb(
|
||||
int status, ogs_sbi_response_t *response, void *data)
|
||||
|
@ -270,10 +274,12 @@ static int client_discover_cb(
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
service_type, NULL,
|
||||
amf_nsmf_pdusession_build_create_sm_context,
|
||||
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_sbi_xact_remove(xact);
|
||||
|
||||
|
@ -291,7 +297,7 @@ cleanup:
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
bool amf_sess_sbi_discover_by_nsi(
|
||||
int amf_sess_sbi_discover_by_nsi(
|
||||
amf_sess_t *sess,
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option)
|
||||
|
@ -311,7 +317,7 @@ bool amf_sess_sbi_discover_by_nsi(
|
|||
&sess->sbi, service_type, discovery_option, NULL, NULL, NULL);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->request = amf_nnrf_disc_build_discover(
|
||||
|
@ -319,31 +325,35 @@ bool amf_sess_sbi_discover_by_nsi(
|
|||
if (!xact->request) {
|
||||
ogs_error("amf_nnrf_disc_build_discover() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
return ogs_sbi_client_send_request(
|
||||
client, client_discover_cb, xact->request, xact);
|
||||
client, client_discover_cb, xact->request, xact) == true ? OGS_OK : OGS_ERROR;
|
||||
}
|
||||
|
||||
void amf_sbi_send_activating_session(amf_sess_t *sess, int state)
|
||||
{
|
||||
amf_nsmf_pdusession_sm_context_param_t param;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
||||
memset(¶m, 0, sizeof(param));
|
||||
param.upCnxState = OpenAPI_up_cnx_state_ACTIVATING;
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context, sess, state, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
void amf_sbi_send_deactivate_session(
|
||||
amf_sess_t *sess, int state, int group, int cause)
|
||||
{
|
||||
amf_nsmf_pdusession_sm_context_param_t param;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
||||
|
@ -354,9 +364,11 @@ void amf_sbi_send_deactivate_session(
|
|||
param.ue_location = true;
|
||||
param.ue_timezone = true;
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_update_sm_context, sess, state, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
void amf_sbi_send_deactivate_all_sessions(
|
||||
|
@ -415,11 +427,15 @@ void amf_sbi_send_deactivate_all_ue_in_gnb(amf_gnb_t *gnb, int state)
|
|||
|
||||
void amf_sbi_send_release_session(amf_sess_t *sess, int state)
|
||||
{
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
||||
amf_sess_sbi_discover_and_send(
|
||||
r = amf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
|
||||
amf_nsmf_pdusession_build_release_sm_context, sess, state, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
/* Prevent to invoke SMF for this session */
|
||||
CLEAR_SM_CONTEXT_REF(sess);
|
||||
|
|
|
@ -65,18 +65,18 @@ bool amf_sbi_send_request(
|
|||
#define AMF_REMOVE_S1_CONTEXT_BY_RESET_ALL 52
|
||||
#define AMF_REMOVE_S1_CONTEXT_BY_RESET_PARTIAL 53
|
||||
|
||||
bool amf_ue_sbi_discover_and_send(
|
||||
int amf_ue_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data),
|
||||
amf_ue_t *amf_ue, int state, void *data);
|
||||
bool amf_sess_sbi_discover_and_send(
|
||||
int amf_sess_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data),
|
||||
amf_sess_t *sess, int state, void *data);
|
||||
|
||||
bool amf_sess_sbi_discover_by_nsi(
|
||||
int amf_sess_sbi_discover_by_nsi(
|
||||
amf_sess_t *sess,
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option);
|
||||
|
|
|
@ -26,6 +26,7 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
|
|||
{
|
||||
OpenAPI_authentication_info_t *AuthenticationInfo = NULL;
|
||||
char *serving_network_name = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(ausf_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -54,11 +55,12 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
|
|||
ausf_ue->serving_network_name = ogs_strdup(serving_network_name);
|
||||
ogs_assert(ausf_ue->serving_network_name);
|
||||
|
||||
ogs_assert(true ==
|
||||
ausf_sbi_discover_and_send(
|
||||
r = ausf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UEAU, NULL,
|
||||
ausf_nudm_ueau_build_get,
|
||||
ausf_ue, stream, AuthenticationInfo->resynchronization_info));
|
||||
ausf_ue, stream, AuthenticationInfo->resynchronization_info);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -69,6 +71,7 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
|
|||
OpenAPI_confirmation_data_t *ConfirmationData = NULL;
|
||||
char *res_star_string = NULL;
|
||||
uint8_t res_star[OGS_KEYSTRLEN(OGS_MAX_RES_LEN)];
|
||||
int r;
|
||||
|
||||
ogs_assert(ausf_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -104,11 +107,12 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
|
|||
ausf_ue->auth_result = OpenAPI_auth_result_AUTHENTICATION_SUCCESS;
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
ausf_sbi_discover_and_send(
|
||||
r = ausf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UEAU, NULL,
|
||||
ausf_nudm_ueau_build_result_confirmation_inform,
|
||||
ausf_ue, stream, NULL));
|
||||
ausf_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -116,15 +120,18 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
|
|||
bool ausf_nausf_auth_handle_authenticate_delete(ausf_ue_t *ausf_ue,
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int r;
|
||||
|
||||
ogs_assert(ausf_ue);
|
||||
ogs_assert(stream);
|
||||
ogs_assert(recvmsg);
|
||||
|
||||
ogs_assert(true ==
|
||||
ausf_sbi_discover_and_send(
|
||||
r = ausf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDM_UEAU, NULL,
|
||||
ausf_nudm_ueau_build_auth_removal_ind,
|
||||
ausf_ue, stream, NULL));
|
||||
ausf_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -73,13 +73,14 @@ bool ausf_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
bool ausf_sbi_discover_and_send(
|
||||
int ausf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data),
|
||||
ausf_ue_t *ausf_ue, ogs_sbi_stream_t *stream, void *data)
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(ausf_ue);
|
||||
|
@ -95,20 +96,21 @@ bool ausf_sbi_discover_and_send(
|
|||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", ausf_ue->suci));
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("ausf_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", ausf_ue->suci));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ void ausf_sbi_close(void);
|
|||
|
||||
bool ausf_sbi_send_request(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
bool ausf_sbi_discover_and_send(
|
||||
int ausf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data),
|
||||
|
|
|
@ -71,13 +71,14 @@ bool bsf_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
bool bsf_sbi_discover_and_send(
|
||||
int bsf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(bsf_sess_t *sess, void *data),
|
||||
bsf_sess_t *sess, ogs_sbi_stream_t *stream, void *data)
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(sess);
|
||||
|
@ -93,22 +94,23 @@ bool bsf_sbi_discover_and_send(
|
|||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", sess->dnn));
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("bsf_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", sess->dnn));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
void bsf_sbi_send_response(ogs_sbi_stream_t *stream, int status)
|
||||
|
|
|
@ -31,7 +31,7 @@ void bsf_sbi_close(void);
|
|||
|
||||
bool bsf_sbi_send_request(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
bool bsf_sbi_discover_and_send(
|
||||
int bsf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(bsf_sess_t *sess, void *data),
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
void pcf_nnrf_handle_nf_discover(
|
||||
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int r;
|
||||
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;
|
||||
|
@ -92,11 +93,12 @@ void pcf_nnrf_handle_nf_discover(
|
|||
|
||||
ogs_assert(sess);
|
||||
ogs_assert(stream);
|
||||
ogs_assert(true ==
|
||||
pcf_sess_sbi_discover_and_send(
|
||||
r = pcf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
|
||||
pcf_nbsf_management_build_register,
|
||||
sess, stream, nf_instance));
|
||||
sess, stream, nf_instance);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
default:
|
||||
ogs_assert(xact->request);
|
||||
|
|
|
@ -25,6 +25,7 @@ bool pcf_npcf_am_policy_contrtol_handle_create(pcf_ue_t *pcf_ue,
|
|||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
|
||||
{
|
||||
bool rc;
|
||||
int r;
|
||||
|
||||
OpenAPI_policy_association_request_t *PolicyAssociationRequest = NULL;
|
||||
OpenAPI_guami_t *Guami = NULL;
|
||||
|
@ -155,11 +156,12 @@ bool pcf_npcf_am_policy_contrtol_handle_create(pcf_ue_t *pcf_ue,
|
|||
pcf_ue->subscribed_ue_ambr = OpenAPI_ambr_copy(
|
||||
pcf_ue->subscribed_ue_ambr, PolicyAssociationRequest->ue_ambr);
|
||||
|
||||
ogs_assert(true ==
|
||||
pcf_ue_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
pcf_nudr_dr_build_query_am_data, pcf_ue, stream, NULL));
|
||||
r = pcf_ue_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
pcf_nudr_dr_build_query_am_data, pcf_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
return (r == OGS_OK);
|
||||
}
|
||||
|
||||
bool pcf_npcf_smpolicycontrol_handle_create(pcf_sess_t *sess,
|
||||
|
@ -167,6 +169,7 @@ bool pcf_npcf_smpolicycontrol_handle_create(pcf_sess_t *sess,
|
|||
{
|
||||
bool rc;
|
||||
int status = 0;
|
||||
int r;
|
||||
char *strerror = NULL;
|
||||
pcf_ue_t *pcf_ue = NULL;
|
||||
|
||||
|
@ -336,12 +339,13 @@ bool pcf_npcf_smpolicycontrol_handle_create(pcf_sess_t *sess,
|
|||
sess->subscribed_default_qos = OpenAPI_subscribed_default_qos_copy(
|
||||
sess->subscribed_default_qos, SmPolicyContextData->subs_def_qos);
|
||||
|
||||
ogs_assert(true ==
|
||||
pcf_sess_sbi_discover_and_send(
|
||||
r = pcf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
pcf_nudr_dr_build_query_sm_data, sess, stream, NULL));
|
||||
pcf_nudr_dr_build_query_sm_data, sess, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
return (r == OGS_OK);
|
||||
|
||||
cleanup:
|
||||
ogs_assert(status);
|
||||
|
@ -357,6 +361,7 @@ cleanup:
|
|||
bool pcf_npcf_smpolicycontrol_handle_delete(pcf_sess_t *sess,
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
|
||||
{
|
||||
int r;
|
||||
int status = 0;
|
||||
char *strerror = NULL;
|
||||
pcf_ue_t *pcf_ue = NULL;
|
||||
|
@ -391,10 +396,11 @@ bool pcf_npcf_smpolicycontrol_handle_delete(pcf_sess_t *sess,
|
|||
ogs_assert(response);
|
||||
ogs_assert(true == ogs_sbi_server_send_response(stream, response));
|
||||
} else {
|
||||
ogs_assert(true ==
|
||||
pcf_sess_sbi_discover_and_send(
|
||||
r = pcf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
|
||||
pcf_nbsf_management_build_de_register, sess, stream, NULL));
|
||||
pcf_nbsf_management_build_de_register, sess, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -177,6 +177,7 @@ bool pcf_nudr_dr_handle_query_sm_data(
|
|||
char *strerror = NULL;
|
||||
pcf_ue_t *pcf_ue = NULL;
|
||||
ogs_sbi_server_t *server = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
pcf_ue = sess->pcf_ue;
|
||||
|
@ -215,14 +216,16 @@ bool pcf_nudr_dr_handle_query_sm_data(
|
|||
}
|
||||
|
||||
if (nf_instance) {
|
||||
ogs_assert(true ==
|
||||
pcf_sess_sbi_discover_and_send(
|
||||
r = pcf_sess_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NBSF_MANAGEMENT, NULL,
|
||||
pcf_nbsf_management_build_register,
|
||||
sess, stream, nf_instance));
|
||||
sess, stream, nf_instance);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_expect(true ==
|
||||
pcf_sess_sbi_discover_only(sess, stream, service_type));
|
||||
r = pcf_sess_sbi_discover_only(sess, stream, service_type);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -122,7 +122,7 @@ bool pcf_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
static bool pcf_sbi_discover_and_send(
|
||||
static int pcf_sbi_discover_and_send(
|
||||
ogs_sbi_object_t *sbi_object,
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
|
@ -130,6 +130,7 @@ static bool pcf_sbi_discover_and_send(
|
|||
void *context, ogs_sbi_stream_t *stream, void *data)
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(sbi_object);
|
||||
|
@ -141,41 +142,45 @@ static bool pcf_sbi_discover_and_send(
|
|||
build, context, data);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("ogs_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
bool pcf_ue_sbi_discover_and_send(
|
||||
int pcf_ue_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(pcf_ue_t *pcf_ue, void *data),
|
||||
pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, void *data)
|
||||
{
|
||||
if (pcf_sbi_discover_and_send(
|
||||
int r;
|
||||
|
||||
r = pcf_sbi_discover_and_send(
|
||||
&pcf_ue->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, pcf_ue, stream, data) != true) {
|
||||
(ogs_sbi_build_f)build, pcf_ue, stream, data);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("pcf_ue_sbi_discover_and_send() failed");
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", pcf_ue->supi));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
bool pcf_sess_sbi_discover_only(
|
||||
int pcf_sess_sbi_discover_only(
|
||||
pcf_sess_t *sess, ogs_sbi_stream_t *stream,
|
||||
ogs_sbi_service_type_e service_type)
|
||||
{
|
||||
|
@ -187,7 +192,7 @@ bool pcf_sess_sbi_discover_only(
|
|||
xact = ogs_sbi_xact_add(&sess->sbi, service_type, NULL, NULL, NULL, NULL);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
@ -195,24 +200,27 @@ bool pcf_sess_sbi_discover_only(
|
|||
return ogs_sbi_discover_only(xact);
|
||||
}
|
||||
|
||||
bool pcf_sess_sbi_discover_and_send(
|
||||
int pcf_sess_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
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)
|
||||
{
|
||||
if (pcf_sbi_discover_and_send(
|
||||
int r;
|
||||
|
||||
r = pcf_sbi_discover_and_send(
|
||||
&sess->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, sess, stream, data) != true) {
|
||||
(ogs_sbi_build_f)build, sess, stream, data);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("pcf_sess_sbi_discover_and_send() failed");
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", NULL));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static int client_notify_cb(
|
||||
|
|
|
@ -35,17 +35,17 @@ void pcf_sbi_close(void);
|
|||
|
||||
bool pcf_sbi_send_request(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
bool pcf_ue_sbi_discover_and_send(
|
||||
int pcf_ue_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(pcf_ue_t *pcf_ue, void *data),
|
||||
pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, void *data);
|
||||
bool pcf_sess_sbi_discover_and_send(
|
||||
int pcf_sess_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
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(
|
||||
int pcf_sess_sbi_discover_only(
|
||||
pcf_sess_t *sess, ogs_sbi_stream_t *stream,
|
||||
ogs_sbi_service_type_e service_type);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ int gsm_handle_pdu_session_establishment_request(
|
|||
integrity_protection_maximum_data_rate;
|
||||
ogs_nas_pdu_session_type_t *pdu_session_type = NULL;
|
||||
ogs_nas_ssc_mode_t *ssc_mode = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
ogs_assert(stream);
|
||||
|
@ -66,10 +67,11 @@ int gsm_handle_pdu_session_establishment_request(
|
|||
extended_protocol_configuration_options);
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
r = smf_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
|
||||
smf_nudm_sdm_build_get,
|
||||
sess, stream, 0, (char *)OGS_SBI_RESOURCE_NAME_SM_DATA));
|
||||
sess, stream, 0, (char *)OGS_SBI_RESOURCE_NAME_SM_DATA);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -748,6 +748,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_gtp2_message_t *gtp2_message = NULL;
|
||||
uint8_t gtp1_cause, gtp2_cause;
|
||||
bool release;
|
||||
int r;
|
||||
|
||||
int state = 0;
|
||||
|
||||
|
@ -1021,12 +1022,13 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
param.ran_nas_release.ngap_cause.value =
|
||||
NGAP_CauseNas_normal_release;
|
||||
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_delete,
|
||||
sess, stream,
|
||||
OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED, ¶m));
|
||||
OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_error("[%s:%d] No PolicyAssociationId",
|
||||
smf_ue->supi, sess->psi);
|
||||
|
|
|
@ -702,6 +702,7 @@ bool smf_npcf_smpolicycontrol_handle_terminate_notify(
|
|||
{
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
smf_npcf_smpolicycontrol_param_t param;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
ogs_assert(stream);
|
||||
|
@ -713,11 +714,12 @@ bool smf_npcf_smpolicycontrol_handle_terminate_notify(
|
|||
ogs_assert(true == ogs_sbi_send_http_status_no_content(stream));
|
||||
|
||||
memset(¶m, 0, sizeof(param));
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_delete,
|
||||
sess, NULL, OGS_PFCP_DELETE_TRIGGER_PCF_INITIATED, ¶m));
|
||||
sess, NULL, OGS_PFCP_DELETE_TRIGGER_PCF_INITIATED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ bool smf_nsmf_handle_update_sm_context(
|
|||
smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
|
||||
{
|
||||
int i;
|
||||
int r;
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
|
||||
ogs_sbi_message_t sendmsg;
|
||||
|
@ -660,12 +661,14 @@ bool smf_nsmf_handle_update_sm_context(
|
|||
param.ue_location = true;
|
||||
param.ue_timezone = true;
|
||||
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_delete,
|
||||
sess, stream,
|
||||
OGS_PFCP_DELETE_TRIGGER_AMF_UPDATE_SM_CONTEXT, ¶m));
|
||||
OGS_PFCP_DELETE_TRIGGER_AMF_UPDATE_SM_CONTEXT, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
}
|
||||
} else {
|
||||
ogs_error("No PolicyAssociationId");
|
||||
|
@ -701,6 +704,7 @@ bool smf_nsmf_handle_update_sm_context(
|
|||
bool smf_nsmf_handle_release_sm_context(
|
||||
smf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
|
||||
{
|
||||
int r;
|
||||
smf_npcf_smpolicycontrol_param_t param;
|
||||
|
||||
OpenAPI_sm_context_release_data_t *SmContextReleaseData = NULL;
|
||||
|
@ -751,12 +755,13 @@ bool smf_nsmf_handle_release_sm_context(
|
|||
}
|
||||
|
||||
if (sess->policy_association_id) {
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_delete,
|
||||
sess, stream,
|
||||
OGS_PFCP_DELETE_TRIGGER_AMF_RELEASE_SM_CONTEXT, ¶m));
|
||||
OGS_PFCP_DELETE_TRIGGER_AMF_RELEASE_SM_CONTEXT, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_error("No PolicyAssociationId");
|
||||
ogs_assert(true ==
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream,
|
||||
ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int r;
|
||||
char *strerror = NULL;
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
ogs_pkbuf_t *n1smbuf = NULL;
|
||||
|
@ -333,10 +334,11 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream,
|
|||
|
||||
ogs_free(sendmsg.http.location);
|
||||
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_create, sess, stream, 0, NULL));
|
||||
smf_npcf_smpolicycontrol_build_create, sess, stream, 0, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
smf_sess_t *sess = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -331,11 +332,12 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
|
|||
smf_npcf_smpolicycontrol_param_t param;
|
||||
|
||||
memset(¶m, 0, sizeof(param));
|
||||
ogs_assert(true ==
|
||||
smf_sbi_discover_and_send(
|
||||
r = smf_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NPCF_SMPOLICYCONTROL, NULL,
|
||||
smf_npcf_smpolicycontrol_build_delete,
|
||||
sess, NULL, OGS_PFCP_DELETE_TRIGGER_SMF_INITIATED, ¶m));
|
||||
sess, NULL, OGS_PFCP_DELETE_TRIGGER_SMF_INITIATED, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ bool smf_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
bool smf_sbi_discover_and_send(
|
||||
int smf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data),
|
||||
|
@ -96,6 +96,7 @@ bool smf_sbi_discover_and_send(
|
|||
{
|
||||
smf_ue_t *smf_ue = NULL;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(sess);
|
||||
|
@ -112,13 +113,14 @@ bool smf_sbi_discover_and_send(
|
|||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", smf_ue->supi));
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->state = state;
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("smf_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
|
||||
|
@ -127,10 +129,10 @@ bool smf_sbi_discover_and_send(
|
|||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", smf_ue->supi));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
void smf_namf_comm_send_n1_n2_message_transfer(
|
||||
|
@ -139,6 +141,7 @@ void smf_namf_comm_send_n1_n2_message_transfer(
|
|||
smf_ue_t *smf_ue = NULL;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
ogs_sbi_discovery_option_t *discovery_option = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(sess);
|
||||
smf_ue = sess->smf_ue;
|
||||
|
@ -164,9 +167,11 @@ void smf_namf_comm_send_n1_n2_message_transfer(
|
|||
|
||||
xact->state = param->state;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("smf_namf_comm_send_n1_n2_message_transfer() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void smf_sbi_close(void);
|
|||
|
||||
bool smf_sbi_send_request(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
bool smf_sbi_discover_and_send(
|
||||
int smf_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data),
|
||||
|
|
|
@ -28,6 +28,7 @@ bool udm_nudm_ueau_handle_get(
|
|||
OpenAPI_resynchronization_info_t *ResynchronizationInfo = NULL;
|
||||
char *serving_network_name = NULL;
|
||||
char *ausf_instance_id = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(udm_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -73,10 +74,11 @@ bool udm_nudm_ueau_handle_get(
|
|||
ResynchronizationInfo = AuthenticationInfoRequest->resynchronization_info;
|
||||
if (!ResynchronizationInfo) {
|
||||
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
r = udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_authentication_subscription,
|
||||
udm_ue, stream, NULL));
|
||||
udm_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else {
|
||||
uint8_t rand[OGS_RAND_LEN];
|
||||
|
@ -162,10 +164,11 @@ bool udm_nudm_ueau_handle_get(
|
|||
|
||||
ogs_uint64_to_buffer(sqn, OGS_SQN_LEN, udm_ue->sqn);
|
||||
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
r = udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_authentication_subscription,
|
||||
udm_ue, stream, udm_ue->sqn));
|
||||
udm_ue, stream, udm_ue->sqn);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -175,6 +178,7 @@ bool udm_nudm_ueau_handle_result_confirmation_inform(
|
|||
udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
|
||||
{
|
||||
OpenAPI_auth_event_t *AuthEvent = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(udm_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -232,10 +236,11 @@ bool udm_nudm_ueau_handle_result_confirmation_inform(
|
|||
udm_ue->auth_event = OpenAPI_auth_event_copy(
|
||||
udm_ue->auth_event, message->AuthEvent);
|
||||
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
r = udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_update_authentication_status,
|
||||
udm_ue, stream, NULL));
|
||||
udm_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -245,6 +250,7 @@ bool udm_nudm_uecm_handle_registration(
|
|||
{
|
||||
OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
|
||||
OpenAPI_guami_t *Guami = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(udm_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -331,9 +337,10 @@ bool udm_nudm_uecm_handle_registration(
|
|||
udm_ue->amf_3gpp_access_registration,
|
||||
message->Amf3GppAccessRegistration);
|
||||
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_update_amf_context, udm_ue, stream, NULL));
|
||||
r = udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_update_amf_context, udm_ue, stream, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -347,6 +354,7 @@ bool udm_nudm_uecm_handle_registration_update(
|
|||
ogs_guami_t recv_guami;
|
||||
OpenAPI_list_t *PatchItemList = NULL;
|
||||
OpenAPI_patch_item_t item;
|
||||
int r;
|
||||
|
||||
ogs_assert(udm_ue);
|
||||
ogs_assert(stream);
|
||||
|
@ -438,10 +446,11 @@ bool udm_nudm_uecm_handle_registration_update(
|
|||
OpenAPI_list_add(PatchItemList, &item);
|
||||
}
|
||||
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
r = udm_sbi_discover_and_send(OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_patch_amf_context,
|
||||
udm_ue, stream, PatchItemList));
|
||||
udm_ue, stream, PatchItemList);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,13 +93,14 @@ bool udm_sbi_send_request(
|
|||
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
|
||||
}
|
||||
|
||||
bool udm_sbi_discover_and_send(
|
||||
int udm_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data),
|
||||
udm_ue_t *udm_ue, ogs_sbi_stream_t *stream, void *data)
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(udm_ue);
|
||||
|
@ -115,20 +116,21 @@ bool udm_sbi_discover_and_send(
|
|||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", udm_ue->suci));
|
||||
return false;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("udm_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(true ==
|
||||
ogs_sbi_server_send_error(stream,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
|
||||
"Cannot discover", udm_ue->suci));
|
||||
return false;
|
||||
return r;
|
||||
}
|
||||
|
||||
return true;
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ void udm_sbi_close(void);
|
|||
|
||||
bool udm_sbi_send_request(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
|
||||
bool udm_sbi_discover_and_send(
|
||||
int udm_sbi_discover_and_send(
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data),
|
||||
|
|
|
@ -39,6 +39,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -158,11 +159,12 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
|
||||
CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
|
||||
ogs_assert(true ==
|
||||
udm_sbi_discover_and_send(
|
||||
r = udm_sbi_discover_and_send(
|
||||
OGS_SBI_SERVICE_TYPE_NUDR_DR, NULL,
|
||||
udm_nudr_dr_build_query_subscription_provisioned,
|
||||
udm_ue, stream, message));
|
||||
udm_ue, stream, message);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
|
||||
|
|
|
@ -67,6 +67,7 @@ void af_sbi_discover_and_send(
|
|||
af_sess_t *sess, void *data)
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
int r;
|
||||
|
||||
ogs_assert(service_type);
|
||||
ogs_assert(sess);
|
||||
|
@ -80,7 +81,8 @@ void af_sbi_discover_and_send(
|
|||
return;
|
||||
}
|
||||
|
||||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
r = ogs_sbi_discover_and_send(xact);
|
||||
if (r != OGS_OK) {
|
||||
ogs_error("af_sbi_discover_and_send() failed");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue