Commit 2865eb95 authored by matzakos's avatar matzakos

ENDC X2AP: Add generation of X2 sGNB Reconfiguration Complete message

parent 3552b8e4
...@@ -447,7 +447,7 @@ void x2ap_eNB_handle_handover_req_ack(instance_t instance, ...@@ -447,7 +447,7 @@ void x2ap_eNB_handle_handover_req_ack(instance_t instance,
} }
static static
void x2ap_eNB_handle_sgNB_add_req_ack(instance_t instance, void x2ap_gNB_trigger_sgNB_add_req_ack(instance_t instance,
x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_ENDC_sgnb_addition_req_ACK) x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_ENDC_sgnb_addition_req_ACK)
{ {
/* TODO: remove this hack (the goal is to find the correct /* TODO: remove this hack (the goal is to find the correct
...@@ -483,7 +483,7 @@ void x2ap_eNB_handle_sgNB_add_req_ack(instance_t instance, ...@@ -483,7 +483,7 @@ void x2ap_eNB_handle_sgNB_add_req_ack(instance_t instance,
//target = x2ap_get_eNB(NULL, 17, 0); //target = x2ap_get_eNB(NULL, 17, 0);
target = x2ap_is_eNB_id_in_list (3585); //Currently hardcoded. Need to extract it differently target = x2ap_is_eNB_id_in_list (3585); //Currently hardcoded. Need to extract it differently
DevAssert(target != NULL); DevAssert(target != NULL);
x2ap_eNB_generate_ENDC_x2_SgNB_addition_request_ACK(instance_p, target, x2ap_ENDC_sgnb_addition_req_ACK, 0); x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK(instance_p, target, x2ap_ENDC_sgnb_addition_req_ACK, 0);
} }
...@@ -553,7 +553,7 @@ void *x2ap_task(void *arg) { ...@@ -553,7 +553,7 @@ void *x2ap_task(void *arg) {
break; break;
case X2AP_ENDC_SGNB_ADDITION_REQ_ACK: case X2AP_ENDC_SGNB_ADDITION_REQ_ACK:
x2ap_eNB_handle_sgNB_add_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), x2ap_gNB_trigger_sgNB_add_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&X2AP_ENDC_SGNB_ADDITION_REQ_ACK(received_msg)); &X2AP_ENDC_SGNB_ADDITION_REQ_ACK(received_msg));
LOG_I(X2AP, "Received elements for X2AP_ENDC_SGNB_ADDITION_REQ_ACK \n"); LOG_I(X2AP, "Received elements for X2AP_ENDC_SGNB_ADDITION_REQ_ACK \n");
......
...@@ -1673,7 +1673,7 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( ...@@ -1673,7 +1673,7 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(
} }
int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, int x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p,
x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_sgnb_addition_req_ACK, int ue_id) x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_sgnb_addition_req_ACK, int ue_id)
{ {
...@@ -1792,3 +1792,63 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *in ...@@ -1792,3 +1792,63 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *in
return ret; return ret;
} }
int x2ap_eNB_generate_ENDC_x2_SgNB_reconfiguration_complete(
x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id, int SgNB_ue_id)
{
X2AP_X2AP_PDU_t pdu;
X2AP_SgNBReconfigurationComplete_t *out;
X2AP_SgNBReconfigurationComplete_IEs_t *ie;
uint8_t *buffer;
uint32_t len;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(x2ap_eNB_data_p != NULL);
x2ap_eNB_data_p->state = X2AP_ENB_STATE_WAITING;
/* Prepare the X2AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = X2AP_ProcedureCode_id_sgNBReconfigurationCompletion;
pdu.choice.initiatingMessage.criticality = X2AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = X2AP_InitiatingMessage__value_PR_SgNBReconfigurationComplete;
out = &pdu.choice.initiatingMessage.value.choice.SgNBReconfigurationComplete;
ie = (X2AP_SgNBReconfigurationComplete_IEs_t *)calloc(1, sizeof(X2AP_SgNBReconfigurationComplete_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_MeNB_UE_X2AP_ID;
ie->criticality= X2AP_Criticality_reject;
ie->value.present = X2AP_SgNBReconfigurationComplete_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID = ue_id; //x2ap_id_get_id_source(&instance_p->id_manager, ue_id);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (X2AP_SgNBReconfigurationComplete_IEs_t *)calloc(1, sizeof(X2AP_SgNBReconfigurationComplete_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_SgNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_reject;
ie->value.present = X2AP_SgNBReconfigurationComplete_IEs__value_PR_SgNB_UE_X2AP_ID;
ie->value.choice.SgNB_UE_X2AP_ID = SgNB_ue_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (X2AP_SgNBReconfigurationComplete_IEs_t *)calloc(1, sizeof(X2AP_SgNBReconfigurationComplete_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_ResponseInformationSgNBReconfComp;
ie->criticality = X2AP_Criticality_ignore;
ie->value.present = X2AP_SgNBReconfigurationComplete_IEs__value_PR_ResponseInformationSgNBReconfComp;
ie->value.choice.ResponseInformationSgNBReconfComp.present = X2AP_ResponseInformationSgNBReconfComp_PR_success_SgNBReconfComp;
// meNBtoSgNBContainer should contain the RRCReconfigurationComplete message from the UE but in the specs 36.423(9.1.4.4) its presence is not mandatory
ie->value.choice.ResponseInformationSgNBReconfComp.choice.success_SgNBReconfComp.meNBtoSgNBContainer = NULL;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
X2AP_ERROR("Failed to encode ENDC X2 SgNB_addition request message\n");
return -1;
}
x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0);
return ret;
}
...@@ -72,6 +72,9 @@ int x2ap_eNB_generate_ENDC_x2_setup_response( x2ap_eNB_instance_t *instance_p, x ...@@ -72,6 +72,9 @@ int x2ap_eNB_generate_ENDC_x2_setup_response( x2ap_eNB_instance_t *instance_p, x
int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id); int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id);
int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_sgnb_addition_req_ACK, int ue_id); int x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, x2ap_ENDC_sgnb_addition_req_ACK_t *x2ap_sgnb_addition_req_ACK, int ue_id);
int x2ap_eNB_generate_ENDC_x2_SgNB_reconfiguration_complete(
x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p, int ue_id, int SgNB_ue_id);
#endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */ #endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */
...@@ -121,7 +121,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, ...@@ -121,7 +121,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance,
X2AP_X2AP_PDU_t *pdu); X2AP_X2AP_PDU_t *pdu);
static static
int x2ap_gNB_handle_ENDC_sGNB_addition_response (instance_t instance, int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
X2AP_X2AP_PDU_t *pdu); X2AP_X2AP_PDU_t *pdu);
...@@ -156,7 +156,7 @@ x2ap_message_decoded_callback x2ap_messages_callback[][3] = { ...@@ -156,7 +156,7 @@ x2ap_message_decoded_callback x2ap_messages_callback[][3] = {
{ 0, 0, 0 }, /* seNBinitiatedSeNBRelease */ { 0, 0, 0 }, /* seNBinitiatedSeNBRelease */
{ 0, 0, 0 }, /* seNBCounterCheck */ { 0, 0, 0 }, /* seNBCounterCheck */
{ 0, 0, 0 }, /* retrieveUEContext */ { 0, 0, 0 }, /* retrieveUEContext */
{ x2ap_gNB_handle_ENDC_sGNB_addition_request, x2ap_gNB_handle_ENDC_sGNB_addition_response, 0 }, /*X2AP_ProcedureCode_id_sgNBAdditionPreparation*/ { x2ap_gNB_handle_ENDC_sGNB_addition_request, x2ap_eNB_handle_ENDC_sGNB_addition_response, 0 }, /*X2AP_ProcedureCode_id_sgNBAdditionPreparation*/
{ 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 },
...@@ -1477,7 +1477,7 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, ...@@ -1477,7 +1477,7 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance,
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data);
return x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_eNB_data,0); return x2ap_eNB_generate_ENDC_x2_SgNB_addition_request(instance_p, x2ap_eNB_data,0); // Not the right place to call the X2 function. Used only initially for testing.
} }
...@@ -1782,7 +1782,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, ...@@ -1782,7 +1782,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance,
static static
int x2ap_gNB_handle_ENDC_sGNB_addition_response (instance_t instance, int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
X2AP_X2AP_PDU_t *pdu) X2AP_X2AP_PDU_t *pdu)
...@@ -1901,6 +1901,8 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_response (instance_t instance, ...@@ -1901,6 +1901,8 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_response (instance_t instance,
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
x2ap_eNB_generate_ENDC_x2_SgNB_reconfiguration_complete(instance_p, x2ap_eNB_data,0,0); // Not the right place to call the X2 function. Used only initially for testing.
return 0; return 0;
} }
......
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