Commit 956fafb5 authored by Robert Schmidt's avatar Robert Schmidt

F1AP_UE_CONTEXT_RELEASE_REQUEST/COMPLETE: Implement in CU

parent 707048c5
......@@ -35,6 +35,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_resp_t, f1ap_initial_context_setup_resp)
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_FAILURE, MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_failure_t, f1ap_initial_context_setup_failure)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_req_t, f1ap_ue_context_release_req)
MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_release_cmd_t, f1ap_ue_context_release_cmd)
/* RRC -> F1AP messages */
......
......@@ -42,6 +42,7 @@
#define F1AP_DL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_dl_rrc_message
#define F1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req
#define F1AP_UE_CONTEXT_RELEASE_CMD(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_req
#define F1AP_UE_CONTEXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_req
/* Length of the transport layer address string
......
......@@ -34,6 +34,7 @@
#include "f1ap_handlers.h"
#include "f1ap_cu_interface_management.h"
#include "f1ap_cu_rrc_message_transfer.h"
#include "f1ap_cu_ue_context_management.h"
#include "f1ap_cu_task.h"
#include "proto_agent.h"
......@@ -170,6 +171,12 @@ void *F1AP_CU_task(void *arg) {
&F1AP_DL_RRC_MESSAGE(received_msg));
break;
case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc
LOG_I(CU_F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n");
CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg));
break;
// case F1AP_SETUP_RESPONSE: // This is from RRC
// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp)
// break;
......
......@@ -790,7 +790,7 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance],
ie->value.choice.GNB_DU_UE_F1AP_ID),
"RNTI obtained through DU ID is different from CU ID\n");
"RNTI obtained through DU ID is different from CU ID\n");
/* Cause */
/* We don't care for the moment
......@@ -825,14 +825,13 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) {
f1ap_ue_context_release_cmd_t *cmd) {
F1AP_F1AP_PDU_t pdu;
F1AP_UEContextReleaseCommand_t *out;
F1AP_UEContextReleaseCommandIEs_t *ie;
uint8_t *buffer;
uint32_t len;
//int i = 0, j = 0;
/* Create */
/* 0. Message Type */
......@@ -850,7 +849,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -859,7 +858,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id;
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance], cmd->rnti);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -869,25 +868,26 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
ie->criticality = F1AP_Criticality_ignore;
ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause;
// dummy value
ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork;
switch(ie->value.choice.Cause.present)
{
case F1AP_Cause_PR_radioNetwork:
ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified;
switch (cmd->cause) {
case F1AP_CAUSE_RADIO_NETWORK:
ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork;
ie->value.choice.Cause.choice.radioNetwork = cmd->cause_value;
break;
case F1AP_Cause_PR_transport:
ie->value.choice.Cause.choice.transport = F1AP_CauseTransport_unspecified;
case F1AP_CAUSE_TRANSPORT:
ie->value.choice.Cause.present = F1AP_Cause_PR_transport;
ie->value.choice.Cause.choice.transport = cmd->cause_value;
break;
case F1AP_Cause_PR_protocol:
ie->value.choice.Cause.choice.protocol = F1AP_CauseProtocol_unspecified;
case F1AP_CAUSE_PROTOCOL:
ie->value.choice.Cause.present = F1AP_Cause_PR_protocol;
ie->value.choice.Cause.choice.protocol = cmd->cause_value;
break;
case F1AP_Cause_PR_misc:
ie->value.choice.Cause.choice.misc = F1AP_CauseMisc_unspecified;
case F1AP_CAUSE_MISC:
ie->value.choice.Cause.present = F1AP_Cause_PR_misc;
ie->value.choice.Cause.choice.misc = cmd->cause_value;
break;
case F1AP_Cause_PR_NOTHING:
case F1AP_CAUSE_NOTHING:
default:
ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING;
break;
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
......@@ -899,8 +899,8 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
ie->criticality = F1AP_Criticality_ignore;
ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as",
strlen("asdsa1d32sa1d31asd31as"));
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)cmd->rrc_container,
cmd->rrc_container_length);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* encode */
......@@ -909,41 +909,33 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
return -1;
}
// send
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
return 0;
}
// note: is temporary with F1AP_UE_CONTEXT_SETUP_REQ
int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu) {
MessageDef *msg_p; // message to RRC
F1AP_UEContextReleaseComplete_t *container;
F1AP_UEContextReleaseCompleteIEs_t *ie;
//int i;
rnti_t rnti;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ);
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req;
f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p);
container = &pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance], ie->value.choice.GNB_CU_UE_F1AP_ID);
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t));
AssertFatal(f1ap_ue_context_setup_req->gNB_DU_ue_id,
"can not allocate memory for f1ap_ue_context_setup_req->gNB_DU_ue_id\n");
*f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
AssertFatal(rnti == f1ap_get_rnti_by_du_id(&f1ap_cu_ue[instance],
ie->value.choice.GNB_DU_UE_F1AP_ID),
"RNTI obtained through DU ID is different from CU ID\n");
/* Optional*/
/* CriticalityDiagnostics */
......@@ -958,7 +950,9 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
// F1AP_CriticalityDiagnostics_IE_List
}
AssertFatal(0, "check configuration, send to appropriate handler\n");
LOG_I(CU_F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti);
f1ap_remove_ue(&f1ap_cu_ue[instance], rnti);
return 0;
}
......
......@@ -61,9 +61,8 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
/*
* UE Context Release (gNB-CU initiated)
*/
// note: is temporary with f1ap_ue_context_setup_req_t
int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req);
f1ap_ue_context_release_cmd_t *cmd);
int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
uint32_t assoc_id,
......
......@@ -1068,8 +1068,13 @@ void release_UE_in_freeList(module_id_t mod_id)
rrc_rlc_remove_ue(&ctxt);
}
else if (RC.rrc[mod_id]->node_type == ngran_eNB_CU || RC.rrc[mod_id]->node_type == ngran_ng_eNB_CU) {
// send UE_CONTEXT_RELEASE
AssertFatal(1==0,"Need to added context removal\n");
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
itti_send_msg_to_task(TASK_CU_F1, mod_id, m);
}
pdcp_remove_UE(&ctxt);
......@@ -2176,14 +2181,24 @@ rrc_eNB_generate_RRCConnectionRelease(
}
}
pthread_mutex_unlock(&rrc_release_freelist);
rrc_data_req(
ctxt_pP,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU
|| RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) {
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = buffer;
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = size;
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
} else {
rrc_data_req(ctxt_pP,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
}
uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9};
......@@ -6487,8 +6502,13 @@ rrc_eNB_decode_ccch(
rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
}
else {
// send message to DU to remove context
AssertFatal(1==0,"Need to added context removal\n");
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
}
stmsi_received=1;
/* replace rnti in the context */
......@@ -6590,8 +6610,15 @@ rrc_eNB_decode_ccch(
if (RC.rrc[ctxt_pP->module_id] == ngran_eNB)
rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU ||
RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)
AssertFatal(1==0,"Need to added context removal\n");
RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) {
MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD);
F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK;
F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container = NULL;
F1AP_UE_CONTEXT_RELEASE_CMD(m).rrc_container_length = 0;
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, m);
}
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment