Commit c4ada56a authored by Sakthivel Velumani's avatar Sakthivel Velumani

setup resp decoding success

parent a2f41597
......@@ -233,7 +233,7 @@ int e1apCUCP_send_SETUP_RESPONSE(instance_t instance,
}
int e1apCUCP_send_SETUP_FAILURE(instance_t instance,
e1ap_setup_resp_t *e1ap_setup_resp) {
long transac_id) {
E1AP_E1AP_PDU_t pdu = {0};
/* Create */
/* 0. pdu Type */
......@@ -249,7 +249,7 @@ int e1apCUCP_send_SETUP_FAILURE(instance_t instance,
ieC1->id = E1AP_ProtocolIE_ID_id_TransactionID;
ieC1->criticality = E1AP_Criticality_reject;
ieC1->value.present = E1AP_GNB_CU_UP_E1SetupResponseIEs__value_PR_TransactionID;
ieC1->value.choice.TransactionID = e1ap_setup_resp->transac_id;
ieC1->value.choice.TransactionID = transac_id;
/* mandatory */
/* c2. cause (integer value) */
asn1cSequenceAdd(out->protocolIEs.list, E1AP_GNB_CU_UP_E1SetupFailureIEs_t, ieC2);
......@@ -311,6 +311,16 @@ int e1apCUCP_handle_SETUP_REQUEST(instance_t instance,
}
/* Create ITTI message and send to queue */
MessageDef *msg_p = itti_alloc_new_message(TASK_CUCP_E1, instance, E1AP_SETUP_REQ);
memcpy(&E1AP_SETUP_REQ(msg_p), req, sizeof(e1ap_setup_req_t));
if (req->supported_plmns > 0) {
itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p);
} else {
e1apCUCP_send_SETUP_FAILURE(instance, req->transac_id);
itti_free(TASK_CUCP_E1, msg_p);
return -1;
}
return 0;
}
......@@ -1141,6 +1151,7 @@ void *E1AP_CUCP_task(void *arg) {
LOG_I(E1AP, "Starting E1AP at CU CP\n");
MessageDef *msg = NULL;
e1ap_common_init();
int result;
while (1) {
itti_receive_msg(TASK_CUCP_E1, &msg);
......@@ -1178,16 +1189,27 @@ void *E1AP_CUCP_task(void *arg) {
cuxp_task_handle_sctp_data_ind(myInstance, &msg->ittiMsg.sctp_data_ind);
break;
case E1AP_SETUP_RESP:
LOG_I(E1AP, "CUCP Task Received E1AP_SETUP_RESP\n");
e1apCUCP_send_SETUP_RESPONSE(myInstance, &E1AP_SETUP_RESP(msg));
break;
default:
LOG_E(E1AP, "Unknown message received in TASK_CUCP_E1\n");
break;
}
result = itti_free(ITTI_MSG_ORIGIN_ID(msg), msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d) in E1AP_CUCP_task!\n", result);
msg = NULL;
}
}
void *E1AP_CUUP_task(void *arg) {
LOG_I(E1AP, "Starting E1AP at CU UP\n");
e1ap_common_init();
int result;
// SCTP
while (1) {
......@@ -1218,6 +1240,11 @@ void *E1AP_CUUP_task(void *arg) {
LOG_E(E1AP, "Unknown message received in TASK_CUUP_E1\n");
break;
}
result = itti_free(ITTI_MSG_ORIGIN_ID(msg), msg);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d) in E1AP_CUUP_task!\n", result);
msg = NULL;
}
}
......
......@@ -3876,6 +3876,26 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
}
}
void rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req, instance_t instance) {
AssertFatal(req->supported_plmns <= PLMN_LIST_MAX_SIZE, "Supported PLMNs is more than PLMN_LIST_MAX_SIZE\n");
gNB_RRC_INST *rrc = RC.nrrrc[0]; //TODO: remove hardcoding of RC index here
MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_GNB, instance, E1AP_SETUP_RESP);
e1ap_setup_resp_t *resp = &E1AP_SETUP_RESP(msg_p);
resp->transac_id = req->transac_id;
for (int i=0; i < req->supported_plmns; i++) {
if (rrc->configuration.mcc[i] == req->plmns[i].mcc &&
rrc->configuration.mnc[i] == req->plmns[i].mnc) {
LOG_E(NR_RRC, "PLMNs received from CUUP (mcc:%d, mnc:%d) did not match with PLMNs in RRC (mcc:%d, mnc:%d)\n",
req->plmns[i].mcc, req->plmns[i].mnc, rrc->configuration.mcc[i], rrc->configuration.mnc[i]);
}
}
itti_send_msg_to_task(TASK_CUCP_E1, instance, msg_p);
}
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
void *rrc_gnb_task(void *args_p) {
......@@ -4034,6 +4054,11 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
case E1AP_SETUP_REQ:
LOG_I(NR_RRC, "Received E1AP_SETUP_REQ for instance %d\n", (int)instance);
rrc_gNB_process_e1_setup_req(&E1AP_SETUP_REQ(msg_p), instance);
break;
default:
LOG_E(NR_RRC, "[gNB %ld] Received unexpected message %s\n", instance, msg_name_p);
break;
......@@ -4239,3 +4264,4 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe)
LOG_D(NR_RRC, "Time in RRC: %u/ %u \n", frame, subframe);
itti_send_msg_to_task(TASK_RRC_GNB, ctxt->module_id, message_p);
}
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