From 24884bfb2bff03e7ebfbe895b98c62fc3b055944 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong Date: Wed, 19 Sep 2018 18:57:48 +0200 Subject: [PATCH 1/3] Update complete elements with ue context setup request --- openair2/COMMON/f1ap_messages_types.h | 14 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 455 ++++++++++++++++-- openair2/F1AP/f1ap_du_ue_context_management.c | 41 +- openair2/F1AP/f1ap_handlers.c | 4 +- openair3/UTILS/conversions.h | 34 +- 5 files changed, 501 insertions(+), 47 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d133aab66e..fbc5995617 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -247,6 +247,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { typedef struct f1ap_ul_rrc_message_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; + uint16_t rnti; uint8_t srb_id; uint8_t *rrc_container; int rrc_container_length; @@ -265,18 +266,25 @@ typedef struct f1ap_drb_to_be_setup_s { } f1ap_drb_to_be_setup_t; typedef struct f1ap_ue_context_setup_req_s { - uint32_t gNB_CU_ue_id; + uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti uint32_t *gNB_DU_ue_id; + uint16_t rnti; // SpCell Info uint16_t mcc; uint16_t mnc; uint8_t mnc_digit_length; uint64_t nr_cellid; + uint8_t servCellIndex; + uint8_t cellULConfigured; uint32_t servCellId; uint8_t *cu_to_du_rrc_information; uint8_t cu_to_du_rrc_information_length; - f1ap_drb_to_be_setup_t *drbs_to_be_setup; - uint8_t drbs_to_be_setup_length; + f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req + uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req + s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req; + // coniatner for the rrc_eNB_generate_SecurityModeCommand message + uint8_t *rrc_container; + int rrc_container_length; } f1ap_ue_context_setup_req_t; #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 82f97e4758..da04a80578 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -122,16 +122,26 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + /* optional */ + /* 6.1 cG_ConfigInfo */ + ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); /* optional */ + /* 6.2 uE_CapabilityRAT_ContainerList */ + ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); + /* optional */ + /* 6.3 measConfig */ + ie->value.choice.CUtoDURRCInformation.measConfig = (F1AP_MeasConfig_t *)calloc(1, sizeof(F1AP_MeasConfig_t)); + OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.measConfig, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ /* c7. Candidate_SpCell_List */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); @@ -149,7 +159,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; - /* 5.1 Candidate_SpCell_Item */ + /* 7.1 Candidate_SpCell_Item */ F1AP_Candidate_SpCell_Item_t candidate_spCell_item; memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); @@ -178,11 +188,18 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; + /* 8.1 longDRXCycleLength */ ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + + /* optional */ + /* 8.2 shortDRXCycleLength */ if (0) { ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum } + + /* optional */ + /* 8.3 shortDRXCycleTimer */ if (0) { ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; @@ -226,11 +243,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; - /* 8.1 SCell_ToBeSetup_Item */ + /* 10.1 SCell_ToBeSetup_Item */ F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); - // /* - sCell_ID */ + /* 10.1.1 sCell_ID */ F1AP_NRCGI_t nRCGI; /* TODO correct MCC/MNC */ MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, @@ -238,12 +255,19 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeSetup_item.sCell_ID = nRCGI; - /* sCellIndex */ + /* 10.1.2 sCellIndex */ scell_toBeSetup_item.sCellIndex = 3; // issue here - // /* ADD */ + + /* OPTIONAL */ + /* 10.1.3 sCellULConfigured*/ + if (0) { + scell_toBeSetup_item.sCellULConfigured = (F1AP_CellULConfigured_t *)calloc(1, sizeof(F1AP_CellULConfigured_t)); + scell_toBeSetup_item.sCellULConfigured = F1AP_CellULConfigured_ul_and_sul; // enum + } + + /* ADD */ scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, @@ -251,7 +275,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* mandatory */ + + /* mandatory */ /* c11. SRBs_ToBeSetup_List */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; @@ -268,13 +293,20 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; - /* 9.1 SRBs_ToBeSetup_Item */ + /* 11.1 SRBs_ToBeSetup_Item */ F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); - /* - sRBID */ + /* 11.1.1 sRBID */ srbs_toBeSetup_item.sRBID = 2L; + /* OPTIONAL */ + /* 11.1.2 duplicationIndication */ + if (0) { + srbs_toBeSetup_item.duplicationIndication = (F1AP_DuplicationIndication_t *)calloc(1, sizeof(F1AP_DuplicationIndication_t)); + srbs_toBeSetup_item.duplicationIndication = F1AP_DuplicationIndication_true; // enum + } + /* ADD */ srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, @@ -297,53 +329,355 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - /* 10.1 DRBs_ToBeSetup_Item */ + /* 12.1 DRBs_ToBeSetup_Item */ F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); - /* dRBID */ - drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; + /* 12.1.1 dRBID */ + drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; // 9 - /* qoSInformation */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + /* 12.1.2 qoSInformation */ + int some_decide_qos = 1; // BK: Need Check + if (some_decide_qos) { + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - /* ULTunnels_ToBeSetup_List */ + /* 12.1.2.1 eUTRANQoS */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + + /* 12.1.2.1.1 qCI */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + + /* 12.1.2.1.2 allocationAndRetentionPriority */ + { + /* 12.1.2.1.2.1 priorityLevel */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + + /* 12.1.2.1.2.2 pre_emptionCapability */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_may_trigger_pre_emption; // enum + + /* 12.1.2.1.2.2 pre_emptionVulnerability */ + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } + + /* OPTIONAL */ + /* 12.1.2.1.3 gbrQosInformation */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation = (F1AP_GBR_QosInformation_t *)calloc(1, sizeof(F1AP_GBR_QosInformation_t)); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateDL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateUL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateDL, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateUL, 1L); + } + + } else { + /* 12.1.2 dRB_Information */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_dRB_Information; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information = (F1AP_DRB_Information_t *)calloc(1, sizeof(F1AP_DRB_Information_t)); + + /* 12.1.2.1 dRB_QoS */ + { + /* qoS_Characteristics */ + { + int some_decide_qoS_characteristics = 1; // BK: Need Check + if (some_decide_qoS_characteristics) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + + /* fiveQI */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + + /* OPTIONAL */ + /* qoSPriorityLevel */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + } + + } else { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + + /* qoSPriorityLevel */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + + /* packetDelayBudget */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + + /* packetErrorRate */ + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + + /* OPTIONAL */ + /* delayCritical */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + } + + } // if some_decide_qoS_characteristics + + } // qoS_Characteristics + + /* nGRANallocationRetentionPriority */ + { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } // nGRANallocationRetentionPriority + + /* OPTIONAL */ + /* gBR_QoS_Flow_Information */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + + /* OPTIONAL */ + /* maxPacketLossRateDownlink */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + } + + /* OPTIONAL */ + /* maxPacketLossRateUplink */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + } + + } + + /* OPTIONAL */ + /* reflective_QoS_Attribute */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + } + + } // dRB_QoS + + /* 12.1.2.2 sNSSAI */ + { + /* sST */ + OCTET_STRING_fromBuf(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + /* OPTIONAL */ + /* sD */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + } + } + /* OPTIONAL */ + /* 12.1.2.3 notificationControl */ + if (0) { + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); + drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + } + + /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy + int k; + for (k = 0; k < 1; k ++) { + + F1AP_Flows_Mapped_To_DRB_Item_t flows_mapped_to_drb_item; + memset((void *)&flows_mapped_to_drb_item, 0, sizeof(F1AP_Flows_Mapped_To_DRB_Item_t)); + + /* qoSFlowIndicator */ + flows_mapped_to_drb_item.qoSFlowIndicator = 1L; + + /* qoSFlowLevelQoSParameters */ + { + /* qoS_Characteristics */ + { + int some_decide_qoS_characteristics = 1; // BK: Need Check + if (some_decide_qoS_characteristics) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + + /* fiveQI */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + + /* OPTIONAL */ + /* qoSPriorityLevel */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + } + + } else { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + + /* qoSPriorityLevel */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + + /* packetDelayBudget */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + + /* packetErrorRate */ + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + + /* OPTIONAL */ + /* delayCritical */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + } + + /* OPTIONAL */ + /* averagingWindow */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + } + + /* OPTIONAL */ + /* maxDataBurstVolume */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + } + + } // if some_decide_qoS_characteristics + + } // qoS_Characteristics + + /* nGRANallocationRetentionPriority */ + { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + } // nGRANallocationRetentionPriority + + /* OPTIONAL */ + /* gBR_QoS_Flow_Information */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + + /* OPTIONAL */ + /* maxPacketLossRateDownlink */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + } + + /* OPTIONAL */ + /* maxPacketLossRateUplink */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + } + + } + + /* OPTIONAL */ + /* reflective_QoS_Attribute */ + if (0) { + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = 1L; + } + + } // qoSFlowLevelQoSParameters + // BK: need check + ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); + } + + } // if some_decide_qos + + /* 12.1.3 uLUPTNLInformation_ToBeSetup_List */ for (j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { f1ap_up_tnl_t *up_tnl = &f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j]; - /* ULTunnels_ToBeSetup_Item */ + + /* 12.3.1 ULTunnels_ToBeSetup_Item */ F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - // gTPTunnel + /* 12.3.1.1 gTPTunnel */ uLUPTNLInformation_ToBeSetup_Item = calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = - F1AP_UPTransportLayerInformation_PR_gTPTunnel; + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(up_tnl->tl_address, &gTPTunnel->transportLayerAddress); + /* 12.3.1.1.2 gTP_TEID */ INT32_TO_OCTET_STRING(up_tnl->gtp_teid, &gTPTunnel->gTP_TEID); + // Add uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } - /* rLCMode */ + /* 12.1.4 rLCMode */ /* TODO use rlc_mode from f1ap_drb_to_be_setup */ switch (f1ap_ue_context_setup_req->drbs_to_be_setup[i].rlc_mode) { - case RLC_MODE_AM: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; - break; - default: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; + case RLC_MODE_AM: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; + break; + default: + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; } /* OPTIONAL */ - /* ULConfiguration */ + /* 12.1.5 ULConfiguration */ if (0) { drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + drbs_toBeSetup_item.uLConfiguration->uLUEConfiguration = F1AP_ULUEConfiguration_no_data; + } + + /* OPTIONAL */ + /* 12.1.6 duplicationActivation */ + if (0) { + drbs_toBeSetup_item.duplicationActivation = (F1AP_DuplicationActivation_t *)calloc(1, sizeof(F1AP_DuplicationActivation_t)); + drbs_toBeSetup_item.duplicationActivation = F1AP_DuplicationActivation_active; // enum } /* ADD */ @@ -355,11 +689,56 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* OPTIONAL */ + /* InactivityMonitoringRequest */ if (0) { - //F1AP_InactivityMonitoringRequest_t InactivityMonitoringRequest; - //F1AP_RAT_FrequencyPriorityInformation_t RAT_FrequencyPriorityInformation; - //F1AP_RRCContainer_t RRCContainer; - //F1AP_MaskedIMEISV_t MaskedIMEISV; + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringRequest; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_InactivityMonitoringRequest; + ie->value.choice.InactivityMonitoringRequest = F1AP_InactivityMonitoringRequest_true; // 0 + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* RAT_FrequencyPriorityInformation */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; + + int some_decide_rat = 1; // BK: Need Check + if (some_decide_rat) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 11L; + } else { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 11L; + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* RRCContainer */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* OPTIONAL */ + /* MaskedIMEISV */ + if (0) { + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_MaskedIMEISV; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_MaskedIMEISV; + MaskedIMEISV_TO_BIT_STRING(12340000, &ie->value.choice.MaskedIMEISV); // size (64) + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* encode */ @@ -698,7 +1077,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; - /* ULTunnels_ToBeSetupMod_List */ + /* uLUPTNLInformation_ToBeSetup_List */ int j = 0; int maxnoofULTunnels = 1; // 2; for (j=0; @@ -711,13 +1090,15 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + /* transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + /* gTP_TEID */ OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", strlen("4567")); + // Add uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 76aa4299a1..7d8a8026c0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -56,10 +56,13 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; + /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + /* optional */ + /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false); if (ie) { @@ -70,6 +73,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL; } + /* SpCell_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SpCell_ID, true); PLMNID_TO_MCC_MNC(&ie->value.choice.NRCGI.pLMN_Identity, @@ -78,15 +82,42 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->mnc_digit_length); BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); - /* TODO: decode candidate SpCell */ - /* TODO: decode CUtoDURRCInformation */ + /* ServCellIndex */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_ServCellndex, true); + f1ap_ue_context_setup_req->servCellIndex = ie->value.choice.ServCellIndex; - /* TODO: Candidate_SpCell_List */ + /* optional */ + /* CellULConfigured */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SpCellULConfigured, false); // SpCellULConfigured + if (ie) { + f1ap_ue_context_setup_req->cellULConfigured = malloc(sizeof(uint32_t)); + if (f1ap_ue_context_setup_req->cellULConfigured) + f1ap_ue_context_setup_req->cellULConfigured = ie->value.choice.CellULConfigured; + } else { + f1ap_ue_context_setup_req->cellULConfigured = NULL; + } - /* TODO: SCell_ToBeSetup_List */ + /* CUtoDURRCInformation */ - /* TODO: SRBs_ToBeSetup_List */ + + /* Candidate_SpCell_List */ + + + /* optional */ + /* DRXCycle */ + + /* optional */ + /* ResourceCoordinationTransferContainer */ + + + /* SCell_ToBeSetup_List */ + + /* SRBs_ToBeSetup_List */ + + /* DRBs_ToBeSetup_List */ /* Decode DRBs_ToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index ef0b6d1f5c..6d957e4ad6 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -37,6 +37,8 @@ #include "f1ap_du_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_du_rrc_message_transfer.h" +#include "f1ap_cu_ue_context_management.h" +#include "f1ap_du_ue_context_management.h" extern f1ap_setup_req_t *f1ap_du_data_from_du; @@ -49,7 +51,7 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { { 0, 0, 0 }, /* ErrorIndication */ { 0, 0, 0 }, /* gNBDUConfigurationUpdate */ { 0, 0, 0 }, /* gNBCUConfigurationUpdate */ - { 0, 0, 0 }, /* UEContextSetup */ + { DU_handle_UE_CONTEXT_SETUP_REQUEST, CU_handle_UE_CONTEXT_SETUP_RESPONSE, 0 }, /* UEContextSetup */ { 0, 0, 0 }, /* UEContextRelease */ { 0, 0, 0 }, /* UEContextModification */ { 0, 0, 0 }, /* UEContextModificationRequired */ diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index e2773aeedf..4763352af7 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -283,7 +283,7 @@ do { \ } while(0) -/* TS 38.473 v15.1.1 section 9.3.2.3: +/* TS 38.473 v15.2.1 section 9.3.2.3: * TRANSPORT LAYER ADDRESS for IPv4 is 32bit (TS 38.414) */ #define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \ @@ -323,6 +323,38 @@ do { \ (bITsTRING)->bits_unused = 4; \ } while(0) +/* TS 38.473 v15.2.1 section 9.3.1.55: + * MaskedIMEISV is BIT_STRING(64) + */ +#define MaskedIMEISV_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(8, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = (mACRO) >> 56 & 0xFF; \ + (bITsTRING)->buf[1] = (mACRO) >> 48 & 0xFF; \ + (bITsTRING)->buf[2] = (mACRO) >> 40 & 0xFF; \ + (bITsTRING)->buf[3] = (mACRO) >> 32 & 0xFF; \ + (bITsTRING)->buf[4] = (mACRO) >> 24 & 0xFF; \ + (bITsTRING)->buf[5] = (mACRO) >> 16 & 0xFF; \ + (bITsTRING)->buf[6] = (mACRO) >> 8 & 0xFF; \ + (bITsTRING)->buf[7] = (mACRO) >> 4 & 0xFF; \ + (bITsTRING)->size = 8; \ + (bITsTRING)->bits_unused = 0; \ +} while(0) + +#define BIT_STRING_TO_MaskedIMEISV(bITsTRING, mACRO) \ +do { \ + DevCheck((bITsTRING)->size == 8, (bITsTRING)->size, 8, 0); \ + DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \ + mACRO = ((bITsTRING)->buf[0] << 56) + \ + ((bITsTRING)->buf[1] << 48) + \ + ((bITsTRING)->buf[2] << 40) + \ + ((bITsTRING)->buf[3] << 32) + \ + ((bITsTRING)->buf[4] << 24) + \ + ((bITsTRING)->buf[5] << 16) + \ + ((bITsTRING)->buf[6] << 8) + \ + ((bITsTRING)->buf[7]); \ +} while (0) + /* TS 36.413 v10.9.0 section 9.2.1.37: * Macro eNB ID: * Equal to the 20 leftmost bits of the Cell From a7be0cc2a81592e69ad93da36f78e22d76643aba Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong Date: Wed, 19 Sep 2018 19:47:11 +0200 Subject: [PATCH 2/3] send F1AP_UL_RRC_MESSAGE from rrc --- openair2/COMMON/f1ap_messages_types.h | 2 + openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 4 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 25 ++++----- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 6 +-- openair2/F1AP/f1ap_du_task.c | 7 +++ openair2/RRC/LTE/rrc_defs.h | 6 +++ openair2/RRC/LTE/rrc_eNB.c | 55 +++++++++++++++++--- openair2/RRC/LTE/rrc_eNB_S1AP.c | 22 ++++++++ 9 files changed, 101 insertions(+), 28 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index fbc5995617..ed04cc704e 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -83,6 +83,8 @@ typedef struct f1ap_setup_req_s { uint16_t sctp_in_streams; uint16_t sctp_out_streams; + uint16_t default_sctp_stream_id; + // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 802cd167a2..4948e2ebe1 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -271,7 +271,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0); + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index eeed466ceb..ccdc85fa69 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -147,10 +147,8 @@ void *F1AP_CU_task(void *arg) { case F1AP_DL_RRC_MESSAGE: // from rrc LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); - // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - // &F1AP_SETUP_RESP(received_msg)); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &F1AP_SETUP_RESP(received_msg)); + &F1AP_DL_RRC_MESSAGE(received_msg)); break; // case F1AP_SETUP_RESPONSE: // This is from RRC diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 9149607e96..0b8a67ce93 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -94,13 +94,15 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); // this should be the one transmitted via initial ul rrc message transfer + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) { LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); //return -1; } - + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -160,11 +162,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } -//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, - rb_id_t srb_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_ul_rrc_message_t *f1ap_ul_rrc) { LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); @@ -191,7 +190,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -200,7 +199,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -209,7 +208,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = srb_idP; + ie->value.choice.SRBID = f1ap_ul_rrc->srb_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -219,7 +218,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_ul_rrc->rrc_container, f1ap_ul_rrc->rrc_container_length); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ @@ -228,9 +227,11 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, return -1; } + du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; } + /* UL RRC Message Transfer */ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, @@ -323,7 +324,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return -1; } - du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); + du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index e0f2f8f71f..a8e704aaa4 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,10 +39,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, - rb_id_t srb_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP); +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, + f1ap_ul_rrc_message_t *f1ap_ul_rrc); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 3f99810a22..73dc40e655 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -93,6 +93,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; + f1ap_du_data->default_sctp_stream_id = 0; DU_send_F1_SETUP_REQUEST(instance); @@ -159,6 +160,12 @@ void *F1AP_DU_task(void *arg) { &received_msg->ittiMsg.sctp_data_ind); break; + case F1AP_UL_RRC_MESSAGE: // from rrc + LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + break; + case TERMINATE_MESSAGE: LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n"); itti_exit_task(); diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 7408f64f35..0c81a04a7f 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -512,6 +512,11 @@ typedef struct HANDOVER_INFO_UE_s { uint8_t measFlag; } HANDOVER_INFO_UE; +typedef struct RRC_CONTAINER_s{ + char *buffer; + uint8_t size; +} RRC_CONTAINER_t; + typedef struct eNB_RRC_UE_s { uint8_t primaryCC_id; #if (RRC_VERSION >= MAKE_VERSION(10, 0, 0)) @@ -539,6 +544,7 @@ typedef struct eNB_RRC_UE_s { HANDOVER_INFO* handover_info; MeasResults_t* measResults; + RRC_CONTAINER_t *security_mode_cmd; UE_EUTRA_Capability_t* UE_Capability; ImsiMobileIdentity_t imsi; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 720c23ce9d..1f58e85668 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1095,7 +1095,28 @@ rrc_eNB_process_RRCConnectionSetupComplete( rrc_eNB_generate_SecurityModeCommand( ctxt_pP, ue_context_pP); +/* + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)) { + +message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + } +*/ // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + } } @@ -1146,7 +1167,9 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - rrc_data_req( + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB)) { + rrc_data_req( ctxt_pP, DCCH, rrc_eNB_mui++, @@ -1154,6 +1177,7 @@ rrc_eNB_generate_SecurityModeCommand( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); + } } @@ -6944,14 +6968,29 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. present == RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - ue_context_p->ue_context.Status = RRC_CONNECTED; - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + + if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU) || + (RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU) ) { + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UL_RRC_MESSAGE); + F1AP_UL_RRC_MESSAGE (message_p).rrc_container = &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8; + F1AP_UL_RRC_MESSAGE (message_p).rrc_container_length = strlen(&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + F1AP_UL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; + F1AP_UL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; + F1AP_UL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti; + F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH; + itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n"); + } else { //if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || + // (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB) ) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + ue_context_p->ue_context.Status = RRC_CONNECTED; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - + } //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (rrc_agent_registered[ctxt_pP->module_id]) { agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 7d24228602..15ea141301 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1059,6 +1059,28 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char rrc_eNB_generate_UECapabilityEnquiry (&ctxt, ue_context_p); } } +/* + if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){ + + message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; + + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + + } +*/ + return (0); } } From cee89cb389245b2fd13a0ddf31b9741b78180f82 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 19 Sep 2018 21:22:24 +0200 Subject: [PATCH 3/3] Send the UL_RRC_MESSAGE over DCCH from CU to RRC --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 28 ++++++++++++++------ openair2/LAYER2/RLC/rlc.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 3 +-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 4948e2ebe1..638717b54f 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -332,7 +332,10 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - LOG_D(CU_F1AP, "srb_id %lu \n", srb_id); + if (srb_id < 1 ) + LOG_E(CU_F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu (CCCH)\n", srb_id); + else + LOG_D(CU_F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); // issue in here @@ -340,16 +343,25 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // BK: need check - // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); + // print message in debug mode LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); for (int i=0;ivalue.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); LOG_D(CU_F1AP, "\n"); + // create an ITTI message and copy SDU + message_p = itti_alloc_new_message (TASK_CU_F1, RRC_DCCH_DATA_IND); + memset (RRC_DCCH_DATA_IND (message_p).sdu_p, 0, CCCH_SDU_SIZE); + + RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; + memcpy(RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, + ie->value.choice.RRCContainer.size); + + RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; + RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],cu_ue_f1ap_id); + RRC_DCCH_DATA_IND (message_p).module_id = instance; + RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU + + itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); + return 0; } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 793e140641..17918cd5ae 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -63,7 +63,7 @@ async_server_thread_init (void) //create log_list //log_list_init(&log_list); - AssertFatal(0, "this should not be reached!\n"); + //AssertFatal(0, "this should not be reached!\n"); async_server_shutdown = 0; if ((pthread_mutex_init (&async_server_lock, NULL) != 0) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 1f58e85668..4c54f75d29 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6981,8 +6981,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH; itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p); LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n"); - } else { //if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) || - // (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB) ) { + } else { // eNB or CU node type rrc_eNB_process_RRCConnectionSetupComplete( ctxt_pP, ue_context_p,