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"
27 #include "du_cell_mgr.h"
28 #include<ProtocolIE-Field.h>
31 extern DuCfgParams duCfgParam;
32 extern S16 duBuildAndSendMacCellCfg();
34 /*******************************************************************
36 * @brief Processes cells to be activated
40 * Function : procCellsToBeActivated
43 * - Processes cells to be activated list received in F1SetupRsp
46 * @return ROK - success
49 * ****************************************************************/
50 S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
55 for(idx=0; idx<cellsToActivate.list.count; idx++)
59 DuCellCb *cellCb = NULLP;
61 Cells_to_be_Activated_List_Item_t cell = cellsToActivate.list.array[idx]->\
62 value.choice.Cells_to_be_Activated_List_Item;
64 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
65 if(nci <= 0 || nci > DU_MAX_CELLS)
67 DU_LOG("\nDU APP : Invalid NCI %d", nci);
76 cellCb = duCb.cfgCellLst[nci-1];
80 DU_LOG("\nDU APP : No Cell found for NCI %d", nci);
83 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
84 cellCb->cellInfo.nrPci = pci;
86 /* Now remove this cell from configured list and move to active list */
87 duCb.cfgCellLst[nci-1] = NULL;
88 duCb.actvCellLst[nci-1] = cellCb;
90 /* Build and send Mac Cell Cfg for the number of active cells */
91 ret = duBuildAndSendMacCellCfg();
94 DU_LOG("\nDU APP : macCellCfg build and send failed");
101 /******************************************************************
103 * @brief Processes F1 Setup Response sent by CU
107 * Function : procF1SetupRsp
109 * Functionality: Processes F1 Setup Response sent by CU
111 * @params[in] F1AP_PDU_t ASN decoded F1AP message
112 * @return ROK - success
115 * ****************************************************************/
116 S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg)
120 F1SetupResponse_t *f1SetRspMsg;
121 F1SetupRsp f1SetRspDb;
122 GNB_CU_Name_t *cuName;
123 RRC_Version_t *rrc_Ver;
126 DU_LOG("\nDU_APP : F1 Setup Response received");
127 printf("\nDU_APP : F1 Setup Response received");
128 duCb.f1Status = TRUE; //Set F1 status as true
129 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
131 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
133 // F1SetupResponseIEs_t f1RspIe = f1SetRspMsg->protocolIEs.list.array[idx];
134 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
136 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
138 procCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
139 value.choice.Cells_to_be_Activated_List);
142 //TODO: where to store and how to use below variables?can they be skipped
143 case ProtocolIE_ID_id_TransactionID:
145 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
146 value.choice.TransactionID;
149 case ProtocolIE_ID_id_gNB_CU_Name:
151 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
152 value.choice.GNB_CU_Name;
153 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
156 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
158 rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
159 value.choice.RRC_Version;
160 strcpy(f1SetRspDb.rrcVersion.rrcVer,
161 (const char*)rrc_Ver->latest_RRC_Version.buf);
165 DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
166 f1SetRspMsg->protocolIEs.list.array[idx]->id);
170 /* TODO :Check the deallocation */
172 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\
173 (Size)elementCnt * sizeof(F1SetupResponseIEs_t *));
174 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\
175 (Size)sizeof(SuccessfulOutcome_t));
176 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
182 /*******************************************************************
184 * @brief Processes GNB DU config update ack
188 * Function : procGNBDUCfgUpdAck
190 * Functionality: Processes GNB DU config update ack
192 * @params[in] F1AP_PDU_t ASN decoded F1AP message
193 * @return ROK - success
196 * ****************************************************************/
197 S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
199 DU_LOG("\nF1AP : GNB-DU config update acknowledgment received");
200 /* TODO :Check the deallocation */
202 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(gNBDuCfgAck->protocolIEs.list.array),\
203 (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t
205 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(f1apMsg->choice.successfulOutcome),\
206 (Size)sizeof(SuccessfulOutcome_t));
207 SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
213 /**********************************************************************
215 **********************************************************************/