Commit 1f3b3970 authored by Melissa Elkadi's avatar Melissa Elkadi

do_nrMeasReport updated for elements eNB expects

Also updated the generate_nrMeasReport().
The uper_encode_to_buffer is still not working.
parent c4d7e11c
......@@ -4216,97 +4216,59 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
return((enc_rval.encoded+7)/8);
}
ssize_t do_nrMeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) {
asn_enc_rval_t enc_rval;
ssize_t do_nrMeasurementReport(int measid, long phy_id, uint8_t *buffer) {
LTE_UL_DCCH_Message_t ul_dcch_msg;
LTE_MeasurementReport_t *measurementReport;
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_measurementReport;
measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport;
measurementReport->criticalExtensions.present=LTE_MeasurementReport__criticalExtensions_PR_c1;
measurementReport->criticalExtensions.choice.c1.present=LTE_MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1,
sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension));
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult=rsrq_s;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells=CALLOC(1,
sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells));
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15;
LTE_MeasResultCellListNR_r15_t *measResultListNR_r15;
measResultListNR_r15 = CALLOC(1,sizeof(*measResultListNR_r15));
struct LTE_MeasResultCellNR_r15 *measResultNR_r15;
measResultNR_r15 = CALLOC(1,sizeof(*measResultNR_r15));
measResultNR_r15->pci_r15;
struct LTE_CGI_InfoNR_r15 *measresult_nr_cgi2;
measresult_nr_cgi2 = CALLOC(1,sizeof(*measresult_nr_cgi2));
int count = measresult_nr_cgi2->plmn_IdentityInfoList_r15->list.count;
for (int i = 0; i < count; i++)
{
AssertFatal(i < count, "%d >= measresult_nr_cgi2->plmn_IdentityInfoList_r15->list.count", i);
//LTE_PLMN_IdentityInfoNR_r15_t *plmn_info_list = measResultNR_r15->ext1->cgi_Info_r15->plmn_IdentityInfoList_r15->list.array[i]->cellIdentity_r15.
LTE_PLMN_IdentityInfoNR_r15_t *plmn_info_list = measresult_nr_cgi2->plmn_IdentityInfoList_r15->list.array[i];
memset(&plmn_info_list,0,sizeof(plmn_info_list));
LTE_PLMN_Identity_t *plmn_id = plmn_info_list->plmn_IdentityList_r15.list.array[i];
memset(&plmn_id, 0, sizeof(plmn_id));
plmn_id->mcc = CALLOC(1, sizeof(plmn_id->mcc));
asn_set_empty(plmn_id->mcc->list);
LTE_MCC_MNC_Digit_t dummy;
dummy=2;
ASN_SEQUENCE_ADD(plmn_id->mcc->list, &dummy);
dummy=6;
ASN_SEQUENCE_ADD(plmn_id->mcc->list, &dummy);
dummy=2;
ASN_SEQUENCE_ADD(plmn_id->mcc->list, &dummy);
plmn_id->mnc.list.size=0;
plmn_id->mnc.list.count=0;
dummy=8;
ASN_SEQUENCE_ADD(&plmn_id->mnc.list, &dummy);
dummy=0;
ASN_SEQUENCE_ADD(&plmn_id->mnc.list, &dummy);
plmn_info_list->cellIdentity_r15.buf = MALLOC(8);
plmn_info_list->cellIdentity_r15.buf[0] = 0x01;
plmn_info_list->cellIdentity_r15.buf[1] = 0x48;
plmn_info_list->cellIdentity_r15.buf[2] = 0x0f;
plmn_info_list->cellIdentity_r15.buf[3] = 0x03;
plmn_info_list->cellIdentity_r15.size = 4;
plmn_info_list->cellIdentity_r15.bits_unused = 4;
plmn_info_list->trackingAreaCode_r15->buf = MALLOC(2);
plmn_info_list->trackingAreaCode_r15->buf[0]=0x00;
plmn_info_list->trackingAreaCode_r15->buf[1]=0x10;
plmn_info_list->trackingAreaCode_r15->size=2;
plmn_info_list->trackingAreaCode_r15->bits_unused=0;
}
memset((void *)&ul_dcch_msg, 0, sizeof(LTE_UL_DCCH_Message_t));
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_measurementReport;
measResultNR_r15->ext1->cgi_Info_r15 = measResultNR_r15;
struct LTE_MeasResultNR_r15_t meas2;
meas2.rsrpResult_r15 = &(rsrp_t);
meas2.rsrqResult_r15 = &(rsrq_t);
measResultNR_r15->measResultCell_r15 = meas2;
LTE_MeasurementReport_t *measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport;
measurementReport->criticalExtensions.present = LTE_MeasurementReport__criticalExtensions_PR_c1;
measurementReport->criticalExtensions.choice.c1.present = LTE_MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8;
ASN_SEQUENCE_ADD(&measResultListNR_r15->list, measResultListNR_r15);
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultNeighCellListNR_r15 = *(measResultListNR_r15);
LTE_MeasurementReport_r8_IEs_t *mr_r8 = &measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8;
mr_r8->measResults.measId = measid;
mr_r8->measResults.measResultNeighCells = CALLOC(1, sizeof(*mr_r8->measResults.measResultNeighCells));
mr_r8->measResults.measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15;
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message,
LTE_MeasResultCellListNR_r15_t *mr_cl = &mr_r8->measResults.measResultNeighCells->choice.measResultNeighCellListNR_r15;
mr_cl = CALLOC(1, sizeof(*mr_cl));
LTE_MeasResultCellNR_r15_t *measResultNR_r15;
measResultNR_r15 = CALLOC(1, sizeof(*measResultNR_r15));
measResultNR_r15->pci_r15 = phy_id;
LTE_MeasResultCellListNR_r15_t *measResultListNR_r15;
measResultListNR_r15 = CALLOC(1, sizeof(*measResultListNR_r15));
ASN_SEQUENCE_ADD(&measResultListNR_r15->list, measResultNR_r15);
ASN_SEQUENCE_ADD(&mr_cl->list, measResultListNR_r15);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message,
NULL,
(void *)&ul_dcch_msg,
buffer,
RRC_BUF_SIZE);
if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
LOG_I(RRC, "[eNB AssertFatal] ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
free(mr_r8->measResults.measResultNeighCells);
mr_r8->measResults.measResultNeighCells = NULL;
free(measResultListNR_r15);
measResultListNR_r15 = NULL;
free(measResultNR_r15);
measResultNR_r15 = NULL;
return -1;
}
free(mr_r8->measResults.measResultNeighCells);
mr_r8->measResults.measResultNeighCells = NULL;
free(measResultListNR_r15);
measResultListNR_r15 = NULL;
free(measResultNR_r15);
measResultNR_r15 = NULL;
return((enc_rval.encoded+7)/8);
}
......
......@@ -341,9 +341,9 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
LTE_MCCH_Message_t *mcch_message,
LTE_MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration);
uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t);
ssize_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t);
uint8_t do_nrMeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t);
ssize_t do_nrMeasurementReport(int measid, long phy_id, uint8_t *buffer);
uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer);
......
......@@ -151,6 +151,8 @@ static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol
static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index );
static void rrc_ue_generate_nrMeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index );
static uint8_t check_trigger_meas_event(
module_id_t module_idP,
frame_t frameP,
......@@ -4091,6 +4093,36 @@ void ue_meas_filtering( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_
}
}
}
//Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5
//-----------------------------------------------------------------------------
void rrc_ue_generate_nrMeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index ) {
uint8_t buffer[RRC_BUF_SIZE];
uint8_t target_eNB_offset = UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget;
LTE_PhysCellId_t targetCellId = UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId;
for (int i = 0; i < MAX_MEAS_ID; i++) {
if (UE_rrc_inst[ctxt_pP->module_id].measReportList[eNB_index][i] != NULL) {
LTE_MeasId_t measId = UE_rrc_inst[ctxt_pP->module_id].measReportList[eNB_index][i]->measId;
LOG_I(RRC,"Melissa [UE %d] Frame %d: source eNB: %d target eNB: %d servingCell(%d) targetCell(%ld)\n",
ctxt_pP->module_id,
ctxt_pP->frame,
eNB_index,
target_eNB_offset,
get_adjacent_cell_id(ctxt_pP->module_id, eNB_index),
targetCellId);
if (ctxt_pP->frame != 0) {
ssize_t size = do_nrMeasurementReport(measId, targetCellId, buffer);
AssertFatal(size >= 0, "do_nrMeasurementReport failed \n");
LOG_I(RRC, "Melissa [UE %d] Frame %d : Generating Measurement Report for eNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, eNB_index);
int result = pdcp_data_req(ctxt_pP, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA,NULL, NULL);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
}
}
}
}
//Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5
//-----------------------------------------------------------------------------
......@@ -4149,9 +4181,9 @@ void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t e
(long int)rsrq_s,
(long int)rsrp_t,
(long int)rsrq_t);
ssize_t size = do_nrMeasurementReport(ctxt_pP->module_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
AssertFatal(size >= 0, "do_nrMeasurementReport failed \n");
LOG_I(RRC, "Melissa [UE %d] Frame %d : Generating Measurement Report for eNB %d\n",
ssize_t size = do_MeasurementReport(ctxt_pP->module_id, buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
AssertFatal(size >= 0, "do_MeasurementReport failed \n");
LOG_I(RRC, "[UE %d] Frame %d : Generating Measurement Report for eNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, eNB_index);
result = pdcp_data_req(ctxt_pP, SRB_FLAG_YES, DCCH, rrc_mui++, 0, size, buffer, PDCP_TRANSMISSION_MODE_DATA,NULL, NULL);
AssertFatal (result == TRUE, "PDCP data request failed!\n");
......@@ -4162,7 +4194,6 @@ void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t e
// }
}
}
/* Melissa: also need to generate report based on MeasObj for 5G (can look in eNB for these)*/
}
static bool have_received_nr_meas_msg(void)
{
......@@ -4314,7 +4345,7 @@ void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint
}
ue->measReportList[i][j]->measId = ue->MeasId[i][j]->measId;
ue->measReportList[i][j]->numberOfReportsSent = 0;
rrc_ue_generate_MeasurementReport(ctxt_pP, eNB_index);
rrc_ue_generate_nrMeasurementReport(ctxt_pP, eNB_index);
ue->HandoverInfoUe.measFlag = 1;
LOG_I(RRC,"[UE %d] Frame %d: RSRB detected, state: %d \n",
ctxt_pP->module_id, ctxt_pP->frame, ue->Info[0].State);
......
......@@ -4584,6 +4584,7 @@ rrc_eNB_process_MeasurementReport(
/* TODO: improve NR triggering */
if (measResults2->measId == 7) { //Melissa this is where we finish step 26
LOG_I(RRC, "MELISSA! You got into NR triggering!!\n");
if ((ue_context_pP->ue_context.Status != RRC_NR_NSA) && (ue_context_pP->ue_context.Status != RRC_NR_NSA_RECONFIGURED)) {
MessageDef *msg;
ue_context_pP->ue_context.Status = RRC_NR_NSA;
......@@ -4607,10 +4608,12 @@ rrc_eNB_process_MeasurementReport(
memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer,enc_buf,enc_size);
X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size;
#if 0
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId
= measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId;
= measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId; //Melissa
#endif
X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId
= measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15;
//For the moment we have a single E-RAB which will be the one to be added to the gNB
//Not sure how to select bearers to be added if there are multiple.
X2AP_ENDC_SGNB_ADDITION_REQ(msg).nb_e_rabs_tobeadded = 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