Commit 15a7b91c authored by vettel's avatar vettel

Merge branch 'x2-ka-test' of https://gitlab.eurecom.fr/oai/openairinterface5g into x2-ka-test

parents 8cd5e072 d9154232
......@@ -154,9 +154,13 @@ typedef struct x2ap_handover_req_s {
/* UE aggregate maximum bitrate */
ambr_t ue_ambr;
uint8_t nb_e_rabs_tobesetup;
/* list of e_rab setup-ed by RRC layers */
e_rab_setup_t e_rabs_tobesetup[S1AP_MAX_E_RAB];
/* ue_context_pP->ue_context.e_rab[i].param.sgw_addr; */
x2ap_lastvisitedcell_info_t lastvisitedcell_info;
/* TODO: this parameter has to be removed */
......
......@@ -1854,7 +1854,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
// CellToAdd->cellIndex = i + 1;
CellToAdd->cellIndex = 1;
CellToAdd->physCellId = 1;//get_adjacent_cell_id(ctxt_pP->module_id, i);
CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
CellToAdd->cellIndividualOffset = Q_OffsetRange_dB10;
ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
// }
......@@ -2385,7 +2385,7 @@ rrc_eNB_process_MeasurementReport(
//-----------------------------------------------------------------------------
{
int target_rsrp, source_rsrp;
int offset_db = 4;
int offset_db = -10;
T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -2457,6 +2457,10 @@ rrc_eNB_process_MeasurementReport(
if (!(measResults2->measId == 4 && target_rsrp - source_rsrp >= offset_db))
return;
static int count=0;
count++;
if (count < 30) return;
/* if the UE is not in handover mode, start handover procedure */
if (ue_context_pP->ue_context.Status != RRC_HO_EXECUTION) {
MessageDef *msg;
......@@ -2495,8 +2499,16 @@ rrc_eNB_process_MeasurementReport(
X2AP_HANDOVER_REQ(msg).ue_ambr=ue_context_pP->ue_context.ue_ambr;
// to be done
// X2AP_HANDOVER_REQ(msg).e_rabs_tobesetu=;
X2AP_HANDOVER_REQ(msg).nb_e_rabs_tobesetup=ue_context_pP->ue_context.setup_e_rabs;
int i=0;
for (i=0;i<ue_context_pP->ue_context.setup_e_rabs;i++){
X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].e_rab_id=ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr=ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].gtp_teid=ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
}
/*add QoS related info*/
/* TODO: don't do that, X2AP should find the target by itself */
X2AP_HANDOVER_REQ(msg).target_mod_id = 0;//get_adjacent_cell_mod_id(X2AP_HANDOVER_REQ(msg).target_physCellId);
......@@ -2669,7 +2681,7 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
struct rrc_eNB_ue_context_s* ue_context_target_p = NULL;
/* TODO: get proper UE rnti */
int rnti = taus() & 0xffff;
int i;
global_rnti = rnti;
ue_context_target_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id], rnti);
......@@ -2704,6 +2716,19 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
ue_context_target_p->ue_context.nh_ncc = -1;
memcpy (ue_context_target_p->ue_context.kenb, m->kenb, 32);
ue_context_target_p->ue_context.kenb_ncc = m->kenb_ncc;
ue_context_target_p->ue_context.nb_of_e_rabs = m->nb_e_rabs_tobesetup;
for (i = 0; i < ue_context_target_p->ue_context.nb_of_e_rabs; i++) {
ue_context_target_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW;
ue_context_target_p->ue_context.e_rab[i].param.e_rab_id = m->e_rabs_tobesetup[i].e_rab_id;
ue_context_target_p->ue_context.e_rab[i].param.sgw_addr = m->e_rabs_tobesetup[i].eNB_addr;
ue_context_target_p->ue_context.e_rab[i].param.gtp_teid= m->e_rabs_tobesetup[i].gtp_teid;
LOG_D(RRC, "eNB %d: Update the UE context after HO, gto_teid %u\n", mod_id, ue_context_target_p->ue_context.e_rab[i].param.gtp_teid);
}
}
void rrc_eNB_process_handoverCommand(
......@@ -3908,7 +3933,7 @@ rrc_eNB_generate_handover_reconfiguration(
mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission));
*mobilityInfo->additionalSpectrumEmission = 1; //Check this value!
mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here
mobilityInfo->t304 = MobilityControlInfo__t304_ms200; // need to configure an appropriate value here
// New UE Identity (C-RNTI) to identify an UE uniquely in a cell
mobilityInfo->newUE_Identity.size = 2;
......@@ -4879,7 +4904,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission));
*mobilityInfo->additionalSpectrumEmission = 1; //Check this value!
mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here
mobilityInfo->t304 = MobilityControlInfo__t304_ms200; // need to configure an appropriate value here
// New UE Identity (C-RNTI) to identify an UE uniquely in a cell
mobilityInfo->newUE_Identity.size = 2;
......@@ -6127,7 +6152,7 @@ rrc_eNB_decode_dcch(
int i;
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
int dedicated_DRB=0;
int DRB_procedure=0;
T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -6255,14 +6280,21 @@ rrc_eNB_decode_dcch(
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.
present ==
RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) {
/*NN: revise the condition */
/*NN: revise the conditions and merge them with the corresponding action */
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){
dedicated_DRB = 1;
DRB_procedure = 1;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
}else if (ue_context_p->ue_context.Status == RRC_HO_EXECUTION){
DRB_procedure = 2;
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_HO_EXECUTION (xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
}else {
dedicated_DRB = 0;
DRB_procedure = 0;
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
......@@ -6285,17 +6317,20 @@ rrc_eNB_decode_dcch(
#if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
if (dedicated_DRB == 1){
if (DRB_procedure == 1){ //s1ap E_RAB_SETUP
rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
}else {
}else if (DRB_procedure == 2){ // x2ap path switch
rrc_eNB_send_PATH_SWITCH_REQ(ctxt_pP,
ue_context_p);
}else { // S1AP_INITIAL_CONTEXT_SETUP
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
ue_context_p);
}
}
#else // establish a dedicated bearer
if (dedicated_DRB == 0 ) {
if (DRB_procedure == 0 ) {
// ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED;
rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p);
}
......
This diff is collapsed.
......@@ -374,23 +374,47 @@ int x2ap_eNB_generate_x2_handover_request(x2ap_eNB_instance_t *instance_p,
UEAGMAXBITRTD_TO_ASN_PRIMITIVES(3L,&message.msg.x2ap_HandoverRequest_IEs.uE_ContextInformation.uEaggregateMaximumBitRate.uEaggregateMaximumBitRateDownlink);
UEAGMAXBITRTU_TO_ASN_PRIMITIVES(6L,&message.msg.x2ap_HandoverRequest_IEs.uE_ContextInformation.uEaggregateMaximumBitRate.uEaggregateMaximumBitRateUplink);
X2ap_E_RABs_ToBeSetup_Item_t *e_RABs_ToBeSetup_Item1 = calloc(1, sizeof(X2ap_E_RABs_ToBeSetup_Item_t));
int i;
for (i=0;i<rrc_eNB_ue_context->ue_context.setup_e_rabs;i++){
e_RABs_ToBeSetup_Item1->e_RAB_ID=rrc_eNB_ue_context->ue_context.e_rab[i].param.e_rab_id;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.qCI=rrc_eNB_ue_context->ue_context.e_rab[i].param.qos.qci;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel =
rrc_eNB_ue_context->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level ;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability =
rrc_eNB_ue_context->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability ;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability =
rrc_eNB_ue_context->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.iE_Extensions = NULL;
e_RABs_ToBeSetup_Item1->e_RAB_ID=10;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.qCI=1;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel = 1;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability = 0;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability = 0;
e_RABs_ToBeSetup_Item1->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.iE_Extensions = NULL;
e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.size= (uint8_t)(rrc_eNB_ue_context->ue_context.e_rab[i].param.sgw_addr.length/8);
e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.bits_unused = rrc_eNB_ue_context->ue_context.e_rab[i].param.sgw_addr.length%8;
TRLA_TO_BIT_STRING(1, &e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress); // IPv4
GTP_TEID_TO_OCTET_STRING (12, &e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.gTP_TEID);
e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.buf =
calloc(1,e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.size);
X2ap_E_RABs_ToBeSetup_ListIEs_t *e_RABs_ToBeSetup_List1 = calloc(1, sizeof(X2ap_E_RABs_ToBeSetup_ListIEs_t));
ASN_SEQUENCE_ADD(e_RABs_ToBeSetup_List1, e_RABs_ToBeSetup_Item1);
x2ap_encode_x2ap_e_rabs_tobesetup_list(&message.msg.x2ap_HandoverRequest_IEs.uE_ContextInformation.e_RABs_ToBeSetup_List, e_RABs_ToBeSetup_List1);
memcpy (e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.buf,
rrc_eNB_ue_context->ue_context.e_rab[i].param.sgw_addr.buffer,
e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress.size);
//TRLA_TO_BIT_STRING(rrc_eNB_ue_context->ue_context.e_rab[i].param.sgw_addr.buffer,
// &e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.transportLayerAddress); // IPv4
GTP_TEID_TO_OCTET_STRING (rrc_eNB_ue_context->ue_context.e_rab[i].param.gtp_teid,
&e_RABs_ToBeSetup_Item1->uL_GTPtunnelEndpoint.gTP_TEID);
X2ap_E_RABs_ToBeSetup_ListIEs_t *e_RABs_ToBeSetup_List1 = calloc(1, sizeof(X2ap_E_RABs_ToBeSetup_ListIEs_t));
ASN_SEQUENCE_ADD(e_RABs_ToBeSetup_List1, e_RABs_ToBeSetup_Item1);
x2ap_encode_x2ap_e_rabs_tobesetup_list(&message.msg.x2ap_HandoverRequest_IEs.uE_ContextInformation.e_RABs_ToBeSetup_List, e_RABs_ToBeSetup_List1);
}
#if 0
char RRC[81] = { 0x0a,0x10,0x00,0x00,0x03,0x41,0x60,0x08,0xcf,0x50,0x4a,0x0e,0x07,0x00,0x8c,0xf5,0x04,0xa0,0xe0,0x03,0xc0,0x51,0xc2,0x28,
0xb8,0x56,0xd1,0x80,0x4a,0x00,0x00,0x08,0x18,0x02,0x20,0x42,0x08,0x00,0x80,0x60,0x00,0x20,0x00,0x00,0x03,0x82,0xca,0x04,
......
......@@ -211,6 +211,7 @@ x2ap_eNB_handle_handover_preparation(uint32_t assoc_id,
X2ap_HandoverRequest_IEs_t *x2HandoverRequest;
x2ap_eNB_data_t *x2ap_eNB_data;
uint32_t eNB_id = 0;
uint8_t i;
int ta_ret;
//uint16_t max_enb_connected;
MessageDef *m;
......@@ -234,16 +235,37 @@ x2ap_eNB_handle_handover_preparation(uint32_t assoc_id,
extern int x2id_to_source_rnti[1];
X2AP_HANDOVER_REQ(m).source_x2id = x2HandoverRequest->old_eNB_UE_X2AP_ID;
X2AP_HANDOVER_REQ(m).source_rnti = x2id_to_source_rnti[x2HandoverRequest->old_eNB_UE_X2AP_ID];
X2AP_HANDOVER_REQ(m).nb_e_rabs_tobesetup=x2HandoverRequest->uE_ContextInformation.e_RABs_ToBeSetup_List.list.count;
X2ap_E_RABs_ToBeSetup_Item_t *e_RABs_ToBeSetup_Item;
for (i=0; i< x2HandoverRequest->uE_ContextInformation.e_RABs_ToBeSetup_List.list.count;i++){
e_RABs_ToBeSetup_Item=(X2ap_E_RABs_ToBeSetup_Item_t *) x2HandoverRequest->uE_ContextInformation.e_RABs_ToBeSetup_List.list.array[i];
X2AP_HANDOVER_REQ(m).e_rabs_tobesetup[i].e_rab_id=e_RABs_ToBeSetup_Item->e_RAB_ID;
memcpy(X2AP_HANDOVER_REQ(m).e_rabs_tobesetup[i].eNB_addr.buffer,
e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.buf,
e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size);
X2AP_HANDOVER_REQ(m).e_rabs_tobesetup[i].eNB_addr.length =
e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size * 8 - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.bits_unused;
OCTET_STRING_TO_INT32(&e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.gTP_TEID,
X2AP_HANDOVER_REQ(m).e_rabs_tobesetup[i].gtp_teid);
}
if ((x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf) &&
(x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.size == 32)) {
memcpy(X2AP_HANDOVER_REQ(m).kenb, x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf, 32);
X2AP_HANDOVER_REQ(m).kenb_ncc = x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.nextHopChainingCount;
itti_send_msg_to_task(TASK_RRC_ENB, x2ap_eNB_data->x2ap_eNB_instance->instance, m);
return 0;
} else {
return -1;
X2AP_WARN ("Size of eNB key star does not match the expected value\n");
//return -1;
}
itti_send_msg_to_task(TASK_RRC_ENB, x2ap_eNB_data->x2ap_eNB_instance->instance, m);
#if 0
if (x2SetupRequest->globalENB_ID.eNB_ID.present == X2ap_ENB_ID_PR_home_eNB_ID) {
// Home eNB ID = 28 bits
......
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