Add triggering of F1 UE Context release command
-Add also a temporary artificial trigger just to be able to test with OAI UE -Comment out most of the part of the UE context release command handler function at the DU in order to separate properly the RRC from F1AP functionality later.
This commit is contained in:
@@ -907,12 +907,14 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
|
||||
/* optional */
|
||||
/* c4. RRCContainer */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie4);
|
||||
ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie4->criticality = F1AP_Criticality_ignore;
|
||||
ie4->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *)cmd->rrc_container,
|
||||
if(cmd->rrc_container!=NULL){
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie4);
|
||||
ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie4->criticality = F1AP_Criticality_ignore;
|
||||
ie4->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *)cmd->rrc_container,
|
||||
cmd->rrc_container_length);
|
||||
}
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
|
||||
@@ -683,14 +683,14 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
protocol_ctxt_t ctxt;
|
||||
DevAssert(pdu);
|
||||
container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
|
||||
/* GNB_CU_UE_F1AP_ID */
|
||||
// GNB_CU_UE_F1AP_ID
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
|
||||
ctxt.rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID);
|
||||
ctxt.instance = instance;
|
||||
ctxt.module_id = instance;
|
||||
ctxt.enb_flag = 1;
|
||||
/* GNB_DU_UE_F1AP_ID */
|
||||
// GNB_DU_UE_F1AP_ID
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
const rnti_t rnti = f1ap_get_rnti_by_du_id(DUtype, instance,
|
||||
@@ -700,7 +700,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
rnti, ctxt.rnti);
|
||||
int UE_out_of_sync = 0;
|
||||
|
||||
if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
|
||||
/*if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) {
|
||||
for (int n = 0; n < MAX_MOBILES_PER_GNB; ++n) {
|
||||
if (RC.nrmac[instance]->UE_info.active[n] == TRUE
|
||||
&& rnti == RC.nrmac[instance]->UE_info.rnti[n]) {
|
||||
@@ -718,13 +718,13 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
}
|
||||
}
|
||||
|
||||
/* We don't need the Cause */
|
||||
/* Optional RRC Container: if present, send to UE */
|
||||
// We don't need the Cause
|
||||
// Optional RRC Container: if present, send to UE
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, false);
|
||||
|
||||
if (ie && !UE_out_of_sync) {
|
||||
/* RRC message and UE is reachable, send message */
|
||||
// RRC message and UE is reachable, send message
|
||||
const sdu_size_t sdu_len = ie->value.choice.RRCContainer.size;
|
||||
mem_block_t *pdu_p = NULL;
|
||||
pdu_p = get_free_mem_block(sdu_len, __func__);
|
||||
@@ -775,8 +775,8 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti);
|
||||
|
||||
if (ue_context_p && !UE_out_of_sync) {
|
||||
/* UE exists and is in sync so we start a timer before releasing the
|
||||
* connection */
|
||||
// UE exists and is in sync so we start a timer before releasing the
|
||||
// connection
|
||||
pthread_mutex_lock(&rrc_release_freelist);
|
||||
|
||||
for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) {
|
||||
@@ -800,18 +800,18 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
|
||||
pthread_mutex_unlock(&rrc_release_freelist);
|
||||
ue_context_p->ue_context.ue_release_timer_s1 = 0;
|
||||
} else if (ue_context_p && UE_out_of_sync) {
|
||||
/* UE exists and is out of sync, drop the connection */
|
||||
// UE exists and is out of sync, drop the connection
|
||||
mac_eNB_rrc_ul_failure(instance, 0, 0, 0, rnti);
|
||||
} else {
|
||||
LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti);
|
||||
}
|
||||
|
||||
/* TODO send this once the connection has really been released */
|
||||
// TODO send this once the connection has really been released
|
||||
f1ap_ue_context_release_cplt_t cplt;
|
||||
cplt.rnti = ctxt.rnti;
|
||||
DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt);
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
|
||||
f1ap_ue_context_release_cplt_t *cplt) {
|
||||
|
||||
@@ -1515,6 +1515,18 @@ rrc_gNB_process_RRCReconfigurationComplete(
|
||||
free(DRB_Release_configList2);
|
||||
ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL;
|
||||
}
|
||||
//Temporarily trigger artificially UE context release for the CU case just to be able to test it with OAI UE. To be removed later
|
||||
if(0){
|
||||
if(NODE_IS_CU(RC.nrrrc[ctxt_pP->instance]->node_type)){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
|
||||
f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p);
|
||||
rel_cmd->rnti = ctxt_pP->rnti;
|
||||
rel_cmd->cause = F1AP_CAUSE_RADIO_NETWORK;
|
||||
rel_cmd->cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
|
||||
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, message_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -3925,15 +3937,27 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
|
||||
|
||||
// Remove here the MAC and RRC context when RRC is not connected or gNB is not connected to CN5G
|
||||
if(ue_context_p->ue_context.StatusRrc < NR_RRC_CONNECTED || ue_context_p->ue_context.gNB_ue_ngap_id == 0) {
|
||||
mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti);
|
||||
rrc_rlc_remove_ue(ctxt_pP);
|
||||
pdcp_remove_UE(ctxt_pP);
|
||||
if(!NODE_IS_CU(RC.nrrrc[ctxt_pP->instance]->node_type)){
|
||||
mac_remove_nr_ue(ctxt_pP->module_id, ctxt_pP->rnti);
|
||||
rrc_rlc_remove_ue(ctxt_pP);
|
||||
pdcp_remove_UE(ctxt_pP);
|
||||
|
||||
/* remove RRC UE Context */
|
||||
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti);
|
||||
if (ue_context_p) {
|
||||
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
||||
LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti);
|
||||
/* remove RRC UE Context */
|
||||
ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[ctxt_pP->module_id], ctxt_pP->rnti);
|
||||
if (ue_context_p) {
|
||||
rrc_gNB_remove_ue_context(ctxt_pP, RC.nrrrc[ctxt_pP->module_id], ue_context_p);
|
||||
LOG_I(NR_RRC, "remove UE %x \n", ctxt_pP->rnti);
|
||||
}
|
||||
}
|
||||
// In case of CU trigger UE context release command towards the DU
|
||||
else{
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
|
||||
f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p);
|
||||
rel_cmd->rnti = ctxt_pP->rnti;
|
||||
rel_cmd->cause = F1AP_CAUSE_RADIO_NETWORK;
|
||||
rel_cmd->cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
|
||||
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, message_p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user