diff --git a/openair2/X2AP/x2ap_eNB_encoder.c b/openair2/X2AP/x2ap_eNB_encoder.c index 8b1c030d35d0b14d588475cf317d450f2fa3e686..392206e4d730653e76dfea07c299860347aaa625 100644 --- a/openair2/X2AP/x2ap_eNB_encoder.c +++ b/openair2/X2AP/x2ap_eNB_encoder.c @@ -44,9 +44,9 @@ int x2ap_eNB_encode_pdu(X2AP_X2AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) DevAssert(buffer != NULL); DevAssert(len != NULL); - if (asn1_xer_print) { + //if (asn1_xer_print) { xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)pdu); - } + //} encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, pdu, (void **)buffer); diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index 2a9406b632c71ec45acd14ed301e8f7f7decaadc..ec3d3f4aa0fe243d28f0927a3394cf395cdb0ae7 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -323,6 +323,10 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN &servedCellMember->servedCellInfo.cellId.eUTRANcellIdentifier); INT16_TO_OCTET_STRING(instance_p->tac, &servedCellMember->servedCellInfo.tAC); + X2AP_INFO("TAC: %d -> %02x%02x\n", instance_p->tac, + servedCellMember->servedCellInfo.tAC.buf[0], + servedCellMember->servedCellInfo.tAC.buf[1]); + plmn = (X2AP_PLMN_Identity_t *)calloc(1,sizeof(X2AP_PLMN_Identity_t)); { MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn); @@ -1341,7 +1345,7 @@ int x2ap_eNB_generate_ENDC_x2_setup_request( ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { - X2AP_ERROR("Failed to encode X2 setup request\n"); + X2AP_ERROR("Failed to encode X2 setup response\n"); return -1; } @@ -1357,6 +1361,7 @@ int x2ap_eNB_generate_ENDC_x2_setup_request( int x2ap_gNB_generate_ENDC_x2_setup_response( x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p) { + X2AP_INFO("In x2ap_gNB_generate_ENDC_x2_setup_response ()!\n"); X2AP_X2AP_PDU_t pdu; X2AP_ENDCX2SetupResponse_t *out; X2AP_ENDCX2SetupResponse_IEs_t *ie; @@ -1375,7 +1380,7 @@ int x2ap_gNB_generate_ENDC_x2_setup_response( /* Prepare the X2AP message to encode */ memset(&pdu, 0, sizeof(pdu)); - pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage; + pdu.present = X2AP_X2AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome.procedureCode = X2AP_ProcedureCode_id_endcX2Setup; pdu.choice.successfulOutcome.criticality = X2AP_Criticality_reject; pdu.choice.successfulOutcome.value.present = X2AP_SuccessfulOutcome__value_PR_ENDCX2SetupResponse; @@ -1394,6 +1399,12 @@ int x2ap_gNB_generate_ENDC_x2_setup_response( INT32_TO_OCTET_STRING(instance_p->eNB_id, &ie_GNB_ENDC->value.choice.GlobalGNB_ID.gNB_ID.choice.gNB_ID); + + X2AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, + ie_GNB_ENDC->value.choice.GlobalGNB_ID.gNB_ID.choice.gNB_ID.buf[0], + ie_GNB_ENDC->value.choice.GlobalGNB_ID.gNB_ID.choice.gNB_ID.buf[1], + ie_GNB_ENDC->value.choice.GlobalGNB_ID.gNB_ID.choice.gNB_ID.buf[2]); + MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, &ie_GNB_ENDC->value.choice.GlobalGNB_ID.pLMN_Identity); @@ -1414,6 +1425,12 @@ int x2ap_gNB_generate_ENDC_x2_setup_response( &servedCellMember->servedNRCellInfo.nrCellID.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(instance_p->eNB_id, &servedCellMember->servedNRCellInfo.nrCellID.nRcellIdentifier); + NR_EXTENDED_TAC_ID_TO_BIT_STRING(instance_p->tac, &servedCellMember->servedNRCellInfo.eXtended_TAC); + + X2AP_INFO("TAC: %d -> %02x%02x%02x\n", instance_p->tac, + servedCellMember->servedNRCellInfo.eXtended_TAC.buf[0], + servedCellMember->servedNRCellInfo.eXtended_TAC.buf[1], + servedCellMember->servedNRCellInfo.eXtended_TAC.buf[2]); plmn = (X2AP_PLMN_Identity_t *)calloc(1,sizeof(X2AP_PLMN_Identity_t)); { @@ -1421,9 +1438,9 @@ int x2ap_gNB_generate_ENDC_x2_setup_response( ASN_SEQUENCE_ADD(&servedCellMember->servedNRCellInfo.broadcastPLMNs.list, plmn); } - if (instance_p->frame_type[i] == TDD) { + if (instance_p->frame_type[i] == TDD) { // Panos: Remember to change that to TDD servedCellMember->servedNRCellInfo.nrModeInfo.present = X2AP_ServedNRCell_Information__nrModeInfo_PR_tdd; - servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_ARFCN = instance_p->tdd_nRARFCN[i]; + servedCellMember->servedNRCellInfo.nrModeInfo.choice.tdd.nR_ARFCN = 0; //instance_p->tdd_nRARFCN[i]; /*Missing addition of Frequency Band List item here, can't find it... */ switch (instance_p->N_RB_DL[i]) { case 50: @@ -1470,7 +1487,7 @@ int x2ap_gNB_generate_ENDC_x2_setup_response( AssertFatal(0,"nr_X2Setupresponse not supported for FDD!"); } /*Don't know where to extract the value of measurementTimingConfiguration from. Set it to 0 for now */ - INT16_TO_OCTET_STRING(0, &servedCellMember->servedNRCellInfo.measurementTimingConfiguration); + INT8_TO_OCTET_STRING(0, &servedCellMember->servedNRCellInfo.measurementTimingConfiguration); } ASN_SEQUENCE_ADD(&ie_GNB_ENDC->value.choice.ServedNRcellsENDCX2ManagementList.list, servedCellMember); diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 55d09e45b56b334230f1ba853e2fd1d60ddcbabb..1f577fa2a4788da1d891127631f5377c37546b92 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -1463,7 +1463,8 @@ x2ap_gNB_handle_ENDC_x2_setup_request(instance_t instance, DevAssert(instance_p != NULL); // Panos: Here we should be calling an ENDC specific setup response function - return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); + return x2ap_gNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); + //return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); } int diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index b4438b1aa5804c76383021c9c1ce0638d3874819..cba8d0fd2285bc7b316859338b1da8d70bb69156 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -371,6 +371,26 @@ do { \ (bITsTRING)->bits_unused = 4; \ } while(0) +/* +#define INT16_TO_3_BYTE_BUFFER(x, buf) \ +do { \ + (buf)[0] = 0x00; \ + (buf)[1] = (x) >> 8; \ + (buf)[2] = (x); \ +} while(0) +*/ + +#define NR_EXTENDED_TAC_ID_TO_BIT_STRING(x, aSN) \ +do { \ + (aSN)->buf = calloc(3, sizeof(uint8_t)); \ + (aSN)->size = 3; \ + (aSN)->buf[0] = 0x00; \ + (aSN)->buf[1] = (x) >> 8; \ + (aSN)->buf[2] = (x); \ +} while(0) + + + /* TS 38.473 v15.2.1 section 9.3.1.55: * MaskedIMEISV is BIT_STRING(64) */