1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains message handling functionality for DU cell management */
20 #include "common_def.h"
28 #include<ProtocolIE-Field.h>
30 #include "du_e2ap_msg_hdl.h"
31 #include "du_app_mac_inf.h"
32 #include "du_app_rlc_inf.h"
35 #include "odu_common_codec.h"
36 #include "du_cell_mgr.h"
37 #include "du_f1ap_msg_hdl.h"
39 extern DuCfgParams duCfgParam;
40 extern uint8_t duBuildAndSendMacCellCfg();
42 /*******************************************************************
44 * @brief Processes cells to be activated
48 * Function : procCellsToBeActivated
51 * - Processes cells to be activated list received in F1SetupRsp
54 * @return ROK - success
57 * ****************************************************************/
58 uint8_t procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
63 for(idx=0; idx<cellsToActivate.list.count; idx++)
67 DuCellCb *cellCb = NULLP;
69 Cells_to_be_Activated_List_Item_t cell = cellsToActivate.list.array[idx]->\
70 value.choice.Cells_to_be_Activated_List_Item;
72 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
73 if(nci <= 0 || nci > MAX_NUM_CELL)
75 DU_LOG("\nDU APP : Invalid NCI %d", nci);
84 cellCb = duCb.cfgCellLst[nci-1];
88 DU_LOG("\nDU APP : No Cell found for NCI %d", nci);
91 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
92 cellCb->cellInfo.nrPci = pci;
94 /* Now remove this cell from configured list and move to active list */
95 duCb.cfgCellLst[nci-1] = NULL;
96 duCb.actvCellLst[nci-1] = cellCb;
98 /* Build and send Mac Cell Cfg for the number of active cells */
99 ret = duBuildAndSendMacCellCfg();
102 DU_LOG("\nDU APP : macCellCfg build and send failed");
109 /******************************************************************
111 * @brief Processes F1 Setup Response sent by CU
115 * Function : procF1SetupRsp
117 * Functionality: Processes F1 Setup Response sent by CU
119 * @params[in] F1AP_PDU_t ASN decoded F1AP message
120 * @return ROK - success
123 * ****************************************************************/
124 uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
128 F1SetupResponse_t *f1SetRspMsg;
129 F1SetupRsp f1SetRspDb;
130 GNB_CU_Name_t *cuName;
131 RRC_Version_t *rrc_Ver;
134 DU_LOG("\nDU_APP : F1 Setup Response received");
135 printf("\nDU_APP : F1 Setup Response received");
136 duCb.f1Status = TRUE; //Set F1 status as true
137 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
139 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
141 // F1SetupResponseIEs_t f1RspIe = f1SetRspMsg->protocolIEs.list.array[idx];
142 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
144 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
146 procCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
147 value.choice.Cells_to_be_Activated_List);
150 //TODO: where to store and how to use below variables?can they be skipped
151 case ProtocolIE_ID_id_TransactionID:
153 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
154 value.choice.TransactionID;
157 case ProtocolIE_ID_id_gNB_CU_Name:
159 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
160 value.choice.GNB_CU_Name;
161 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
164 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
166 rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
167 value.choice.RRC_Version;
168 strcpy(f1SetRspDb.rrcVersion.rrcVer,
169 (const char*)rrc_Ver->latest_RRC_Version.buf);
173 DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
174 f1SetRspMsg->protocolIEs.list.array[idx]->id);
178 /* TODO :Check the deallocation */
180 DU_FREE(f1SetupRsp->protocolIEs.list.array,(Size)elementCnt * sizeof(F1SetupResponseIEs_t *));
181 DU_FREE(f1apMsg->choice.successfulOutcome,(Size)sizeof(SuccessfulOutcome_t));
182 DU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t));
188 /*******************************************************************
190 * @brief Processes GNB DU config update ack
194 * Function : procGNBDUCfgUpdAck
196 * Functionality: Processes GNB DU config update ack
198 * @params[in] F1AP_PDU_t ASN decoded F1AP message
199 * @return ROK - success
202 * ****************************************************************/
203 uint8_t procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
205 DU_LOG("\nF1AP : GNB-DU config update acknowledgment received");
206 /* TODO :Check the deallocation */
208 DU_FREE(gNBDuCfgAck->protocolIEs.list.array,(Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t));
209 DU_FREE(f1apMsg->choice.successfulOutcome,(Size)sizeof(SuccessfulOutcome_t));
210 DU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t));
216 /**********************************************************************
218 **********************************************************************/