Re-factoring 5GC for solving crash issue

This commit is contained in:
Sukchan Lee 2020-08-02 23:22:41 -04:00
parent 4d5b38c8f4
commit bcffdd823e
79 changed files with 971 additions and 945 deletions

View File

@ -21,7 +21,7 @@ description: >- # this means to ignore newlines until "baseurl:"
baseurl: "/open5gs" # the subpath of your site, e.g. /blog
url: "https://open5gs.org" # the base hostname & protocol for your site, e.g. http://example.com
author: "Sukchan Lee"
github_username: open5gs
github_username: acetcom
google_analytics: UA-139225646-2
# Build settings

View File

@ -63,13 +63,22 @@ typedef struct ogs_pfcp_xact_s {
void *assoc_xact; /**< Associated GTP transaction */
void *assoc_session; /**< Associated SBI session */
#define OGS_PFCP_5GC_MODIFY_CREATE ((uint64_t)1<<0)
#define OGS_PFCP_5GC_MODIFY_TFT_UPDATE ((uint64_t)1<<1)
#define OGS_PFCP_5GC_MODIFY_QOS_UPDATE ((uint64_t)1<<2)
#define OGS_PFCP_5GC_MODIFY_REMOVE ((uint64_t)1<<3)
#define OGS_PFCP_5GC_MODIFY_ACTIVATE ((uint64_t)1<<4)
#define OGS_PFCP_5GC_MODIFY_DEACTIVATE ((uint64_t)1<<5)
int modify_flags;
#define OGS_PFCP_5GC_DELETE_TRIGGER_UE_REQUESTED 1
#define OGS_PFCP_5GC_DELETE_TRIGGER_PCF_INITIATED 2
#define OGS_PFCP_5GC_DELETE_TRIGGER_RAN_INITIATED 3
#define OGS_PFCP_5GC_DELETE_TRIGGER_SMF_INITIATED 4
#define OGS_PFCP_5GC_DELETE_TRIGGER_AMF_RELEASE_SM_CONTEXT 5
#define OGS_PFCP_5GC_DELETE_TRIGGER_AMF_UPDATE_SM_CONTEXT 6
int trigger;
int delete_trigger;
} ogs_pfcp_xact_t;
int ogs_pfcp_xact_init(ogs_timer_mgr_t *timer_mgr, int size);

View File

@ -474,6 +474,8 @@ void ogs_sbi_client_send_request(
conn = connection_add(client, client_cb, request, data);
ogs_assert(conn);
ogs_sbi_request_free(request);
}
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data)

View File

@ -24,6 +24,7 @@ int __ogs_sbi_domain;
static OGS_POOL(nf_instance_pool, ogs_sbi_nf_instance_t);
static OGS_POOL(nf_service_pool, ogs_sbi_nf_service_t);
static OGS_POOL(xact_pool, ogs_sbi_xact_t);
static OGS_POOL(subscription_pool, ogs_sbi_subscription_t);
static ogs_sbi_context_t self;
@ -53,6 +54,8 @@ void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr)
ogs_pool_init(&nf_instance_pool, ogs_config()->max.nf);
ogs_pool_init(&nf_service_pool, ogs_config()->pool.nf_service);
ogs_pool_init(&xact_pool, ogs_config()->pool.sbi_message);
ogs_list_init(&self.subscription_list);
ogs_pool_init(&subscription_pool, ogs_config()->pool.nf_subscription);
@ -69,6 +72,8 @@ void ogs_sbi_context_final(void)
ogs_sbi_subscription_remove_all();
ogs_pool_final(&subscription_pool);
ogs_pool_final(&xact_pool);
ogs_sbi_nf_instance_remove_all();
ogs_pool_final(&nf_instance_pool);
ogs_pool_final(&nf_service_pool);
@ -869,8 +874,8 @@ static void nf_service_associate_client_all(ogs_sbi_nf_instance_t *nf_instance)
nf_service_associate_client(nf_service);
}
bool ogs_sbi_nf_types_associate(
ogs_sbi_nf_types_t nf_types, OpenAPI_nf_type_e nf_type, void *state)
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
@ -879,15 +884,15 @@ bool ogs_sbi_nf_types_associate(
if (nf_instance) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(
nf_types, OpenAPI_nf_type_NRF)) {
nf_type_array, OpenAPI_nf_type_NRF)) {
ogs_warn("UE %s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(OpenAPI_nf_type_NRF),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_types[OpenAPI_nf_type_NRF].nf_instance);
nf_type_array[OpenAPI_nf_type_NRF].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_types[OpenAPI_nf_type_NRF], nf_instance);
&nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
return true;
}
}
@ -896,15 +901,15 @@ bool ogs_sbi_nf_types_associate(
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (nf_instance->nf_type == nf_type) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(nf_types, nf_type)) {
if (OGS_SBI_NF_INSTANCE_GET(nf_type_array, nf_type)) {
ogs_warn("%s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(nf_type),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_types[nf_type].nf_instance);
nf_type_array[nf_type].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_types[nf_type], nf_instance);
&nf_type_array[nf_type], nf_instance);
return true;
}
}
@ -978,13 +983,73 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
ogs_assert(sbi_object);
for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) {
if (sbi_object->nf_types[i].nf_instance)
ogs_sbi_nf_instance_remove(sbi_object->nf_types[i].nf_instance);
}
if (ogs_list_count(&sbi_object->xact_list))
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
if (sbi_object->request)
ogs_sbi_request_free(sbi_object->request);
for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) {
if (sbi_object->nf_type_array[i].nf_instance)
ogs_sbi_nf_instance_remove(
sbi_object->nf_type_array[i].nf_instance);
}
}
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build, void (*timer_cb)(void *data))
{
ogs_sbi_xact_t *xact = NULL;
ogs_assert(sbi_object);
ogs_pool_alloc(&xact_pool, &xact);
ogs_assert(xact);
memset(xact, 0, sizeof(ogs_sbi_xact_t));
xact->target_nf_type = target_nf_type;
xact->sbi_object = sbi_object;
xact->request = (*build)(sbi_object, data);
ogs_assert(xact->request);
xact->t_response = ogs_timer_add(
ogs_sbi_self()->timer_mgr, timer_cb, xact);
ogs_assert(xact->t_response);
ogs_timer_start(xact->t_response,
ogs_config()->time.message.sbi.client_wait_duration);
ogs_list_add(&sbi_object->xact_list, xact);
return xact;
}
void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact)
{
ogs_sbi_object_t *sbi_object = NULL;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
ogs_assert(xact->t_response);
ogs_timer_delete(xact->t_response);
/* If ogs_sbi_send() is called, xact->request has already been freed */
if (xact->request)
ogs_sbi_request_free(xact->request);
ogs_list_remove(&sbi_object->xact_list, xact);
ogs_pool_free(&xact_pool, xact);
}
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object)
{
ogs_sbi_xact_t *xact = NULL, *next_xact = NULL;
ogs_assert(sbi_object);
ogs_list_for_each_safe(&sbi_object->xact_list, next_xact, xact)
ogs_sbi_xact_remove(xact);
}
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void)

View File

@ -101,31 +101,36 @@ typedef struct ogs_sbi_nf_instance_s {
#define OGS_SBI_NF_INSTANCE_GET(__aRRAY, __nFType) \
((__aRRAY)[__nFType].nf_instance)
typedef struct ogs_sbi_nf_types_s {
typedef struct ogs_sbi_nf_type_array_s {
ogs_sbi_nf_instance_t *nf_instance;
} ogs_sbi_nf_types_t[OGS_SBI_MAX_NF_TYPE];
} ogs_sbi_nf_type_array_t[OGS_SBI_MAX_NF_TYPE];
typedef struct ogs_sbi_object_s {
ogs_lnode_t lnode;
struct {
ogs_timer_t *timer;
ogs_time_t duration;
} client_wait;
ogs_sbi_nf_type_array_t nf_type_array;
int running_count;
ogs_list_t xact_list;
OpenAPI_nf_type_e nf_type;
ogs_sbi_request_t *request;
ogs_sbi_nf_types_t nf_types;
ogs_sbi_session_t *session;
void *nf_state_registered;
ogs_sbi_client_cb_f client_cb;
} ogs_sbi_object_t;
typedef ogs_sbi_request_t *(*ogs_sbi_build_f)(
ogs_sbi_object_t *sbi_object, void *data);
typedef struct ogs_sbi_xact_s {
ogs_lnode_t lnode;
OpenAPI_nf_type_e target_nf_type;
ogs_sbi_request_t *request;
ogs_timer_t *t_response;
ogs_sbi_session_t *assoc_session;
uint8_t state;
ogs_sbi_object_t *sbi_object;
} ogs_sbi_xact_t;
typedef struct ogs_sbi_nf_service_s {
ogs_lnode_t lnode;
@ -174,20 +179,6 @@ typedef struct ogs_sbi_subscription_s {
void *client; /* only used in SERVER */
} ogs_sbi_subscription_t;
typedef struct ogs_sbi_discover_s {
OpenAPI_nf_type_e nf_type;
char *uri;
struct {
char *name;
} service;
struct {
char *version;
} api;
ogs_sbi_request_t *request;
} ogs_sbi_discover_t;
void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr);
void ogs_sbi_context_final(void);
ogs_sbi_context_t *ogs_sbi_self(void);
@ -220,11 +211,17 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version);
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_sbi_nf_types_associate(
ogs_sbi_nf_types_t nf_types, OpenAPI_nf_type_e nf_type, void *state);
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state);
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build, void (*timer_cb)(void *data));
void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact);
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object);
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void);
void ogs_sbi_subscription_set_id(
ogs_sbi_subscription_t *subscription, char *id);

View File

@ -18,58 +18,66 @@
*/
#include "ogs-sbi.h"
#include "ogs-app.h"
static ogs_sbi_nf_instance_t *find_or_discover_nf_instance(
ogs_sbi_object_t *sbi_object, bool *nrf, bool *nf)
bool *nrf, bool *nf,
ogs_sbi_xact_t *xact, ogs_fsm_handler_t nf_state_registered)
{
ogs_assert(sbi_object);
ogs_assert(sbi_object->nf_type);
ogs_assert(sbi_object->nf_state_registered);
ogs_assert(sbi_object->client_wait.duration);
ogs_sbi_object_t *sbi_object = NULL;
ogs_assert(nrf);
ogs_assert(nf);
if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_types, OpenAPI_nf_type_NRF))
*nrf = ogs_sbi_nf_types_associate(sbi_object->nf_types,
OpenAPI_nf_type_NRF, sbi_object->nf_state_registered);
if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_types,
sbi_object->nf_type))
*nf = ogs_sbi_nf_types_associate(sbi_object->nf_types,
sbi_object->nf_type, sbi_object->nf_state_registered);
ogs_assert(xact);
ogs_assert(xact->target_nf_type);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
ogs_assert(nf_state_registered);
if (!OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_type_array, OpenAPI_nf_type_NRF))
*nrf = ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
OpenAPI_nf_type_NRF, nf_state_registered);
if (!OGS_SBI_NF_INSTANCE_GET(sbi_object->nf_type_array,
xact->target_nf_type))
*nf = ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
xact->target_nf_type, nf_state_registered);
if (*nrf == false && *nf == false) {
ogs_error("Cannot discover [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
return NULL;
}
if (*nf == false) {
ogs_warn("Try to discover [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
ogs_timer_start(sbi_object->client_wait.timer,
sbi_object->client_wait.duration);
OpenAPI_nf_type_ToString(xact->target_nf_type));
ogs_nnrf_disc_send_nf_discover(
sbi_object->nf_types[OpenAPI_nf_type_NRF].nf_instance,
sbi_object->nf_type, sbi_object);
sbi_object->nf_type_array[OpenAPI_nf_type_NRF].nf_instance,
xact->target_nf_type, xact);
return NULL;
}
return sbi_object->nf_types[sbi_object->nf_type].nf_instance;
return sbi_object->nf_type_array[xact->target_nf_type].nf_instance;
}
void ogs_sbi_send(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_object_t *sbi_object)
void ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
request = sbi_object->request;
request = xact->request;
ogs_assert(request);
ogs_assert(sbi_object->client_wait.duration);
ogs_assert(sbi_object->client_cb);
ogs_assert(nf_instance);
@ -102,36 +110,30 @@ void ogs_sbi_send(
}
ogs_sbi_client_send_request(
client, sbi_object->client_cb, request, sbi_object);
client, client_cb, request, xact);
/* Prevent ogs_sbi_request_free() in ogs_sbi_xact_remove() */
xact->request = NULL;
}
bool ogs_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build)
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact,
ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb)
{
bool nrf = true;
bool nf = true;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(sbi_object);
ogs_assert(nf_type);
ogs_assert(build);
ogs_assert(xact);
ogs_assert(nf_state_registered);
ogs_assert(client_cb);
sbi_object->running_count++;
ogs_timer_start(sbi_object->client_wait.timer,
sbi_object->client_wait.duration);
sbi_object->nf_type = nf_type;
if (sbi_object->request)
ogs_sbi_request_free(sbi_object->request);
sbi_object->request = (*build)(sbi_object, data);
nf_instance = find_or_discover_nf_instance(sbi_object, &nrf, &nf);
nf_instance = find_or_discover_nf_instance(
&nrf, &nf, xact, nf_state_registered);
if (nrf == false && nf == false) return false;
if (!nf_instance) return true;
ogs_sbi_send(nf_instance, sbi_object);
ogs_sbi_send(nf_instance, client_cb, xact);
return true;
}
@ -148,7 +150,6 @@ void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance)
request = ogs_nnrf_nfm_build_register(nf_instance);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, nf_instance);
ogs_sbi_request_free(request);
}
void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance)
@ -163,7 +164,6 @@ void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance)
request = ogs_nnrf_nfm_build_update(nf_instance);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, nf_instance);
ogs_sbi_request_free(request);
}
void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance)
@ -178,7 +178,6 @@ void ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance)
request = ogs_nnrf_nfm_build_de_register(nf_instance);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, nf_instance);
ogs_sbi_request_free(request);
}
void ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client,
@ -200,7 +199,6 @@ void ogs_nnrf_nfm_send_nf_status_subscribe(ogs_sbi_client_t *client,
request = ogs_nnrf_nfm_build_status_subscribe(subscription);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, subscription);
ogs_sbi_request_free(request);
}
void ogs_nnrf_nfm_send_nf_status_unsubscribe(
@ -216,7 +214,6 @@ void ogs_nnrf_nfm_send_nf_status_unsubscribe(
request = ogs_nnrf_nfm_build_status_unsubscribe(subscription);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, subscription);
ogs_sbi_request_free(request);
}
void ogs_nnrf_disc_send_nf_discover(ogs_sbi_nf_instance_t *nf_instance,
@ -234,5 +231,4 @@ void ogs_nnrf_disc_send_nf_discover(ogs_sbi_nf_instance_t *nf_instance,
target_nf_type, nf_instance->nf_type);
ogs_assert(request);
ogs_sbi_client_send_request(client, client->cb, request, data);
ogs_sbi_request_free(request);
}

View File

@ -26,14 +26,10 @@
extern "C" {
#endif
typedef ogs_sbi_request_t *(*ogs_sbi_build_f)(
ogs_sbi_object_t *sbi_object, void *data);
void ogs_sbi_send(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_object_t *sbi_object);
bool ogs_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, ogs_sbi_object_t *sbi_object, void *data,
ogs_sbi_build_f build);
void ogs_sbi_send(ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact);
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact,
ogs_fsm_handler_t nf_state_registered, ogs_sbi_client_cb_f client_cb);
void ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance);
void ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance);

View File

@ -28,13 +28,6 @@
extern "C" {
#endif
#define OGS_SETUP_SBI_SESSION(__cTX, __pSESSION) \
do { \
ogs_assert((__cTX)); \
ogs_assert((__pSESSION)); \
(__cTX)->session = __pSESSION; \
} while(0)
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
typedef struct ogs_sbi_session_s ogs_sbi_session_t;

View File

@ -62,6 +62,8 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
amf_sess_t *sess = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_xact_t *sbi_xact = NULL;
int state = AMF_UPDATE_SM_CONTEXT_NO_STATE;
ogs_sbi_session_t *session = NULL;
ogs_sbi_request_t *sbi_request = NULL;
@ -341,13 +343,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC)
SWITCH(sbi_message.h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
SWITCH(sbi_message.h.method)
CASE(OGS_SBI_HTTP_METHOD_GET)
if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK)
amf_nnrf_handle_nf_discover(sbi_object, &sbi_message);
amf_nnrf_handle_nf_discover(sbi_xact, &sbi_message);
else
ogs_error("HTTP response error [%d]",
sbi_message.res_status);
@ -369,43 +371,75 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH)
CASE(OGS_SBI_SERVICE_NAME_NUDM_UECM)
CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
amf_ue = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
amf_ue = (amf_ue_t *)sbi_xact->sbi_object;
ogs_assert(amf_ue);
amf_ue = amf_ue_cycle(amf_ue);
ogs_assert(amf_ue);
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
e->amf_ue = amf_ue;
e->sbi.message = &sbi_message;;
amf_ue->sbi.running_count--;
ogs_timer_stop(amf_ue->sbi.client_wait.timer);
ogs_sbi_xact_remove(sbi_xact);
ogs_fsm_dispatch(&amf_ue->sm, e);
break;
CASE(OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION)
sess = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
sess = (amf_sess_t *)sbi_xact->sbi_object;
ogs_assert(sess);
sess = amf_sess_cycle(sess);
/*
* 1. If AMF-UE context is duplicated in Identity-Response,
* OLD AMF-UE's all session contexts are removed.
* 2. If there is an unfinished transaction with SMF,
* Transaction's session context is NULL.
*
* For example,
*
* 1. gNB->AMF : PDUSessionResourceSetupResponse
* 2. AMF->SMF : [POST] /nsmf-pdusession/v1/sm-contexts/1/modify
* 3. UE ->AMF : Registration request with Unknwon GUTI
* 4. AMF->UE : Identity request
* 5. UE ->AMF : Identity response
* AMF UE context duplicated.
* All session contexts are removed
* 6. SMF->AMF : RESPONSE /nsmf-pdusession/v1/sm-contexts/1/modify
* No Session Context
* Assertion
*
* IF THIS HAPPENS IN THE REAL WORLD,
* I WILL MODIFY THE ASSERTS BELOW.
*/
ogs_assert(sess);
amf_ue = sess->amf_ue;
ogs_assert(amf_ue);
amf_ue = amf_ue_cycle(amf_ue);
ogs_assert(amf_ue);
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
e->amf_ue = amf_ue;
e->sess = sess;
e->sbi.message = &sbi_message;;
sess->sbi.running_count--;
ogs_timer_stop(sess->sbi.client_wait.timer);
state = sbi_xact->state;
ogs_sbi_xact_remove(sbi_xact);
SWITCH(sbi_message.h.resource.component[2])
CASE(OGS_SBI_RESOURCE_NAME_MODIFY)
amf_nsmf_pdu_session_handle_update_sm_context(
sess, &sbi_message);
sess, state, &sbi_message);
break;
CASE(OGS_SBI_RESOURCE_NAME_RELEASE)
@ -466,12 +500,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
break;
case AMF_TIMER_SBI_CLIENT_WAIT:
sbi_object = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
sbi_object = sbi_xact->sbi_object;
ogs_assert(sbi_object);
sbi_object->running_count--;
switch(sbi_object->nf_type) {
switch(sbi_xact->target_nf_type) {
case OpenAPI_nf_type_AUSF:
case OpenAPI_nf_type_UDM:
amf_ue = (amf_ue_t *)sbi_object;
@ -498,9 +533,12 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
default:
ogs_fatal("Not implemented [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(sbi_xact->target_nf_type));
}
ogs_sbi_xact_remove(sbi_xact);
break;
default:
ogs_error("Unknown timer[%s:%d]",
amf_timer_get_name(e->timer_id), e->timer_id);

View File

@ -1108,9 +1108,6 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue)
amf_ue_new_guti(amf_ue);
/* Add All Timers */
amf_ue->sbi.client_wait.timer = ogs_timer_add(
self.timer_mgr, amf_timer_sbi_client_wait_expire, amf_ue);
amf_ue->t3513.timer = ogs_timer_add(
self.timer_mgr, amf_timer_t3513_expire, amf_ue);
amf_ue->t3513.pkbuf = NULL;
@ -1197,12 +1194,7 @@ void amf_ue_remove(amf_ue_t *amf_ue)
ogs_timer_delete(amf_ue->t3570.timer);
/* Free SBI object memory */
if (amf_ue->sbi.running_count)
ogs_error("[%s] SBI running [%d]",
amf_ue->supi ? amf_ue->supi : "Unknown",
amf_ue->sbi.running_count);
ogs_sbi_object_free(&amf_ue->sbi);
ogs_timer_delete(amf_ue->sbi.client_wait.timer);
amf_ue_deassociate(amf_ue);
@ -1370,9 +1362,16 @@ void amf_ue_set_suci(amf_ue_t *amf_ue,
/* Check if OLD amf_ue_t is different with NEW amf_ue_t */
if (ogs_pool_index(&amf_ue_pool, amf_ue) !=
ogs_pool_index(&amf_ue_pool, old_amf_ue)) {
ogs_warn("[%s] OLD UE Context Release", suci);
if (old_amf_ue->ran_ue)
ran_ue_deassociate(old_amf_ue->ran_ue);
if (CM_CONNECTED(old_amf_ue)) {
/* Implcit NG release */
ogs_debug("[%s] Implicit NG release", suci);
ogs_debug("[%s] RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
old_amf_ue->suci, old_amf_ue->ran_ue->ran_ue_ngap_id,
(long long)old_amf_ue->ran_ue->amf_ue_ngap_id);
ran_ue_remove(old_amf_ue->ran_ue);
}
amf_ue_remove(old_amf_ue);
}
}
@ -1480,9 +1479,6 @@ amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi)
sess->s_nssai.mapped_hplmn_sst = 0;
sess->s_nssai.mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE;
sess->sbi.client_wait.timer = ogs_timer_add(
self.timer_mgr, amf_timer_sbi_client_wait_expire, sess);
ogs_list_add(&amf_ue->sess_list, sess);
return sess;
@ -1496,12 +1492,7 @@ void amf_sess_remove(amf_sess_t *sess)
ogs_list_remove(&sess->amf_ue->sess_list, sess);
/* Free SBI object memory */
if (sess->sbi.running_count)
ogs_error("[%s:%d] SBI running [%d]",
sess->amf_ue->supi ? sess->amf_ue->supi : "Unknown",
sess->psi, sess->sbi.running_count);
ogs_sbi_object_free(&sess->sbi);
ogs_timer_delete(sess->sbi.client_wait.timer);
if (sess->sm_context_ref)
ogs_free(sess->sm_context_ref);
@ -1550,25 +1541,17 @@ amf_sess_t *amf_sess_cycle(amf_sess_t *sess)
return ogs_pool_cycle(&amf_sess_pool, sess);
}
bool amf_ue_sync_done(amf_ue_t *amf_ue)
int amf_sess_xact_count(amf_ue_t *amf_ue)
{
amf_sess_t *sess = NULL;
int xact_count = 0;
ogs_assert(amf_ue);
if (amf_ue->sbi.running_count) return false;
ogs_list_for_each(&amf_ue->sess_list, sess)
if (sess->sbi.running_count) return false;
xact_count += ogs_list_count(&sess->sbi.xact_list);
return true;
}
bool amf_sess_sync_done(amf_sess_t *sess)
{
ogs_assert(sess);
if (sess->sbi.running_count) return false;
return true;
return xact_count;;
}
int amf_find_served_tai(ogs_5gs_tai_t *tai)

View File

@ -396,21 +396,47 @@ typedef struct amf_sess_s {
ogs_free((__sESS)->sm_context_ref); \
(__sESS)->sm_context_ref = NULL; \
} while(0);
char *sm_context_ref; /* smContextRef from SMF */
#define SESSION_SYNC_DONE(__aMF) \
(amf_ue_sync_done(__aMF) == true)
/* SMF sends the RESPONSE
* of [POST] /nsmf-pdusession/v1/sm-contexts */
char *sm_context_ref;
/* UE session context is activated or not */
OpenAPI_up_cnx_state_e ueUpCnxState;
/* SMF session context is activated or not */
OpenAPI_up_cnx_state_e smfUpCnxState;
/* SMF notify status when PDU session release complete is received */
OpenAPI_resource_status_e resource_status;
ogs_pkbuf_t *n2smbuf;
/* SMF sends the REQUEST
* of [POST] /namf-comm/v1/ue-contexts/{supi}/n1-n2-messages */
ogs_pkbuf_t *pdu_session_establishment_accept;
/*
* [AMF]
* 1. PDUSessionResourceReleaseResponse
* REQUEST [POST] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
* 2. PDU Session release complete
* REQUEST [POST] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
*
* [SMF]
* 1. RESPONSE /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
* sess->n2_released = true;
*
* 2. RESPONSE /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
* sess->n1_released = true;
*
* 3. NOTIFY /namf-callback/v1/{supi}/sm-context-status/{psi})
* sess->resource_status = OpenAPI_resource_status_RELEASED;
*
* if (sess->n1_released == true &&
* sess->n2_released == true &&
* sess->resource_status == OpenAPI_resource_status_RELEASED) {
*
* REMOVE_SESSION_CONTEXT()
* }
*/
OpenAPI_resource_status_e resource_status;
bool n1_released;
bool n2_released;
/* SMF sends the RESPONSE
* of [POST] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify */
ogs_pkbuf_t *pdu_session_resource_setup_request_transfer;
/* last payload for sending back to the UE */
uint8_t payload_container_type;
ogs_pkbuf_t *payload_container;
@ -539,8 +565,8 @@ amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn);
amf_ue_t *amf_ue_cycle(amf_ue_t *amf_ue);
amf_sess_t *amf_sess_cycle(amf_sess_t *sess);
bool amf_ue_sync_done(amf_ue_t *amf_ue);
bool amf_sess_sync_done(amf_sess_t *sess);
#define SESSION_SYNC_DONE(__aMF) (amf_sess_xact_count(__aMF) == 0)
int amf_sess_xact_count(amf_ue_t *amf_ue);
int amf_find_served_tai(ogs_5gs_tai_t *tai);
ogs_s_nssai_t *amf_find_s_nssai(

View File

@ -842,7 +842,7 @@ static uint16_t get_pdu_session_reactivation_result(amf_ue_t *amf_ue)
ogs_assert(amf_ue);
ogs_list_for_each(&amf_ue->sess_list, sess) {
if (sess->smfUpCnxState == OpenAPI_up_cnx_state_DEACTIVATED)
if (!SESSION_CONTEXT_IN_SMF(sess))
psimask |= (1 << sess->psi);
}

View File

@ -399,6 +399,7 @@ int gmm_handle_service_update(amf_ue_t *amf_ue,
{
amf_sess_t *sess = NULL;
uint16_t psimask = 0;
int xact_count = 0;
ogs_nas_uplink_data_status_t *uplink_data_status = NULL;
ogs_nas_pdu_session_status_t *pdu_session_status = NULL;
@ -420,6 +421,8 @@ int gmm_handle_service_update(amf_ue_t *amf_ue,
amf_ue, &service_request->nas_message_container);
}
xact_count = amf_sess_xact_count(amf_ue);
if ((service_request->presencemask &
OGS_NAS_5GS_SERVICE_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT) == 0) {
amf_ue->nas.present.allowed_pdu_session_status = 0;
@ -491,7 +494,7 @@ int gmm_handle_service_update(amf_ue_t *amf_ue,
}
}
if (SESSION_SYNC_DONE(amf_ue))
if (amf_sess_xact_count(amf_ue) == xact_count)
nas_5gs_send_service_accept(amf_ue);
return OGS_OK;
@ -524,7 +527,8 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
ogs_debug(" Switch-Off");
amf_sbi_send_release_all_sessions(amf_ue);
if (SESSION_SYNC_DONE(amf_ue))
if (ogs_list_count(&amf_ue->sess_list) == 0)
nas_5gs_send_de_registration_accept(amf_ue);
return OGS_OK;
@ -931,8 +935,8 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
sess->dnn = ogs_strdup(dnn->value);
}
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, NULL,
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_NO_STATE, NULL,
amf_nsmf_pdu_session_build_create_sm_context);
} else {
@ -954,12 +958,13 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
param.ue_timezone = true;
}
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_N1_RELEASED, &param,
amf_nsmf_pdu_session_build_update_sm_context);
if (gsm_header->message_type ==
OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE) {
/* Prevent to invoke SMF for this session */
CLEAR_SM_CONTEXT_REF(sess);
}
}

View File

@ -93,6 +93,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
ran_ue_t *ran_ue = NULL;
ogs_nas_5gs_message_t *nas_message = NULL;
ogs_nas_security_header_type_t h;
int xact_count = 0;
ogs_assert(e);
@ -121,6 +122,8 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
h.type = e->nas.type;
amf_ue->nas.ngapProcedureCode = e->ngap.code;
xact_count = amf_sess_xact_count(amf_ue);
switch (nas_message->gmm.h.message_type) {
case OGS_NAS_5GS_REGISTRATION_REQUEST:
rv = gmm_handle_registration_request(
@ -149,7 +152,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
break;
}
if (SESSION_SYNC_DONE(amf_ue))
if (amf_sess_xact_count(amf_ue) == xact_count)
nas_5gs_send_registration_accept(amf_ue);
OGS_FSM_TRAN(s, &gmm_state_registered);
@ -157,7 +160,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
} else {
amf_sbi_send_release_all_sessions(amf_ue);
if (SESSION_SYNC_DONE(amf_ue)) {
if (amf_sess_xact_count(amf_ue) == xact_count) {
amf_ue_sbi_discover_and_send(
OpenAPI_nf_type_AUSF, amf_ue, NULL,
amf_nausf_auth_build_authenticate);
@ -218,7 +221,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
}
amf_sbi_send_release_all_sessions(amf_ue);
if (SESSION_SYNC_DONE(amf_ue)) {
if (amf_sess_xact_count(amf_ue) == xact_count) {
amf_ue_sbi_discover_and_send(OpenAPI_nf_type_AUSF, amf_ue, NULL,
amf_nausf_auth_build_authenticate);
}
@ -971,7 +974,8 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
CLEAR_AMF_UE_ALL_TIMERS(amf_ue);
amf_sbi_send_release_all_sessions(amf_ue);
if (SESSION_SYNC_DONE(amf_ue))
if (ogs_list_count(&amf_ue->sess_list) == 0)
ngap_send_amf_ue_context_release_command(amf_ue,
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);

View File

@ -258,26 +258,25 @@ int amf_namf_callback_handle_sm_context_status(
}
sess->resource_status = StatusInfo->resource_status;
if (sess->resource_status == OpenAPI_resource_status_RELEASED) {
ogs_debug("[%s:%d] SM context status released",
amf_ue->supi, sess->psi);
/*
* Race condition for PDU session release complete
* - CLIENT : /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
* - SERVER : /namf-callback/v1/{supi}/sm-context-status/{psi})
*
* If NOTIFICATION is received before the CLIENT response is received,
* CLIENT sync is not finished. In this case, the session context
* should not be removed.
*
* If NOTIFICATION comes after the CLIENT response is received,
* sync is done. So, the session context can be removed.
*/
if (amf_sess_sync_done(sess)) {
ogs_debug("[%s:%d] SM context remove", amf_ue->supi, sess->psi);
amf_nsmf_pdu_session_handle_release_sm_context(sess);
}
/*
* Race condition for PDU session release complete
* - CLIENT : /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
* - SERVER : /namf-callback/v1/{supi}/sm-context-status/{psi})
*
* If NOTIFICATION is received before the CLIENT response is received,
* CLIENT sync is not finished. In this case, the session context
* should not be removed.
*
* If NOTIFICATION comes after the CLIENT response is received,
* sync is done. So, the session context can be removed.
*/
if (sess->n1_released == true &&
sess->n2_released == true &&
sess->resource_status == OpenAPI_resource_status_RELEASED) {
ogs_debug("[%s:%d] SM context remove", amf_ue->supi, sess->psi);
amf_nsmf_pdu_session_handle_release_sm_context(sess);
}
cleanup:

View File

@ -305,34 +305,6 @@ void nas_5gs_send_configuration_update_command(
ogs_expect(rv == OGS_OK);
}
void nas_send_pdu_session_establishment_accept(amf_sess_t *sess,
ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf)
{
int rv;
amf_ue_t *amf_ue = NULL;
ogs_pkbuf_t *gmmbuf = NULL;
ogs_pkbuf_t *ngapbuf = NULL;
ogs_assert(sess);
amf_ue = sess->amf_ue;
ogs_assert(amf_ue);
ogs_assert(n1smbuf);
ogs_assert(n2smbuf);
gmmbuf = gmm_build_dl_nas_transport(sess,
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf, 0, 0);
ogs_expect_or_return(gmmbuf);
ngapbuf = ngap_build_pdu_session_resource_setup_request(
sess, gmmbuf, n2smbuf);
ogs_expect_or_return(ngapbuf);
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
ogs_expect(rv == OGS_OK);
}
void nas_send_pdu_session_release_command(amf_sess_t *sess,
ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf)
{

View File

@ -54,8 +54,6 @@ void nas_5gs_send_security_mode_command(amf_ue_t *amf_ue);
void nas_5gs_send_configuration_update_command(
amf_ue_t *amf_ue, gmm_configuration_update_command_param_t *param);
void nas_send_pdu_session_establishment_accept(amf_sess_t *sess,
ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf);
void nas_send_pdu_session_release_command(amf_sess_t *sess,
ogs_pkbuf_t *n1smbuf, ogs_pkbuf_t *n2smbuf);

View File

@ -388,7 +388,7 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request(
NGAP_S_NSSAI_t *s_NSSAI = NULL;
NGAP_SST_t *sST = NULL;
if (!sess->n2smbuf) continue;
if (!sess->pdu_session_resource_setup_request_transfer) continue;
if (!PDUSessionList) {
ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t));
@ -418,9 +418,11 @@ ogs_pkbuf_t *ngap_build_initial_context_setup_request(
}
transfer = &PDUSessionItem->pDUSessionResourceSetupRequestTransfer;
transfer->size = sess->n2smbuf->len;
transfer->size = sess->pdu_session_resource_setup_request_transfer->len;
transfer->buf = CALLOC(transfer->size, sizeof(uint8_t));
memcpy(transfer->buf, sess->n2smbuf->data, transfer->size);
memcpy(transfer->buf,
sess->pdu_session_resource_setup_request_transfer->data,
transfer->size);
}
ie = CALLOC(1, sizeof(NGAP_InitialContextSetupRequestIEs_t));

View File

@ -780,16 +780,14 @@ void ngap_handle_initial_context_setup_response(
return;
}
/* UPDATE_UpCnxState - ACTIVATED */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATED;
memset(&param, 0, sizeof(param));
param.n2smbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP;
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
/* UPDATE_UpCnxState - ACTIVATED */
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, &param,
amf_nsmf_pdu_session_build_update_sm_context);
ogs_pkbuf_free(param.n2smbuf);
@ -1134,6 +1132,8 @@ void ngap_handle_ue_context_release_request(
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
} else {
int xact_count = amf_sess_xact_count(amf_ue);
if (!PDUSessionList) {
amf_sbi_send_deactivate_all_sessions(
amf_ue, Cause->present, (int)Cause->choice.radioNetwork);
@ -1169,7 +1169,7 @@ void ngap_handle_ue_context_release_request(
}
}
if (SESSION_SYNC_DONE(amf_ue))
if (amf_sess_xact_count(amf_ue) == xact_count)
ngap_send_amf_ue_context_release_command(amf_ue,
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
@ -1441,16 +1441,14 @@ void ngap_handle_pdu_session_resource_setup_response(
return;
}
/* UPDATE_UpCnxState - ACTIVATED */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATED;
memset(&param, 0, sizeof(param));
param.n2smbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
param.n2SmInfoType = OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP;
ogs_pkbuf_put_data(param.n2smbuf, transfer->buf, transfer->size);
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
/* UPDATE_UpCnxState - ACTIVATED */
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATED, &param,
amf_nsmf_pdu_session_build_update_sm_context);
ogs_pkbuf_free(param.n2smbuf);
@ -1611,8 +1609,8 @@ 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);
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_N2_RELEASED, &param,
amf_nsmf_pdu_session_build_update_sm_context);
ogs_pkbuf_free(param.n2smbuf);

View File

@ -370,11 +370,12 @@ void ngap_send_session_sync_or_context_release_command(
ngap_send_ran_ue_context_release_command(ran_ue,
group, cause, action, delay);
} else {
int xact_count = amf_sess_xact_count(amf_ue);
amf_sbi_send_release_all_sessions(amf_ue);
if (SESSION_SYNC_DONE(amf_ue)) {
if (amf_sess_xact_count(amf_ue) == xact_count)
ngap_send_ran_ue_context_release_command(ran_ue,
group, cause, action, delay);
}
}
}

View File

@ -133,7 +133,7 @@ bool amf_nnrf_handle_nf_status_notify(
}
if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
ogs_error("[%s] The notification is not allowed",
ogs_warn("[%s] The notification is not allowed",
NFProfile->nf_instance_id);
ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
message, "The notification is not allowed",
@ -210,10 +210,11 @@ bool amf_nnrf_handle_nf_status_notify(
}
void amf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message)
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message)
{
bool handled;
ogs_sbi_object_t *sbi_object = NULL;
amf_ue_t *amf_ue = NULL;
amf_sess_t *sess = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
@ -221,6 +222,8 @@ void amf_nnrf_handle_nf_discover(
OpenAPI_search_result_t *SearchResult = NULL;
OpenAPI_lnode_t *node = NULL;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
ogs_assert(message);
@ -271,9 +274,9 @@ void amf_nnrf_handle_nf_discover(
}
if (!OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, nf_instance->nf_type))
ogs_sbi_nf_types_associate(sbi_object->nf_types,
nf_instance->nf_type, sbi_object->nf_state_registered);
sbi_object->nf_type_array, nf_instance->nf_type))
ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
nf_instance->nf_type, amf_nf_state_registered);
/* TIME : Update validity from NRF */
if (SearchResult->validity_period) {
@ -292,17 +295,17 @@ void amf_nnrf_handle_nf_discover(
}
}
ogs_assert(sbi_object->nf_type);
ogs_assert(xact->target_nf_type);
nf_instance = OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, sbi_object->nf_type);
sbi_object->nf_type_array, xact->target_nf_type);
if (!nf_instance) {
switch(sbi_object->nf_type) {
switch(xact->target_nf_type) {
case OpenAPI_nf_type_AUSF:
case OpenAPI_nf_type_UDM:
amf_ue = (amf_ue_t *)sbi_object;
ogs_assert(amf_ue);
ogs_error("[%s] (NF discover) No [%s]", amf_ue->suci,
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
break;
@ -310,7 +313,7 @@ void amf_nnrf_handle_nf_discover(
sess = (amf_sess_t *)sbi_object;
ogs_assert(sess);
ogs_error("[%d:%d] (NF discover) No [%s]", sess->psi, sess->pti,
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
if (sess->payload_container_type) {
nas_5gs_send_back_5gsm_message_from_sbi(sess,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
@ -322,9 +325,9 @@ void amf_nnrf_handle_nf_discover(
break;
default:
ogs_fatal("(NF discover) Not implemented [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
}
} else {
ogs_sbi_send(nf_instance, sbi_object);
amf_sbi_send(nf_instance, xact);
}
}

View File

@ -35,7 +35,7 @@ bool amf_nnrf_handle_nf_status_notify(
ogs_sbi_session_t *session, ogs_sbi_message_t *message);
void amf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message);
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
#ifdef __cplusplus
}

View File

@ -97,10 +97,6 @@ int amf_nsmf_pdu_session_handle_create_sm_context(
ogs_free(sess->sm_context_ref);
sess->sm_context_ref = ogs_strdup(message.h.resource.component[1]);
/* Update UpCnxState */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATING;
sess->smfUpCnxState = OpenAPI_up_cnx_state_ACTIVATING;
ogs_sbi_header_free(&header);
} else {
@ -147,7 +143,7 @@ int amf_nsmf_pdu_session_handle_create_sm_context(
}
int amf_nsmf_pdu_session_handle_update_sm_context(
amf_sess_t *sess, ogs_sbi_message_t *recvmsg)
amf_sess_t *sess, int state, ogs_sbi_message_t *recvmsg)
{
amf_ue_t *amf_ue = NULL;
ogs_assert(sess);
@ -164,9 +160,6 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
ogs_pkbuf_t *n1smbuf = NULL;
ogs_pkbuf_t *n2smbuf = NULL;
/* UPDATE_UpCnxState - SYNC */
sess->smfUpCnxState = sess->ueUpCnxState;
if (recvmsg->SmContextUpdatedData &&
recvmsg->SmContextUpdatedData->n2_sm_info) {
@ -200,22 +193,24 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
* To Deliver N2 SM Content to gNB Temporarily,
* Store N2 SM Context in Session Context
*/
if (sess->n2smbuf) {
if (sess->pdu_session_resource_setup_request_transfer) {
/*
* It should not be reached this way.
* If the problem occurred, free the old n2smbuf
*/
ogs_error("[%s:%d] N2 SM Content is duplicated",
amf_ue->supi, sess->psi);
ogs_pkbuf_free(sess->n2smbuf);
ogs_pkbuf_free(
sess->pdu_session_resource_setup_request_transfer);
}
/*
* NOTE : The pkbuf created in the SBI message will be removed
* from ogs_sbi_message_free().
* So it must be copied and push a event queue.
*/
sess->n2smbuf = ogs_pkbuf_copy(n2smbuf);
ogs_assert(sess->n2smbuf);
sess->pdu_session_resource_setup_request_transfer =
ogs_pkbuf_copy(n2smbuf);
ogs_assert(sess->pdu_session_resource_setup_request_transfer);
if (SESSION_SYNC_DONE(amf_ue)) {
nas_5gs_send_accept(amf_ue);
@ -225,9 +220,11 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
* For checking memory, NULL pointer should be set to n2smbuf.
*/
ogs_list_for_each(&amf_ue->sess_list, sess) {
if (sess->n2smbuf) {
ogs_pkbuf_free(sess->n2smbuf);
sess->n2smbuf = NULL;
if (sess->pdu_session_resource_setup_request_transfer) {
ogs_pkbuf_free(sess->
pdu_session_resource_setup_request_transfer);
sess->pdu_session_resource_setup_request_transfer =
NULL;
}
}
}
@ -264,26 +261,7 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
} else {
if (!SESSION_CONTEXT_IN_SMF(sess)) {
/*
* 1. PDU session release complete
* CLEAR_SM_CONTEXT_REF(sess) in gmm-handler.c
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
*
* If resource-status has already been updated by
* notify(/namf-callback/v1/{supi}/sm-context-status/{psi})
* Remove 'amf_sess_t' context to call
* amf_nsmf_pdu_session_handle_release_sm_context().
*/
ogs_debug("[%s:%d] Receive Update SM context",
amf_ue->supi, sess->psi);
if (sess->resource_status == OpenAPI_resource_status_RELEASED) {
ogs_debug("[%s:%d] SM context remove",
amf_ue->supi, sess->psi);
amf_nsmf_pdu_session_handle_release_sm_context(sess);
}
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_ACTIVATED) {
if (state == AMF_UPDATE_SM_CONTEXT_ACTIVATED) {
/*
* 1. PDUSessionResourceSetupResponse
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
@ -297,15 +275,7 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
* 3. PFCP Session Modifcation Request (Apply: FORWARD)
* 4. PFCP Session Modifcation Response
*/
/*
* 1. PDUSessionResourceReleaseResponse
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
*/
/* Nothing */
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_DEACTIVATED) {
} else if (state == AMF_UPDATE_SM_CONTEXT_DEACTIVATED) {
/*
* 1. UEContextReleaseRequest
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
@ -321,14 +291,51 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
}
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_ACTIVATING) {
} else if (state == AMF_UPDATE_SM_CONTEXT_ACTIVATING) {
/* Not reached here */
} else if (state == AMF_UPDATE_SM_CONTEXT_N2_RELEASED) {
/*
* 1. PDUSessionResourceReleaseResponse
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
*/
ogs_debug("[%s:%d] Receive Update SM context(N2-RELEASED)",
amf_ue->supi, sess->psi);
sess->n2_released = true;
} else if (state == AMF_UPDATE_SM_CONTEXT_N1_RELEASED) {
/*
* 1. PDU session release complete
* CLEAR_SM_CONTEXT_REF(sess) in gmm-handler.c
* 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
*/
ogs_debug("[%s:%d] Receive Update SM context(N1-RELEASED)",
amf_ue->supi, sess->psi);
sess->n1_released = true;
} else {
ogs_error("Invalid UpCnxState [UE:%d,SMF:%d]",
sess->ueUpCnxState, sess->smfUpCnxState);
ogs_error("Invalid STATE[%d]", state);
}
/*
* If resource-status has already been updated by
* notify(/namf-callback/v1/{supi}/sm-context-status/{psi})
* Remove 'amf_sess_t' context to call
* amf_nsmf_pdu_session_handle_release_sm_context().
*/
if (sess->n1_released == true &&
sess->n2_released == true &&
sess->resource_status == OpenAPI_resource_status_RELEASED) {
ogs_debug("[%s:%d] SM context remove", amf_ue->supi, sess->psi);
amf_nsmf_pdu_session_handle_release_sm_context(sess);
}
}
} else {
amf_ue_t *amf_ue = NULL;

View File

@ -29,7 +29,7 @@ extern "C" {
int amf_nsmf_pdu_session_handle_create_sm_context(
amf_sess_t *sess, ogs_sbi_message_t *message);
int amf_nsmf_pdu_session_handle_update_sm_context(
amf_sess_t *sess, ogs_sbi_message_t *message);
amf_sess_t *sess, int state, ogs_sbi_message_t *recvmsg);
int amf_nsmf_pdu_session_handle_release_sm_context(amf_sess_t *sess);
#ifdef __cplusplus

View File

@ -116,42 +116,54 @@ void amf_sbi_close(void)
ogs_sbi_server_stop_all();
}
void amf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_sbi_send(nf_instance, client_cb, xact);
}
void amf_ue_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, amf_ue_t *amf_ue, void *data,
OpenAPI_nf_type_e target_nf_type, amf_ue_t *amf_ue, void *data,
ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data))
{
ogs_assert(nf_type);
ogs_sbi_xact_t *xact = NULL;
ogs_assert(target_nf_type);
ogs_assert(amf_ue);
ogs_assert(build);
amf_ue->sbi.nf_state_registered = amf_nf_state_registered;
amf_ue->sbi.client_wait.duration =
ogs_config()->time.message.sbi.client_wait_duration;
amf_ue->sbi.client_cb = client_cb;
xact = ogs_sbi_xact_add(target_nf_type, &amf_ue->sbi, data,
(ogs_sbi_build_f)build, amf_timer_sbi_client_wait_expire);
ogs_assert(xact);
if (ogs_sbi_discover_and_send(
nf_type, &amf_ue->sbi, data, (ogs_sbi_build_f)build) != true) {
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
if (ogs_sbi_discover_and_send(xact,
(ogs_fsm_handler_t)amf_nf_state_registered, client_cb) != true) {
nas_5gs_send_gmm_reject_from_sbi(
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
}
}
void amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, amf_sess_t *sess, void *data,
void amf_sess_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
amf_sess_t *sess, int state, void *data,
ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data))
{
ogs_assert(nf_type);
ogs_sbi_xact_t *xact = NULL;
ogs_assert(target_nf_type);
ogs_assert(sess);
ogs_assert(build);
sess->sbi.nf_state_registered = amf_nf_state_registered;
sess->sbi.client_wait.duration =
ogs_config()->time.message.sbi.client_wait_duration;
sess->sbi.client_cb = client_cb;
xact = ogs_sbi_xact_add(target_nf_type, &sess->sbi, data,
(ogs_sbi_build_f)build, amf_timer_sbi_client_wait_expire);
ogs_assert(xact);
if (ogs_sbi_discover_and_send(
nf_type, &sess->sbi, data, (ogs_sbi_build_f)build) != true) {
nas_5gs_send_back_5gsm_message_from_sbi(sess,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
xact->state = state;
if (ogs_sbi_discover_and_send(xact,
(ogs_fsm_handler_t)amf_nf_state_registered, client_cb) != true) {
nas_5gs_send_back_5gsm_message_from_sbi(
sess, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
}
}
@ -161,13 +173,12 @@ void amf_sbi_send_activating_session(amf_sess_t *sess)
ogs_assert(sess);
/* UPDATE_UpCnxState - ACTIVATING */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATING;
memset(&param, 0, sizeof(param));
param.upCnxState = sess->ueUpCnxState;
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
param.upCnxState = OpenAPI_up_cnx_state_ACTIVATING;
/* UPDATE_UpCnxState - ACTIVATING */
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_ACTIVATING, &param,
amf_nsmf_pdu_session_build_update_sm_context);
}
@ -178,17 +189,16 @@ void amf_sbi_send_deactivate_session(
ogs_assert(sess);
/* UPDATE_UpCnxState - DEACTIVATED */
sess->ueUpCnxState = OpenAPI_up_cnx_state_DEACTIVATED;
memset(&param, 0, sizeof(param));
param.upCnxState = sess->ueUpCnxState;
param.upCnxState = OpenAPI_up_cnx_state_DEACTIVATED;
param.ngApCause.group = group;
param.ngApCause.value = cause;
param.ue_location = true;
param.ue_timezone = true;
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, &param,
/* UPDATE_UpCnxState - DEACTIVATED */
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
sess, AMF_UPDATE_SM_CONTEXT_DEACTIVATED, &param,
amf_nsmf_pdu_session_build_update_sm_context);
}
@ -210,8 +220,11 @@ void amf_sbi_send_release_session(amf_sess_t *sess)
ogs_assert(sess);
amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_SMF, sess, NULL,
OpenAPI_nf_type_SMF, sess, AMF_UPDATE_SM_CONTEXT_NO_STATE, NULL,
amf_nsmf_pdu_session_build_release_sm_context);
/* Prevent to invoke SMF for this session */
CLEAR_SM_CONTEXT_REF(sess);
}
void amf_sbi_send_release_all_sessions(amf_ue_t *amf_ue)

View File

@ -31,11 +31,20 @@ extern "C" {
int amf_sbi_open(void);
void amf_sbi_close(void);
void amf_ue_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, amf_ue_t *amf_ue, void *data,
void amf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
void amf_ue_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
amf_ue_t *amf_ue, void *data,
ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data));
void amf_sess_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, amf_sess_t *sess, void *data,
#define AMF_UPDATE_SM_CONTEXT_NO_STATE 0
#define AMF_UPDATE_SM_CONTEXT_ACTIVATED 1
#define AMF_UPDATE_SM_CONTEXT_DEACTIVATED 2
#define AMF_UPDATE_SM_CONTEXT_ACTIVATING 3
#define AMF_UPDATE_SM_CONTEXT_SUSPENDED 4
#define AMF_UPDATE_SM_CONTEXT_N2_RELEASED 5
#define AMF_UPDATE_SM_CONTEXT_N1_RELEASED 6
void amf_sess_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
amf_sess_t *sess, int state, void *data,
ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data));
void amf_sbi_send_activating_session(amf_sess_t *sess);

View File

@ -45,7 +45,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
ogs_sbi_subscription_t *subscription = NULL;
ogs_sbi_response_t *response = NULL;
ogs_sbi_message_t message;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_xact_t *sbi_xact = NULL;
ausf_ue_t *ausf_ue = NULL;
@ -152,8 +152,6 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
ogs_assert(OGS_FSM_STATE(&ausf_ue->sm));
OGS_SETUP_SBI_SESSION(&ausf_ue->sbi, session);
e->ausf_ue = ausf_ue;
e->sbi.message = &message;
ogs_fsm_dispatch(&ausf_ue->sm, e);
@ -250,13 +248,13 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC)
SWITCH(message.h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
SWITCH(message.h.method)
CASE(OGS_SBI_HTTP_METHOD_GET)
if (message.res_status == OGS_SBI_HTTP_STATUS_OK)
ausf_nnrf_handle_nf_discover(sbi_object, &message);
ausf_nnrf_handle_nf_discover(sbi_xact, &message);
else
ogs_error("HTTP response error [%d]",
message.res_status);
@ -276,7 +274,10 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
break;
CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
ausf_ue = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
ausf_ue = (ausf_ue_t *)sbi_xact->sbi_object;
ogs_assert(ausf_ue);
ausf_ue = ausf_ue_cycle(ausf_ue);
ogs_assert(ausf_ue);
@ -284,9 +285,9 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
e->ausf_ue = ausf_ue;
e->sbi.message = &message;
e->sbi.session = sbi_xact->assoc_session;
ausf_ue->sbi.running_count--;
ogs_timer_stop(ausf_ue->sbi.client_wait.timer);
ogs_sbi_xact_remove(sbi_xact);
ogs_fsm_dispatch(&ausf_ue->sm, e);
if (OGS_FSM_CHECK(&ausf_ue->sm, ausf_ue_state_exception)) {
@ -334,12 +335,13 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
break;
case AUSF_TIMER_SBI_CLIENT_WAIT:
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
session = sbi_object->session;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
session = sbi_xact->assoc_session;
ogs_assert(session);
sbi_object->running_count--;
ogs_sbi_xact_remove(sbi_xact);
ogs_error("Cannot receive SBI message");
ogs_sbi_server_send_error(session,

View File

@ -138,9 +138,6 @@ ausf_ue_t *ausf_ue_add(char *suci)
ogs_assert(ausf_ue->supi);
ogs_hash_set(self.supi_hash, ausf_ue->supi, strlen(ausf_ue->supi), ausf_ue);
ausf_ue->sbi.client_wait.timer = ogs_timer_add(
self.timer_mgr, ausf_timer_sbi_client_wait_expire, ausf_ue);
memset(&e, 0, sizeof(e));
e.ausf_ue = ausf_ue;
ogs_fsm_create(&ausf_ue->sm, ausf_ue_state_initial, ausf_ue_state_final);
@ -165,11 +162,7 @@ void ausf_ue_remove(ausf_ue_t *ausf_ue)
ogs_fsm_delete(&ausf_ue->sm);
/* Free SBI object memory */
if (ausf_ue->sbi.running_count)
ogs_error("[%s] SBI running [%d]",
ausf_ue->supi, ausf_ue->sbi.running_count);
ogs_sbi_object_free(&ausf_ue->sbi);
ogs_timer_delete(ausf_ue->sbi.client_wait.timer);
ogs_assert(ausf_ue->ctx_id);
ogs_free(ausf_ue->ctx_id);

View File

@ -21,16 +21,13 @@
#include "nnrf-handler.h"
#include "nausf-handler.h"
bool ausf_nausf_auth_handle_authenticate(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_session_t *session = NULL;
OpenAPI_authentication_info_t *AuthenticationInfo = NULL;
char *serving_network_name = NULL;
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
ogs_assert(session);
ogs_assert(recvmsg);
@ -54,24 +51,21 @@ bool ausf_nausf_auth_handle_authenticate(
ogs_free(ausf_ue->serving_network_name);
ausf_ue->serving_network_name = ogs_strdup(serving_network_name);
ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue,
ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, session,
AuthenticationInfo->resynchronization_info,
ausf_nudm_ueau_build_get);
return true;
}
bool ausf_nausf_auth_handle_authenticate_confirmation(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_session_t *session = NULL;
OpenAPI_confirmation_data_t *ConfirmationData = NULL;
char *res_star_string = NULL;
uint8_t res_star[OGS_KEYSTRLEN(OGS_MAX_RES_LEN)];
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
ogs_assert(session);
ogs_assert(recvmsg);
@ -103,7 +97,7 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(
ausf_ue->auth_result = OpenAPI_auth_result_AUTHENTICATION_SUCCESS;
}
ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, NULL,
ausf_sbi_discover_and_send(OpenAPI_nf_type_UDM, ausf_ue, session, NULL,
ausf_nudm_ueau_build_result_confirmation_inform);
return true;

View File

@ -26,10 +26,10 @@
extern "C" {
#endif
bool ausf_nausf_auth_handle_authenticate(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg);
bool ausf_nausf_auth_handle_authenticate_confirmation(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg);
bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@ -131,7 +131,7 @@ bool ausf_nnrf_handle_nf_status_notify(
}
if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
ogs_error("The notification is not allowed [%s]",
ogs_warn("The notification is not allowed [%s]",
NFProfile->nf_instance_id);
ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
message, "The notification is not allowed",
@ -208,8 +208,9 @@ bool ausf_nnrf_handle_nf_status_notify(
}
void ausf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message)
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message)
{
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_session_t *session = NULL;
@ -217,8 +218,10 @@ void ausf_nnrf_handle_nf_discover(
OpenAPI_lnode_t *node = NULL;
bool handled;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
session = sbi_object->session;
session = xact->assoc_session;
ogs_assert(session);
ogs_assert(message);
@ -269,9 +272,9 @@ void ausf_nnrf_handle_nf_discover(
}
if (!OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, nf_instance->nf_type))
ogs_sbi_nf_types_associate(sbi_object->nf_types,
nf_instance->nf_type, sbi_object->nf_state_registered);
sbi_object->nf_type_array, nf_instance->nf_type))
ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
nf_instance->nf_type, ausf_nf_state_registered);
/* TIME : Update validity from NRF */
if (SearchResult->validity_period) {
@ -290,13 +293,13 @@ void ausf_nnrf_handle_nf_discover(
}
}
ogs_assert(sbi_object->nf_type);
ogs_assert(xact->target_nf_type);
nf_instance = OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, sbi_object->nf_type);
sbi_object->nf_type_array, xact->target_nf_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
} else {
ogs_sbi_send(nf_instance, sbi_object);
ausf_sbi_send(nf_instance, xact);
}
}

View File

@ -35,7 +35,7 @@ bool ausf_nnrf_handle_nf_status_notify(
ogs_sbi_session_t *session, ogs_sbi_message_t *message);
void ausf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message);
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
#ifdef __cplusplus
}

View File

@ -32,10 +32,10 @@ static const char *links_member_name(OpenAPI_auth_type_e auth_type)
return NULL;
}
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_server_t *server = NULL;
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_header_t header;
@ -51,7 +51,6 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
OpenAPI_links_value_schema_t LinksValueSchemeValue;
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
ogs_assert(session);
server = ogs_sbi_session_get_server(session);
ogs_assert(server);
@ -206,11 +205,9 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
return true;
}
bool ausf_nudm_ueau_handle_result_confirmation_inform(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg)
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_response_t *response = NULL;
@ -220,7 +217,6 @@ bool ausf_nudm_ueau_handle_result_confirmation_inform(
OpenAPI_auth_event_t *AuthEvent = NULL;
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
ogs_assert(session);
ogs_assert(recvmsg);

View File

@ -26,9 +26,10 @@
extern "C" {
#endif
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg);
bool ausf_nudm_ueau_handle_result_confirmation_inform(
ausf_ue_t *ausf_ue, ogs_sbi_message_t *recvmsg);
bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}
#endif

View File

@ -114,26 +114,33 @@ void ausf_sbi_close(void)
ogs_sbi_server_stop_all();
}
void ausf_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, ausf_ue_t *ausf_ue, void *data,
void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_sbi_send(nf_instance, client_cb, xact);
}
void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
ausf_ue_t *ausf_ue, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data))
{
ogs_sbi_session_t *session = NULL;
ogs_sbi_xact_t *xact = NULL;
ogs_assert(target_nf_type);
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
ogs_assert(nf_type);
ogs_assert(session);
ogs_assert(build);
ausf_ue->sbi.nf_state_registered = ausf_nf_state_registered;
ausf_ue->sbi.client_wait.duration =
ogs_config()->time.message.sbi.client_wait_duration;
ausf_ue->sbi.client_cb = client_cb;
xact = ogs_sbi_xact_add(target_nf_type, &ausf_ue->sbi, data,
(ogs_sbi_build_f)build, ausf_timer_sbi_client_wait_expire);
ogs_assert(xact);
xact->assoc_session = session;
if (ogs_sbi_discover_and_send(xact,
(ogs_fsm_handler_t)ausf_nf_state_registered, client_cb) != true) {
if (ogs_sbi_discover_and_send(
nf_type, &ausf_ue->sbi, data, (ogs_sbi_build_f)build) != true) {
ogs_sbi_server_send_error(session,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
"Cannot discover", ausf_ue->suci);
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
"Cannot discover", ausf_ue->suci);
}
}

View File

@ -29,8 +29,9 @@ extern "C" {
int ausf_sbi_open(void);
void ausf_sbi_close(void);
void ausf_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, ausf_ue_t *ausf_ue, void *data,
void ausf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
void ausf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
ausf_ue_t *ausf_ue, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(ausf_ue_t *ausf_ue, void *data));
#ifdef __cplusplus

View File

@ -85,7 +85,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
handled = ausf_nausf_auth_handle_authenticate(
ausf_ue, message);
ausf_ue, session, message);
if (!handled) {
ogs_error("[%s] Cannot handle SBI message",
ausf_ue->suci);
@ -94,7 +94,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
break;
CASE(OGS_SBI_HTTP_METHOD_PUT)
handled = ausf_nausf_auth_handle_authenticate_confirmation(
ausf_ue, message);
ausf_ue, session, message);
if (!handled) {
ogs_error("[%s] Cannot handle SBI message",
ausf_ue->suci);
@ -114,9 +114,10 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
case AUSF_EVT_SBI_CLIENT:
message = e->sbi.message;
ogs_assert(message);
ausf_ue = e->sbi.data;
ausf_ue = e->ausf_ue;
ogs_assert(ausf_ue);
session = ausf_ue->sbi.session;
session = e->sbi.session;
ogs_assert(session);
SWITCH(message->h.service.name)
@ -138,12 +139,12 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
ausf_nudm_ueau_handle_get(ausf_ue, message);
ausf_nudm_ueau_handle_get(ausf_ue, session, message);
break;
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
ausf_nudm_ueau_handle_result_confirmation_inform(
ausf_ue, message);
ausf_ue, session, message);
break;
DEFAULT
@ -161,7 +162,8 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
default:
ogs_error("[%s] Unknown event %s", ausf_ue->suci, ausf_event_get_name(e));
ogs_error("[%s] Unknown event %s",
ausf_ue->suci, ausf_event_get_name(e));
break;
}
}

View File

@ -96,7 +96,6 @@ void nrf_nnrf_nfm_send_nf_status_notify(ogs_sbi_subscription_t *subscription,
client, subscription, event, nf_instance);
ogs_assert(request);
ogs_sbi_client_send_request(client, client_notify_cb, request, NULL);
ogs_sbi_request_free(request);
}
void nrf_nnrf_nfm_send_nf_status_notify_all(

View File

@ -696,8 +696,6 @@ smf_sess_t *smf_sess_add_by_apn(smf_ue_t *smf_ue, char *apn)
ogs_cpystrn(sess->pdn.apn, apn, OGS_MAX_APN_LEN+1);
/* Setup Timer */
sess->sbi.client_wait.timer = ogs_timer_add(
self.timer_mgr, smf_timer_sbi_client_wait_expire, sess);
sess->t_release_holding = ogs_timer_add(
self.timer_mgr, smf_timer_release_holding_expire, sess);
@ -809,8 +807,6 @@ smf_sess_t *smf_sess_add_by_psi(smf_ue_t *smf_ue, uint8_t psi)
sess->smf_n4_seid = sess->index;
/* Setup Timer */
sess->sbi.client_wait.timer = ogs_timer_add(
self.timer_mgr, smf_timer_sbi_client_wait_expire, sess);
sess->t_release_holding = ogs_timer_add(
self.timer_mgr, smf_timer_release_holding_expire, sess);
@ -983,12 +979,8 @@ void smf_sess_remove(smf_sess_t *sess)
ogs_freeaddrinfo(sess->upf_n3_addr6);
/* Free SBI object memory */
if (sess->sbi.running_count)
ogs_error("[%s:%d] SBI running [%d]",
smf_ue->supi, sess->psi, sess->sbi.running_count);
ogs_sbi_object_free(&sess->sbi);
ogs_timer_delete(sess->sbi.client_wait.timer);
ogs_timer_delete(sess->t_release_holding);
smf_bearer_remove_all(sess);

View File

@ -228,23 +228,10 @@ typedef struct smf_sess_s {
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE]; /* Saved from Gx */
int num_of_pcc_rule;
struct {
bool create;
bool tft_update;
bool qos_update;
bool outer_header_creation_update;
bool remove;
} pfcp_5gc_modify;
struct {
bool create_session_response_apn_ambr;
bool create_session_response_bearer_qos;
} gtp_5gc;;
/* UE session context is activated or not */
OpenAPI_up_cnx_state_e ueUpCnxState;
/* SMF session context is activated or not */
OpenAPI_up_cnx_state_e smfUpCnxState;
} gtp_5gc;
/* Release Holding timer of SMF session context */
ogs_timer_t *t_release_holding;

View File

@ -64,7 +64,7 @@ int gsm_handle_pdu_session_establishment_request(
extended_protocol_configuration_options);
}
smf_sbi_discover_and_send(OpenAPI_nf_type_UDM, sess,
smf_sbi_discover_and_send(OpenAPI_nf_type_UDM, sess, session,
(char *)OGS_SBI_RESOURCE_NAME_SM_DATA, smf_nudm_sdm_build_get);
return OGS_OK;

View File

@ -96,13 +96,15 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
case SMF_EVT_SBI_CLIENT:
sbi_message = e->sbi.message;
ogs_assert(sbi_message);
sess = e->sbi.data;
sess = e->sess;
ogs_assert(sess);
session = sess->sbi.session;
ogs_assert(session);
smf_ue = sess->smf_ue;
ogs_assert(smf_ue);
session = e->sbi.session;
ogs_assert(session);
SWITCH(sbi_message->h.service.name)
CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
SWITCH(sbi_message->h.resource.component[1])
@ -116,7 +118,8 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
break;
}
if (smf_nudm_sdm_handle_get(sess, sbi_message) != true) {
if (smf_nudm_sdm_handle_get(
sess, session, sbi_message) != true) {
ogs_sbi_server_send_error(session,
OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR,
sbi_message, "HTTP response error", smf_ue->supi);

View File

@ -327,54 +327,57 @@ static void build_update_qer(
}
}
static void build_update_far(smf_sess_t *sess,
static void build_update_dl_far_deactivate(
ogs_pfcp_tlv_update_far_t *message, int i, ogs_pfcp_far_t *far)
{
ogs_pfcp_sess_t *pfcp_sess = NULL;
ogs_assert(message);
ogs_assert(far);
pfcp_sess = far->sess;
ogs_assert(pfcp_sess);
ogs_assert(far->dst_if == OGS_PFCP_INTERFACE_ACCESS);
ogs_assert(far->outer_header_creation_len);
if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) {
message->presence = 1;
message->far_id.presence = 1;
message->far_id.u32 = far->id;
message->presence = 1;
message->far_id.presence = 1;
message->far_id.u32 = far->id;
if (sess->ueUpCnxState == OpenAPI_up_cnx_state_ACTIVATED) {
if (sess->pfcp_5gc_modify.outer_header_creation_update) {
memcpy(&farbuf[i].outer_header_creation,
&far->outer_header_creation, far->outer_header_creation_len);
farbuf[i].outer_header_creation.teid =
htobe32(far->outer_header_creation.teid);
message->update_forwarding_parameters.presence = 1;
message->update_forwarding_parameters.
outer_header_creation.presence = 1;
message->update_forwarding_parameters.
outer_header_creation.data = &farbuf[i].outer_header_creation;
message->update_forwarding_parameters.
outer_header_creation.len = far->outer_header_creation_len;
}
if (far->apply_action != OGS_PFCP_APPLY_ACTION_FORW) {
message->apply_action.presence = 1;
far->apply_action = OGS_PFCP_APPLY_ACTION_FORW;
}
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_DEACTIVATED) {
message->apply_action.presence = 1;
far->apply_action =
OGS_PFCP_APPLY_ACTION_BUFF | OGS_PFCP_APPLY_ACTION_NOCP;
} else {
ogs_error("Invalid UpCnxState [%d:%d]",
sess->ueUpCnxState, sess->smfUpCnxState);
}
if (message->apply_action.presence)
message->apply_action.presence = 1;
message->apply_action.u8 = far->apply_action;
}
}
static void build_update_dl_far_activate(
ogs_pfcp_tlv_update_far_t *message, int i, ogs_pfcp_far_t *far)
{
ogs_assert(message);
ogs_assert(far);
if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) {
ogs_assert(far->outer_header_creation_len);
message->presence = 1;
message->far_id.presence = 1;
message->far_id.u32 = far->id;
if (far->apply_action != OGS_PFCP_APPLY_ACTION_FORW) {
far->apply_action = OGS_PFCP_APPLY_ACTION_FORW;
message->apply_action.presence = 1;
message->apply_action.u8 = far->apply_action;
}
memcpy(&farbuf[i].outer_header_creation,
&far->outer_header_creation, far->outer_header_creation_len);
farbuf[i].outer_header_creation.teid =
htobe32(far->outer_header_creation.teid);
message->update_forwarding_parameters.presence = 1;
message->update_forwarding_parameters.
outer_header_creation.presence = 1;
message->update_forwarding_parameters.
outer_header_creation.data = &farbuf[i].outer_header_creation;
message->update_forwarding_parameters.
outer_header_creation.len = far->outer_header_creation_len;
}
}
ogs_pkbuf_t *smf_n4_build_session_establishment_request(
@ -471,130 +474,160 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request(
}
ogs_pkbuf_t *smf_5gc_n4_build_session_modification_request(
uint8_t type, smf_sess_t *sess)
uint8_t type, smf_sess_t *sess, uint64_t modify_flags)
{
int i;
ogs_pfcp_message_t pfcp_message;
ogs_pfcp_session_modification_request_t *req = NULL;
ogs_pfcp_pdr_t *pdr = NULL;
ogs_pfcp_far_t *far = NULL;
ogs_pfcp_qer_t *qer = NULL;
ogs_pkbuf_t *pkbuf = NULL;
smf_bearer_t *bearer = NULL;
ogs_debug("Session Modification Request");
ogs_assert(sess);
ogs_assert(modify_flags);
req = &pfcp_message.pfcp_session_modification_request;
memset(&pfcp_message, 0, sizeof(ogs_pfcp_message_t));
if (!sess->pfcp_5gc_modify.create &&
!sess->pfcp_5gc_modify.tft_update &&
!sess->pfcp_5gc_modify.qos_update &&
!sess->pfcp_5gc_modify.outer_header_creation_update &&
!sess->pfcp_5gc_modify.remove &&
sess->ueUpCnxState == sess->smfUpCnxState) {
ogs_error("No Session Modification [upCnxState:%d-%d]",
sess->ueUpCnxState,sess->smfUpCnxState);
return NULL;
}
if (sess->pfcp_5gc_modify.remove) {
if (modify_flags & OGS_PFCP_5GC_MODIFY_DEACTIVATE) {
/* Update FAR - Only DL */
i = 0;
ogs_list_for_each(&sess->bearer_list, bearer) {
/* Remove PDR */
i = 0;
ogs_list_for_each(&bearer->pfcp.pdr_list, pdr) {
ogs_pfcp_tlv_remove_pdr_t *message = &req->remove_pdr[i];
message->presence = 1;
message->pdr_id.presence = 1;
message->pdr_id.u16 = pdr->id;
i++;
}
/* Remove FAR */
i = 0;
ogs_list_for_each(&bearer->pfcp.far_list, far) {
ogs_pfcp_tlv_remove_far_t *message = &req->remove_far[i];
message->presence = 1;
message->far_id.presence = 1;
message->far_id.u32 = far->id;
build_update_dl_far_deactivate(&req->update_far[i], i, far);
i++;
}
/* Remove QER */
i = 0;
ogs_list_for_each(&bearer->pfcp.qer_list, qer) {
ogs_pfcp_tlv_remove_qer_t *message = &req->remove_qer[i];
message->presence = 1;
message->qer_id.presence = 1;
message->qer_id.u32 = qer->id;
i++;
}
}
} else {
if (sess->pfcp_5gc_modify.create) {
pdrbuf_init();
ogs_list_for_each(&sess->bearer_list, bearer) {
/* Create PDR */
i = 0;
ogs_list_for_each(&bearer->pfcp.pdr_list, pdr) {
build_create_pdr(&req->create_pdr[i], i, pdr);
i++;
}
/* Create FAR */
i = 0;
ogs_list_for_each(&bearer->pfcp.far_list, far) {
build_create_far(&req->create_far[i], i, far);
i++;
}
/* Create QER */
i = 0;
ogs_list_for_each(&bearer->pfcp.qer_list, qer) {
build_create_qer(&req->create_qer[i], i, qer);
i++;
}
}
}
if (sess->pfcp_5gc_modify.qos_update) {
/* Update QER */
i = 0;
ogs_list_for_each(&sess->bearer_list, bearer) {
ogs_list_for_each(&bearer->pfcp.qer_list, qer) {
build_update_qer(&req->update_qer[i], i, qer);
i++;
}
}
}
if (sess->ueUpCnxState != sess->smfUpCnxState) {
i = 0;
ogs_list_for_each(&sess->bearer_list, bearer) {
ogs_list_for_each(&bearer->pfcp.far_list, far) {
if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) {
build_update_far(sess, &req->update_far[i], i, far);
i++;
}
}
}
}
}
pfcp_message.h.type = type;
pkbuf = ogs_pfcp_build_msg(&pfcp_message);
if (sess->pfcp_5gc_modify.create) {
return pkbuf;
}
ogs_pkbuf_t *smf_5gc_n4_build_qos_flow_modification_request(
uint8_t type, smf_bearer_t *qos_flow, uint64_t modify_flags)
{
ogs_pfcp_message_t pfcp_message;
ogs_pfcp_session_modification_request_t *req = NULL;
ogs_pfcp_pdr_t *pdr = NULL;
ogs_pfcp_far_t *far = NULL;
ogs_pfcp_qer_t *qer = NULL;
ogs_pkbuf_t *pkbuf = NULL;
int i;
smf_sess_t *sess = NULL;
ogs_debug("QoS Flow Modification Request");
ogs_assert(qos_flow);
sess = qos_flow->sess;
ogs_assert(sess);
ogs_assert(modify_flags);
req = &pfcp_message.pfcp_session_modification_request;
memset(&pfcp_message, 0, sizeof(ogs_pfcp_message_t));
if (modify_flags & OGS_PFCP_5GC_MODIFY_REMOVE) {
/* Remove PDR */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.pdr_list, pdr) {
ogs_pfcp_tlv_remove_pdr_t *message = &req->remove_pdr[i];
message->presence = 1;
message->pdr_id.presence = 1;
message->pdr_id.u16 = pdr->id;
i++;
}
/* Remove FAR */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.far_list, far) {
ogs_pfcp_tlv_remove_far_t *message = &req->remove_far[i];
message->presence = 1;
message->far_id.presence = 1;
message->far_id.u32 = far->id;
i++;
}
/* Remove QER */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.qer_list, qer) {
ogs_pfcp_tlv_remove_qer_t *message = &req->remove_qer[i];
message->presence = 1;
message->qer_id.presence = 1;
message->qer_id.u32 = qer->id;
i++;
}
} else {
if (modify_flags & OGS_PFCP_5GC_MODIFY_CREATE) {
pdrbuf_init();
/* Create PDR */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.pdr_list, pdr) {
build_create_pdr(&req->create_pdr[i], i, pdr);
i++;
}
/* Create FAR */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.far_list, far) {
build_create_far(&req->create_far[i], i, far);
i++;
}
/* Create QER */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.qer_list, qer) {
build_create_qer(&req->create_qer[i], i, qer);
i++;
}
}
if (modify_flags & OGS_PFCP_5GC_MODIFY_QOS_UPDATE) {
/* Update QER */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.qer_list, qer) {
build_update_qer(&req->update_qer[i], i, qer);
i++;
}
}
if (modify_flags & OGS_PFCP_5GC_MODIFY_ACTIVATE) {
/* Update FAR - Only DL */
i = 0;
ogs_list_for_each(&qos_flow->pfcp.far_list, far) {
build_update_dl_far_activate(&req->update_far[i], i, far);
i++;
}
}
}
pfcp_message.h.type = type;
pkbuf = ogs_pfcp_build_msg(&pfcp_message);
if (modify_flags & OGS_PFCP_5GC_MODIFY_CREATE) {
pdrbuf_clear();
}
return pkbuf;
}
ogs_pkbuf_t *smf_n4_build_session_deletion_request(
uint8_t type, smf_sess_t *sess)
{
ogs_pfcp_message_t pfcp_message;
ogs_debug("Session Deletion Request");
ogs_assert(sess);
pfcp_message.h.type = type;
return ogs_pfcp_build_msg(&pfcp_message);
}
ogs_pkbuf_t *smf_epc_n4_build_session_modification_request(
uint8_t type, smf_bearer_t *bearer)
{
@ -701,15 +734,3 @@ ogs_pkbuf_t *smf_epc_n4_build_session_modification_request(
return pkbuf;
}
ogs_pkbuf_t *smf_n4_build_session_deletion_request(
uint8_t type, smf_sess_t *sess)
{
ogs_pfcp_message_t pfcp_message;
ogs_debug("Session Deletion Request");
ogs_assert(sess);
pfcp_message.h.type = type;
return ogs_pfcp_build_msg(&pfcp_message);
}

View File

@ -32,13 +32,18 @@ ogs_pkbuf_t *smf_n4_build_association_setup_response(uint8_t type,
ogs_pkbuf_t *smf_n4_build_session_establishment_request(
uint8_t type, smf_sess_t *sess);
ogs_pkbuf_t *smf_5gc_n4_build_session_modification_request(
uint8_t type, smf_sess_t *sess);
ogs_pkbuf_t *smf_epc_n4_build_session_modification_request(
uint8_t type, smf_bearer_t *bearer);
uint8_t type, smf_sess_t *sess, uint64_t modify_flags);
ogs_pkbuf_t *smf_5gc_n4_build_qos_flow_modification_request(
uint8_t type, smf_bearer_t *qos_flow, uint64_t modify_flags);
ogs_pkbuf_t *smf_n4_build_session_deletion_request(
uint8_t type, smf_sess_t *sess);
ogs_pkbuf_t *smf_epc_n4_build_session_modification_request(
uint8_t type, smf_bearer_t *bearer);
#ifdef __cplusplus
}
#endif

View File

@ -173,11 +173,16 @@ void smf_5gc_n4_handle_session_establishment_response(
smf_sess_t *sess, ogs_pfcp_xact_t *xact,
ogs_pfcp_session_establishment_response_t *rsp)
{
ogs_sbi_session_t *session = NULL;
ogs_pfcp_f_seid_t *up_f_seid = NULL;
ogs_assert(xact);
ogs_assert(rsp);
session = xact->assoc_session;
ogs_assert(session);
ogs_pfcp_xact_commit(xact);
if (!sess) {
@ -207,11 +212,7 @@ void smf_5gc_n4_handle_session_establishment_response(
ogs_assert(up_f_seid);
sess->upf_n4_seid = be64toh(up_f_seid->seid);
/* UPDATE_UpCnxState - ACTIVATING */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATING;
sess->smfUpCnxState = OpenAPI_up_cnx_state_ACTIVATING;
smf_sbi_discover_and_send(OpenAPI_nf_type_AMF, sess, NULL,
smf_sbi_discover_and_send(OpenAPI_nf_type_AMF, sess, session, NULL,
smf_namf_comm_build_n1_n2_message_transfer);
#if 0
@ -224,6 +225,7 @@ void smf_5gc_n4_handle_session_modification_response(
ogs_pfcp_session_modification_response_t *rsp)
{
int status = 0;
uint64_t flags = 0;
ogs_sbi_session_t *session = NULL;
ogs_assert(xact);
@ -231,6 +233,8 @@ void smf_5gc_n4_handle_session_modification_response(
session = xact->assoc_session;
ogs_assert(session);
flags = xact->modify_flags;
ogs_assert(flags);
ogs_pfcp_xact_commit(xact);
@ -262,10 +266,15 @@ void smf_5gc_n4_handle_session_modification_response(
ogs_assert(sess);
/* UPDATE_UpCnxState - SYNC */
sess->smfUpCnxState = sess->ueUpCnxState;
if (flags & OGS_PFCP_5GC_MODIFY_ACTIVATE) {
/* ACTIVATED Is NOT Inlcuded in RESPONSE */
smf_sbi_send_sm_context_updated_data(sess, session, 0);
smf_sbi_send_sm_context_updated_data(sess, session);
} else if (flags & OGS_PFCP_5GC_MODIFY_DEACTIVATE) {
/* Only ACTIVING & DEACTIVATED is Included */
smf_sbi_send_sm_context_updated_data(
sess, session, OpenAPI_up_cnx_state_DEACTIVATED);
}
}
void smf_5gc_n4_handle_session_deletion_response(
@ -285,7 +294,7 @@ void smf_5gc_n4_handle_session_deletion_response(
session = xact->assoc_session;
ogs_assert(session);
trigger = xact->trigger;
trigger = xact->delete_trigger;
ogs_assert(trigger);
ogs_pfcp_xact_commit(xact);

View File

@ -113,29 +113,23 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
&gTPTunnel->transportLayerAddress, &upf_n3_ip);
ogs_asn_OCTET_STRING_to_uint32(&gTPTunnel->gTP_TEID, &upf_n3_teid);
/* Need to Update? */
if (memcmp(&sess->gnb_n3_ip, &upf_n3_ip, sizeof(sess->gnb_n3_ip)) != 0 ||
sess->gnb_n3_teid != upf_n3_teid)
sess->pfcp_5gc_modify.outer_header_creation_update = true;
else
sess->pfcp_5gc_modify.outer_header_creation_update = false;
far_update = true;
memcpy(&sess->gnb_n3_ip, &upf_n3_ip, sizeof(sess->gnb_n3_ip));
sess->gnb_n3_teid = upf_n3_teid;
/* Need to Update? */
ogs_list_for_each(&qos_flow->pfcp.far_list, far) {
if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) {
if (sess->ueUpCnxState == OpenAPI_up_cnx_state_ACTIVATED) {
if (far->apply_action != OGS_PFCP_APPLY_ACTION_FORW) {
far_update = true;
}
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_DEACTIVATED) {
if (far->apply_action != OGS_PFCP_APPLY_ACTION_FORW) {
far_update = true;
}
}
}
/* Setup FAR */
memcpy(&sess->gnb_n3_ip, &upf_n3_ip, sizeof(sess->gnb_n3_ip));
sess->gnb_n3_teid = upf_n3_teid;
ogs_list_for_each(&qos_flow->pfcp.far_list, far) {
if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) {
ogs_pfcp_ip_to_outer_header_creation(&sess->gnb_n3_ip,
@ -144,11 +138,13 @@ int ngap_handle_pdu_session_resource_setup_response_transfer(
}
}
if (far_update || sess->pfcp_5gc_modify.outer_header_creation_update)
smf_5gc_pfcp_send_session_modification_request(sess, session);
else
smf_sbi_send_sm_context_updated_data(sess, session);
if (far_update) {
smf_5gc_pfcp_send_qos_flow_modification_request(
qos_flow, session, OGS_PFCP_5GC_MODIFY_ACTIVATE);
} else {
/* ACTIVATED Is NOT Inlcuded in RESPONSE */
smf_sbi_send_sm_context_updated_data(sess, session, 0);
}
rv = OGS_OK;
cleanup:

View File

@ -131,7 +131,7 @@ bool smf_nnrf_handle_nf_status_notify(
}
if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
ogs_error("[%s] The notification is not allowed",
ogs_warn("[%s] The notification is not allowed",
NFProfile->nf_instance_id);
ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
message, "The notification is not allowed",
@ -208,8 +208,9 @@ bool smf_nnrf_handle_nf_status_notify(
}
void smf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message)
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message)
{
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_session_t *session = NULL;
@ -217,8 +218,10 @@ void smf_nnrf_handle_nf_discover(
OpenAPI_lnode_t *node = NULL;
bool handled;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
session = sbi_object->session;
session = xact->assoc_session;
ogs_assert(session);
ogs_assert(message);
@ -269,9 +272,9 @@ void smf_nnrf_handle_nf_discover(
}
if (!OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, nf_instance->nf_type))
ogs_sbi_nf_types_associate(sbi_object->nf_types,
nf_instance->nf_type, sbi_object->nf_state_registered);
sbi_object->nf_type_array, nf_instance->nf_type))
ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
nf_instance->nf_type, smf_nf_state_registered);
/* TIME : Update validity from NRF */
if (SearchResult->validity_period) {
@ -290,13 +293,13 @@ void smf_nnrf_handle_nf_discover(
}
}
ogs_assert(sbi_object->nf_type);
ogs_assert(xact->target_nf_type);
nf_instance = OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, sbi_object->nf_type);
sbi_object->nf_type_array, xact->target_nf_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
} else {
ogs_sbi_send(nf_instance, sbi_object);
smf_sbi_send(nf_instance, xact);
}
}

View File

@ -35,7 +35,7 @@ bool smf_nnrf_handle_nf_status_notify(
ogs_sbi_session_t *session, ogs_sbi_message_t *message);
void smf_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message);
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
#ifdef __cplusplus
}

View File

@ -210,7 +210,6 @@ bool smf_nsmf_handle_update_sm_context(
ogs_sbi_response_t *response = NULL;
OpenAPI_sm_context_update_data_t *SmContextUpdateData = NULL;
OpenAPI_sm_context_updated_data_t SmContextUpdatedData;
OpenAPI_ref_to_binary_data_t *n1SmMsg = NULL;
OpenAPI_ref_to_binary_data_t *n2SmMsg = NULL;
@ -324,9 +323,6 @@ bool smf_nsmf_handle_update_sm_context(
return false;
}
/* UPDATE_UpCnxState - ACTIVATED */
sess->ueUpCnxState = OpenAPI_up_cnx_state_ACTIVATED;
/*
* NOTE : The pkbuf created in the SBI message will be removed
* from ogs_sbi_message_free().
@ -346,51 +342,17 @@ bool smf_nsmf_handle_update_sm_context(
return false;
}
/* UPDATE_UpCnxState - from SmContextUpdateData */
sess->ueUpCnxState = SmContextUpdateData->up_cnx_state;
if (sess->ueUpCnxState == OpenAPI_up_cnx_state_DEACTIVATED) {
if (SmContextUpdateData->up_cnx_state ==
OpenAPI_up_cnx_state_DEACTIVATED) {
/*********************************************************
* Handle DEACTIVATED
********************************************************/
smf_5gc_pfcp_send_session_modification_request(
sess, session, OGS_PFCP_5GC_MODIFY_DEACTIVATE);
if (sess->smfUpCnxState == OpenAPI_up_cnx_state_ACTIVATED) {
smf_5gc_pfcp_send_session_modification_request(sess, session);
} else if (sess->smfUpCnxState ==
OpenAPI_up_cnx_state_DEACTIVATED) {
ogs_warn("[%s:%d] FALLBACK - UpCnxState has already been"
"DEACTIVATED", smf_ue->supi, sess->psi);
/* No UPDATE_UPCnxState - ueUpCnxState == smfUpCnxState */
memset(&sendmsg, 0, sizeof(sendmsg));
memset(&SmContextUpdatedData, 0, sizeof(SmContextUpdatedData));
SmContextUpdatedData.up_cnx_state = sess->smfUpCnxState;
sendmsg.SmContextUpdatedData = &SmContextUpdatedData;
response = ogs_sbi_build_response(&sendmsg,
OGS_SBI_HTTP_STATUS_OK);
ogs_assert(response);
ogs_sbi_server_send_response(session, response);
} else {
char *strerror = ogs_msprintf(
"[%s:%d] Invalid upCnxState [%d:%d]",
smf_ue->supi, sess->psi,
sess->ueUpCnxState, sess->smfUpCnxState);
ogs_error("%s", strerror);
smf_sbi_send_sm_context_update_error(session,
OGS_SBI_HTTP_STATUS_BAD_REQUEST, strerror,
NULL, NULL, NULL);
ogs_free(strerror);
return false;
}
} else if (sess->ueUpCnxState == OpenAPI_up_cnx_state_ACTIVATING) {
} else if (SmContextUpdateData->up_cnx_state ==
OpenAPI_up_cnx_state_ACTIVATING) {
/*********************************************************
* Handle ACTIVATING
@ -398,9 +360,6 @@ bool smf_nsmf_handle_update_sm_context(
OpenAPI_sm_context_updated_data_t SmContextUpdatedData;
OpenAPI_ref_to_binary_data_t n2SmInfo;
if (sess->smfUpCnxState == OpenAPI_up_cnx_state_ACTIVATED) {
ogs_warn("[%s:%d] FALLBACK - UpCnxState has already been "
"ACTIVATED", smf_ue->supi, sess->psi);
/*
* TODO :
*
@ -437,19 +396,13 @@ bool smf_nsmf_handle_update_sm_context(
* and initiates an N4 Session Modification procedure
* to remove Tunnel Info of AN in the UPF.
*/
} else if (sess->smfUpCnxState == OpenAPI_up_cnx_state_ACTIVATING) {
ogs_warn("[%s:%d] FALLBACK - UpCnxState has already been "
"ACTIVATING", smf_ue->supi, sess->psi);
}
/* UPDATE_UpCnxState - SYNC */
sess->smfUpCnxState = sess->ueUpCnxState;
memset(&sendmsg, 0, sizeof(sendmsg));
sendmsg.SmContextUpdatedData = &SmContextUpdatedData;
memset(&SmContextUpdatedData, 0, sizeof(SmContextUpdatedData));
SmContextUpdatedData.up_cnx_state = sess->smfUpCnxState;
/* Only ACTIVING & DEACTIVATED is Included */
SmContextUpdatedData.up_cnx_state = OpenAPI_up_cnx_state_ACTIVATING;
SmContextUpdatedData.n2_sm_info_type =
OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ;
SmContextUpdatedData.n2_sm_info = &n2SmInfo;
@ -478,9 +431,9 @@ bool smf_nsmf_handle_update_sm_context(
ogs_pkbuf_free(sendmsg.part[i].pkbuf);
} else {
char *strerror = ogs_msprintf("[%s:%d] Invalid upCnxState [%d:%d]",
char *strerror = ogs_msprintf("[%s:%d] Invalid upCnxState [%d]",
smf_ue->supi, sess->psi,
sess->ueUpCnxState, sess->smfUpCnxState);
SmContextUpdateData->up_cnx_state);
ogs_error("%s", strerror);
smf_sbi_send_sm_context_update_error(session,
OGS_SBI_HTTP_STATUS_BAD_REQUEST, strerror,

View File

@ -20,7 +20,8 @@
#include "nudm-handler.h"
#include "pfcp-path.h"
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg)
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
ogs_sbi_message_t *recvmsg)
{
char buf1[OGS_ADDRSTRLEN];
char buf2[OGS_ADDRSTRLEN];
@ -33,7 +34,6 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg)
ogs_pfcp_qer_t *qer = NULL;
ogs_sbi_server_t *server = NULL;
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_header_t header;
@ -54,7 +54,6 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg)
OpenAPI_lnode_t *node = NULL, *node2 = NULL;
ogs_assert(sess);
session = sess->sbi.session;
ogs_assert(session);
smf_ue = sess->smf_ue;
ogs_assert(smf_ue);

View File

@ -26,7 +26,8 @@
extern "C" {
#endif
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_message_t *recvmsg);
bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_session_t *session,
ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@ -366,7 +366,7 @@ void smf_5gc_pfcp_send_session_establishment_request(
}
void smf_5gc_pfcp_send_session_modification_request(
smf_sess_t *sess, ogs_sbi_session_t *session)
smf_sess_t *sess, ogs_sbi_session_t *session, uint64_t flags)
{
int rv;
ogs_pkbuf_t *n4buf = NULL;
@ -380,13 +380,14 @@ void smf_5gc_pfcp_send_session_modification_request(
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid = sess->upf_n4_seid;
n4buf = smf_5gc_n4_build_session_modification_request(h.type, sess);
n4buf = smf_5gc_n4_build_session_modification_request(h.type, sess, flags);
ogs_expect_or_return(n4buf);
xact = ogs_pfcp_xact_local_create(
sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
ogs_expect_or_return(xact);
xact->assoc_session = session;
xact->modify_flags = flags;
rv = ogs_pfcp_xact_commit(xact);
ogs_expect(rv == OGS_OK);
@ -415,7 +416,7 @@ void smf_5gc_pfcp_send_session_deletion_request(
sess->pfcp_node, &h, n4buf, sess_5gc_timeout, sess);
ogs_expect_or_return(xact);
xact->assoc_session = session;
xact->trigger = trigger;
xact->delete_trigger = trigger;
rv = ogs_pfcp_xact_commit(xact);
ogs_expect(rv == OGS_OK);
@ -499,3 +500,37 @@ void smf_epc_pfcp_send_session_deletion_request(
rv = ogs_pfcp_xact_commit(xact);
ogs_expect(rv == OGS_OK);
}
void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
ogs_sbi_session_t *session, uint64_t flags)
{
int rv;
ogs_pkbuf_t *n4buf = NULL;
ogs_pfcp_header_t h;
ogs_pfcp_xact_t *xact = NULL;
smf_sess_t *sess = NULL;
ogs_assert(qos_flow);
sess = qos_flow->sess;
ogs_assert(sess);
ogs_assert(session);
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid = sess->upf_n4_seid;
n4buf = smf_5gc_n4_build_qos_flow_modification_request(
h.type, qos_flow, flags);
ogs_expect_or_return(n4buf);
xact = ogs_pfcp_xact_local_create(
sess->pfcp_node, &h, n4buf, sess_5gc_timeout, qos_flow);
ogs_expect_or_return(xact);
xact->assoc_session = session;
xact->modify_flags = flags;
rv = ogs_pfcp_xact_commit(xact);
ogs_expect(rv == OGS_OK);
}

View File

@ -37,7 +37,7 @@ void smf_pfcp_send_heartbeat_request(ogs_pfcp_node_t *node);
void smf_5gc_pfcp_send_session_establishment_request(
smf_sess_t *sess, ogs_sbi_session_t *session);
void smf_5gc_pfcp_send_session_modification_request(
smf_sess_t *sess, ogs_sbi_session_t *session);
smf_sess_t *sess, ogs_sbi_session_t *session, uint64_t flags);
void smf_5gc_pfcp_send_session_deletion_request(
smf_sess_t *sess, ogs_sbi_session_t *session, int trigger);
@ -47,6 +47,9 @@ void smf_epc_pfcp_send_session_modification_request(smf_bearer_t *bearer);
void smf_epc_pfcp_send_session_deletion_request(
smf_sess_t *sess, void *gtp_xact);
void smf_5gc_pfcp_send_qos_flow_modification_request(smf_bearer_t *qos_flow,
ogs_sbi_session_t *session, uint64_t flags);
#ifdef __cplusplus
}
#endif

View File

@ -116,29 +116,36 @@ void smf_sbi_close(void)
ogs_sbi_server_stop_all();
}
void smf_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, smf_sess_t *sess, void *data,
void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_sbi_send(nf_instance, client_cb, xact);
}
void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
smf_sess_t *sess, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data))
{
ogs_sbi_session_t *session = NULL;
ogs_sbi_xact_t *xact = NULL;
smf_ue_t *smf_ue = NULL;
ogs_assert(nf_type);
ogs_assert(build);
ogs_assert(target_nf_type);
ogs_assert(sess);
session = sess->sbi.session;
ogs_assert(session);
smf_ue = sess->smf_ue;
ogs_assert(smf_ue);
sess->sbi.nf_state_registered = smf_nf_state_registered;
sess->sbi.client_wait.duration =
ogs_config()->time.message.sbi.client_wait_duration;
sess->sbi.client_cb = client_cb;
ogs_assert(session);
ogs_assert(build);
xact = ogs_sbi_xact_add(target_nf_type, &sess->sbi, data,
(ogs_sbi_build_f)build, smf_timer_sbi_client_wait_expire);
ogs_assert(xact);
xact->assoc_session = session;
if (ogs_sbi_discover_and_send(xact,
(ogs_fsm_handler_t)smf_nf_state_registered, client_cb) != true) {
if (ogs_sbi_discover_and_send(
nf_type, &sess->sbi, data, (ogs_sbi_build_f)build) != true) {
ogs_sbi_server_send_error(session,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
"Cannot discover", smf_ue->supi);
@ -202,8 +209,8 @@ void smf_sbi_send_sm_context_create_error(
ogs_pkbuf_free(n1smbuf);
}
void smf_sbi_send_sm_context_updated_data(
smf_sess_t *sess, ogs_sbi_session_t *session)
void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
ogs_sbi_session_t *session, OpenAPI_up_cnx_state_e up_cnx_state)
{
int status;
@ -216,16 +223,15 @@ void smf_sbi_send_sm_context_updated_data(
ogs_assert(session);
memset(&sendmsg, 0, sizeof(sendmsg));
if (sess->smfUpCnxState == OpenAPI_up_cnx_state_ACTIVATED &&
sess->pfcp_5gc_modify.outer_header_creation_update == true) {
status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
} else {
if (up_cnx_state) {
memset(&SmContextUpdatedData, 0, sizeof(SmContextUpdatedData));
SmContextUpdatedData.up_cnx_state = sess->smfUpCnxState;
SmContextUpdatedData.up_cnx_state = up_cnx_state;
sendmsg.SmContextUpdatedData = &SmContextUpdatedData;
status = OGS_SBI_HTTP_STATUS_OK;
} else {
status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
}
response = ogs_sbi_build_response(&sendmsg, status);
@ -394,5 +400,4 @@ void smf_sbi_send_sm_context_status_notify(smf_sess_t *sess)
request = smf_namf_callback_build_sm_context_status(sess, NULL);
ogs_assert(request);
ogs_sbi_client_send_request(client, client_notify_cb, request, NULL);
ogs_sbi_request_free(request);
}

View File

@ -32,9 +32,9 @@ extern "C" {
int smf_sbi_open(void);
void smf_sbi_close(void);
void smf_sbi_send(smf_sess_t *sess, ogs_sbi_nf_instance_t *nf_instance);
void smf_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, smf_sess_t *sess, void *data,
void smf_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
void smf_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
smf_sess_t *sess, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(smf_sess_t *sess, void *data));
void smf_sbi_send_response(ogs_sbi_session_t *session, int status);
@ -43,8 +43,8 @@ void smf_sbi_send_sm_context_create_error(
ogs_sbi_session_t *session,
int status, const char *title, const char *detail,
ogs_pkbuf_t *n1smbuf);
void smf_sbi_send_sm_context_updated_data(
smf_sess_t *sess, ogs_sbi_session_t *session);
void smf_sbi_send_sm_context_updated_data(smf_sess_t *sess,
ogs_sbi_session_t *session, OpenAPI_up_cnx_state_e up_cnx_state);
void smf_sbi_send_sm_context_updated_data_in_session_deletion(
smf_sess_t *sess, ogs_sbi_session_t *session);
void smf_sbi_send_sm_context_update_error(

View File

@ -68,7 +68,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_sbi_subscription_t *subscription = NULL;
ogs_sbi_response_t *sbi_response = NULL;
ogs_sbi_message_t sbi_message;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_xact_t *sbi_xact = NULL;
ogs_nas_5gs_message_t nas_message;
ogs_pkbuf_t *pkbuf = NULL;
@ -367,8 +367,6 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_assert(smf_ue);
ogs_assert(OGS_FSM_STATE(&sess->sm));
OGS_SETUP_SBI_SESSION(&sess->sbi, session);
e->sess = sess;
e->sbi.message = &sbi_message;
ogs_fsm_dispatch(&sess->sm, e);
@ -484,13 +482,13 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC)
SWITCH(sbi_message.h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
SWITCH(sbi_message.h.method)
CASE(OGS_SBI_HTTP_METHOD_GET)
if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK)
smf_nnrf_handle_nf_discover(sbi_object, &sbi_message);
smf_nnrf_handle_nf_discover(sbi_xact, &sbi_message);
else
ogs_error("HTTP response error [%d]",
sbi_message.res_status);
@ -511,7 +509,10 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NUDM_SDM)
CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM)
sess = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
sess = (smf_sess_t *)sbi_xact->sbi_object;
ogs_assert(sess);
sess = smf_sess_cycle(sess);
ogs_assert(sess);
@ -522,10 +523,10 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_assert(OGS_FSM_STATE(&sess->sm));
e->sess = sess;
e->sbi.message = &sbi_message;;
e->sbi.message = &sbi_message;
e->sbi.session = sbi_xact->assoc_session;
sess->sbi.running_count--;
ogs_timer_stop(sess->sbi.client_wait.timer);
ogs_sbi_xact_remove(sbi_xact);
ogs_fsm_dispatch(&sess->sm, e);
if (OGS_FSM_CHECK(&sess->sm, smf_gsm_state_exception)) {
@ -572,12 +573,13 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
break;
case SMF_TIMER_SBI_CLIENT_WAIT:
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
session = sbi_object->session;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
session = sbi_xact->assoc_session;
ogs_assert(session);
sbi_object->running_count--;
ogs_sbi_xact_remove(sbi_xact);
ogs_error("Cannot receive SBI message");
ogs_sbi_server_send_error(session,

View File

@ -138,9 +138,6 @@ udm_ue_t *udm_ue_add(char *suci)
ogs_assert(udm_ue->supi);
ogs_hash_set(self.supi_hash, udm_ue->supi, strlen(udm_ue->supi), udm_ue);
udm_ue->sbi.client_wait.timer = ogs_timer_add(udm_self()->timer_mgr,
udm_timer_sbi_client_wait_expire, udm_ue);
memset(&e, 0, sizeof(e));
e.udm_ue = udm_ue;
ogs_fsm_create(&udm_ue->sm, udm_ue_state_initial, udm_ue_state_final);
@ -165,11 +162,8 @@ void udm_ue_remove(udm_ue_t *udm_ue)
ogs_fsm_delete(&udm_ue->sm);
/* Free SBI object memory */
if (udm_ue->sbi.running_count)
ogs_error("[%s] SBI running [%d]",
udm_ue->supi, udm_ue->sbi.running_count);
ogs_sbi_object_free(&udm_ue->sbi);
ogs_timer_delete(udm_ue->sbi.client_wait.timer);
OpenAPI_auth_event_free(udm_ue->auth_event);
OpenAPI_amf3_gpp_access_registration_free(
udm_ue->amf_3gpp_access_registration);

View File

@ -131,7 +131,7 @@ bool udm_nnrf_handle_nf_status_notify(
}
if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
ogs_error("The notification is not allowed [%s]",
ogs_warn("The notification is not allowed [%s]",
NFProfile->nf_instance_id);
ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
message, "The notification is not allowed",
@ -208,8 +208,9 @@ bool udm_nnrf_handle_nf_status_notify(
}
void udm_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message)
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message)
{
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_session_t *session = NULL;
@ -217,8 +218,10 @@ void udm_nnrf_handle_nf_discover(
OpenAPI_lnode_t *node = NULL;
bool handled;
ogs_assert(xact);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
session = sbi_object->session;
session = xact->assoc_session;
ogs_assert(session);
ogs_assert(message);
@ -269,9 +272,9 @@ void udm_nnrf_handle_nf_discover(
}
if (!OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, nf_instance->nf_type))
ogs_sbi_nf_types_associate(sbi_object->nf_types,
nf_instance->nf_type, sbi_object->nf_state_registered);
sbi_object->nf_type_array, nf_instance->nf_type))
ogs_sbi_nf_instance_associate(sbi_object->nf_type_array,
nf_instance->nf_type, udm_nf_state_registered);
/* TIME : Update validity from NRF */
if (SearchResult->validity_period) {
@ -290,13 +293,13 @@ void udm_nnrf_handle_nf_discover(
}
}
ogs_assert(sbi_object->nf_type);
ogs_assert(xact->target_nf_type);
nf_instance = OGS_SBI_NF_INSTANCE_GET(
sbi_object->nf_types, sbi_object->nf_type);
sbi_object->nf_type_array, xact->target_nf_type);
if (!nf_instance) {
ogs_error("(NF discover) No [%s]",
OpenAPI_nf_type_ToString(sbi_object->nf_type));
OpenAPI_nf_type_ToString(xact->target_nf_type));
} else {
ogs_sbi_send(nf_instance, sbi_object);
udm_sbi_send(nf_instance, xact);
}
}

View File

@ -35,7 +35,7 @@ bool udm_nnrf_handle_nf_status_notify(
ogs_sbi_session_t *session, ogs_sbi_message_t *message);
void udm_nnrf_handle_nf_discover(
ogs_sbi_object_t *sbi_object, ogs_sbi_message_t *message);
ogs_sbi_xact_t *xact, ogs_sbi_message_t *message);
#ifdef __cplusplus
}

View File

@ -21,19 +21,16 @@
#include "nnrf-handler.h"
#include "nudm-handler.h"
bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
bool udm_nudm_ueau_handle_get(
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_session_t *session = NULL;
OpenAPI_authentication_info_request_t *AuthenticationInfoRequest = NULL;
OpenAPI_resynchronization_info_t *ResynchronizationInfo = NULL;
char *serving_network_name = NULL;
char *ausf_instance_id = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
ogs_assert(recvmsg);
AuthenticationInfoRequest = recvmsg->AuthenticationInfoRequest;
@ -71,7 +68,7 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
ResynchronizationInfo = AuthenticationInfoRequest->resynchronization_info;
if (!ResynchronizationInfo) {
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL,
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
udm_nudr_dr_build_authentication_subscription);
} else {
@ -154,7 +151,8 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
ogs_uint64_to_buffer(sqn, OGS_SQN_LEN, udm_ue->sqn);
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, udm_ue->sqn,
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR,
udm_ue, session, udm_ue->sqn,
udm_nudr_dr_build_authentication_subscription);
}
@ -162,14 +160,10 @@ bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
}
bool udm_nudm_ueau_handle_result_confirmation_inform(
udm_ue_t *udm_ue, ogs_sbi_message_t *message)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
{
ogs_sbi_session_t *session = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
ogs_assert(message);
if (!message->AuthEvent) {
@ -182,24 +176,20 @@ bool udm_nudm_ueau_handle_result_confirmation_inform(
udm_ue->auth_event = OpenAPI_auth_event_copy(
udm_ue->auth_event, message->AuthEvent);
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL,
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
udm_nudr_dr_build_update_authentication_status);
return true;
}
bool udm_nudm_uecm_handle_registration(
udm_ue_t *udm_ue, ogs_sbi_message_t *message)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message)
{
ogs_sbi_session_t *session = NULL;
OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
OpenAPI_guami_t *Guami = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
ogs_assert(message);
Amf3GppAccessRegistration = message->Amf3GppAccessRegistration;
@ -265,24 +255,20 @@ bool udm_nudm_uecm_handle_registration(
udm_ue->amf_3gpp_access_registration,
message->Amf3GppAccessRegistration);
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, NULL,
udm_sbi_discover_and_send(OpenAPI_nf_type_UDR, udm_ue, session, NULL,
udm_nudr_dr_build_update_amf_context);
return true;
}
bool udm_nudm_sdm_handle_subscription_provisioned(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_response_t *response = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
ogs_assert(recvmsg);
SWITCH(recvmsg->h.resource.component[1])

View File

@ -26,15 +26,16 @@
extern "C" {
#endif
bool udm_nudm_ueau_handle_get(udm_ue_t *udm_ue, ogs_sbi_message_t *message);
bool udm_nudm_ueau_handle_get(
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
bool udm_nudm_ueau_handle_result_confirmation_inform(
udm_ue_t *udm_ue, ogs_sbi_message_t *message);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
bool udm_nudm_uecm_handle_registration(
udm_ue_t *udm_ue, ogs_sbi_message_t *message);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *message);
bool udm_nudm_sdm_handle_subscription_provisioned(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@ -20,10 +20,9 @@
#include "nudr-handler.h"
bool udm_nudr_dr_handle_subscription_authentication(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_server_t *server = NULL;
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_header_t header;
@ -60,7 +59,6 @@ bool udm_nudr_dr_handle_subscription_authentication(
OpenAPI_authentication_vector_t AuthenticationVector;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
server = ogs_sbi_session_get_server(session);
ogs_assert(server);
@ -253,10 +251,9 @@ bool udm_nudr_dr_handle_subscription_authentication(
}
bool udm_nudr_dr_handle_subscription_context(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_server_t *server = NULL;
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_header_t header;
@ -267,7 +264,6 @@ bool udm_nudr_dr_handle_subscription_context(
OpenAPI_amf3_gpp_access_registration_t *Amf3GppAccessRegistration = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
server = ogs_sbi_session_get_server(session);
ogs_assert(server);
@ -335,16 +331,14 @@ bool udm_nudr_dr_handle_subscription_context(
}
bool udm_nudr_dr_handle_subscription_provisioned(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg)
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_server_t *server = NULL;
ogs_sbi_session_t *session = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_response_t *response = NULL;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(session);
server = ogs_sbi_session_get_server(session);
ogs_assert(server);

View File

@ -27,11 +27,11 @@ extern "C" {
#endif
bool udm_nudr_dr_handle_subscription_authentication(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
bool udm_nudr_dr_handle_subscription_context(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
bool udm_nudr_dr_handle_subscription_provisioned(
udm_ue_t *udm_ue, ogs_sbi_message_t *recvmsg);
udm_ue_t *udm_ue, ogs_sbi_session_t *session, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@ -124,24 +124,31 @@ void udm_sbi_close(void)
ogs_sbi_server_stop_all();
}
void udm_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, udm_ue_t *udm_ue, void *data,
void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_sbi_send(nf_instance, client_cb, xact);
}
void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
udm_ue_t *udm_ue, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data))
{
ogs_sbi_session_t *session = NULL;
ogs_sbi_xact_t *xact = NULL;
ogs_assert(target_nf_type);
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
ogs_assert(nf_type);
ogs_assert(session);
ogs_assert(build);
udm_ue->sbi.nf_state_registered = udm_nf_state_registered;
udm_ue->sbi.client_wait.duration =
ogs_config()->time.message.sbi.client_wait_duration;
udm_ue->sbi.client_cb = client_cb;
xact = ogs_sbi_xact_add(target_nf_type, &udm_ue->sbi, data,
(ogs_sbi_build_f)build, udm_timer_sbi_client_wait_expire);
ogs_assert(xact);
xact->assoc_session = session;
if (ogs_sbi_discover_and_send(xact,
(ogs_fsm_handler_t)udm_nf_state_registered, client_cb) != true) {
if (ogs_sbi_discover_and_send(
nf_type, &udm_ue->sbi, data, (ogs_sbi_build_f)build) != true) {
ogs_sbi_server_send_error(session,
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL,
"Cannot discover", udm_ue->suci);

View File

@ -31,8 +31,9 @@ extern "C" {
int udm_sbi_open(void);
void udm_sbi_close(void);
void udm_sbi_discover_and_send(
OpenAPI_nf_type_e nf_type, udm_ue_t *udm_ue, void *data,
void udm_sbi_send(ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
void udm_sbi_discover_and_send(OpenAPI_nf_type_e target_nf_type,
udm_ue_t *udm_ue, ogs_sbi_session_t *session, void *data,
ogs_sbi_request_t *(*build)(udm_ue_t *udm_ue, void *data));
#ifdef __cplusplus

View File

@ -46,7 +46,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
ogs_sbi_subscription_t *subscription = NULL;
ogs_sbi_response_t *response = NULL;
ogs_sbi_message_t message;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_xact_t *sbi_xact = NULL;
udm_ue_t *udm_ue = NULL;
@ -171,8 +171,6 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
ogs_assert(OGS_FSM_STATE(&udm_ue->sm));
OGS_SETUP_SBI_SESSION(&udm_ue->sbi, session);
e->udm_ue = udm_ue;
e->sbi.message = &message;
ogs_fsm_dispatch(&udm_ue->sm, e);
@ -277,13 +275,13 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC)
SWITCH(message.h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
SWITCH(message.h.method)
CASE(OGS_SBI_HTTP_METHOD_GET)
if (message.res_status == OGS_SBI_HTTP_STATUS_OK)
udm_nnrf_handle_nf_discover(sbi_object, &message);
udm_nnrf_handle_nf_discover(sbi_xact, &message);
else
ogs_error("HTTP response error [%d]",
message.res_status);
@ -305,22 +303,26 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
CASE(OGS_SBI_SERVICE_NAME_NUDR_DR)
SWITCH(message.h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA)
udm_ue = e->sbi.data;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
udm_ue = (udm_ue_t *)sbi_xact->sbi_object;
ogs_assert(udm_ue);
udm_ue = udm_ue_cycle(udm_ue);
ogs_assert(udm_ue);
e->udm_ue = udm_ue;
e->sbi.message = &message;
e->sbi.session = sbi_xact->assoc_session;
udm_ue->sbi.running_count--;
ogs_timer_stop(udm_ue->sbi.client_wait.timer);
ogs_sbi_xact_remove(sbi_xact);
ogs_fsm_dispatch(&udm_ue->sm, e);
if (OGS_FSM_CHECK(&udm_ue->sm, udm_ue_state_exception)) {
ogs_error("[%s] State machine exception", udm_ue->suci);
udm_ue_remove(udm_ue);
}
break;
DEFAULT
@ -369,12 +371,13 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
break;
case UDM_TIMER_SBI_CLIENT_WAIT:
sbi_object = e->sbi.data;
ogs_assert(sbi_object);
session = sbi_object->session;
sbi_xact = e->sbi.data;
ogs_assert(sbi_xact);
session = sbi_xact->assoc_session;
ogs_assert(session);
sbi_object->running_count--;
ogs_sbi_xact_remove(sbi_xact);
ogs_error("Cannot receive SBI message");
ogs_sbi_server_send_error(session,

View File

@ -68,11 +68,11 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
CASE(OGS_SBI_HTTP_METHOD_POST)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
udm_nudm_ueau_handle_get(udm_ue, message);
udm_nudm_ueau_handle_get(udm_ue, session, message);
break;
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
udm_nudm_ueau_handle_result_confirmation_inform(
udm_ue, message);
udm_ue, session, message);
break;
DEFAULT
ogs_error("[%s] Invalid resource name [%s]",
@ -97,7 +97,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
CASE(OGS_SBI_HTTP_METHOD_PUT)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS)
udm_nudm_uecm_handle_registration(udm_ue, message);
udm_nudm_uecm_handle_registration(udm_ue, session, message);
break;
DEFAULT
@ -125,13 +125,13 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
udm_sbi_discover_and_send(
OpenAPI_nf_type_UDR, udm_ue, message,
OpenAPI_nf_type_UDR, udm_ue, session, message,
udm_nudr_dr_build_query_subscription_provisioned);
break;
CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
udm_nudm_sdm_handle_subscription_provisioned(
udm_ue, message);
udm_ue, session, message);
break;
DEFAULT
@ -162,9 +162,10 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
case UDM_EVT_SBI_CLIENT:
message = e->sbi.message;
ogs_assert(message);
udm_ue = e->sbi.data;
udm_ue = e->udm_ue;
ogs_assert(udm_ue);
session = udm_ue->sbi.session;
session = e->sbi.session;
ogs_assert(session);
SWITCH(message->h.service.name)
@ -190,7 +191,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
}
udm_nudr_dr_handle_subscription_authentication(
udm_ue, message);
udm_ue, session, message);
break;
CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA)
@ -203,14 +204,15 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
break;
}
udm_nudr_dr_handle_subscription_context(udm_ue, message);
udm_nudr_dr_handle_subscription_context(
udm_ue, session, message);
break;
DEFAULT
SWITCH(message->h.resource.component[3])
CASE(OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA)
handled = udm_nudr_dr_handle_subscription_provisioned(
udm_ue, message);
udm_ue, session, message);
if (!handled) {
ogs_sbi_server_send_error(
session, message->res_status,

View File

@ -131,7 +131,7 @@ bool udr_nnrf_handle_nf_status_notify(
}
if (NF_INSTANCE_IS_SELF(NFProfile->nf_instance_id)) {
ogs_error("The notification is not allowed [%s]",
ogs_warn("The notification is not allowed [%s]",
NFProfile->nf_instance_id);
ogs_sbi_server_send_error(session, OGS_SBI_HTTP_STATUS_FORBIDDEN,
message, "The notification is not allowed",

View File

@ -326,8 +326,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive PDU session establishment accept */
ogs_msleep(100);
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
@ -360,8 +358,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send De-registration request */
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -381,8 +377,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -326,8 +326,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive PDU session establishment accept */
ogs_msleep(100);
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
@ -360,8 +358,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(&test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
@ -442,8 +438,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -379,8 +379,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(50);
/* Receive Initial Context Setup Request +
* Attach Accept +
* Activate Default Bearer Context Request */

View File

@ -306,8 +306,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -257,8 +257,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -267,8 +267,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -320,8 +318,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
@ -343,8 +339,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send De-registration request */
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -364,8 +358,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -633,8 +625,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -667,8 +657,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -933,8 +921,6 @@ static void test3_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -976,8 +962,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
@ -999,8 +983,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send PDU Session release request */
test_sess.ul_nas_transport_param.request_type = 0;
test_sess.ul_nas_transport_param.dnn = 0;
@ -1042,8 +1024,6 @@ static void test3_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send De-registration request */
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -1063,8 +1043,6 @@ static void test3_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration request : Uplink Data Status */
test_ue.registration_request_param.integrity_protected = 0;
test_ue.registration_request_param.guti = 1;
@ -1124,8 +1102,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
/* Send GTP-U ICMP Packet */
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
ABTS_INT_EQUAL(tc, OGS_OK, rv);
@ -1154,8 +1130,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1360,7 +1334,7 @@ static void test4_func(abts_case *tc, void *data)
} while (count == 0);
bson_destroy(doc);
for (i = 0; i < 5; i++) {
for (i = 0; i < 10; i++) {
/* Send Registration request */
test_ue.registration_request_param.gmm_capability = 0;
gmmbuf = testgmm_build_registration_request(&test_ue, NULL);
@ -1462,6 +1436,8 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send PDU Session release request */
test_sess.ul_nas_transport_param.request_type = 0;
test_sess.ul_nas_transport_param.dnn = 0;

View File

@ -292,8 +292,6 @@ static void test1_func(abts_case *tc, void *data)
testngap_recv(&test_ue, recvbuf);
/* Send GMM Status */
ogs_msleep(100);
gmmbuf = testgmm_build_gmm_status(&test_ue,
OGS_5GMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -313,8 +311,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -311,8 +311,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
/* Send GTP-U ICMP Packet */
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
ABTS_INT_EQUAL(tc, OGS_OK, rv);
@ -341,8 +339,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Update Registration request type */
test_ue.nas.registration.value =
OGS_NAS_5GS_REGISTRATION_TYPE_MOBILITY_UPDATING;
@ -389,8 +385,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Update Registration request type */
test_ue.nas.registration.value =
OGS_NAS_5GS_REGISTRATION_TYPE_PERIODIC_UPDATING;
@ -415,6 +409,8 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
/* Send Identity response */
gmmbuf = testgmm_build_identity_response(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -494,8 +490,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
/* Send PDU session resource setup response */
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
@ -513,8 +507,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -298,15 +298,11 @@ static void test1_func(abts_case *tc, void *data)
testngap_recv(&test_ue, recvbuf);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Update Registration request type */
test_ue.nas.registration.value =
OGS_NAS_5GS_REGISTRATION_TYPE_MOBILITY_UPDATING;
@ -335,9 +331,9 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send De-registration request */
ogs_msleep(100);
/* Send De-registration request */
gmmbuf = testgmm_build_de_registration_request(&test_ue, 1);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_uplink_nas_transport(&test_ue, gmmbuf);
@ -356,8 +352,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Update Registration request type */
test_ue.nas.registration.value =
OGS_NAS_5GS_REGISTRATION_TYPE_PERIODIC_UPDATING;
@ -379,6 +373,8 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
/* INVALID SUCI */
test_ue.mobile_identity_suci.scheme_output[0] = 0x99;
@ -390,6 +386,11 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Registration reject */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
@ -401,8 +402,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -304,8 +304,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
@ -327,8 +325,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(&test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
@ -405,8 +401,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(&test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
@ -487,8 +481,6 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -752,8 +744,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -786,8 +776,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/*
* Send Service request Using InitialUEMessage
* - PDU Session Status
@ -819,8 +807,6 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1084,8 +1070,6 @@ static void test3_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -1127,8 +1111,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
@ -1150,8 +1132,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/*
* Send Service request Using InitialUEMessage
* - Uplink Data Status
@ -1237,8 +1217,6 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1520,8 +1498,6 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send Registration complete */
gmmbuf = testgmm_build_registration_complete(&test_ue);
ABTS_PTR_NOTNULL(tc, gmmbuf);
@ -1554,8 +1530,6 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/*
* Send Service request Using InitialUEMessage
* - PDU Session Status
@ -1609,8 +1583,6 @@ static void test4_func(abts_case *tc, void *data)
testngap_recv(&test_ue, recvbuf);
/* Send PDU session resource setup response */
ogs_msleep(100);
sendbuf = testngap_build_pdu_session_resource_setup_response(&test_sess);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
@ -1627,8 +1599,6 @@ static void test4_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
ogs_msleep(100);
/*
* Send Service request Using InitialUEMessage
* - Uplink Data Status
@ -1669,8 +1639,6 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* Send GTP-U ICMP Packet */
rv = test_gtpu_build_ping(&sendbuf, &test_sess, "10.45.0.1");
ABTS_INT_EQUAL(tc, OGS_OK, rv);
@ -1725,8 +1693,6 @@ static void test4_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(&test_ue, recvbuf);
ogs_msleep(100);
test_ue.ran_ue_ngap_id = ran_ue_ngap_id;
test_ue.amf_ue_ngap_id = amf_ue_ngap_id;
@ -1774,8 +1740,6 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -269,8 +269,6 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue.imsi));
ABTS_PTR_NOTNULL(tc, doc);