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 APP */
20 #include "du_cell_mgr.h"
22 extern DuCfgParams duCfgParam;
24 extern S16 duBuildAndSendMacCellCfg();
26 /*******************************************************************
28 * @brief Processes cells to be activated
32 * Function : procCellsToBeActivated
35 * - Processes cells to be activated list received in F1SetupRsp
38 * @return ROK - success
41 * ****************************************************************/
42 S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
47 for(idx=0; idx<cellsToActivate.list.count; idx++)
51 DuCellCb *cellCb = NULLP;
53 Cells_to_be_Activated_List_Item_t cell = cellsToActivate.list.array[idx]->\
54 value.choice.Cells_to_be_Activated_List_Item;
56 bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
57 if(nci <= 0 || nci > DU_MAX_CELLS)
59 DU_LOG("\nDU APP : Invalid NCI %d", nci);
68 cellCb = duCb.cfgCellLst[nci-1];
72 DU_LOG("\nDU APP : No Cell found for NCI %d", nci);
75 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
76 cellCb->cellInfo.nrPci = pci;
78 /* Now remove this cell from configured list and move to active list */
79 duCb.cfgCellLst[nci-1] = NULLP;
80 duCb.actvCellLst[nci-1] = cellCb;
82 /* Build and send Mac Cell Cfg for the number of active cells */
83 ret = duBuildAndSendMacCellCfg();
86 DU_LOG("\nDU APP : macCellCfg build and send failed");
93 /******************************************************************
95 * @brief Processes F1 Setup Response sent by CU
99 * Function : procF1SetupRsp
101 * Functionality: Processes F1 Setup Response sent by CU
103 * @params[in] F1AP_PDU_t ASN decoded F1AP message
104 * @return ROK - success
107 * ****************************************************************/
108 S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg)
112 F1SetupResponse_t *f1SetRspMsg;
113 F1SetupRsp f1SetRspDb;
114 GNB_CU_Name_t *cuName;
115 RRC_Version_t *rrc_Ver;
118 DU_LOG("\nDU_APP : F1 Setup Response received");
119 printf("\nDU_APP : F1 Setup Response received");
120 duCb.f1Status = TRUE; //Set F1 status as true
121 f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
123 for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
125 // F1SetupResponseIEs_t f1RspIe = f1SetRspMsg->protocolIEs.list.array[idx];
126 switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
128 case ProtocolIE_ID_id_Cells_to_be_Activated_List:
130 procCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
131 value.choice.Cells_to_be_Activated_List);
134 //TODO: where to store and how to use below variables?can they be skipped
135 case ProtocolIE_ID_id_TransactionID:
137 f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
138 value.choice.TransactionID;
141 case ProtocolIE_ID_id_gNB_CU_Name:
143 cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
144 value.choice.GNB_CU_Name;
145 strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
148 case ProtocolIE_ID_id_GNB_CU_RRC_Version:
150 rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
151 value.choice.RRC_Version;
152 strcpy(f1SetRspDb.rrcVersion.rrcVer,
153 (const char*)rrc_Ver->latest_RRC_Version.buf);
157 DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
158 f1SetRspMsg->protocolIEs.list.array[idx]->id);
162 /* TODO :Check the deallocation */
164 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1SetupRsp->protocolIEs.list.array),\
165 (Size)elementCnt * sizeof(F1SetupResponseIEs_t *));
166 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\
167 (Size)sizeof(SuccessfulOutcome_t));
168 SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
174 /**********************************************************************
176 **********************************************************************/