[AMF] Add support for SDM subscription and authentication deletion

This commit is contained in:
mitmitmitm 2022-11-23 12:37:27 +01:00 committed by Sukchan Lee
parent 9364cd7513
commit 3870216a6b
6 changed files with 129 additions and 15 deletions

View File

@ -1213,6 +1213,8 @@ static int parse_json(ogs_sbi_message_t *message,
}
}
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown method [%s]", message->h.method);

View File

@ -164,21 +164,38 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
break;
CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM)
if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
break;
}
SWITCH(sbi_message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS)
if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
break;
}
SWITCH(sbi_message->h.method)
CASE(OGS_SBI_HTTP_METHOD_PUT)
ogs_warn("[%s] Ignore SBI message", amf_ue->supi);
break;
CASE(OGS_SBI_HTTP_METHOD_PATCH)
SWITCH(sbi_message->h.resource.component[2])
CASE(OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS)
if (amf_ue->data_change_subscription_id) {
ogs_free(amf_ue->data_change_subscription_id);
amf_ue->data_change_subscription_id = NULL;
}
ogs_assert(true ==
amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH, NULL,
amf_nausf_auth_build_authenticate_delete,
amf_ue, NULL));
break;
DEFAULT
ogs_warn("Ignoring invalid resource name [%s]",
sbi_message->h.resource.component[2]);
END
break;
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
@ -195,21 +212,36 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
break;
CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
if ((sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) &&
(sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED) &&
(sbi_message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT)) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
break;
}
SWITCH(sbi_message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS)
if ((sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) &&
(sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED)) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
break;
}
ogs_warn("[%s] Ignore SBI message", amf_ue->supi);
break;
CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS)
SWITCH(sbi_message->h.method)
CASE(OGS_SBI_HTTP_METHOD_DELETE)
ogs_assert(true ==
amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
amf_nudm_uecm_build_registration_delete,
amf_ue, NULL));
break;
DEFAULT
ogs_warn("[%s] Ignore invalid HTTP method [%s]",
amf_ue->suci, sbi_message->h.method);
END
break;
DEFAULT
ogs_error("Invalid resource name [%s]",
sbi_message->h.resource.component[1]);
@ -217,6 +249,38 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
END
break;
CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH)
if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
break;
}
SWITCH(sbi_message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_5G_AKA)
CASE(OGS_SBI_RESOURCE_NAME_5G_AKA_CONFIRMATION)
CASE(OGS_SBI_RESOURCE_NAME_EAP_SESSION)
ogs_warn("[%s] Ignore SBI message", amf_ue->supi);
break;
CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS)
SWITCH(sbi_message->h.method)
CASE(OGS_SBI_HTTP_METHOD_DELETE)
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka = NULL;
break;
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
amf_ue->suci, sbi_message->h.method);
END
break;
DEFAULT
ogs_error("Invalid resource name [%s]",
sbi_message->h.resource.component[1]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL)
SWITCH(sbi_message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_POLICIES)

View File

@ -80,6 +80,25 @@ end:
return request;
}
ogs_sbi_request_t *amf_nausf_auth_build_authenticate_delete(
amf_ue_t *amf_ue, void *data)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
ogs_assert(amf_ue);
ogs_assert(amf_ue->confirmation_url_for_5g_aka);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.uri = amf_ue->confirmation_url_for_5g_aka;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}
ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
amf_ue_t *amf_ue, void *data)
{

View File

@ -28,6 +28,8 @@ extern "C" {
ogs_sbi_request_t *amf_nausf_auth_build_authenticate(
amf_ue_t *amf_ue, void *data);
ogs_sbi_request_t *amf_nausf_auth_build_authenticate_delete(
amf_ue_t *amf_ue, void *data);
ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
amf_ue_t *amf_ue, void *data);

View File

@ -239,3 +239,28 @@ end:
return request;
}
ogs_sbi_request_t *amf_nudm_sdm_build_subscription_delete(
amf_ue_t *amf_ue, void *data)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
ogs_assert(amf_ue);
ogs_assert(amf_ue->supi);
ogs_assert(amf_ue->data_change_subscription_id);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_SDM;
message.h.api.version = (char *)OGS_SBI_API_V2;
message.h.resource.component[0] = amf_ue->supi;
message.h.resource.component[1] =
(char *)OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS;
message.h.resource.component[2] = amf_ue->data_change_subscription_id;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}

View File

@ -33,6 +33,8 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration_delete(
ogs_sbi_request_t *amf_nudm_sdm_build_get(amf_ue_t *amf_ue, void *data);
ogs_sbi_request_t *amf_nudm_sdm_build_subscription(
amf_ue_t *amf_ue, void *data);
ogs_sbi_request_t *amf_nudm_sdm_build_subscription_delete(
amf_ue_t *amf_ue, void *data);
#ifdef __cplusplus
}