5G Core: Maintaining Old NAS signalling [#546]

This commit is contained in:
Sukchan Lee 2020-09-03 22:00:26 -04:00
parent 3c3bac6812
commit e86b1043c2
16 changed files with 328 additions and 25 deletions

View File

@ -20,6 +20,7 @@
#include "sbi-path.h"
#include "ngap-path.h"
#include "nas-path.h"
#include "ngap-handler.h"
#include "nnrf-handler.h"
#include "namf-handler.h"
#include "nsmf-handler.h"
@ -643,11 +644,29 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
case AMF_EVT_NGAP_TIMER:
ran_ue = e->ran_ue;
ogs_assert(ran_ue);
gnb = e->gnb;
ogs_assert(gnb);
ogs_assert(OGS_FSM_STATE(&gnb->sm));
ogs_fsm_dispatch(&gnb->sm, e);
switch (e->timer_id) {
case AMF_TIMER_NG_DELAYED_SEND:
gnb = e->gnb;
ogs_assert(gnb);
pkbuf = e->pkbuf;
ogs_assert(pkbuf);
ogs_expect(OGS_OK == ngap_send_to_ran_ue(ran_ue, pkbuf));
ogs_timer_delete(e->timer);
break;
case AMF_TIMER_NG_HOLDING:
ogs_warn("Implicit NG release");
ogs_warn(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
ran_ue->ran_ue_ngap_id,
(long long)ran_ue->amf_ue_ngap_id);
ngap_handle_ue_context_release_action(ran_ue);
break;
default:
ogs_error("Unknown timer[%s:%d]",
amf_timer_get_name(e->timer_id), e->timer_id);
break;
}
break;
case AMF_EVT_5GMM_MESSAGE:
@ -708,12 +727,21 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
/* If NAS(amf_ue_t) has already been associated with
* older NG(ran_ue_t) context */
if (CM_CONNECTED(amf_ue)) {
/* Implcit NG release */
ogs_debug("[%s] Implicit NG release", amf_ue->suci);
/* Previous NG(ran_ue_t) context the holding timer(30secs)
* is started.
* Newly associated NG(ran_ue_t) context holding timer
* is stopped. */
ogs_debug("[%s] Start NG Holding Timer", amf_ue->suci);
ogs_debug("[%s] RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
amf_ue->suci, amf_ue->ran_ue->ran_ue_ngap_id,
(long long)amf_ue->ran_ue->amf_ue_ngap_id);
ran_ue_remove(amf_ue->ran_ue);
/* De-associate NG with NAS/EMM */
ran_ue_deassociate(amf_ue->ran_ue);
ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
}
amf_ue_associate_ran_ue(amf_ue, ran_ue);
}

View File

@ -965,6 +965,9 @@ ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint32_t ran_ue_ngap_id)
ran_ue->gnb = gnb;
ran_ue->t_ng_holding = ogs_timer_add(
ogs_app()->timer_mgr, amf_timer_ng_holding_timer_expire, ran_ue);
ogs_list_add(&gnb->ran_ue_list, ran_ue);
return ran_ue;
@ -980,6 +983,8 @@ void ran_ue_remove(ran_ue_t *ran_ue)
ogs_list_remove(&ran_ue->gnb->ran_ue_list, ran_ue);
ogs_timer_delete(ran_ue->t_ng_holding);
ogs_pool_free(&ran_ue_pool, ran_ue);
}

View File

@ -173,6 +173,9 @@ struct ran_ue_s {
ogs_nr_cgi_t nr_cgi;
} saved;
/* NG Holding timer for removing this context */
ogs_timer_t *t_ng_holding;
/* Store by UE Context Release Command
* Retrieve by UE Context Release Complete */
#define NGAP_UE_CTX_REL_INVALID_ACTION 0

View File

@ -419,12 +419,21 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
/* If NAS(amf_ue_t) has already been associated with
* older NG(ran_ue_t) context */
if (CM_CONNECTED(amf_ue)) {
/* Implcit NG release */
ogs_debug("Implicit NG release");
ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
amf_ue->ran_ue->ran_ue_ngap_id,
(long long)amf_ue->ran_ue->amf_ue_ngap_id);
ran_ue_remove(amf_ue->ran_ue);
/* Previous NG(ran_ue_t) context the holding timer(30secs)
* is started.
* Newly associated NG(ran_ue_t) context holding timer
* is stopped. */
ogs_debug("[%s] Start NG Holding Timer", amf_ue->suci);
ogs_debug("[%s] RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
amf_ue->suci, amf_ue->ran_ue->ran_ue_ngap_id,
(long long)amf_ue->ran_ue->amf_ue_ngap_id);
/* De-associate NG with NAS/EMM */
ran_ue_deassociate(amf_ue->ran_ue);
ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
}
amf_ue_associate_ran_ue(amf_ue, ran_ue);
}
@ -1185,7 +1194,7 @@ void ngap_handle_ue_context_release_request(
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);
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
}
}
@ -1196,7 +1205,6 @@ void ngap_handle_ue_context_release_complete(
char buf[OGS_ADDRSTRLEN];
uint64_t amf_ue_ngap_id;
amf_ue_t *amf_ue = NULL;
ran_ue_t *ran_ue = NULL;
NGAP_SuccessfulOutcome_t *successfulOutcome = NULL;
@ -1260,11 +1268,20 @@ void ngap_handle_ue_context_release_complete(
return;
}
ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id);
ngap_handle_ue_context_release_action(ran_ue);
}
void ngap_handle_ue_context_release_action(ran_ue_t *ran_ue)
{
amf_ue_t *amf_ue = NULL;
ogs_assert(ran_ue);
amf_ue = ran_ue->amf_ue;
ogs_debug(" RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%lld]",
ran_ue->ran_ue_ngap_id, (long long)ran_ue->amf_ue_ngap_id);
switch (ran_ue->ue_ctx_rel_action) {
case NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE:
ogs_debug(" Action: NG context remove");

View File

@ -53,6 +53,7 @@ void ngap_handle_ue_context_release_request(
amf_gnb_t *gnb, ogs_ngap_message_t *message);
void ngap_handle_ue_context_release_complete(
amf_gnb_t *gnb, ogs_ngap_message_t *message);
void ngap_handle_ue_context_release_action(ran_ue_t *ran_ue);
void ngap_handle_path_switch_request(
amf_gnb_t *gnb, ogs_ngap_message_t *message);

View File

@ -288,7 +288,7 @@ int amf_nsmf_pdu_session_handle_update_sm_context(
if (SESSION_SYNC_DONE(amf_ue)) {
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);
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
}
} else if (state == AMF_UPDATE_SM_CONTEXT_ACTIVATING) {

View File

@ -50,6 +50,9 @@ static amf_timer_cfg_t g_amf_timer_cfg[MAX_NUM_OF_AMF_TIMER] = {
/* IDENTITY REQUEST sent */
[AMF_TIMER_T3570] =
{ .max_count = 4, .duration = ogs_time_from_sec(3) },
[AMF_TIMER_NG_HOLDING] =
{ .duration = ogs_time_from_sec(3) },
};
static void gmm_timer_event_send(
@ -90,6 +93,8 @@ const char *amf_timer_get_name(amf_timer_e id)
return "AMF_TIMER_T3560";
case AMF_TIMER_T3570:
return "AMF_TIMER_T3570";
case AMF_TIMER_NG_HOLDING:
return "AMF_TIMER_NG_HOLDING";
default:
break;
}
@ -222,3 +227,24 @@ void amf_timer_t3570_expire(void *data)
{
gmm_timer_event_send(AMF_TIMER_T3570, data);
}
void amf_timer_ng_holding_timer_expire(void *data)
{
int rv;
amf_event_t *e = NULL;
ran_ue_t *ran_ue = NULL;
ogs_assert(data);
ran_ue = data;
e = amf_event_new(AMF_EVT_NGAP_TIMER);
e->timer_id = AMF_TIMER_NG_HOLDING;
e->ran_ue = ran_ue;
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
amf_event_free(e);
}
}

View File

@ -38,6 +38,7 @@ typedef enum {
AMF_TIMER_SBI_CLIENT_WAIT,
AMF_TIMER_NG_DELAYED_SEND,
AMF_TIMER_NG_HOLDING,
AMF_TIMER_T3513,
AMF_TIMER_T3522,
@ -75,6 +76,8 @@ void amf_timer_t3555_expire(void *data);
void amf_timer_t3560_expire(void *data);
void amf_timer_t3570_expire(void *data);
void amf_timer_ng_holding_timer_expire(void *data);
#ifdef __cplusplus
}
#endif

View File

@ -84,6 +84,6 @@ void mme_send_release_access_bearer_or_ue_context_release(enb_ue_t *enb_ue)
ogs_debug("No UE Context");
s1ap_send_ue_context_release_command(enb_ue,
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0);
}
}

View File

@ -327,8 +327,8 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
* is started.
* Newly associated S1(enb_ue_t) context holding timer
* is stopped. */
ogs_debug("Start S1 Holding Timer\n");
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
ogs_debug("Start S1 Holding Timer");
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
mme_ue->enb_ue->enb_ue_s1ap_id,
mme_ue->enb_ue->mme_ue_s1ap_id);

View File

@ -292,8 +292,8 @@ void s1ap_handle_initial_ue_message(mme_enb_t *enb, ogs_s1ap_message_t *message)
* is started.
* Newly associated S1(enb_ue_t) context holding timer
* is stopped. */
ogs_debug("Start S1 Holding Timer\n");
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
ogs_debug("Start S1 Holding Timer");
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
mme_ue->enb_ue->enb_ue_s1ap_id,
mme_ue->enb_ue->mme_ue_s1ap_id);

View File

@ -76,6 +76,7 @@ void testngap_handle_downlink_nas_transport(
NGAP_DownlinkNASTransport_IEs_t *ie = NULL;
NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL;
NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL;
NGAP_NAS_PDU_t *NAS_PDU = NULL;
ogs_assert(test_ue);
@ -93,6 +94,9 @@ void testngap_handle_downlink_nas_transport(
case NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID:
AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID;
break;
case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID:
RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID;
break;
case NGAP_ProtocolIE_ID_id_NAS_PDU:
NAS_PDU = &ie->value.choice.NAS_PDU;
break;
@ -101,8 +105,14 @@ void testngap_handle_downlink_nas_transport(
}
}
ogs_assert(AMF_UE_NGAP_ID);
asn_INTEGER2ulong(AMF_UE_NGAP_ID, &test_ue->amf_ue_ngap_id);
if (AMF_UE_NGAP_ID) {
uint64_t amf_ue_ngap_id;
asn_INTEGER2ulong(AMF_UE_NGAP_ID, (unsigned long *)&amf_ue_ngap_id);
test_ue->amf_ue_ngap_id = (uint64_t)amf_ue_ngap_id;
}
if (RAN_UE_NGAP_ID) {
test_ue->ran_ue_ngap_id = *RAN_UE_NGAP_ID;
}
if (NAS_PDU)
testngap_send_to_nas(test_ue, NAS_PDU);
@ -120,6 +130,7 @@ void testngap_handle_initial_context_setup_request(
NGAP_InitialContextSetupRequestIEs_t *ie = NULL;
NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL;
NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL;
NGAP_NAS_PDU_t *NAS_PDU = NULL;
ogs_assert(test_ue);
@ -137,6 +148,9 @@ void testngap_handle_initial_context_setup_request(
case NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID:
AMF_UE_NGAP_ID = &ie->value.choice.AMF_UE_NGAP_ID;
break;
case NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID:
RAN_UE_NGAP_ID = &ie->value.choice.RAN_UE_NGAP_ID;
break;
case NGAP_ProtocolIE_ID_id_NAS_PDU:
NAS_PDU = &ie->value.choice.NAS_PDU;
break;
@ -150,6 +164,9 @@ void testngap_handle_initial_context_setup_request(
asn_INTEGER2ulong(AMF_UE_NGAP_ID, (unsigned long *)&amf_ue_ngap_id);
test_ue->amf_ue_ngap_id = (uint64_t)amf_ue_ngap_id;
}
if (RAN_UE_NGAP_ID) {
test_ue->ran_ue_ngap_id = *RAN_UE_NGAP_ID;
}
if (NAS_PDU)
testngap_send_to_nas(test_ue, NAS_PDU);
@ -191,10 +208,14 @@ void testngap_handle_ue_release_context_command(
if (UE_NGAP_IDs) {
if (UE_NGAP_IDs->present == NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair) {
uint64_t amf_ue_ngap_id;
uint64_t ran_ue_ngap_id;
asn_INTEGER2ulong(
&UE_NGAP_IDs->choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID,
(unsigned long *)&amf_ue_ngap_id);
test_ue->amf_ue_ngap_id = (uint64_t)amf_ue_ngap_id;
test_ue->ran_ue_ngap_id =
UE_NGAP_IDs->choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID;
}
}
}

View File

@ -318,6 +318,8 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -579,6 +581,8 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1010,6 +1014,27 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* 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);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1351,6 +1376,8 @@ static void test4_func(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, OGS_OK, rv);
}
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -332,6 +332,17 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* OLD Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send OLD UE Context Release Complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Registration accept */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
@ -478,6 +489,27 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);

View File

@ -281,6 +281,17 @@ static void test1_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* OLD Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send OLD UE Context Release Complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Initial context setup request */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);

View File

@ -430,6 +430,27 @@ static void test1_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -718,6 +739,27 @@ static void test2_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1029,6 +1071,17 @@ static void test3_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* OLD Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send OLD UE Context Release Complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Service accept */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
@ -1084,6 +1137,27 @@ static void test3_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1454,6 +1528,17 @@ static void test4_func(abts_case *tc, void *data)
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* OLD Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send OLD UE Context Release Complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Service accept */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
@ -1567,6 +1652,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(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -1947,6 +2034,27 @@ static void test5_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);
@ -2338,6 +2446,27 @@ static void test6_func(abts_case *tc, void *data)
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Send UE context release request */
sendbuf = testngap_build_ue_context_release_request(test_ue,
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive UE context release command */
recvbuf = testgnb_ngap_read(ngap);
ABTS_PTR_NOTNULL(tc, recvbuf);
testngap_recv(test_ue, recvbuf);
/* Send UE context release complete */
sendbuf = testngap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testgnb_ngap_send(ngap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);
/********** Remove Subscriber in Database */
doc = BCON_NEW("imsi", BCON_UTF8(test_ue->imsi));
ABTS_PTR_NOTNULL(tc, doc);