[Epic-ID: ODUHIGH-538][Issue-ID: ODUHIGH-564] Filling E2 configuration from XML ...
[o-du/l2.git] / src / du_app / du_cfg.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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  *******************************************************************************/
18
19 /* This file contains all utility functions */
20 #include "common_def.h"
21
22 #include <libxml/parser.h>
23 #include <libxml/tree.h>
24 #include <libxml/xmlmemory.h>
25 #include <arpa/inet.h>
26
27 #include "du_tmr.h"
28 #include "legtp.h"
29 #include "lrg.h"
30 #include "lkw.x"
31 #include "lrg.x"
32 #include "du_app_mac_inf.h"
33 #include "du_app_rlc_inf.h"
34 #include "du_e2ap_mgr.h"
35 #include "du_cfg.h"
36 #include "du_mgr.h"
37 #include "du_utils.h"
38 #include "du_f1ap_conversions.h"
39 #include "OCTET_STRING.h"
40 #include "BIT_STRING.h"
41 #include "odu_common_codec.h"
42 #include "MIB.h"
43 #include "SearchSpace.h"
44 #include "SIB-TypeInfo.h"
45 #include "SchedulingInfo.h"
46 #include "SI-SchedulingInfo.h"
47 #include "ConnEstFailureControl.h"
48 #include "PLMN-IdentityInfo.h"
49 #include "PDSCH-TimeDomainResourceAllocation.h"
50 #include "BCCH-Config.h"
51 #include "PagingCycle.h"
52 #include "PCCH-Config.h"
53 #include "TimeAlignmentTimer.h"
54 #include "BCCH-DL-SCH-Message.h"
55 #include "RACH-ConfigGeneric.h"
56 #include "PUSCH-TimeDomainResourceAllocation.h"
57 #include "PUCCH-ConfigCommon.h"
58 #include "SubcarrierSpacing.h"
59 #include "TDD-UL-DL-Pattern.h"
60 #include "RACH-ConfigCommon.h"
61 #include "BWP-DownlinkCommon.h"
62 #include "BWP-UplinkCommon.h"
63 #include "TDD-UL-DL-ConfigCommon.h"
64 #include "du_sys_info_hdl.h"
65
66 #ifdef O1_ENABLE
67 #include "CmInterface.h"
68 extern StartupConfig g_cfg;
69 extern NRCellDU cellParams;
70 #endif
71
72 char encBuf[ENC_BUF_MAX_LEN];
73
74
75 /* Filling Slot configuration as :
76  * Slot Sym 0 Sym 1 Sym 2 Sym 3 Sym 4 Sym 5 Sym 6 Sym 7 Sym 8 Sym 9 Sym10 Sym11 Sym12 Sym13
77  *   0   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
78  *   1   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
79  *   2   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
80      3   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
81      4   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
82      5   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
83      6   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL
84      7   DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    DL    F     UL
85      8   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
86      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
87  */
88
89 /*******************************************************************
90  * @brief Reads the CL Configuration.
91  *
92  * @details
93  *
94  *    Function : readMacCfg
95  *
96  *    Functionality:
97  *       - Fills up the cell configuration for CL.
98  *       - Calls FillSlotConfig()  
99  *
100  * @params[in] void
101  * @return ROK     - success
102  *         RFAILED - failure
103  *
104  * ****************************************************************/
105
106 uint8_t readMacCfg()
107 {
108    uint8_t idx=0, sliceIdx=0,plmnIdx = 0;
109    SupportedSliceList *taiSliceSuppLst;
110
111    /* DL carrier configuration */
112 #ifdef O1_ENABLE
113    duCfgParam.macCellCfg.cellId = cellParams.cellLocalId;
114    duCfgParam.macCellCfg.carrCfg.dlBw = cellParams.bSChannelBwDL;
115    duCfgParam.macCellCfg.carrCfg.arfcnDL = cellParams.arfcnDL;
116 #else
117    duCfgParam.macCellCfg.cellId = NR_CELL_ID;
118    duCfgParam.macCellCfg.carrCfg.dlBw = NR_BANDWIDTH;
119    duCfgParam.macCellCfg.carrCfg.arfcnDL  = NR_DL_ARFCN;
120 #endif
121    duCfgParam.macCellCfg.carrCfg.numTxAnt = NUM_TX_ANT;
122    /* UL Carrier configuration */
123 #ifdef O1_ENABLE
124    duCfgParam.macCellCfg.carrCfg.ulBw = cellParams.bSChannelBwUL;
125    duCfgParam.macCellCfg.carrCfg.arfcnUL = cellParams.arfcnUL;
126 #else   
127    duCfgParam.macCellCfg.carrCfg.ulBw = NR_BANDWIDTH;
128    duCfgParam.macCellCfg.carrCfg.arfcnUL =  NR_UL_ARFCN;
129 #endif   
130    duCfgParam.macCellCfg.carrCfg.numRxAnt = NUM_RX_ANT;
131
132    /* Cell configuration */
133 #ifdef O1_ENABLE
134    duCfgParam.macCellCfg.cellCfg.opState    = cellParams.operationalState;
135    duCfgParam.macCellCfg.cellCfg.adminState = cellParams.administrativeState;
136    duCfgParam.macCellCfg.cellCfg.cellState  = cellParams.cellState;
137    duCfgParam.macCellCfg.cellCfg.phyCellId  = cellParams.nRPCI;
138    duCfgParam.macCellCfg.cellCfg.tac        = cellParams.nRTAC;
139    duCfgParam.macCellCfg.cellCfg.ssbFreq    = cellParams.ssbFrequency;
140 #else
141    duCfgParam.macCellCfg.cellCfg.opState    = OP_DISABLED; 
142    duCfgParam.macCellCfg.cellCfg.adminState = ADMIN_UNLOCKED;
143    duCfgParam.macCellCfg.cellCfg.cellState  = CELL_INACTIVE;
144    duCfgParam.macCellCfg.cellCfg.phyCellId  = NR_PCI;
145    duCfgParam.macCellCfg.cellCfg.tac        = DU_TAC; 
146    duCfgParam.macCellCfg.cellCfg.ssbFreq    = SSB_FREQUENCY;
147 #endif
148    /* Plmn And SNSSAI Configuration */
149    for(plmnIdx = 0; plmnIdx < MAX_PLMN; plmnIdx++)
150    {
151       memcpy(&duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].plmn, &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].plmn,\
152             sizeof(Plmn));
153       taiSliceSuppLst = &duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[plmnIdx].taiSliceSuppLst;
154       duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices = taiSliceSuppLst->numSupportedSlices;
155       if(taiSliceSuppLst->snssai)
156       {
157          DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai, (duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.numSupportedSlices) * sizeof(Snssai*));
158          if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai == NULLP)
159          {
160             DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
161             return RFAILED;
162          }
163       }
164       for(sliceIdx=0; sliceIdx < taiSliceSuppLst->numSupportedSlices; sliceIdx++)
165       {
166          if(taiSliceSuppLst->snssai[sliceIdx] != NULLP)
167          {
168             DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], sizeof(Snssai));
169             if(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx] == NULLP)
170             {
171                DU_LOG("\nERROR  --> DU_APP: Memory allocation failed at readMacCfg");
172                return RFAILED;
173             }
174             memcpy(duCfgParam.macCellCfg.cellCfg.plmnInfoList[plmnIdx].suppSliceList.snssai[sliceIdx], taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
175          }
176       }
177    }
178    duCfgParam.macCellCfg.cellCfg.subCarrSpacing = NR_SCS;
179    duCfgParam.macCellCfg.cellCfg.dupType    = DUPLEX_MODE;
180
181    /* SSB configuration */
182    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
183    duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
184    duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
185    duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
186 #ifdef O1_ENABLE
187    duCfgParam.macCellCfg.ssbCfg.scsCmn = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
188    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = convertSSBPeriodicityToEnum(cellParams.ssbPeriodicity);
189    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = cellParams.ssbOffset;
190 #else
191    duCfgParam.macCellCfg.ssbCfg.scsCmn = NR_SCS;
192    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PRDCTY_MS_20;
193    duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
194 #endif
195    duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
196    if(BuildMibPdu() != ROK)
197    {
198       DU_LOG("\nERROR  -->  Failed to build MIB PDU");
199       memset(&duCfgParam.macCellCfg.ssbCfg.mibPdu, 0, 3*sizeof(uint8_t));
200    }
201    else
202    {
203       memcpy(&duCfgParam.macCellCfg.ssbCfg.mibPdu, encBuf,encBufSize);
204    }
205
206    /* PRACH configuration */
207    duCfgParam.macCellCfg.prachCfg.prachSeqLen = PRACH_SEQ_LEN;
208    duCfgParam.macCellCfg.prachCfg.prachSubcSpacing = convertScsEnumValToScsVal(PRACH_SUBCARRIER_SPACING);
209    duCfgParam.macCellCfg.prachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
210    duCfgParam.macCellCfg.prachCfg.msg1Fdm = NUM_PRACH_FDM;
211    duCfgParam.macCellCfg.prachCfg.fdm[0].rootSeqIdx = ROOT_SEQ_IDX;
212    duCfgParam.macCellCfg.prachCfg.fdm[0].numRootSeq = NUM_ROOT_SEQ;
213    duCfgParam.macCellCfg.prachCfg.fdm[0].k1 = 0;
214    duCfgParam.macCellCfg.prachCfg.fdm[0].zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
215    duCfgParam.macCellCfg.prachCfg.prachRstSetCfg = PRACH_RESTRICTED_SET_CFG;
216    duCfgParam.macCellCfg.prachCfg.ssbPerRach = SSB_PER_RACH;
217    duCfgParam.macCellCfg.prachCfg.msg1FreqStart = PRACH_FREQ_START;
218
219    duCfgParam.macCellCfg.prachCfg.totalNumRaPreamble = NUM_RA_PREAMBLE;
220    duCfgParam.macCellCfg.prachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
221    duCfgParam.macCellCfg.prachCfg.raRspWindow = RA_RSP_WINDOW;
222    
223    /* TDD configuration */
224 #ifdef NR_TDD   
225    duCfgParam.macCellCfg.tddCfg.tddPeriod = TDD_PERIODICITY;
226    duCfgParam.macCellCfg.tddCfg.nrOfDlSlots = NUM_DL_SLOTS;
227    duCfgParam.macCellCfg.tddCfg.nrOfDlSymbols = NUM_DL_SYMBOLS;
228    duCfgParam.macCellCfg.tddCfg.nrOfUlSlots = NUM_UL_SLOTS;
229    duCfgParam.macCellCfg.tddCfg.nrOfUlSymbols = NUM_UL_SYMBOLS;
230
231    //FillSlotConfig();
232
233 #endif
234
235    /* fill SIB1 configuration */
236    duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
237    DU_ALLOC_SHRABL_BUF(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
238    memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
239          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
240    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.coresetZeroIndex = CORESET_0_INDEX;
241    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pdcchCfgSib1.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
242
243    duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.ns;
244    if((duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringType != \
245             PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_NOTHING) && (duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.numPO != 0))
246    {
247       duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = TRUE;
248       memcpy(duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.pagingOcc, 
249             duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg.firstPDCCHMontioringInfo,MAX_PO_PER_PF);
250    }
251    else
252    {
253       duCfgParam.macCellCfg.cellCfg.sib1Cfg.pagingCfg.poPresent = FALSE;
254    }
255
256    /* fill Intial DL BWP */
257    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.firstPrb = 0;
258    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.numPrb = MAX_NUM_RB; /* configured to total BW */
259    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
260    duCfgParam.macCellCfg.cellCfg.initialDlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
261    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.searchSpaceId = SEARCHSPACE_1_INDEX;
262    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.coresetId = CORESET_0_INDEX;
263    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSlot =
264       SS_MONITORING_SLOT_SL1; /* sl1 - all slots */
265    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.duration = 0;
266    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.monitoringSymbol =
267       SS_MONITORING_SYMBOL;
268    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
269       candidate.aggLevel1       = 8;
270    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
271       candidate.aggLevel2       = 4;
272    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
273       candidate.aggLevel4       = 2;
274    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
275       candidate.aggLevel8       = 1;
276    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.commonSearchSpace.
277       candidate.aggLevel16      = 0;
278
279    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.numTimeDomAlloc = NUM_TIME_DOM_RSRC_ALLOC;
280    idx = 0;
281    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG1;
282    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
283       PDSCH_MAPPING_TYPE_A;
284    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
285       PDSCH_START_SYMBOL;
286    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
287       PDSCH_LENGTH_SYMBOL;
288
289    idx++;
290    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].k0 = PDSCH_K0_CFG2;
291    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].mappingType = 
292       PDSCH_MAPPING_TYPE_A;
293    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].startSymbol = 
294       PDSCH_START_SYMBOL;
295    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdschCommon.timeDomRsrcAllocList[idx].lengthSymbol =
296       PDSCH_LENGTH_SYMBOL;
297
298    /* ra-searchSpace ID is set to 1 */
299    duCfgParam.macCellCfg.cellCfg.initialDlBwp.pdcchCommon.raSearchSpaceId = SEARCHSPACE_1_INDEX;
300
301    /* fill Intial UL BWP */
302    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.firstPrb = 0;
303    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.numPrb = MAX_NUM_RB; /* configured to total BW */
304    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.scs = duCfgParam.macCellCfg.ssbCfg.scsCmn;
305    duCfgParam.macCellCfg.cellCfg.initialUlBwp.bwp.cyclicPrefix = NORMAL_CYCLIC_PREFIX;
306    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.numTimeDomRsrcAlloc = 2;
307    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].k2 = PUSCH_K2_CFG1;
308    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].mappingType = 
309       PUSCH_MAPPING_TYPE_A;
310    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].startSymbol = 
311       PUSCH_START_SYMBOL;
312    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[0].symbolLength =
313       PUSCH_LENGTH_SYMBOL;
314
315    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].k2 = PUSCH_K2_CFG2;
316    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].mappingType = 
317       PUSCH_MAPPING_TYPE_A;
318    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].startSymbol = 
319       PUSCH_START_SYMBOL;
320    duCfgParam.macCellCfg.cellCfg.initialUlBwp.puschCommon.timeDomRsrcAllocList[1].symbolLength =
321       PUSCH_LENGTH_SYMBOL;
322
323    duCfgParam.macCellCfg.ssbCfg.dmrsTypeAPos = DMRS_TYPE_A_POS; 
324
325    /* fill PUCCH config common */
326    duCfgParam.macCellCfg.cellCfg.initialUlBwp.pucchCommon.pucchResourceCommon = PUCCH_RSRC_COMMON;
327    duCfgParam.macCellCfg.cellCfg.initialUlBwp.pucchCommon.pucchGroupHopping = PUCCH_NEITHER_HOPPING;
328
329
330 #ifndef O1_ENABLE
331
332    /*Note: Static Configuration, when O1 is not configuring the RRM policy*/
333    RrmPolicyList rrmPolicy;
334    rrmPolicy.id[0] = 1;
335    rrmPolicy.resourceType = PRB;
336    rrmPolicy.rRMMemberNum = 1;
337    memcpy(rrmPolicy.rRMPolicyMemberList[0].mcc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mcc, 3*sizeof(uint8_t));
338    memcpy(rrmPolicy.rRMPolicyMemberList[0].mnc,duCfgParam.macCellCfg.cellCfg.plmnInfoList[0].plmn.mnc, 3*sizeof(uint8_t));
339    rrmPolicy.rRMPolicyMemberList[0].sst = 1;
340    rrmPolicy.rRMPolicyMemberList[0].sd[0] = 2;
341    rrmPolicy.rRMPolicyMemberList[0].sd[1] = 3;
342    rrmPolicy.rRMPolicyMemberList[0].sd[2] = 4;
343    rrmPolicy.rRMPolicyMaxRatio = 90;
344    rrmPolicy.rRMPolicyMinRatio = 30;
345    rrmPolicy.rRMPolicyDedicatedRatio = 10;
346
347    cpyRrmPolicyInDuCfgParams(&rrmPolicy, 1, &duCfgParam.tempSliceCfg);
348
349 #endif
350
351    return ROK;
352 }
353
354 /*******************************************************************
355  *
356  * @brief Configures the DU Parameters
357  *
358  * @details
359  *
360  *    Function : calcSliv
361  *
362  *    Functionality:
363  *       - calculate SLIV value from start and length field
364  *
365  * @params[in] start symbol
366  * @params[in] length of symbols
367  * @return SLIV value
368  *
369  * ****************************************************************/
370 uint16_t calcSliv(uint8_t startSymbol, uint8_t lengthSymbol)
371 {
372    uint16_t sliv = 0;
373    if((lengthSymbol-1) <= 7)
374    {
375       sliv = NUM_SYMBOLS_PER_SLOT * (lengthSymbol-1) + startSymbol;
376    }
377    else
378    {
379       sliv = NUM_SYMBOLS_PER_SLOT * (NUM_SYMBOLS_PER_SLOT - lengthSymbol + 1) \
380              + (NUM_SYMBOLS_PER_SLOT - 1 - startSymbol);
381    }
382    return sliv;
383 }
384
385
386 /*******************************************************************
387  *
388  * @brief Configures serving cell config common in sib1
389  *
390  * @details
391  *
392  *    Function : fillServCellCfgCommSib
393  *
394  *    Functionality:
395  *       - fills Serving cell config common for SIB1
396  *
397  * @params[in] SrvCellCfgCommSib pointer
398  * @return ROK     - success
399  *         RFAILED - failure
400  * 
401  ** ****************************************************************/
402 uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm)
403 {
404    PdcchCfgCommon   pdcchCfg;
405    PdschCfgCommon   pdschCfg;
406    PcchCfg          pcchCfg;
407    RachCfgCommon    rachCfg;
408    PuschCfgCommon   puschCfg;
409    PucchCfgCommon   pucchCfg;
410    TddUlDlCfgCommon   tddCfg;
411
412 #ifdef O1_ENABLE
413    srvCellCfgComm->scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
414 #else
415    srvCellCfgComm->scs = NR_SCS;
416 #endif
417
418    /* Configuring DL Config Common for SIB1*/
419    srvCellCfgComm->dlCfg.freqBandInd = NR_FREQ_BAND; 
420    srvCellCfgComm->dlCfg.offsetToPointA = OFFSET_TO_POINT_A;
421 #ifdef O1_ENABLE
422    srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset =  cellParams.ssbOffset;
423    srvCellCfgComm->dlCfg.dlScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
424    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw =  cellParams.bSChannelBwUL;
425 #else
426    srvCellCfgComm->dlCfg.dlScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
427    srvCellCfgComm->dlCfg.dlScsCarrier.scs = NR_SCS;
428    srvCellCfgComm->dlCfg.dlScsCarrier.scsBw = NR_BANDWIDTH;
429 #endif   
430    srvCellCfgComm->dlCfg.locAndBw = FREQ_LOC_BW;
431
432    /* Configuring PDCCH Config Common For SIB1 */
433    pdcchCfg.present = BWP_DownlinkCommon__pdcch_ConfigCommon_PR_setup;
434    pdcchCfg.ctrlRsrcSetZero = CORESET_0_INDEX;
435    pdcchCfg.searchSpcZero = SEARCHSPACE_0_INDEX;
436    pdcchCfg.searchSpcId = PDCCH_SEARCH_SPACE_ID;
437    pdcchCfg.ctrlRsrcSetId = PDCCH_CTRL_RSRC_SET_ID;
438    pdcchCfg.monitorSlotPrdAndOffPresent = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
439    //pdcchCfg.monitorSlotPrdAndOff = \
440    SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
441    pdcchCfg.monitorSymbolsInSlot[0] = 128;
442    pdcchCfg.monitorSymbolsInSlot[1] = 0;
443    pdcchCfg.numCandAggLvl1 = SearchSpace__nrofCandidates__aggregationLevel1_n8;
444    pdcchCfg.numCandAggLvl2 = SearchSpace__nrofCandidates__aggregationLevel2_n4;
445    pdcchCfg.numCandAggLvl4 = SearchSpace__nrofCandidates__aggregationLevel4_n2;
446    pdcchCfg.numCandAggLvl8 = SearchSpace__nrofCandidates__aggregationLevel8_n1;
447    pdcchCfg.numCandAggLvl16 = SearchSpace__nrofCandidates__aggregationLevel16_n0;
448    pdcchCfg.searchSpcType = SearchSpace__searchSpaceType_PR_common;
449    pdcchCfg.commSrchSpcDciFrmt = PDCCH_SERACH_SPACE_DCI_FORMAT;
450    pdcchCfg.searchSpcSib1 = PDCCH_SEARCH_SPACE_ID_SIB1;
451    pdcchCfg.pagingSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
452    pdcchCfg.raSearchSpc = PDCCH_SEARCH_SPACE_ID_PAGING;
453    srvCellCfgComm->dlCfg.pdcchCfg = pdcchCfg;
454
455    /* Configuring PDSCH Config Common For SIB1 */
456    pdschCfg.present = BWP_DownlinkCommon__pdsch_ConfigCommon_PR_setup;
457    pdschCfg.numTimeDomRsrcAlloc = 2;
458    pdschCfg.timeDomAlloc[0].k0 = PDSCH_K0_CFG1;
459    pdschCfg.timeDomAlloc[0].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
460    pdschCfg.timeDomAlloc[0].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
461
462    pdschCfg.timeDomAlloc[1].k0 = PDSCH_K0_CFG2;
463    pdschCfg.timeDomAlloc[1].mapType = PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
464    pdschCfg.timeDomAlloc[1].sliv = calcSliv(PDSCH_START_SYMBOL,PDSCH_LENGTH_SYMBOL);
465
466    srvCellCfgComm->dlCfg.pdschCfg = pdschCfg;
467
468    /* Configuring BCCH Config for SIB1 */
469    srvCellCfgComm->dlCfg.bcchCfg.modPrdCoeff = BCCH_Config__modificationPeriodCoeff_n16;
470
471    /* Configuring PCCH Config for SIB1 */
472    pcchCfg.dfltPagingCycle = convertPagingCycleEnumToValue(PagingCycle_rf256);
473    pcchCfg.nAndPagingFrmOffsetType = PCCH_Config__nAndPagingFrameOffset_PR_oneT;
474    pcchCfg.pageFrameOffset = 0;
475    pcchCfg.ns = convertNsEnumToValue(PCCH_Config__ns_one);
476    pcchCfg.firstPDCCHMontioringType = PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS30KHZoneT_SCS15KHZhalfT;
477    memset(pcchCfg.firstPDCCHMontioringInfo, 0, sizeof(uint16_t));
478    pcchCfg.firstPDCCHMontioringInfo[0] = 44;
479    
480    srvCellCfgComm->dlCfg.pcchCfg = pcchCfg;
481
482
483    /* Configuring UL Config Common */
484 #ifdef O1_ENABLE
485    srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset =  cellParams.ssbOffset;
486    srvCellCfgComm->ulCfg.ulScsCarrier.scs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
487    srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = cellParams.bSChannelBwUL; 
488 #else
489    srvCellCfgComm->ulCfg.ulScsCarrier.scsOffset = SSB_SUBCARRIER_OFFSET;
490    srvCellCfgComm->ulCfg.ulScsCarrier.scs = NR_SCS;
491    srvCellCfgComm->ulCfg.ulScsCarrier.scsBw = NR_BANDWIDTH;
492 #endif   
493    srvCellCfgComm->ulCfg.freqBandInd = NR_FREQ_BAND;
494    srvCellCfgComm->ulCfg.pMax = UL_P_MAX;
495    srvCellCfgComm->ulCfg.locAndBw = FREQ_LOC_BW;
496    srvCellCfgComm->ulCfg.timeAlignTimerComm = TimeAlignmentTimer_infinity;
497
498    /* Configuring RACH Config Common for SIB1 */
499    rachCfg.present = BWP_UplinkCommon__rach_ConfigCommon_PR_setup;
500    rachCfg.prachCfgIdx = PRACH_CONFIG_IDX;
501    rachCfg.msg1Fdm = RACH_ConfigGeneric__msg1_FDM_one;
502    rachCfg.msg1FreqStart = PRACH_FREQ_START;
503    rachCfg.zeroCorrZoneCfg = ZERO_CORRELATION_ZONE_CFG;
504    rachCfg.preambleRcvdTgtPwr = PRACH_PREAMBLE_RCVD_TGT_PWR;
505    rachCfg.preambleTransMax = RACH_ConfigGeneric__preambleTransMax_n200;
506    rachCfg.pwrRampingStep = RACH_ConfigGeneric__powerRampingStep_dB2;
507    rachCfg.raRspWindow = RACH_ConfigGeneric__ra_ResponseWindow_sl10;
508    rachCfg.numRaPreamble = NUM_RA_PREAMBLE;
509    rachCfg.numSsbPerRachOcc = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one;
510    rachCfg.numCbPreamblePerSsb = CB_PREAMBLE_PER_SSB;
511    rachCfg.contResTimer = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64;
512    rachCfg.rsrpThreshSsb = RSRP_THRESHOLD_SSB;
513    rachCfg.rootSeqIdxPresent = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
514    rachCfg.rootSeqIdx = ROOT_SEQ_IDX;
515    rachCfg.msg1Scs = PRACH_SUBCARRIER_SPACING ;
516    rachCfg.restrictedSetCfg = PRACH_RESTRICTED_SET_CFG;
517    srvCellCfgComm->ulCfg.rachCfg = rachCfg;
518
519    /* Configuring PUSCH Config Common for SIB1 */
520    puschCfg.puschCfgPresent = BWP_UplinkCommon__pusch_ConfigCommon_PR_setup;
521    puschCfg.numTimeDomRsrcAlloc = 2;
522    puschCfg.timeDomAllocList[0].k2 = PUSCH_K2_CFG1;
523    puschCfg.timeDomAllocList[0].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
524    puschCfg.timeDomAllocList[0].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
525    puschCfg.timeDomAllocList[1].k2 = PUSCH_K2_CFG2;
526    puschCfg.timeDomAllocList[1].mapType = PUSCH_TimeDomainResourceAllocation__mappingType_typeA;
527    puschCfg.timeDomAllocList[1].sliv = calcSliv(PUSCH_START_SYMBOL,PUSCH_LENGTH_SYMBOL);
528    puschCfg.msg3DeltaPreamble = PUSCH_MSG3_DELTA_PREAMBLE;
529    puschCfg.p0NominalWithGrant = PUSCH_P0_NOMINAL_WITH_GRANT;
530    srvCellCfgComm->ulCfg.puschCfg = puschCfg;
531
532    /* Configuring PUCCH Config Common for SIB1 */
533    pucchCfg.present = BWP_UplinkCommon__pucch_ConfigCommon_PR_setup;
534    pucchCfg.rsrcComm = PUCCH_RSRC_COMMON;
535    pucchCfg.grpHop = PUCCH_ConfigCommon__pucch_GroupHopping_neither;
536    pucchCfg.p0Nominal = PUCCH_P0_NOMINAL;
537    srvCellCfgComm->ulCfg.pucchCfg = pucchCfg;
538
539    /* Configuring TDD UL DL config common */
540    tddCfg.refScs = SubcarrierSpacing_kHz30;
541    tddCfg.txPrd = TDD_UL_DL_Pattern__dl_UL_TransmissionPeriodicity_ms5;
542    tddCfg.numDlSlots = NUM_DL_SLOTS;
543    tddCfg.numDlSymbols = NUM_DL_SYMBOLS;
544    tddCfg.numUlSlots = NUM_UL_SLOTS;
545    tddCfg.numUlSymbols = NUM_UL_SYMBOLS;
546    srvCellCfgComm->tddCfg = tddCfg;
547
548    srvCellCfgComm->ssbPosInBurst = 192;
549    srvCellCfgComm->ssbPrdServingCell = SSB_PERIODICITY;
550    srvCellCfgComm->ssPbchBlockPwr = SSB_PBCH_PWR;
551
552    return ROK;
553 }
554
555 /*******************************************************************
556  *
557  * @brief Configures the DU Parameters
558  *
559  * @details
560  *
561  *    Function : readCfg
562  *
563  *    Functionality:
564  *       - Initializes the DuCfg members.  
565  *       - Calls readMacCfg()  
566  *
567  * @params[in] system task ID
568  * @return ROK     - success
569  *         RFAILED - failure
570  *
571  * ****************************************************************/
572
573 uint8_t readCfg()
574 {
575    CmLList *node;
576    uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx, ranFuncIdx, eventTriggerStyleIdx, reportStyleIdx, tnlAssocIdx;
577    uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx;
578    MibParams mib;
579    Sib1Params sib1;
580    SupportedSliceList *taiSliceSuppLst;
581    uint8_t measurementInfoIdx =0, measurementInfoLen=0;
582    char shortName[] = SHORT_NAME;
583    char serviceModelOID[]= SERVICE_MODEL_OID;
584    char  description[] = DESCRIPTION;
585    char event_trigger_style_name[]= EVENT_TRIGGER_STYLE_NAME;
586    char ric_report_style_name[]= REPORT_STYLE_NAME;
587
588 #ifndef O1_ENABLE
589    /* Note: Added these below variable for local testing*/
590    Snssai snssai[NUM_OF_SUPPORTED_SLICE] = {{1,{2,3,4}},{5,{6,7,8}}};
591 #endif
592
593    duCb.e2apDb.e2TransInfo.transIdCounter = 0;
594    duCb.e2apDb.numOfRanFunction = 1;
595    for(ranFuncIdx =0; ranFuncIdx<duCb.e2apDb.numOfRanFunction; ranFuncIdx++)
596    {
597       duCb.e2apDb.ranFunction[ranFuncIdx].id = ranFuncIdx + 1;
598       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.shortName, shortName, sizeof(shortName));
599       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.serviceModelOID, serviceModelOID, sizeof(serviceModelOID));
600       memcpy(&duCb.e2apDb.ranFunction[ranFuncIdx].name.description, description, sizeof(description));
601       duCb.e2apDb.ranFunction[ranFuncIdx].revisionCounter = 0;
602       
603       duCb.e2apDb.ranFunction[ranFuncIdx].numOfEventTriggerStyleSupported  = NUM_OF_EVENT_TRIGGER_STYLE_SUPPORTED;
604       for(eventTriggerStyleIdx=0; eventTriggerStyleIdx<duCb.e2apDb.ranFunction[ranFuncIdx].numOfEventTriggerStyleSupported; eventTriggerStyleIdx++)
605       {
606          duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].styleType = EVENT_TRIGGER_STYLE_TYPE;
607          duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].formatType = EVENT_TRIGGER_STYLE_FORMAT_TYPE;
608          memcpy(duCb.e2apDb.ranFunction[ranFuncIdx].eventTriggerStyleList[eventTriggerStyleIdx].name, event_trigger_style_name, sizeof(event_trigger_style_name));
609       }
610       
611       duCb.e2apDb.ranFunction[ranFuncIdx].numOfReportStyleSupported= NUM_OF_RIC_REPORT_STYLE_SUPPORTED;
612       for(reportStyleIdx=0; reportStyleIdx<duCb.e2apDb.ranFunction[ranFuncIdx].numOfReportStyleSupported; reportStyleIdx++)
613       {
614          duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.styleType = REPORT_STYLE_TYPE;
615          duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.formatType = REPORT_ACTION_FORMAT_TYPE;
616          memcpy(duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].reportStyle.name, ric_report_style_name, sizeof(ric_report_style_name));
617          
618          for(measurementInfoIdx =0; measurementInfoIdx<NUM_OF_MEASUREMENT_INFO_SUPPORTED(CONFIG_ADD); measurementInfoIdx++)
619          {
620             measurementInfoLen= strlen(MEASUREMENT_TYPE_NAME[measurementInfoIdx]);
621             MeasurementInfoForAction *measurementInfoForAction;
622             DU_ALLOC(measurementInfoForAction, sizeof(MeasurementInfoForAction));
623             if(measurementInfoForAction)
624             {
625                measurementInfoForAction->measurementTypeId = measurementInfoIdx+1;
626                memcpy(measurementInfoForAction->measurementTypeName, MEASUREMENT_TYPE_NAME[measurementInfoIdx], measurementInfoLen+1);
627             }
628             DU_ALLOC(node, sizeof(CmLList));
629             if(node)
630             {
631                node->node = (PTR) measurementInfoForAction;
632                cmLListAdd2Tail(&duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].measurementInfoList, node);
633             }
634             else
635             {
636
637                DU_FREE(measurementInfoForAction, sizeof(MeasurementInfoForAction));
638             }
639          }
640       }
641       
642       duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationHeaderFormat = RIC_INDICATION_HEADER_FORMAT;
643       duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationMessageFormat = RIC_INDICATION_MESSAGE_FORMAT; 
644
645       cmLListInit(&duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList);
646    }
647    memset(duCb.e2apDb.e2TransInfo.e2InitTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo));
648    memset(duCb.e2apDb.e2TransInfo.ricInitTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo));
649    
650    /* Mib Params */
651    mib.sysFrmNum = SYS_FRAME_NUM;
652 #ifdef NR_TDD
653    mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
654 #else
655    mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
656 #endif
657    mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
658    mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
659    mib.controlResourceSetZero = CORESET_0_INDEX;
660    mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
661    mib.cellBarred = MIB__cellBarred_notBarred;
662    mib.intraFreqReselection = MIB__intraFreqReselection_notAllowed;
663    duCfgParam.mibParams = mib;
664
665    /* SIB1 Params */
666    memset(&sib1.plmn, 0, sizeof(Plmn));
667    sib1.plmn.mcc[0] = PLMN_MCC0;
668    sib1.plmn.mcc[1] = PLMN_MCC1;
669    sib1.plmn.mcc[2] = PLMN_MCC2;
670    sib1.plmn.mnc[0] = PLMN_MNC0;
671    sib1.plmn.mnc[1] = PLMN_MNC1;
672    sib1.ranac = DU_RANAC;
673
674 #ifdef O1_ENABLE
675    sib1.tac =  cellParams.nRTAC;
676    sib1.cellIdentity =  CELL_IDENTITY *  cellParams.cellLocalId;
677    DU_LOG("\nDEBUG --> DU_APP: readCfg(): OAM CellLocalId=%d", \
678               sib1.cellIdentity);
679 #else
680    sib1.tac = DU_TAC;
681    sib1.cellIdentity = CELL_IDENTITY * NR_CELL_ID;
682 #endif
683    sib1.cellResvdForOpUse = PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;
684    sib1.connEstFailCnt = ConnEstFailureControl__connEstFailCount_n3;
685    sib1.connEstFailOffValidity = ConnEstFailureControl__connEstFailOffsetValidity_s900;
686    sib1.connEstFailOffset = 15;
687    sib1.siSchedInfo.winLen = SI_SchedulingInfo__si_WindowLength_s5;
688    sib1.siSchedInfo.broadcastSta = SchedulingInfo__si_BroadcastStatus_broadcasting;
689    sib1.siSchedInfo.preiodicity = SchedulingInfo__si_Periodicity_rf8;
690    sib1.siSchedInfo.sibType = SIB_TypeInfo__type_sibType2;
691    sib1.siSchedInfo.sibValTag = SIB1_VALUE_TAG;
692
693    fillServCellCfgCommSib(&sib1.srvCellCfgCommSib);
694
695    duCfgParam.sib1Params = sib1;
696
697    for(srvdCellIdx=0; srvdCellIdx<DEFAULT_CELLS; srvdCellIdx++)
698    { 
699       memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn, 0, sizeof(Plmn));
700       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[0] = PLMN_MCC0;
701       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[1] = PLMN_MCC1;
702       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mcc[2] = PLMN_MCC2;
703       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[0] = PLMN_MNC0;
704       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrCgi.plmn.mnc[1] = PLMN_MNC1;
705
706       /*Cell ID */
707  #ifdef O1_ENABLE
708       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = cellParams.nRPCI;
709  #else
710       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.nrPci = NR_PCI;
711 #endif
712       /* List of Available PLMN */
713       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
714       {
715          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
716           * followed by either 2 digit or 3 digits of mnc */ 
717
718          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn, 0,\
719          sizeof(Plmn));
720  #ifdef O1_ENABLE
721          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
722          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
723          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
724          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
725          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
726          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
727  #else
728          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[0] = PLMN_MCC0;
729          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[1] = PLMN_MCC1;
730          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mcc[2] = PLMN_MCC2;
731          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[0] = PLMN_MNC0;
732          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].plmn.mnc[1] = PLMN_MNC1;
733 #endif
734       }
735       /* List of Extended PLMN */
736       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
737       {
738          /* As per spec 38.473, Plmn identity consists of 3 digit from mcc
739           * followed by either 2 digit or 3 digits of mnc */ 
740
741          memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn, 0, sizeof(Plmn));
742          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[0] = PLMN_MCC0;
743          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[1] = PLMN_MCC1;
744          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mcc[2] = PLMN_MCC2;
745          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[0] = PLMN_MNC0;
746          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].extPlmn.mnc[1] = PLMN_MNC1;
747       } 
748       /* List of Supporting Slices */
749       for(srvdPlmnIdx=0; srvdPlmnIdx<MAX_PLMN; srvdPlmnIdx++)
750       {
751          taiSliceSuppLst = &duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellInfo.srvdPlmn[srvdPlmnIdx].\
752          taiSliceSuppLst;
753          
754          /* TODO Calculte the exact number of supported slices once will get
755           * cell configuration from O1 */
756          taiSliceSuppLst->numSupportedSlices = NUM_OF_SUPPORTED_SLICE;
757          if(taiSliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
758          {
759             DU_LOG("\nERROR --> DU_APP: readCfg(): Number of supported slice [%d] is more than 1024",\
760             taiSliceSuppLst->numSupportedSlices);
761             return RFAILED;
762          }
763
764          DU_ALLOC(taiSliceSuppLst->snssai, taiSliceSuppLst->numSupportedSlices*sizeof(Snssai*));
765          if(taiSliceSuppLst->snssai == NULLP)
766          {
767             DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
768             return RFAILED;
769          }
770          
771          for(sliceIdx=0; sliceIdx<taiSliceSuppLst->numSupportedSlices; sliceIdx++)
772          {
773             DU_ALLOC(taiSliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
774             if(taiSliceSuppLst->snssai[sliceIdx] == NULLP)
775             {
776                DU_LOG("\nERROR --> DU_APP: readCfg():Memory allocation failed");
777                return RFAILED;
778             }
779 #ifdef O1_ENABLE
780             memcpy(taiSliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, \
781                   SD_SIZE*sizeof(uint8_t));
782             taiSliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
783 #else
784             memcpy(taiSliceSuppLst->snssai[sliceIdx], &snssai[sliceIdx], sizeof(Snssai));
785 #endif
786          }
787       }
788
789       /* NR Mode info */
790 #ifdef NR_TDD
791       /* NR TDD Mode info */
792 #ifdef O1_ENABLE      
793       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = cellParams.arfcnUL;
794       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
795       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);                
796 #else
797       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn = NR_UL_ARFCN;
798       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
799       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;                 
800 #endif      
801       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb = NRB_273;         
802
803       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
804       {
805          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].nrFreqBand =\
806                                                                                                                      NR_FREQ_BAND;
807          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
808          {
809             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[freqBandIdx].sulBand[bandIdx]\
810                = SUL_BAND;      
811          }
812       }
813 #else
814       /* NR FDD Mode info */
815 #ifdef O1_ENABLE
816       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = cellParams.arfcnUL;
817       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
818       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
819       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
820       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = cellParams.arfcnDL;
821       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = cellParams.arfcnSUL;
822       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
823       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = convertScsValToScsEnum(cellParams.ssbSubCarrierSpacing);
824 #else
825       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn = NR_UL_ARFCN;
826       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
827       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrScs = NR_SCS;
828       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
829       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.nrArfcn = NR_DL_ARFCN;
830       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulArfcn = SUL_ARFCN;
831       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrScs = NR_SCS;
832       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrScs = NR_SCS;
833 #endif
834       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
835       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
836       {
837          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
838          nrFreqBand = NR_FREQ_BAND;
839          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
840          {
841             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.freqBand[freqBandIdx].\
842             sulBand[bandIdx] = SUL_BAND;
843          }
844       }
845       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.sulInfo.sulTxBw.nrb = NRB_106;
846       for(freqBandIdx=0; freqBandIdx<MAX_NRCELL_BANDS; freqBandIdx++)
847       {
848          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
849          nrFreqBand = NR_FREQ_BAND;
850          for(bandIdx=0; bandIdx<MAX_NRCELL_BANDS; bandIdx++)
851          {
852             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.freqBand[freqBandIdx].\
853             sulBand[bandIdx] = SUL_BAND;
854          }
855       }
856
857       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.ulTxBw.nrb = NRB_106;
858       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.f1Mode.mode.fdd.dlTxBw.nrb = NRB_106;
859 #endif
860
861       /*Measurement Config and Cell Config */ 
862       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.measTimeCfgDuration = TIME_CFG; 
863
864       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellDir = DL_UL; 
865
866       duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.cellType=CELL_TYPE;
867
868       /* Broadcast PLMN Identity */
869       for(brdcstPlmnIdx=0; brdcstPlmnIdx<MAX_BPLMN_NRCELL_MINUS_1; brdcstPlmnIdx++)
870       { 
871          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
872          {
873             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx],\
874             0, sizeof(Plmn));
875             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[0] =\
876             PLMN_MCC0;
877             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[1] =\
878             PLMN_MCC1;
879             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mcc[2] =\
880             PLMN_MCC2;
881             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[0] =\
882             PLMN_MNC0;
883             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].plmn[plmnIdx].mnc[1] =\
884             PLMN_MNC1;
885          }
886          /* Extended PLMN List */        
887          for(plmnIdx=0; plmnIdx<MAX_PLMN; plmnIdx++)
888          {
889             memset(&duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
890             extPlmn[plmnIdx], 0, sizeof(Plmn));
891             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
892             extPlmn[plmnIdx].mcc[0] = PLMN_MCC0;
893             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
894             extPlmn[plmnIdx].mcc[1] = PLMN_MCC1;
895             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
896             extPlmn[plmnIdx].mcc[2] = PLMN_MCC2;
897             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
898             extPlmn[plmnIdx].mnc[0] = PLMN_MNC0;
899             duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].\
900             extPlmn[plmnIdx].mnc[1] = PLMN_MNC1;
901          }
902 #ifdef O1_ENABLE
903          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = cellParams.nRTAC; //TODO : to check and fill
904          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = cellParams.nRTAC;
905          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = cellParams.nRTAC;
906          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = cellParams.cellLocalId;
907 #else       
908          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.epsTac = DU_TAC; //TODO : to check and fill
909          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.tac = DU_TAC;
910          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].tac = DU_TAC;
911          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].nrCellId = NR_CELL_ID;
912 #endif     
913          duCfgParam.srvdCellLst[srvdCellIdx].duCellInfo.brdcstPlmnInfo[brdcstPlmnIdx].ranac = NR_RANAC;
914       }
915
916       /*gnb DU System Info mib msg*/
917       BuildMibMsg();
918       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBufSize);
919       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg))
920       {
921          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
922          return RFAILED;
923       }
924       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibMsg, encBuf, encBufSize);
925       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.mibLen = encBufSize;
926
927       /*gnb DU System Info mib msg*/
928       BuildSib1Msg();
929       DU_ALLOC(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
930             encBufSize);
931       if(!(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg))
932       {
933          DU_LOG("\nERROR  -->  DU APP : Memory allocation failure at readCfg");
934          return RFAILED;
935       }
936       memcpy(duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Msg,\
937             encBuf,encBufSize);
938       duCfgParam.srvdCellLst[srvdCellIdx].duSysInfo.sib1Len = encBufSize;
939
940    }
941
942    if(readMacCfg() != ROK)
943    {
944       DU_LOG("\nERROR  -->  DU_APP : Failed while reading MAC config");
945       return RFAILED;
946    }
947
948    return ROK;
949 }
950
951 /*******************************************************************
952  *
953  * @brief Copy Slice Cfg in temp structre in duCfgParams 
954  *
955  * @details
956  *
957  *    Function : cpyRrmPolicyInDuCfgParams
958  *
959  *    Functionality:
960  *      - Copy Slice Cfg in temp structre in duCfgParams 
961  *
962  * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
963  * @return ROK     - success
964  *         RFAILED - failure
965  *
966  * ****************************************************************/
967 uint8_t cpyRrmPolicyInDuCfgParams(RrmPolicyList rrmPolicy[], uint8_t policyNum, MacSliceCfgReq *tempSliceCfg)
968 {
969    uint8_t policyIdx = 0, memberListIdx = 0;
970    if(policyNum)
971    {
972       tempSliceCfg->numOfRrmPolicy = policyNum;
973       DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy, tempSliceCfg->numOfRrmPolicy  * sizeof(MacSliceRrmPolicy*));
974       if(!tempSliceCfg->listOfRrmPolicy)
975       {
976          DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
977          return RFAILED;
978       }
979
980       for(policyIdx = 0; policyIdx<tempSliceCfg->numOfRrmPolicy; policyIdx++)
981       {
982          DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
983          if(!tempSliceCfg->listOfRrmPolicy[policyIdx])
984          {
985             DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
986             return RFAILED;
987          }
988
989          tempSliceCfg->listOfRrmPolicy[policyIdx]->resourceType = rrmPolicy[policyIdx].resourceType;
990
991          tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem = rrmPolicy[policyIdx].rRMMemberNum;
992
993          if(tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem)
994          {
995             DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList,\
996             tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
997
998             if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList)
999             {
1000                DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1001                return RFAILED;
1002             }
1003
1004
1005             for(memberListIdx = 0; memberListIdx<tempSliceCfg->listOfRrmPolicy[policyIdx]->numOfRrmPolicyMem; memberListIdx++)
1006             {
1007                DU_ALLOC_SHRABL_BUF(tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx], sizeof(RrmPolicyMemberList));
1008                if(!tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx])
1009                {
1010                   DU_LOG("\nERROR  --> DU APP : Memory allocation failed in cpyRrmPolicyInDuCfgParams");
1011                   return RFAILED;
1012                }
1013                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sd,\
1014                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sd, 3 * sizeof(uint8_t));
1015                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->snssai.sst,\
1016                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].sst, sizeof(uint8_t));
1017                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mcc,\
1018                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mcc, 3 * sizeof(uint8_t));
1019                memcpy(&tempSliceCfg->listOfRrmPolicy[policyIdx]->rRMPolicyMemberList[memberListIdx]->plmn.mnc,\
1020                &rrmPolicy[policyIdx].rRMPolicyMemberList[memberListIdx].mnc, 3 * sizeof(uint8_t));
1021             }
1022             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.maxRatio = rrmPolicy[policyIdx].rRMPolicyMaxRatio;
1023             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.minRatio = rrmPolicy[policyIdx].rRMPolicyMinRatio;
1024             tempSliceCfg->listOfRrmPolicy[policyIdx]->policyRatio.dedicatedRatio = rrmPolicy[policyIdx].rRMPolicyDedicatedRatio;
1025          }
1026       }
1027    }
1028
1029    return ROK;
1030 }
1031
1032 /*******************************************************************
1033  *
1034  * @brief Fill SCTP Parameters
1035  *
1036  * @details
1037  *
1038  *    Function : parseSctpParams
1039  *
1040  *    Functionality: Fill SCTP Parameters
1041  *
1042  * @params[in] XML document pointer
1043  *             XML namespace
1044  *             Current node in XML
1045  *             Pointer to structure to be filled
1046  * @return ROK     - success
1047  *         RFAILED - failure
1048  *
1049  * ****************************************************************/
1050 uint8_t parseSctpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SctpParams *sctp)
1051 {
1052    uint8_t max_du_port = 0;
1053    uint16_t f1_sctp_port = 0;
1054    uint16_t e2_sctp_port = 0;
1055
1056    memset(sctp, 0, sizeof(SctpParams));
1057    cur = cur->xmlChildrenNode;
1058    while (cur != NULL) 
1059    {
1060 #ifdef O1_ENABLE
1061       sctp->duPort[F1_INTERFACE] = g_cfg.DU_Port;
1062       sctp->duPort[E2_INTERFACE] = g_cfg.RIC_Port;
1063       sctp->cuPort = g_cfg.CU_Port;
1064       sctp->ricPort = g_cfg.RIC_Port;
1065 #else
1066       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_DU_PORT")) && (cur->ns == ns))
1067       {
1068          max_du_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1069          if (max_du_port == 2 )
1070          {
1071             sctp->duPort[F1_INTERFACE] = f1_sctp_port;     /* DU Port idx  0  */
1072             sctp->duPort[E2_INTERFACE] = e2_sctp_port;    /* RIC Port idx 1  */
1073          }
1074       }
1075
1076       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SCTP_PORT")) && (cur->ns == ns))
1077       {
1078          f1_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1079       }
1080       if ((!xmlStrcmp(cur->name, (const xmlChar *)"E2_SCTP_PORT")) && (cur->ns == ns))
1081       {
1082          e2_sctp_port = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1083       }
1084
1085       sctp->cuPort = f1_sctp_port;
1086       sctp->ricPort = e2_sctp_port;
1087 #endif
1088       cur = cur->next;
1089    }
1090    return ROK;
1091 }
1092
1093 /*******************************************************************
1094  *
1095  * @brief Fill EGTP Parameters
1096  *
1097  * @details
1098  *
1099  *    Function : parseEgtpParams
1100  *
1101  *    Functionality: Fill EGTP Parmeters
1102  *
1103  * @params[in] XML document pointer
1104  *             XML namespace
1105  *             Current node in XML
1106  *             Pointer to structure to be filled
1107  * @return ROK     - success
1108  *         RFAILED - failure
1109  *
1110  * ****************************************************************/
1111 uint8_t parseEgtpParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1EgtpParams *egtp) 
1112 {
1113    memset(egtp, 0, sizeof(F1EgtpParams));
1114    cur = cur->xmlChildrenNode;
1115    while (cur != NULL) 
1116    {
1117       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_F1_EGTP_PORT")) && (cur->ns == ns))
1118       {
1119          egtp->localPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1120       }
1121       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEST_F1_EGTP_PORT")) && (cur->ns == ns))
1122       {
1123          egtp->destPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1124       }
1125       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_TEID")) && (cur->ns == ns))
1126       {
1127          egtp->minTunnelId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1128       }
1129       cur = cur -> next;
1130    }
1131    return ROK;
1132 }
1133
1134 #ifdef XML_BASED_CONFIG
1135 /*******************************************************************
1136  *
1137  * @brief Fill MIB configuration 
1138  *
1139  * @details
1140  *
1141  *    Function : parseMibParams
1142  *
1143  *    Functionality: Fill MIB configuration
1144  *
1145  * @params[in] XML document pointer
1146  *             XML namespace
1147  *             Current node in XML
1148  *             Pointer to structure to be filled
1149  * @return ROK     - success
1150  *         RFAILED - failure
1151  *
1152  * ****************************************************************/
1153 uint8_t parseMibParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MibParams *mib)
1154 {
1155    memset(mib, 0, sizeof(MibParams));
1156    cur = cur -> xmlChildrenNode;
1157    while(cur != NULL)
1158    {
1159       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SYS_FRAME_NUM")) && (cur->ns == ns))
1160       {
1161          mib->sysFrmNum = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1162       }
1163       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUB_CARR_SPACE")) && (cur->ns == ns))
1164       {
1165          mib->subCarrierSpacingCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1166       }
1167       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFFSET")) && (cur->ns == ns))
1168       {
1169          mib->ssb_SubcarrierOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1170       }
1171       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPEA_POSITION")) && (cur->ns == ns))
1172       {
1173          mib->dmrs_TypeA_Position = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1174       }
1175       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
1176       {
1177          mib->controlResourceSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1178       }
1179       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns))
1180       {
1181          mib->searchSpaceZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1182       }
1183       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_BARRED")) && (cur->ns == ns))
1184       {
1185          mib->cellBarred = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1186       }
1187       if ((!xmlStrcmp(cur->name, (const xmlChar *)"INTRA_FREQ_RESELECT")) && (cur->ns == ns))
1188       {
1189          mib->intraFreqReselection = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1190       }
1191       cur = cur -> next;
1192    }
1193    return ROK;
1194 }
1195
1196 /*******************************************************************
1197  *
1198  * @brief Fill PLMN ID
1199  *
1200  * @details
1201  *
1202  *    Function : parsePlmn
1203  *
1204  *    Functionality: Fill PLMN ID
1205  *
1206  * @params[in] XML document pointer
1207  *             XML namespace
1208  *             Current node in XML
1209  *             Pointer to structure to be filled
1210  * @return ROK     - success
1211  *         RFAILED - failure
1212  *
1213  * ****************************************************************/
1214 uint8_t parsePlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Plmn *plmn)
1215 {
1216    xmlNodePtr child = NULLP;
1217
1218    memset(plmn, 0, sizeof(Plmn));
1219    cur = cur->xmlChildrenNode;
1220    while(cur != NULL)
1221    {
1222       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MCC")) && (cur->ns == ns))
1223       {
1224          child = cur->xmlChildrenNode;
1225          while (child != NULL)
1226          {
1227             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC0")) && (child->ns == ns))
1228             {
1229                plmn->mcc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1230             }
1231
1232             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC1")) && (child->ns == ns))
1233             {
1234                plmn->mcc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1235             }
1236
1237             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MCC2")) && (child->ns == ns))
1238             {
1239                plmn->mcc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1240             }
1241
1242             child = child->next;
1243          }
1244       }
1245
1246       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MNC")) && (cur->ns == ns))
1247       {
1248          child = cur->xmlChildrenNode;
1249          while (child != NULL)
1250          {
1251             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC0")) && (child->ns == ns))
1252             {
1253                plmn->mnc[0] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));  
1254             }
1255
1256             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC1")) && (child->ns == ns))
1257             {
1258                plmn->mnc[1] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1259             }
1260
1261             if ((!xmlStrcmp(child->name, (const xmlChar *)"plmn_MNC2")) && (child->ns == ns))
1262             {
1263                plmn->mnc[2] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1264             }
1265
1266             child = child->next;
1267          }
1268       }
1269
1270       cur = cur -> next;
1271    }
1272    return ROK;
1273 }
1274
1275 /*******************************************************************
1276  *
1277  * @brief Fill NR CGI
1278  *
1279  * @details
1280  *
1281  *    Function : parseNrCgi
1282  *
1283  *    Functionality: Fill NR CGI
1284  *
1285  * @params[in] XML document pointer
1286  *             XML namespace
1287  *             Current node in XML
1288  *             Pointer to structure to be filled
1289  * @return ROK     - success
1290  *         RFAILED - failure
1291  *
1292  * ****************************************************************/
1293 uint8_t parseNrCgi(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrEcgi *nrCgi)
1294 {
1295    memset(nrCgi, 0, sizeof(NrEcgi));
1296    cur = cur->xmlChildrenNode;
1297    while(cur != NULL)
1298    {
1299       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
1300       {
1301          if(parsePlmn(doc, ns, cur, &nrCgi->plmn) != ROK)
1302          {
1303             return RFAILED;
1304          }
1305       }
1306
1307       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns))
1308       {
1309          nrCgi-> cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1310       }
1311
1312       cur = cur -> next;
1313    }
1314    return ROK;
1315 }
1316
1317 /*******************************************************************
1318  *
1319  * @brief Fill SNSSAI
1320  *
1321  * @details
1322  *
1323  *    Function : parseSnssai
1324  *
1325  *    Functionality: Fill SNSSAI
1326  *
1327  * @params[in] XML document pointer
1328  *             XML namespace
1329  *             Current node in XML
1330  *             Pointer to structure to be filled
1331  * @return ROK     - success
1332  *         RFAILED - failure
1333  *
1334  * ****************************************************************/
1335 uint8_t parseSnssai(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Snssai *snssai)
1336 {
1337    uint8_t sdIdx = 0;
1338    xmlNodePtr child;
1339
1340    memset(snssai, 0, sizeof(Snssai));
1341    cur = cur ->xmlChildrenNode;
1342    while(cur != NULL)
1343    {
1344       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SST")) && (cur->ns == ns))
1345       {
1346          snssai->sst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1347       }
1348
1349       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SD_SIZE")) && (cur->ns == ns))
1350       {
1351          child = cur->xmlChildrenNode;
1352          while(child != NULL)
1353          {
1354             if ((!xmlStrcmp(child->name, (const xmlChar *)"SD")) && (child->ns == ns))
1355             {
1356                snssai->sd[sdIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
1357                sdIdx++;
1358             }
1359             child = child -> next;
1360          }
1361       }
1362
1363       cur = cur -> next;
1364    }
1365    return ROK;
1366 }
1367
1368 /*******************************************************************
1369  *
1370  * @brief Fill Supported Slice List
1371  *
1372  * @details
1373  *
1374  *    Function : parseSupportedSliceList
1375  *
1376  *    Functionality: Fill Supported Slice List
1377  *
1378  * @params[in] XML document pointer
1379  *             XML namespace
1380  *             Current node in XML
1381  *             Pointer to structure to be filled
1382  * @return ROK     - success
1383  *         RFAILED - failure
1384  *
1385  * ****************************************************************/
1386 uint8_t parseSupportedSliceList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SupportedSliceList *sliceSuppLst)
1387 {
1388    uint8_t sliceIdx = 0;
1389    xmlNodePtr child = NULLP;
1390    xmlNodePtr snssaiNode = NULLP;
1391
1392    memset(sliceSuppLst, 0, sizeof(SupportedSliceList));
1393    cur = cur->xmlChildrenNode;
1394    while(cur != NULL)
1395    {
1396       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SUPPORT_SLICE")) && (cur->ns == ns))
1397       {
1398          sliceSuppLst->numSupportedSlices = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1399          if(sliceSuppLst->numSupportedSlices > MAX_NUM_OF_SLICE_ITEMS)
1400          {
1401             DU_LOG("\nERROR --> DU_APP: %s: Number of supported slice [%d] is more than 1024",\
1402                   __func__, sliceSuppLst->numSupportedSlices);
1403             return RFAILED;
1404          }
1405       }
1406
1407       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI_LIST")) && (cur->ns == ns))
1408       {
1409          DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai, (sliceSuppLst->numSupportedSlices) * sizeof(Snssai*));
1410          if (sliceSuppLst->snssai == NULLP)
1411          {
1412             DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
1413             return RFAILED;
1414          }
1415
1416          for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++)
1417          {
1418             DU_ALLOC_SHRABL_BUF(sliceSuppLst->snssai[sliceIdx], sizeof(Snssai));
1419             if (sliceSuppLst->snssai[sliceIdx] == NULLP)
1420             {
1421                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
1422                return RFAILED;
1423             }
1424             else
1425             {
1426 #ifdef O1_ENABLE
1427                memcpy(sliceSuppLst->snssai[sliceIdx]->sd, cellParams.plmnList[sliceIdx].sd, SD_SIZE*sizeof(uint8_t));
1428                sliceSuppLst->snssai[sliceIdx]->sst = cellParams.plmnList[sliceIdx].sst;
1429 #endif
1430             }
1431          }
1432
1433 #ifndef O1_ENABLE
1434          child = cur->xmlChildrenNode;
1435          while (child != NULL)
1436          {
1437             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns))
1438             {     
1439                sliceIdx = 0;
1440                snssaiNode = child->xmlChildrenNode;
1441                while (snssaiNode != NULL)
1442                {
1443                   if ((!xmlStrcmp(snssaiNode->name, (const xmlChar *)"SNSSAI")) && (snssaiNode->ns == ns))
1444                   {
1445                      if(parseSnssai(doc, ns, snssaiNode, sliceSuppLst->snssai[sliceIdx]) != ROK)
1446                      {
1447                         return RFAILED;
1448                      }
1449                      sliceIdx++;
1450                   }
1451                   snssaiNode = snssaiNode->next;
1452                }
1453             }
1454             child = child->next;
1455          }
1456 #endif
1457       }
1458
1459       cur = cur -> next;
1460    }
1461    return ROK;
1462 }
1463
1464 /*******************************************************************
1465  *
1466  * @brief Fill Served PLMN
1467  *
1468  * @details
1469  *
1470  *    Function : parseF1SrvdPlmn
1471  *
1472  *    Functionality: Fill Served PLMN
1473  *
1474  * @params[in] XML document pointer
1475  *             XML namespace
1476  *             Current node in XML
1477  *             Pointer to structure to be filled
1478  * @return ROK     - success
1479  *         RFAILED - failure
1480  *
1481  * ****************************************************************/
1482 uint8_t parseF1SrvdPlmn(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SrvdPlmn *srvdPlmn, uint8_t srvdPlmnIdx)
1483 {
1484    memset(srvdPlmn, 0, sizeof(F1SrvdPlmn));
1485    cur = cur->xmlChildrenNode;
1486    while(cur != NULL)
1487    {
1488 #ifdef O1_ENABLE
1489       fillPlmnFromO1(&srvdPlmn ->plmn, srvdPlmnIdx);
1490 #else
1491       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
1492       {
1493          if(parsePlmn(doc, ns, cur, &srvdPlmn->plmn) != ROK)
1494          {
1495             return RFAILED;
1496          }
1497       }
1498 #endif 
1499
1500       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns))
1501       {
1502          if(parsePlmn(doc, ns, cur, &srvdPlmn->extPlmn) != ROK)
1503          {
1504             return RFAILED;
1505          }
1506       }
1507
1508       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns))
1509       {
1510          if(parseSupportedSliceList(doc, ns, cur, &srvdPlmn->taiSliceSuppLst) != ROK)
1511          {
1512             return RFAILED;
1513          }
1514       }
1515
1516       cur = cur -> next;
1517    }
1518    return ROK;
1519 }
1520
1521 /*******************************************************************
1522  *
1523  * @brief Fill cell information
1524  *
1525  * @details
1526  *
1527  *    Function : parseF1CellInfo
1528  *
1529  *    Functionality: Fill cell information
1530  *
1531  * @params[in] XML document pointer
1532  *             XML namespace
1533  *             Current node in XML
1534  *             Pointer to structure to be filled
1535  * @return ROK     - success
1536  *         RFAILED - failure
1537  *
1538  * ****************************************************************/
1539 uint8_t parseF1CellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1CellInfo *f1CellInfo)
1540 {
1541    memset(f1CellInfo, 0, sizeof(F1CellInfo));
1542    cur = cur->xmlChildrenNode;
1543    while(cur != NULL)
1544    {
1545       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CGI")) && (cur->ns == ns))
1546       {
1547          if(parseNrCgi(doc, ns, cur, &f1CellInfo->nrCgi) != ROK)
1548          {
1549             return RFAILED;
1550          }
1551       }
1552
1553 #ifdef O1_ENABLE
1554       f1CellInfo->nrPci = cellParams.nRPCI;
1555 #else
1556       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns))
1557       {
1558          f1CellInfo->nrPci = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1559       }
1560 #endif   
1561
1562       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SRVD_PLMN")) && (cur->ns == ns))
1563       {
1564          if(parseF1SrvdPlmn(doc, ns, cur, &f1CellInfo->srvdPlmn[0], 0) != ROK)
1565          {
1566             return RFAILED;
1567          }
1568       }
1569
1570       cur = cur -> next;
1571    }
1572    return ROK;
1573 }
1574
1575 /*******************************************************************
1576  *
1577  * @brief Fill Frequency Band
1578  *
1579  * @details
1580  *
1581  *    Function : parseF1FreqBand
1582  *
1583  *    Functionality: Fill Frequency Band
1584  *
1585  * @params[in] XML document pointer
1586  *             XML namespace
1587  *             Current node in XML
1588  *             Pointer to structure to be filled
1589  * @return ROK     - success
1590  *         RFAILED - failure
1591  *
1592  * ****************************************************************/
1593 uint8_t parseF1FreqBand(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1FreqBand *freqBand)
1594 {
1595    uint8_t sulIdx = 0;
1596    uint16_t sulValue = 0;
1597    xmlNodePtr child;
1598    xmlNodePtr sulChild;
1599
1600    memset(freqBand, 0, sizeof(F1FreqBand));
1601    cur = cur->xmlChildrenNode;
1602    while(cur != NULL)
1603    {
1604       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
1605       {
1606          freqBand->nrFreqBand = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1607       }
1608
1609       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_BAND_LIST")) && (cur->ns == ns))
1610       {
1611          child = cur->xmlChildrenNode;
1612          while (child != NULL) 
1613          {
1614             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns)) 
1615             {
1616                sulChild = child->xmlChildrenNode;
1617                sulIdx = 0;
1618                while (sulChild != NULL) 
1619                {
1620                   if ((!xmlStrcmp(sulChild->name, (const xmlChar *)"SUL_BAND")) && (sulChild->ns == ns)) 
1621                   {
1622                      sulValue = atoi((char *)xmlNodeListGetString(doc, sulChild->xmlChildrenNode, 1));
1623                      if (sulIdx < MAX_NRCELL_BANDS) 
1624                      {
1625                         freqBand->sulBand[sulIdx] = sulValue;
1626                         sulIdx++;
1627                      } 
1628                      else 
1629                      {
1630                         DU_LOG("ERROR  -->  DU_APP : %s :  SUL_BAND array overflow\n", __func__);
1631                         return RFAILED;
1632                      }
1633                   }
1634                   sulChild = sulChild->next;
1635                }
1636             }
1637             child = child->next;
1638          }
1639       }
1640       cur = cur -> next;
1641    }
1642    return ROK;
1643 }
1644
1645 /*******************************************************************
1646  *
1647  * @brief Fill Frequency Band List
1648  *
1649  * @details
1650  *
1651  *    Function : parseF1FreqBandList
1652  *
1653  *    Functionality: Fill Frequency Band List
1654  *
1655  * @params[in] XML document pointer
1656  *             XML namespace
1657  *             Current node in XML
1658  *             Pointer to structure to be filled
1659  * @return ROK     - success
1660  *         RFAILED - failure
1661  *
1662  * ****************************************************************/
1663 uint8_t parseF1FreqBandList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo)
1664 {
1665    uint8_t idx = 0;
1666
1667    xmlNodePtr child;
1668    cur = cur->xmlChildrenNode;
1669    while(cur != NULL)
1670    {
1671       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
1672       {
1673          child = cur->xmlChildrenNode;
1674          while(child != NULL)
1675          {
1676             if ((!xmlStrcmp(child->name, (const xmlChar *)"F1_FREQ_BAND")) && (child->ns == ns))
1677             {
1678                if(parseF1FreqBand(doc, ns, child, &nrFreqInfo->freqBand[idx]) != ROK)
1679                {
1680                   return RFAILED;
1681                }
1682                idx++;
1683             }
1684             child = child -> next;
1685          }
1686       }
1687
1688       cur = cur -> next;
1689    }
1690    return ROK;
1691 }
1692
1693 /*******************************************************************
1694  *
1695  * @brief Fill Transmission Bandwidth
1696  *
1697  * @details
1698  *
1699  *    Function : parseF1TxBw
1700  *
1701  *    Functionality: Fill Transmission Bandwidth
1702  *
1703  * @params[in] XML document pointer
1704  *             XML namespace
1705  *             Current node in XML
1706  *             Pointer to structure to be filled
1707  * @return ROK     - success
1708  *         RFAILED - failure
1709  *
1710  * ****************************************************************/
1711 uint8_t parseF1TxBw(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1TxBw *txBw)
1712 {
1713    memset(txBw, 0, sizeof(F1TxBw));
1714    cur = cur->xmlChildrenNode;
1715    while(cur != NULL)
1716    {
1717       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_SCS")) && (cur->ns == ns))
1718       {
1719          txBw->nrScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1720       }
1721
1722       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NRB")) && (cur->ns == ns))
1723       {
1724          txBw->nrb =  atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1725       }
1726
1727       cur = cur -> next;
1728    }
1729    return ROK;
1730 }
1731
1732 /*******************************************************************
1733  *
1734  * @brief Fill SUL Info
1735  *
1736  * @details
1737  *
1738  *    Function : parseF1SulInfo
1739  *
1740  *    Functionality: Fill SUL Info
1741  *
1742  * @params[in] XML document pointer
1743  *             XML namespace
1744  *             Current node in XML
1745  *             Pointer to structure to be filled
1746  * @return ROK     - success
1747  *         RFAILED - failure
1748  *
1749  * ****************************************************************/
1750 uint8_t parseF1SulInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1SulInfo *sulInfo)
1751 {
1752    memset(sulInfo, 0, sizeof(F1SulInfo));
1753    cur = cur->xmlChildrenNode;
1754    while(cur != NULL)
1755    {
1756       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SUL_ARFCN")) && (cur->ns == ns))
1757       {
1758          sulInfo->sulArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1759       }
1760
1761       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns))
1762       {
1763          if(parseF1TxBw(doc, ns, cur, &sulInfo->sulTxBw) != ROK)
1764          {
1765             return RFAILED;
1766          }
1767       }
1768
1769       cur = cur -> next;
1770    }
1771    return ROK;
1772 }
1773
1774 /*******************************************************************
1775  *
1776  * @brief Fill NR Frequency Info 
1777  *
1778  * @details
1779  *
1780  *    Function : parseF1NrFreqInfo
1781  *
1782  *    Functionality: Fill NR Frequency Info
1783  *
1784  * @params[in] XML document pointer
1785  *             XML namespace
1786  *             Current node in XML
1787  *             Pointer to structure to be filled
1788  * @return ROK     - success
1789  *         RFAILED - failure
1790  *
1791  * ****************************************************************/
1792 uint8_t parseF1NrFreqInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFreqInfo *nrFreqInfo)
1793 {
1794    memset(nrFreqInfo, 0, sizeof(F1NrFreqInfo));
1795    cur = cur->xmlChildrenNode;
1796    while(cur != NULL)
1797    {
1798       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_ARFCN")) && (cur->ns == ns))
1799       {
1800          nrFreqInfo->nrArfcn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
1801       }
1802
1803       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SUL_INFO")) && (cur->ns == ns))
1804       {
1805          if(parseF1SulInfo(doc, ns, cur, &nrFreqInfo->sulInfo) != ROK)
1806          {
1807             return RFAILED;
1808          }
1809       }
1810
1811       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_FREQ_BAND_LIST")) && (cur->ns == ns))
1812       {
1813          if(parseF1FreqBandList(doc, ns, cur, nrFreqInfo) != ROK)
1814          {
1815             return RFAILED;
1816          }
1817       }
1818
1819       cur = cur -> next;
1820    }
1821    return ROK;
1822 }
1823
1824 /*******************************************************************
1825  *
1826  * @brief Fill NR FDD Info
1827  *
1828  * @details
1829  *
1830  *    Function : parseF1NrFddInfo 
1831  *
1832  *    Functionality: Fill NR FDD Info
1833  *
1834  * @params[in] XML document pointer
1835  *             XML namespace
1836  *             Current node in XML
1837  *             Pointer to structure to be filled
1838  * @return ROK     - success
1839  *         RFAILED - failure
1840  *
1841  * ****************************************************************/
1842 uint8_t parseF1NrFddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrFddInfo *fddInfo)
1843 {
1844    memset(fddInfo, 0, sizeof(F1NrFddInfo));
1845    cur = cur->xmlChildrenNode;
1846    while(cur != NULL)
1847    {
1848       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_UL")) && (cur->ns == ns))
1849       {
1850          if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->ulNrFreqInfo) != ROK)
1851          {
1852             return RFAILED;
1853          }
1854       }
1855
1856       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO_DL")) && (cur->ns == ns))
1857       {
1858          if(parseF1NrFreqInfo(doc, ns, cur, &fddInfo->dlNrFreqInfo) != ROK)
1859          {
1860             return RFAILED;
1861          }
1862       }
1863
1864       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_UL")) && (cur->ns == ns))
1865       {
1866          if(parseF1TxBw(doc, ns, cur, &fddInfo->ulTxBw) != ROK)
1867          {
1868             return RFAILED;
1869          }
1870       }
1871
1872       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW_DL")) && (cur->ns == ns))
1873       {
1874          if(parseF1TxBw(doc, ns, cur, &fddInfo->dlTxBw) != ROK)
1875          {
1876             return RFAILED;
1877          }
1878       }
1879
1880       cur = cur -> next;
1881    }
1882    return ROK;
1883 }
1884
1885 /*******************************************************************
1886  *
1887  * @brief Fill NR TDD Info
1888  *
1889  * @details
1890  *
1891  *    Function : parseF1NrTddInfo
1892  *
1893  *    Functionality: Fill NR TDD Info
1894  *
1895  * @params[in] XML document pointer
1896  *             XML namespace
1897  *             Current node in XML
1898  *             Pointer to structure to be filled
1899  * @return ROK     - success
1900  *         RFAILED - failure
1901  *
1902  * ****************************************************************/
1903 uint8_t parseF1NrTddInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1NrTddInfo *tddInfo)
1904 {
1905    memset(tddInfo, 0, sizeof(F1NrTddInfo));
1906    cur = cur->xmlChildrenNode;
1907    while(cur != NULL)
1908    {
1909       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FREQ_INFO")) && (cur->ns == ns))
1910       {
1911          if(parseF1NrFreqInfo(doc, ns, cur, &tddInfo->nrFreqInfo) != ROK)
1912          {
1913             return RFAILED;
1914          }
1915       }
1916
1917       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_TX_BW")) && (cur->ns == ns))
1918       {
1919          if(parseF1TxBw(doc, ns, cur, &tddInfo->nrTxBw) != ROK)
1920          {
1921             return RFAILED;
1922          }
1923       }
1924
1925       cur = cur -> next;
1926    }
1927    return ROK;
1928 }
1929
1930 /*******************************************************************
1931  *
1932  * @brief Fill NR Mode Info
1933  *
1934  * @details
1935  *
1936  *    Function : parseNrModeInfo
1937  *
1938  *    Functionality: Fill NR Mode Info
1939  *
1940  * @params[in] XML document pointer
1941  *             XML namespace
1942  *             Current node in XML
1943  *             Pointer to structure to be filled
1944  * @return ROK     - success
1945  *         RFAILED - failure
1946  *
1947  * ****************************************************************/
1948 uint8_t parseNrModeInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, NrModeInfo *nrModeInfo)
1949 {
1950    char  modeCfg[10];
1951
1952    memset(nrModeInfo, 0, sizeof(NrModeInfo));
1953    cur = cur->xmlChildrenNode;
1954    while(cur != NULL)
1955    {
1956       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE")) && (cur->ns == ns))
1957       {
1958          strcpy((char*)modeCfg, (char*)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));      
1959       }
1960
1961       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_FDD_INFO")) && (cur->ns == ns))
1962       {
1963          if(strcmp(modeCfg, "FDD") == 0)
1964          {
1965             if(parseF1NrFddInfo(doc, ns, cur, &nrModeInfo->mode.fdd) != ROK)
1966             {
1967                return RFAILED;
1968             }
1969          }
1970       }
1971
1972       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_NR_TDD_INFO")) && (cur->ns == ns))
1973       {
1974          if(strcmp(modeCfg, "TDD") == 0)
1975          {
1976             if(parseF1NrTddInfo(doc, ns, cur, &nrModeInfo->mode.tdd) != ROK)
1977             {
1978                return RFAILED;
1979             }
1980          }
1981       }
1982
1983       cur = cur -> next;
1984    }
1985    return ROK;
1986 }
1987
1988 /*******************************************************************
1989  *
1990  * @brief Fill Broadcast PLMN Information
1991  *
1992  * @details
1993  *
1994  *    Function : parseF1BrdcstPlmnInfo
1995  *
1996  *    Functionality: Fill Broadcast PLMN Information
1997  *
1998  * @params[in] XML document pointer
1999  *             XML namespace
2000  *             Current node in XML
2001  *             Pointer to structure to be filled
2002  * @return ROK     - success
2003  *         RFAILED - failure
2004  *
2005  * ****************************************************************/
2006 uint8_t parseF1BrdcstPlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1BrdcstPlmnInfo *brdcstPlmnInfo)
2007 {
2008    memset(brdcstPlmnInfo, 0, sizeof(F1BrdcstPlmnInfo));
2009    cur = cur->xmlChildrenNode;
2010    while(cur != NULL)
2011    {
2012       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
2013       {
2014          if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->plmn[0]) != ROK)
2015          {
2016             return RFAILED;
2017          }
2018       }
2019
2020       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EXT_PLMN")) && (cur->ns == ns))
2021       {
2022          if(parsePlmn(doc, ns, cur, &brdcstPlmnInfo->extPlmn[0]) != ROK)
2023          {
2024             return RFAILED;
2025          }
2026       } 
2027
2028       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
2029       {
2030          brdcstPlmnInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2031       }
2032
2033       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_CELL_ID")) && (cur->ns == ns))
2034       {
2035          brdcstPlmnInfo->nrCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2036       }
2037
2038       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_RANAC")) && (cur->ns == ns))
2039       {
2040          brdcstPlmnInfo->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2041       }
2042
2043       cur = cur -> next;
2044    }
2045    return ROK;
2046 }
2047
2048 /*******************************************************************
2049  *
2050  * @brief Fill DU Cell Information 
2051  *
2052  * @details
2053  *
2054  *    Function : parseF1DuCellInfo
2055  *
2056  *    Functionality: Fill DU Cell Information
2057  *
2058  * @params[in] XML document pointer
2059  *             XML namespace
2060  *             Current node in XML
2061  *             Pointer to structure to be filled
2062  * @return ROK     - success
2063  *         RFAILED - failure
2064  *
2065  * ****************************************************************/
2066 uint8_t parseF1DuCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuCellInfo *duCellInfo)
2067 {
2068    memset(duCellInfo, 0, sizeof(F1DuCellInfo));
2069    cur = cur->xmlChildrenNode;
2070    while(cur != NULL)
2071    {
2072       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_INFO")) && (cur->ns == ns))
2073       {
2074          if(parseF1CellInfo(doc, ns, cur, &duCellInfo->cellInfo) != ROK)
2075          {
2076             return RFAILED;
2077          }
2078       }
2079
2080       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
2081       {
2082          duCellInfo->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2083       }
2084
2085       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EPS_TAC")) && (cur->ns == ns))
2086       {
2087          duCellInfo->epsTac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2088       }
2089
2090       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_MODE_INFO")) && (cur->ns == ns))
2091       {
2092          if(parseNrModeInfo(doc, ns, cur, &duCellInfo->f1Mode) != ROK)
2093          {
2094             return RFAILED;
2095          }
2096       }
2097
2098       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_CFG")) && (cur->ns == ns))
2099       {
2100          duCellInfo->measTimeCfgDuration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2101       }
2102
2103       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_DIR")) && (cur->ns == ns))
2104       {
2105          duCellInfo->cellDir = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2106       }
2107
2108       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_CELL_TYPE")) && (cur->ns == ns))
2109       {
2110          duCellInfo->cellType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2111       }
2112
2113       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_BRDCST_PLMN_INFO")) && (cur->ns == ns))
2114       {
2115          if(parseF1BrdcstPlmnInfo(doc, ns, cur, &duCellInfo->brdcstPlmnInfo[0]) != ROK)
2116          {
2117             return RFAILED;
2118          }
2119       }
2120
2121       cur = cur -> next;
2122    }
2123    return ROK;
2124 }
2125
2126 /*******************************************************************
2127  *
2128  * @brief Fill DU served cell information 
2129  *
2130  * @details
2131  *
2132  *    Function : parseF1DuServedCellInfo
2133  *
2134  *    Functionality: Fill DU served cell information
2135  *
2136  * @params[in] XML document pointer
2137  *             XML namespace
2138  *             Current node in XML
2139  *             Pointer to structure to be filled
2140  * @return ROK     - success
2141  *         RFAILED - failure
2142  *
2143  * ****************************************************************/
2144 uint8_t parseF1DuServedCellInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, F1DuSrvdCellInfo *srvdCellInfo)
2145 {
2146    memset(srvdCellInfo, 0, sizeof(F1DuSrvdCellInfo));
2147    cur = cur->xmlChildrenNode;
2148    while(cur != NULL)
2149    {
2150       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_CELL_INFO")) && (cur->ns == ns))
2151       {
2152          if(parseF1DuCellInfo(doc, ns, cur, &srvdCellInfo->duCellInfo) != ROK)
2153          {
2154             return RFAILED;
2155          }
2156       }
2157       cur = cur -> next;
2158    }
2159
2160    if(fillDuSrvdCellSysInfo(&srvdCellInfo->duSysInfo) != ROK)
2161    {
2162       return RFAILED;
2163    }
2164    return ROK;
2165 }
2166
2167 /*******************************************************************
2168  *
2169  * @brief Fill DU Served Cell System Information
2170  *
2171  * @details
2172  *
2173  *    Function : fillDuSrvdCellSysInfo
2174  *
2175  *    Functionality: Fill DU Served Cell System Information
2176  *
2177  * @params[in] Served Cell System Information
2178  * @return ROK     - success
2179  *         RFAILED - failure
2180  *
2181  * ****************************************************************/
2182 uint8_t fillDuSrvdCellSysInfo(F1DuSysInfo *sysInfo)
2183 {
2184    /* GNB DU System Info MIB msg */
2185    BuildMibMsg();
2186    DU_ALLOC(sysInfo->mibMsg, encBufSize);
2187    if(!(sysInfo->mibMsg))
2188    {
2189       DU_LOG("\nERROR  -->  DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__);
2190       return RFAILED;
2191    }
2192    memcpy(sysInfo->mibMsg, encBuf, encBufSize);
2193    sysInfo->mibLen = encBufSize;
2194
2195    /* GNB DU System Info SIB1 msg */
2196    BuildSib1Msg();
2197    DU_ALLOC(sysInfo->sib1Msg, encBufSize);
2198    if(!(sysInfo->sib1Msg))
2199    {
2200       DU_LOG("\nERROR  -->  DU APP : %s : Memory allocation failure at line %d", __func__, __LINE__);
2201       return RFAILED;
2202    }
2203    memcpy(sysInfo->sib1Msg, encBuf,encBufSize);
2204    sysInfo->sib1Len = encBufSize;
2205
2206    return ROK;
2207 }
2208
2209 #ifdef O1_ENABLED
2210 /*******************************************************************
2211  *
2212  * @brief Fill PLMN received from O1 interface
2213  *
2214  * @details
2215  *
2216  *    Function : fillPlmnFromO1
2217  *
2218  *    Functionality: Fill PLMN received from O1 interface
2219  *
2220  * @params[in] XML document pointer
2221  *             XML namespace
2222  *             Current node in XML
2223  *             Pointer to structure to be filled
2224  * @return ROK     - success
2225  *         RFAILED - failure
2226  *
2227  * ****************************************************************/
2228 void fillPlmnFromO1(Plmn *PLMN, uint8_t srvdPlmnIdx)
2229 {
2230    PLMN->mcc[0] = cellParams.plmnList[srvdPlmnIdx].mcc[0];
2231    PLMN->mcc[1] = cellParams.plmnList[srvdPlmnIdx].mcc[1];
2232    PLMN->mcc[2] = cellParams.plmnList[srvdPlmnIdx].mcc[2];
2233    PLMN->mnc[0] = cellParams.plmnList[srvdPlmnIdx].mnc[0];
2234    PLMN->mnc[1] = cellParams.plmnList[srvdPlmnIdx].mnc[1];
2235    PLMN->mnc[2] = cellParams.plmnList[srvdPlmnIdx].mnc[2];
2236 }
2237 #endif
2238
2239 /*******************************************************************
2240  *
2241  * @brief Fill Beamforming Configuration
2242  *
2243  * @details
2244  *
2245  *    Function : parseBeamformingConfig
2246  *
2247  *    Functionality: Fill Beamforming Configuration
2248  *
2249  * @params[in] XML document pointer
2250  *             XML namespace
2251  *             Current node in XML
2252  *             Pointer to structure to be filled
2253  * @return ROK     - success
2254  *         RFAILED - failure
2255  *
2256  * ****************************************************************/
2257 uint8_t parseBeamformingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BeamformingConf *beamformingCfg)
2258 {
2259    memset(beamformingCfg, 0, sizeof(BeamformingConf));
2260    cur = cur -> xmlChildrenNode;
2261    while(cur != NULL)
2262    {
2263       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_OF_BEAMS")) && (cur->ns == ns))
2264       {
2265          beamformingCfg->numOfBeams = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2266       }
2267
2268       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_RUS")) && (cur->ns == ns))
2269       {
2270          beamformingCfg->numTxRUs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2271       }
2272
2273       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_IDX")) && (cur->ns == ns))
2274       {
2275          beamformingCfg->beamIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2276       }
2277
2278       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TYPE")) && (cur->ns == ns))
2279       {
2280          beamformingCfg->beamType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2281       }
2282
2283       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_AZIMUTH")) && (cur->ns == ns))
2284       {
2285          beamformingCfg->beamAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2286       }
2287
2288       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_TILT")) && (cur->ns == ns))
2289       {
2290          beamformingCfg->beamTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2291       }
2292
2293       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_HORIZ_WIDTH")) && (cur->ns == ns))
2294       {
2295          beamformingCfg->beamHorizWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2296       }
2297
2298       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_VERT_WIDTH")) && (cur->ns == ns))
2299       {
2300          beamformingCfg->beamVertWidth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2301       }
2302
2303       if ((!xmlStrcmp(cur->name, (const xmlChar *)"COVER_SHAPE")) && (cur->ns == ns))
2304       {
2305          beamformingCfg->coverageShape = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2306       }
2307
2308       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_TILT")) && (cur->ns == ns))
2309       {
2310          beamformingCfg->digitalTilt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2311       }
2312
2313       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DIGI_AZIMUTH")) && (cur->ns == ns))
2314       {
2315          beamformingCfg->digitalAzimuth = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2316       }
2317
2318       cur = cur -> next;
2319    }
2320    return ROK;
2321 }
2322
2323 /*******************************************************************
2324  *
2325  * @brief Fill Precoding Configuration
2326  *
2327  * @details
2328  *
2329  *    Function : parsePrecodingConfig
2330  *
2331  *    Functionality:  Fill Precoding Configuration
2332  *
2333  * @params[in] XML document pointer
2334  *             XML namespace
2335  *             Current node in XML
2336  *             Pointer to structure to be filled
2337  * @return ROK     - success
2338  *         RFAILED - failure
2339  *
2340  * ****************************************************************/
2341 uint8_t parsePrecodingConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrecodingConf *precodCfg)
2342 {
2343    memset(precodCfg, 0, sizeof(PrecodingConf));
2344    cur = cur -> xmlChildrenNode;
2345    while(cur != NULL)
2346    {
2347       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_LAYERS")) && (cur->ns == ns))
2348       {
2349          precodCfg->numLayers = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2350       }
2351
2352       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ANT_PORTS")) && (cur->ns == ns))
2353       {
2354          precodCfg->numAntPorts  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2355       }
2356
2357       cur = cur -> next;
2358    }
2359    return ROK;
2360 }
2361
2362 /*******************************************************************
2363  *
2364  * @brief Fill PRACH FDM Information
2365  *
2366  * @details
2367  *
2368  *    Function : parsePrachFdmInfo
2369  *
2370  *    Functionality: Fill PRACH FDM Information
2371  *
2372  * @params[in] XML document pointer
2373  *             XML namespace
2374  *             Current node in XML
2375  *             Pointer to structure to be filled
2376  * @return ROK     - success
2377  *         RFAILED - failure
2378  *
2379  * ****************************************************************/
2380 uint8_t parsePrachFdmInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PrachFdmInfo *prachFdmInfo)
2381 {
2382    memset(prachFdmInfo, 0, sizeof(PrachFdmInfo));
2383    cur = cur -> xmlChildrenNode;
2384    while(cur != NULL)
2385    {
2386       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns))
2387       {
2388          prachFdmInfo->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2389       }
2390
2391       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_ROOT_SEQ")) && (cur->ns == ns))
2392       {
2393          prachFdmInfo->numRootSeq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2394       }
2395
2396       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K1")) && (cur->ns == ns))
2397       {
2398          prachFdmInfo->k1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2399       }
2400
2401       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORR_ZONE_CFG")) && (cur->ns == ns))
2402       {
2403          prachFdmInfo->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2404       }
2405
2406       cur = cur -> next;
2407    }
2408    return ROK;
2409 }
2410
2411 /*******************************************************************
2412  *
2413  * @brief Fill PRACH configuration
2414  *
2415  * @details
2416  *
2417  *    Function : parsePrachCfg
2418  *
2419  *    Functionality: Fill PRACH configuration
2420  *
2421  * @params[in] XML document pointer
2422  *             XML namespace
2423  *             Current node in XML
2424  *             Pointer to structure to be filled
2425  * @return ROK     - success
2426  *         RFAILED - failure
2427  *
2428  * ****************************************************************/
2429 uint8_t parsePrachCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PrachCfg *prachCfg)
2430 {
2431    xmlNodePtr child;
2432    uint8_t fdmIdx = 0;
2433    uint8_t maxNumRbs = 0;
2434    uint8_t prachMaxPrb = 0;
2435
2436    memset(prachCfg, 0, sizeof(PrachCfg));
2437    cur = cur -> xmlChildrenNode;
2438    while(cur != NULL)
2439    {
2440       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SEQ_LEN")) && (cur->ns == ns))
2441       {
2442          prachCfg->prachSeqLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2443       }
2444
2445       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
2446       {
2447          prachCfg->prachSubcSpacing = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2448       }
2449
2450       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns))
2451       {
2452          prachCfg->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2453       }
2454
2455       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRACH_FDM")) && (cur->ns == ns))
2456       {
2457          prachCfg->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2458       }
2459
2460       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FDM_LIST")) && (cur->ns == ns))
2461       {
2462          child = cur->xmlChildrenNode;
2463          while(child != NULL)
2464          {
2465             if ((!xmlStrcmp(child->name, (const xmlChar *)"FDM_INFO")) && (child->ns == ns))
2466             {
2467                if(parsePrachFdmInfo(doc, ns, child, &prachCfg->fdm[fdmIdx]) != ROK)
2468                {
2469                   return RFAILED;
2470                }
2471                fdmIdx++;
2472             }
2473             child = child -> next;
2474          }
2475       }
2476
2477       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns == ns))
2478       {
2479          prachCfg->prachRstSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2480       }
2481
2482       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PER_RACH")) && (cur->ns == ns))
2483       {
2484          prachCfg->ssbPerRach = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2485       }
2486
2487       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns))
2488       {
2489          prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2490       }
2491
2492       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns))
2493       {
2494          prachCfg->totalNumRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2495       }
2496
2497       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns))
2498       {
2499          maxNumRbs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2500       }
2501
2502       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns))
2503       {
2504          prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2505       }
2506
2507       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns))
2508       {
2509          prachCfg->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2510       }
2511
2512       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns))
2513       {
2514          prachCfg->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2515       }
2516
2517       cur = cur -> next;
2518    }
2519
2520    prachCfg->msg1FreqStart = maxNumRbs - prachMaxPrb;
2521    return ROK;
2522 }
2523
2524 /*******************************************************************
2525  *
2526  * @brief Fill CSI RS configuration
2527  *
2528  * @details
2529  *
2530  *    Function : parseCsiRsCfg
2531  *
2532  *    Functionality: Fill CSI RS configuration
2533  *
2534  * @params[in] XML document pointer
2535  *             XML namespace
2536  *             Current node in XML
2537  *             Pointer to structure to be filled
2538  * @return ROK     - success
2539  *         RFAILED - failure
2540  *
2541  * ****************************************************************/
2542 uint8_t parseCsiRsCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, CsiRsCfg *csiRsCfg)
2543 {
2544    memset(csiRsCfg, 0, sizeof(CsiRsCfg));
2545    cur = cur -> xmlChildrenNode;
2546    while(cur != NULL)
2547    {
2548       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_FREQ")) && (cur->ns == ns))
2549       {
2550          csiRsCfg->csiFreqDomainAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2551       }
2552
2553       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_PORTS")) && (cur->ns == ns))
2554       {
2555          csiRsCfg->csiNrofPorts = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2556       }
2557
2558       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT")) && (cur->ns == ns))
2559       {
2560          csiRsCfg->csirsfirstOFDMSymbolInTimeDomain = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2561       }
2562
2563       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_OFDM_PORT_2")) && (cur->ns == ns))
2564       {
2565          csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2566       }
2567
2568       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DM_TYPE")) && (cur->ns == ns))
2569       {
2570          csiRsCfg->csirscdmType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2571       }
2572
2573       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY")) && (cur->ns == ns))
2574       {
2575          csiRsCfg->csirsdensity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2576       }
2577
2578       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_DENSITY_DOT_5")) && (cur->ns == ns))
2579       {
2580          csiRsCfg->csirsdensitydot5 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2581       }
2582
2583       if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET")) && (cur->ns == ns))
2584       {
2585          csiRsCfg->powerControlOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2586       }
2587
2588       if ((!xmlStrcmp(cur->name, (const xmlChar *)"POWER_CONTROL_OFFSET_SS")) && (cur->ns == ns))
2589       {
2590          csiRsCfg->powerControlOffsetSS = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2591       }
2592
2593       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY_OFFSET")) && (cur->ns == ns))
2594       {
2595          csiRsCfg->periodicityAndOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2596       }
2597
2598       cur = cur -> next;
2599    }
2600    return ROK;
2601 }
2602
2603 /*******************************************************************
2604  *
2605  * @brief Fill SSB Configuration
2606  *
2607  * @details
2608  *
2609  *    Function : parseSsbCfg
2610  *
2611  *    Functionality: Fill SSB Configuration
2612  *
2613  * @params[in] XML document pointer
2614  *             XML namespace
2615  *             Current node in XML
2616  *             Pointer to structure to be filled
2617  * @return ROK     - success
2618  *         RFAILED - failure
2619  *
2620  * ****************************************************************/
2621 uint8_t parseSsbCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SsbCfg *ssbCfg)
2622 {
2623    xmlNodePtr child;
2624    uint8_t ssbMaskIdx = 0;
2625
2626    memset(ssbCfg, 0, sizeof( SsbCfg));
2627    cur = cur -> xmlChildrenNode;
2628    while(cur != NULL)
2629    {
2630       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBSC_PWR")) && (cur->ns == ns))
2631       {
2632          ssbCfg->ssbPbchPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2633       }
2634
2635       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_CMN")) && (cur->ns == ns))
2636       {
2637          ssbCfg->scsCmn = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2638       }
2639
2640       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_OFF_PT_A")) && (cur->ns == ns))
2641       {
2642          ssbCfg->ssbOffsetPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2643       }
2644
2645       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIOD")) && (cur->ns == ns))
2646       {
2647          ssbCfg->ssbPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2648       }
2649
2650       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SC_OFF")) && (cur->ns == ns))
2651       {
2652          ssbCfg->ssbScOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2653       }
2654
2655       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_LIST")) && (cur->ns == ns))
2656       {
2657          child = cur -> xmlChildrenNode;
2658          while(child != NULL)
2659          {
2660             if ((!xmlStrcmp(child->name, (const xmlChar *)"SSB_MASK")) && (child->ns == ns))
2661             {
2662                ssbCfg->ssbMask[ssbMaskIdx] = atoi((char *)xmlNodeListGetString(doc, child->xmlChildrenNode, 1));
2663                ssbMaskIdx++;
2664             }
2665             child = child -> next;
2666          }
2667       }
2668
2669       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_ID")) && (cur->ns == ns))
2670       {
2671          ssbCfg->beamId[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2672       }
2673
2674       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BETA_PSS")) && (cur->ns == ns))
2675       {
2676          ssbCfg->betaPss = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2677       }
2678
2679       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCH_PAY_FLAG")) && (cur->ns == ns))
2680       {
2681          ssbCfg->bchPayloadFlag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2682       }
2683
2684       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DMRS_TYPE_A_PROS")) && (cur->ns == ns))
2685       {
2686          ssbCfg->dmrsTypeAPos = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2687       }
2688
2689       cur = cur -> next;
2690    }
2691    return ROK;
2692 }
2693
2694 /*******************************************************************
2695  *
2696  * @brief Fill Carrier Configuration
2697  *
2698  * @details
2699  *
2700  *    Function : parseCarrierCfg
2701  *
2702  *    Functionality: Fill Carrier Configuration
2703  *
2704  * @params[in] XML document pointer
2705  *             XML namespace
2706  *             Current node in XML
2707  *             Pointer to structure to be filled
2708  * @return ROK     - success
2709  *         RFAILED - failure
2710  *
2711  * ****************************************************************/
2712 uint8_t parseCarrierCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CarrierCfg *carrierCfg)
2713 {
2714    memset(carrierCfg, 0, sizeof(CarrierCfg));
2715    cur = cur -> xmlChildrenNode;
2716    while(cur != NULL)
2717    {
2718       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_BW")) && (cur->ns == ns))
2719       {
2720          carrierCfg->dlBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2721       }
2722
2723       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_DL_ARFCN")) && (cur->ns == ns))
2724       {
2725          carrierCfg->arfcnDL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)));
2726       }
2727
2728       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_BW")) && (cur->ns == ns))
2729       {
2730          carrierCfg->ulBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2731       }
2732
2733       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_UL_ARFCN")) && (cur->ns == ns))
2734       {
2735          carrierCfg->arfcnUL = convertArfcnToFreqKhz(atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)));
2736       }
2737
2738       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TX_ANT")) && (cur->ns == ns))
2739       {
2740          carrierCfg->numTxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2741       }
2742
2743       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RX_ANT")) && (cur->ns == ns))
2744       {
2745          carrierCfg->numRxAnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2746       }
2747
2748       cur = cur -> next;
2749    }
2750    return ROK;
2751 }
2752
2753 /*******************************************************************
2754  *
2755  * @brief Fill PLMN Information List
2756  *
2757  * @details
2758  *
2759  *    Function : parsePlmnInfo
2760  *
2761  *    Functionality: Fill PLMN Information List
2762  *
2763  * @params[in] XML document pointer
2764  *             XML namespace
2765  *             Current node in XML
2766  *             Pointer to structure to be filled
2767  * @return ROK     - success
2768  *         RFAILED - failure
2769  *
2770  * ****************************************************************/
2771 uint8_t parsePlmnInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PlmnInfoList *plmnInfoList)
2772 {
2773
2774    memset(plmnInfoList, 0, sizeof(PlmnInfoList));
2775    cur = cur -> xmlChildrenNode;
2776    while(cur != NULL)
2777    {
2778       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
2779       {
2780          if(parsePlmn(doc, ns, cur,&plmnInfoList->plmn) != ROK)
2781          {
2782             return RFAILED;
2783          }
2784       }
2785
2786       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_SLICE_SUPP_LST")) && (cur->ns == ns))
2787       {
2788          if(parseSupportedSliceList(doc, ns, cur,&plmnInfoList -> suppSliceList) != ROK)
2789          {
2790             return RFAILED;
2791          }
2792       }
2793
2794       cur = cur -> next;
2795    }
2796    return ROK;
2797 }
2798
2799 /*******************************************************************
2800  *
2801  * @brief Fill PUCCH Configuration Common
2802  *
2803  * @details
2804  *
2805  *    Function : parsePucchConfigCommon
2806  *
2807  *    Functionality: Fill PUCCH Configuration Common
2808  *
2809  * @params[in] XML document pointer
2810  *             XML namespace
2811  *             Current node in XML
2812  *             Pointer to structure to be filled
2813  * @return ROK     - success
2814  *         RFAILED - failure
2815  *
2816  * ****************************************************************/
2817 uint8_t parsePucchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PucchConfigCommon *pucchCfgCmn)
2818 {
2819    memset(pucchCfgCmn, 0, sizeof(PucchConfigCommon));
2820    cur = cur -> xmlChildrenNode;
2821    while(cur != NULL)
2822    {
2823       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns))
2824       {
2825          pucchCfgCmn->pucchResourceCommon = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2826       }
2827
2828       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_NEITHER_HOPPING")) && (cur->ns == ns))
2829       {
2830          pucchCfgCmn->pucchGroupHopping = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2831       }
2832
2833       cur = cur -> next;
2834    }
2835    return ROK;
2836 }
2837
2838 /*******************************************************************
2839  *
2840  * @brief Fill PUSCH Common Time Allocation
2841  *
2842  * @details
2843  *
2844  *    Function :  parsePuschTimeDomRsrcAlloc
2845  *
2846  *    Functionality: Fill PUSCH Common Time Allocation
2847  *
2848  * @params[in] XML document pointer
2849  *             XML namespace
2850  *             Current node in XML
2851  *             Pointer to structure to be filled
2852  * @return ROK     - success
2853  *         RFAILED - failure
2854  *
2855  * ****************************************************************/
2856 uint8_t parsePuschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschTimeDomRsrcAlloc *puschTimeDomRsrsAlloc)
2857 {
2858    memset(puschTimeDomRsrsAlloc, 0, sizeof(PuschTimeDomRsrcAlloc));
2859    cur = cur -> xmlChildrenNode;
2860    while(cur != NULL)
2861    {
2862       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_K2_CFG")) && (cur->ns == ns))
2863       {
2864          puschTimeDomRsrsAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2865       }
2866
2867       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MAPPING_TYPE")) && (cur->ns == ns))
2868       {
2869          puschTimeDomRsrsAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2870       }
2871
2872       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns))
2873       {
2874          puschTimeDomRsrsAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2875       }
2876
2877       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
2878       {
2879          puschTimeDomRsrsAlloc->symbolLength= atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2880       }
2881
2882       cur = cur -> next;
2883    }
2884
2885    puschTimeDomRsrsAlloc -> startSymbolAndLength = \
2886       calcSliv(puschTimeDomRsrsAlloc->startSymbol, puschTimeDomRsrsAlloc->symbolLength);
2887    return ROK;
2888 }
2889
2890 /*******************************************************************
2891  *
2892  * @brief Fill PUSCH Configuration Common 
2893  *
2894  * @details
2895  *
2896  *    Function : parsePuschConfigCommon
2897  *
2898  *    Functionality: Fill PUSCH Configuration Common
2899  *
2900  * @params[in] XML document pointer
2901  *             XML namespace
2902  *             Current node in XML
2903  *             Pointer to structure to be filled
2904  * @return ROK     - success
2905  *         RFAILED - failure
2906  *
2907  * ****************************************************************/
2908 uint8_t parsePuschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschConfigCommon *puschCfgCmn)
2909 {
2910    uint8_t idx = 0;
2911    xmlNodePtr child = NULLP;
2912    xmlNodePtr pdschNode = NULLP;
2913
2914    memset(puschCfgCmn, 0, sizeof(PuschConfigCommon));
2915    cur = cur -> xmlChildrenNode;
2916    while(cur != NULL)
2917    {
2918       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
2919       {
2920          puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2921       }
2922
2923       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns))
2924       {
2925          child = cur->xmlChildrenNode;
2926          while(child != NULL)
2927          {
2928             if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
2929             {
2930                pdschNode = child->xmlChildrenNode;
2931                while(pdschNode != NULL)
2932                {
2933                   if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PUSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns))
2934                   {
2935                      if(parsePuschTimeDomRsrcAlloc(doc, ns, child,&puschCfgCmn->timeDomRsrcAllocList[idx]) != ROK)
2936                      {
2937                         return RFAILED;
2938                      }
2939                      idx++;
2940                   }
2941                   pdschNode = pdschNode -> next;
2942                }
2943             }
2944
2945             child = child -> next;
2946          }
2947       }
2948       cur = cur -> next;
2949    }
2950    return ROK;
2951 }
2952
2953 /*******************************************************************
2954  *
2955  * @brief Fill BWP Configuration
2956  *
2957  * @details
2958  *
2959  *    Function : parseBwp
2960  *
2961  *    Functionality: Fill BWP Configuration
2962  *
2963  * @params[in] XML document pointer
2964  *             XML namespace
2965  *             Current node in XML
2966  *             Pointer to structure to be filled
2967  * @return ROK     - success
2968  *         RFAILED - failure
2969  *
2970  * ****************************************************************/
2971 uint8_t parseBwp(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpParams *bwp)
2972 {
2973    memset(bwp, 0, sizeof(BwpParams));
2974    cur = cur -> xmlChildrenNode;
2975    while(cur != NULL)
2976    {
2977       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PRB")) && (cur->ns == ns))
2978       {
2979          bwp->firstPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2980       }
2981
2982       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PRB")) && (cur->ns == ns))
2983       {
2984          bwp->numPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2985       }
2986
2987       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
2988       {
2989          bwp->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2990       }
2991
2992       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NORMAL_CYCLIC_PREFIX")) && (cur->ns == ns))
2993       {
2994          bwp->cyclicPrefix = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
2995       }
2996
2997       cur = cur -> next;
2998    }
2999    return ROK;
3000 }
3001
3002 /*******************************************************************
3003  *
3004  * @brief Fill UL BWP Configuration
3005  *
3006  * @details
3007  *
3008  *    Function : parseBwpULConfig 
3009  *
3010  *    Functionality: Fill UL BWP Configuration
3011  *
3012  * @params[in] XML document pointer
3013  *             XML namespace
3014  *             Current node in XML
3015  *             Pointer to structure to be filled
3016  * @return ROK     - success
3017  *         RFAILED - failure
3018  *
3019  * ****************************************************************/
3020 uint8_t parseBwpULConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpUlConfig *bwpUlCfg)
3021 {
3022    memset(bwpUlCfg, 0, sizeof(BwpUlConfig));
3023    cur = cur -> xmlChildrenNode;
3024    while(cur != NULL)
3025    {
3026       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns))
3027       {
3028          if(parseBwp(doc, ns, cur, &bwpUlCfg->bwp) != ROK)
3029          {
3030             return RFAILED;
3031          }
3032       }
3033
3034       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns))
3035       {
3036          if(parsePucchConfigCommon(doc, ns, cur, &bwpUlCfg->pucchCommon) != ROK)
3037          {
3038             return RFAILED;
3039          }
3040       }
3041
3042       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns))
3043       {
3044          if(parsePuschConfigCommon(doc, ns, cur, &bwpUlCfg->puschCommon) != ROK)
3045          {
3046             return RFAILED;
3047          }
3048       }
3049       cur = cur -> next;
3050    }
3051    return ROK;
3052 }
3053
3054 /*******************************************************************
3055  *
3056  * @brief Fill Page Configuration
3057  *
3058  * @details
3059  *
3060  *    Function : parsePageCfg
3061  *
3062  *    Functionality: Fill Page Configuration
3063  *
3064  * @params[in] XML document pointer
3065  *             XML namespace
3066  *             Current node in XML
3067  *             Pointer to structure to be filled
3068  * @return ROK     - success
3069  *         RFAILED - failure
3070  *
3071  * ****************************************************************/
3072 uint8_t parsePageCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, SchPageCfg *pageCfg)
3073 {
3074    char *poPresent;
3075
3076    memset(pageCfg, 0, sizeof(SchPageCfg));
3077    cur = cur -> xmlChildrenNode;
3078    while(cur != NULL)
3079    {
3080       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_PO")) && (cur->ns == ns))
3081       {
3082          pageCfg->numPO = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3083       }
3084
3085       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PO_PRESENT")) && (cur->ns == ns))
3086       {
3087          poPresent = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
3088          if(!strcmp(poPresent, "TRUE"))
3089          {
3090             pageCfg->poPresent = true;
3091          }
3092          else
3093          {
3094             pageCfg->poPresent = false;
3095          }
3096       }
3097
3098       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGING_OCC")) && (cur->ns == ns))
3099       {
3100          pageCfg->pagingOcc[0] = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3101       }
3102
3103       cur = cur -> next;
3104    }
3105    return ROK;
3106 }
3107
3108 /*******************************************************************
3109  *
3110  * @brief Fill SIB1 PDCCH Configuration
3111  *
3112  * @details
3113  *
3114  *    Function : parsePdcchCfgSib1
3115  *
3116  *    Functionality: Fill SIB1 PDCCH Configuration
3117  *
3118  * @params[in] XML document pointer
3119  *             XML namespace
3120  *             Current node in XML
3121  *             Pointer to structure to be filled
3122  * @return ROK     - success
3123  *         RFAILED - failure
3124  *
3125  * ****************************************************************/
3126 uint8_t parsePdcchCfgSib1(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigSib1 *pdcchConfigSib1)
3127 {
3128    memset(pdcchConfigSib1, 0, sizeof(PdcchConfigSib1));
3129    cur = cur -> xmlChildrenNode;
3130    while(cur != NULL)
3131    {
3132       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_ZERO_INDEX")) && (cur->ns == ns))
3133       {
3134          pdcchConfigSib1->coresetZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3135       }
3136
3137       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_ZERO_INDEX")) && (cur->ns == ns))
3138       {
3139          pdcchConfigSib1->searchSpaceZeroIndex = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3140       }
3141
3142       cur = cur -> next;
3143    }
3144    return ROK;
3145 }
3146
3147 /*******************************************************************
3148  *
3149  * @brief Fill SIB1 Cell Configuration
3150  *
3151  * @details
3152  *
3153  *    Function : parseSib1CellCfg 
3154  *
3155  *    Functionality: Fill SIB1 Cell Configuration
3156  *
3157  * @params[in] XML document pointer
3158  *             XML namespace
3159  *             Current node in XML
3160  *             Pointer to structure to be filled
3161  * @return ROK     - success
3162  *         RFAILED - failure
3163  *
3164  * ****************************************************************/
3165 uint8_t parseSib1CellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, Sib1CellCfg *sib1CellCfg)
3166 {
3167    memset(sib1CellCfg, 0, sizeof( Sib1CellCfg));
3168    cur = cur -> xmlChildrenNode;
3169    while(cur != NULL)
3170    {
3171       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_PAGE_CFG")) && (cur->ns == ns))
3172       {
3173          if(parsePageCfg(doc, ns, cur, &sib1CellCfg->pagingCfg) != ROK)
3174          {
3175             return RFAILED;
3176          }
3177       }
3178
3179       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CONFIG_SIB1")) && (cur->ns == ns))
3180       {
3181          if(parsePdcchCfgSib1(doc, ns, cur, &sib1CellCfg->pdcchCfgSib1) != ROK)
3182          {
3183             return RFAILED;
3184          }
3185       }
3186
3187       cur = cur -> next;
3188    }
3189    return ROK;
3190 }
3191
3192 /*******************************************************************
3193  *
3194  * @brief Fill Aggregation Level Candidates Information
3195  *
3196  * @details
3197  *
3198  *    Function : parseCandidateInfo 
3199  *
3200  *    Functionality: Fill Aggregation Level Candidates Information
3201  *
3202  * @params[in] XML document pointer
3203  *             XML namespace
3204  *             Current node in XML
3205  *             Pointer to structure to be filled
3206  * @return ROK     - success
3207  *         RFAILED - failure
3208  *
3209  * ****************************************************************/
3210 uint8_t parseCandidateInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CandidatesInfo *candInfo)
3211 {
3212    memset(candInfo, 0, sizeof(CandidatesInfo));
3213    cur = cur -> xmlChildrenNode;
3214    while(cur != NULL)
3215    {
3216       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL1")) && (cur->ns == ns))
3217       {
3218          candInfo->aggLevel1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3219       }
3220
3221       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL2")) && (cur->ns == ns))
3222       {
3223          candInfo->aggLevel2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3224       }
3225
3226       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL4")) && (cur->ns == ns))
3227       {
3228          candInfo->aggLevel4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3229       }
3230
3231       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL8")) && (cur->ns == ns))
3232       {
3233          candInfo->aggLevel8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3234       }
3235
3236       if ((!xmlStrcmp(cur->name, (const xmlChar *)"AGG_LEVEL16")) && (cur->ns == ns))
3237       {
3238          candInfo->aggLevel16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3239       }
3240
3241       cur = cur -> next;
3242    }
3243    return ROK;
3244 }
3245
3246 /*******************************************************************
3247  *
3248  * @brief Fill Search Space Connfiguration
3249  *
3250  * @details
3251  *
3252  *    Function : parseSearchSpaceCfg
3253  *
3254  *    Functionality: Fill Search Space Configuration
3255  *
3256  * @params[in] XML document pointer
3257  *             XML namespace
3258  *             Current node in XML
3259  *             Pointer to structure to be filled
3260  * @return ROK     - success
3261  *         RFAILED - failure
3262  *
3263  * ****************************************************************/
3264 uint8_t parseSearchSpaceCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SearchSpaceCfg *searchSpaceCfg)
3265 {
3266    memset(searchSpaceCfg, 0, sizeof(SearchSpaceCfg));
3267    cur = cur -> xmlChildrenNode;
3268    while(cur != NULL)
3269    {
3270       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns))
3271       {
3272          searchSpaceCfg->searchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3273       }
3274
3275       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
3276       {
3277          searchSpaceCfg->coresetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3278       }
3279
3280       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SLOT_SL1")) && (cur->ns == ns))
3281       {
3282          searchSpaceCfg->monitoringSlot = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3283       }
3284
3285       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DURATION")) && (cur->ns == ns))
3286       {
3287          searchSpaceCfg->duration = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3288       }
3289
3290       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SS_MONITORING_SYMBOL")) && (cur->ns == ns))
3291       {
3292          searchSpaceCfg->monitoringSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3293       }
3294
3295       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CANDIDATE_INFO")) && (cur->ns == ns))
3296       {
3297          if(parseCandidateInfo(doc, ns, cur, &searchSpaceCfg->candidate) != ROK)
3298          {
3299             return RFAILED;
3300          }
3301       }
3302
3303       cur = cur -> next;
3304    }
3305    return ROK;
3306 }
3307
3308 /*******************************************************************
3309  *
3310  * @brief Fill PDCCH Configuration Common
3311  *
3312  * @details
3313  *
3314  *    Function : parsePdcchCfgCommon
3315  *
3316  *    Functionality: Fill PDCCH Configuration Common
3317  *
3318  * @params[in] XML document pointer
3319  *             XML namespace
3320  *             Current node in XML
3321  *             Pointer to structure to be filled
3322  * @return ROK     - success
3323  *         RFAILED - failure
3324  *
3325  * ****************************************************************/
3326 uint8_t parsePdcchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdcchConfigCommon *pdcchCfgCm)
3327 {
3328    memset(pdcchCfgCm, 0, sizeof(PdcchConfigCommon));
3329    cur = cur -> xmlChildrenNode;
3330    while(cur != NULL)
3331    {
3332       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPACE_CFG")) && (cur->ns == ns))
3333       {
3334          if(parseSearchSpaceCfg(doc, ns, cur, &pdcchCfgCm->commonSearchSpace) != ROK)
3335          {
3336             return RFAILED;
3337          }
3338       }
3339
3340       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_1_INDEX")) && (cur->ns == ns))
3341       {
3342          pdcchCfgCm->raSearchSpaceId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3343       }
3344
3345       cur = cur -> next;
3346    }
3347
3348    return ROK;
3349 }
3350
3351 /*******************************************************************
3352  *
3353  * @brief Fill PDSCH Common Time Domain Resource Allocation
3354  *
3355  * @details
3356  *
3357  *    Function : parsePdschCmnTimeDomRsrcAlloc
3358  *
3359  *    Functionality: Fill PDSCH Common Time Domain Resource Allocation
3360  *
3361  * @params[in] XML document pointer
3362  *             XML namespace
3363  *             Current node in XML
3364  *             Pointer to structure to be filled
3365  * @return ROK     - success
3366  *         RFAILED - failure
3367  *
3368  * ****************************************************************/
3369 uint8_t parsePdschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,\
3370       PdschCfgCommTimeDomRsrcAlloc *pdschTimeDomRsrcAlloc)
3371 {
3372    memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschCfgCommTimeDomRsrcAlloc));
3373    cur = cur -> xmlChildrenNode;
3374    while(cur != NULL)
3375    {
3376       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_K0_CFG")) && (cur->ns == ns))
3377       {
3378          pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3379       }
3380       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_MAPPING_TYPE")) && (cur->ns == ns))
3381       {
3382          pdschTimeDomRsrcAlloc->mappingType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3383       }
3384       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns))
3385       {
3386          pdschTimeDomRsrcAlloc->startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3387       }
3388       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
3389       {
3390          pdschTimeDomRsrcAlloc->lengthSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3391       }
3392
3393       cur = cur -> next;
3394    }
3395    return ROK;
3396 }
3397
3398 /*******************************************************************
3399  *
3400  * @brief Fill PDSCH Configuration Common
3401  *
3402  * @details
3403  *
3404  *    Function : parsePdschConfigCommon
3405  *
3406  *    Functionality: Fill PDSCH Configuration Common
3407  *
3408  * @params[in] XML document pointer
3409  *             XML namespace
3410  *             Current node in XML
3411  *             Pointer to structure to be filled
3412  * @return ROK     - success
3413  *         RFAILED - failure
3414  *
3415  * ****************************************************************/
3416 uint8_t parsePdschConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdschConfigCommon *pdschCfgCmn)
3417 {
3418    uint8_t idx = 0;
3419    xmlNodePtr child = NULLP;
3420    xmlNodePtr pdschNode = NULLP;
3421
3422    memset(pdschCfgCmn, 0, sizeof(PdschConfigCommon));
3423    cur = cur -> xmlChildrenNode;
3424    while(cur != NULL)
3425    {
3426       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
3427       {
3428          pdschCfgCmn->numTimeDomAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3429       }
3430
3431       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC_LIST")) && (cur->ns == ns))
3432       {
3433          child = cur->xmlChildrenNode;
3434          while(child != NULL)  
3435          {
3436             if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
3437             {
3438                pdschNode = child->xmlChildrenNode;
3439                while(pdschNode != NULL)
3440                {
3441                   if ((!xmlStrcmp(pdschNode->name, (const xmlChar *)"PDSCH_COMM_TIME_ALLOC")) && (pdschNode->ns == ns))
3442                   {   
3443                      if(parsePdschCmnTimeDomRsrcAlloc(doc, ns, child, &pdschCfgCmn->timeDomRsrcAllocList[idx]) != ROK)
3444                      {
3445                         return RFAILED;
3446                      }
3447                      idx++;
3448                   }
3449                   pdschNode = pdschNode -> next;
3450                }
3451             }
3452
3453             child = child -> next;
3454          }
3455       }
3456       cur = cur -> next;
3457    }
3458    return ROK;
3459 }
3460
3461 /*******************************************************************
3462  *
3463  * @brief Fill DL BWP Configuration
3464  *
3465  * @details
3466  *
3467  *    Function : parseBwpDLConfig
3468  *
3469  *    Functionality: Fill DL BWP Configuration
3470  *
3471  * @params[in] XML document pointer
3472  *             XML namespace
3473  *             Current node in XML
3474  *             Pointer to structure to be filled
3475  * @return ROK     - success
3476  *         RFAILED - failure
3477  *
3478  * ****************************************************************/
3479 uint8_t parseBwpDLConfig(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,BwpDlConfig *bwpDlCfg)
3480 {
3481    memset(bwpDlCfg, 0, sizeof(BwpDlConfig));
3482    cur = cur -> xmlChildrenNode;
3483    while(cur != NULL)
3484    {
3485       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_PARAMS")) && (cur->ns == ns))
3486       {
3487          if(parseBwp(doc, ns, cur, &bwpDlCfg->bwp) != ROK)
3488          {
3489             return RFAILED;
3490          }
3491       }
3492
3493       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns))
3494       {
3495          if(parsePdcchCfgCommon(doc, ns, cur, &bwpDlCfg->pdcchCommon) != ROK)
3496          {
3497             return RFAILED;
3498          }
3499       }
3500
3501       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns))
3502       {
3503          if(parsePdschConfigCommon(doc, ns, cur, &bwpDlCfg->pdschCommon) != ROK)
3504          {
3505             return RFAILED;
3506          }
3507       }
3508
3509       cur = cur -> next;
3510    }
3511    return ROK;
3512 }
3513
3514 /*******************************************************************
3515  *
3516  * @brief Fill Cell Configuration
3517  *
3518  * @details
3519  *
3520  *    Function : parseCellCfg
3521  *
3522  *    Functionality: Fill Cell Configuration
3523  *
3524  * @params[in] XML document pointer
3525  *             XML namespace
3526  *             Current node in XML
3527  *             Pointer to structure to be filled
3528  * @return ROK     - success
3529  *         RFAILED - failure
3530  *
3531  * ****************************************************************/
3532 uint8_t parseCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,CellCfg *cellCfg)
3533 {
3534    memset(cellCfg, 0, sizeof(CellCfg));
3535    cur = cur -> xmlChildrenNode;
3536    while(cur != NULL)
3537    {
3538       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_OP_STATE")) && (cur->ns == ns))
3539       {
3540          cellCfg->opState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3541       }
3542
3543       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_ADMIN_STATE")) && (cur->ns == ns))
3544       {
3545          cellCfg->adminState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3546       }
3547
3548       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_STATE")) && (cur->ns == ns))
3549       {
3550          cellCfg->cellState = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3551       }
3552
3553       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN_INFO")) && (cur->ns == ns))
3554       {
3555          if(parsePlmnInfo(doc, ns, cur, &cellCfg->plmnInfoList[0]) != ROK)
3556          {
3557             return RFAILED;
3558          }
3559       }
3560
3561       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_PCI")) && (cur->ns == ns))
3562       {
3563          cellCfg->phyCellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3564       }
3565
3566       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
3567       {
3568          cellCfg->tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3569       }
3570
3571       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_FREQUENCY")) && (cur->ns == ns))
3572       {
3573          cellCfg->ssbFreq = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3574       }
3575
3576       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
3577       {
3578          cellCfg->subCarrSpacing  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3579       }
3580
3581       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DUPLEX_MODE")) && (cur->ns == ns))
3582       {
3583          cellCfg->dupType  = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3584       }
3585
3586       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_CELL_CFG")) && (cur->ns == ns))
3587       {
3588          if(parseSib1CellCfg(doc, ns, cur, &cellCfg->sib1Cfg) != ROK)
3589          {
3590             return RFAILED;
3591          }
3592       }
3593
3594       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_DL_CFG")) && (cur->ns == ns))
3595       {
3596          if(parseBwpDLConfig(doc, ns, cur, &cellCfg->initialDlBwp) != ROK)
3597          {
3598             return RFAILED;
3599          }
3600       }
3601
3602       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BWP_UL_CFG")) && (cur->ns == ns))
3603       {
3604          if(parseBwpULConfig(doc, ns, cur, &cellCfg->initialUlBwp) != ROK)
3605          {
3606             return RFAILED;
3607          }
3608       }
3609
3610       cur = cur -> next;
3611    }
3612    return ROK;
3613 }
3614
3615 #ifdef NR_TDD
3616 /*******************************************************************
3617  *
3618  * @brief Fill TDD slot configuration
3619  *
3620  * @details
3621  *
3622  *    Function : parseTddCfg
3623  *
3624  *    Functionality: Fill TDD slot configuration
3625  *
3626  * @params[in] XML document pointer
3627  *             XML namespace
3628  *             Current node in XML
3629  *             Pointer to structure to be filled
3630  * @return ROK     - success
3631  *         RFAILED - failure
3632  *
3633  * ****************************************************************/
3634 uint8_t parseTddCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TDDCfg *tddCfg)
3635 {
3636    memset(tddCfg, 0, sizeof(TDDCfg));
3637    cur = cur -> xmlChildrenNode;
3638    while(cur != NULL)
3639    {
3640       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_PERIODICITY")) && (cur->ns == ns))
3641       {
3642          tddCfg->tddPeriod = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3643       }
3644
3645       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns))
3646       {
3647          tddCfg->nrOfDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3648       }
3649
3650       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns))
3651       {
3652          tddCfg->nrOfDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3653       }
3654
3655       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns))
3656       {
3657          tddCfg->nrOfUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3658       }
3659
3660       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns))
3661       {
3662          tddCfg->nrOfUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3663       }
3664
3665       cur = cur -> next;
3666    }
3667    return ROK;
3668 }
3669 #endif
3670
3671 /*******************************************************************
3672  *
3673  * @brief Fill MAC Cell Configuration
3674  *
3675  * @details
3676  *
3677  *    Function : parseMacCellCfg
3678  *
3679  *    Functionality: Fill MAC Cell Configuration
3680  *
3681  * @params[in] XML document pointer
3682  *             XML namespace
3683  *             Current node in XML
3684  *             Pointer to structure to be filled
3685  * @return ROK     - success
3686  *         RFAILED - failure
3687  *
3688  * ****************************************************************/
3689 uint8_t parseMacCellCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacCellCfg *macCellCfg)
3690 {
3691    memset(macCellCfg, 0, sizeof(MacCellCfg));
3692    cur = cur -> xmlChildrenNode;
3693    while(cur != NULL)
3694    {
3695       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_ID")) && (cur->ns == ns))
3696       {
3697          macCellCfg->cellId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3698       }
3699
3700       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CARRIER_CFG")) && (cur->ns == ns))
3701       {
3702          if(parseCarrierCfg(doc, ns, cur, &macCellCfg->carrCfg) != ROK)
3703          {
3704             return RFAILED;
3705          }
3706       }
3707
3708       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_CFG")) && (cur->ns == ns))
3709       {
3710          if(parseCellCfg(doc, ns, cur, &macCellCfg->cellCfg) != ROK)
3711          {
3712             return RFAILED;
3713          }
3714       }
3715
3716       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_CFG")) && (cur->ns == ns))
3717       {
3718          if(parseSsbCfg(doc, ns, cur, &macCellCfg->ssbCfg) != ROK)
3719          {
3720             return RFAILED;
3721          }
3722       }
3723
3724       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CSIRS_CFG")) && (cur->ns == ns))
3725       {
3726          if(parseCsiRsCfg(doc, ns, cur, &macCellCfg->csiRsCfg) != ROK)
3727          {
3728             return RFAILED;
3729          }
3730       }
3731
3732       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CFG")) && (cur->ns == ns))
3733       {
3734          if(parsePrachCfg(doc, ns, cur, &macCellCfg->prachCfg) != ROK)
3735          {
3736             return RFAILED;
3737          }
3738       }
3739
3740 #ifdef NR_TDD
3741       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_CFG")) && (cur->ns == ns))
3742       {
3743          if(parseTddCfg(doc, ns, cur, &macCellCfg->tddCfg) != ROK)
3744          {
3745             return RFAILED;
3746          }
3747       }
3748 #endif 
3749
3750       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRE_CODE_CFG")) && (cur->ns == ns))
3751       {
3752          if(parsePrecodingConfig(doc, ns, cur, &macCellCfg->precodingConf) != ROK)
3753          {
3754             return RFAILED;
3755          }
3756       }
3757
3758       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEAM_FORM_CFG")) && (cur->ns == ns))
3759       {
3760          if(parseBeamformingConfig(doc, ns, cur, &macCellCfg->beamCfg) != ROK)
3761          {
3762             return RFAILED;
3763          }
3764       }
3765
3766       cur = cur -> next;
3767    }
3768    return ROK;
3769 }
3770
3771 /*******************************************************************
3772  *
3773  * @brief Fill PUSCH Configuration Common Time Domain 
3774  *    Resource Allocation
3775  *
3776  * @details
3777  *
3778  *    Function : parsePuschCmnTimeDomRsrcAlloc
3779  *
3780  *    Functionality: Fill PUSCH Configuration Common Time Domain
3781  *       Resource Allocation
3782  *
3783  * @params[in] XML document pointer
3784  *             XML namespace
3785  *             Current node in XML
3786  *             Pointer to structure to be filled
3787  * @return ROK     - success
3788  *         RFAILED - failure
3789  *
3790  * ****************************************************************/
3791 uint8_t parsePuschCmnTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCmnTimeDomAlloc *puschCmnTimeDomAlloc)
3792 {
3793    uint16_t startSymbol;
3794    uint16_t lenSymbol;
3795
3796    memset(puschCmnTimeDomAlloc, 0, sizeof(PuschCfgCmnTimeDomAlloc));
3797    cur = cur -> xmlChildrenNode;
3798    while(cur != NULL)
3799    {
3800       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K2")) && (cur->ns == ns))
3801       {
3802          puschCmnTimeDomAlloc->k2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3803       }
3804       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns))
3805       {
3806          puschCmnTimeDomAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3807       }
3808       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_START_SYMBOL")) && (cur->ns == ns))
3809       {
3810          startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3811       }
3812       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
3813       {
3814          lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3815       }
3816       cur = cur -> next;
3817    }
3818    puschCmnTimeDomAlloc->sliv = calcSliv(startSymbol, lenSymbol);
3819    return ROK;
3820 }
3821
3822 /*******************************************************************
3823  *
3824  * @brief Fill PUSCH Configuration Common
3825  *
3826  * @details
3827  *
3828  *    Function : parsePuschCfgCommon
3829  *
3830  *    Functionality: Fill PUSCH Configuration Common
3831  *
3832  * @params[in] XML document pointer
3833  *             XML namespace
3834  *             Current node in XML
3835  *             Pointer to structure to be filled
3836  * @return ROK     - success
3837  *         RFAILED - failure
3838  *
3839  * ****************************************************************/
3840 uint8_t parsePuschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PuschCfgCommon *puschCfgCmn)
3841 {
3842    uint8_t rsrcIdx = 0;
3843    xmlNodePtr child = NULLP;
3844    xmlNodePtr rsrcNode = NULLP;
3845
3846    memset(puschCfgCmn, 0, sizeof(PuschCfgCommon));
3847    cur = cur -> xmlChildrenNode;
3848    while(cur != NULL)
3849    {
3850       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_PRESENT")) && (cur->ns == ns))
3851       {
3852          puschCfgCmn->puschCfgPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3853       }
3854
3855       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_MSG3_DELTA_PREAMBLE")) && (cur->ns == ns))
3856       {
3857          puschCfgCmn->msg3DeltaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3858       }
3859
3860       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_P0_NOMINAL_WITH_GRANT")) && (cur->ns == ns))
3861       {
3862          puschCfgCmn->p0NominalWithGrant = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3863       }
3864
3865       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRC_ALLOC")) && (cur->ns == ns))
3866       {
3867          puschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3868       }
3869
3870       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns))
3871       {
3872          child = cur->xmlChildrenNode;
3873          while (child != NULL)
3874          {
3875             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns))
3876             {
3877                rsrcNode = child->xmlChildrenNode;
3878                while (rsrcNode != NULL)
3879                {
3880                   if ((!xmlStrcmp(rsrcNode->name, (const xmlChar *)"PUSCH_TIME_DOM_RSRC_ALLOC")) \
3881                      && (rsrcNode->ns == ns))
3882                   {
3883                      if(parsePuschCmnTimeDomRsrcAlloc(doc, ns, rsrcNode, &puschCfgCmn->timeDomAllocList[rsrcIdx]) != ROK)
3884                      {
3885                         return RFAILED;
3886                      }
3887                      rsrcIdx++;
3888                   }
3889                   rsrcNode = rsrcNode->next;
3890                }
3891             }
3892             child = child->next;
3893          }
3894       }
3895       cur = cur -> next;
3896    }
3897    return ROK;
3898 }
3899
3900 /*******************************************************************
3901  *
3902  * @brief Fill PUCCH Configuration Common 
3903  *
3904  * @details
3905  *
3906  *    Function : parsePucchCfgCommon
3907  *
3908  *    Functionality: Fill PUCCH Configuration Common
3909  *
3910  * @params[in] XML document pointer
3911  *             XML namespace
3912  *             Current node in XML
3913  *             Pointer to structure to be filled
3914  * @return ROK     - success
3915  *         RFAILED - failure
3916  *
3917  * ****************************************************************/
3918 uint8_t parsePucchCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PucchCfgCommon *pucchCfgCmn)
3919 {
3920    memset(pucchCfgCmn, 0, sizeof(PucchCfgCommon));
3921    cur = cur -> xmlChildrenNode;
3922    while(cur != NULL)
3923    {
3924       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
3925       {
3926          pucchCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3927       }
3928
3929       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_RSRC_COMMON")) && (cur->ns == ns))
3930       {
3931          pucchCfgCmn->rsrcComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3932       }
3933
3934       if ((!xmlStrcmp(cur->name, (const xmlChar *)"GRP_HOP")) && (cur->ns == ns))
3935       {
3936          pucchCfgCmn->grpHop = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3937       }
3938
3939       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_P0_NOMINAL")) && (cur->ns == ns))
3940       {
3941          pucchCfgCmn->p0Nominal = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3942       }
3943
3944       cur = cur -> next;
3945    }
3946    return ROK;
3947 }
3948
3949 /*******************************************************************
3950  *
3951  * @brief Fill RACH Configuration Common
3952  *
3953  * @details
3954  *
3955  *    Function : parseRachCfgCommon
3956  *
3957  *    Functionality: Fill RACH Configuration Common
3958  *
3959  * @params[in] XML document pointer
3960  *             XML namespace
3961  *             Current node in XML
3962  *             Pointer to structure to be filled
3963  * @return ROK     - success
3964  *         RFAILED - failure
3965  *
3966  * ****************************************************************/
3967 uint8_t parseRachCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RachCfgCommon *rachCfgCmn)
3968 {
3969    long   maxNumRb;
3970    long   prachMaxPrb;
3971
3972    memset(rachCfgCmn, 0, sizeof(RachCfgCommon));
3973    cur = cur -> xmlChildrenNode;
3974    while(cur != NULL)
3975    {
3976       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
3977       {
3978          rachCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3979       }
3980
3981       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_CONFIG_IDX")) && (cur->ns == ns))
3982       {
3983          rachCfgCmn->prachCfgIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3984       }
3985
3986       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MSG_1_FDM")) && (cur->ns == ns))
3987       {
3988          rachCfgCmn->msg1Fdm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3989       }
3990
3991       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_RB")) && (cur->ns == ns))
3992       {
3993          maxNumRb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3994       }
3995       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_MAX_PRB")) && (cur->ns == ns))
3996       {
3997          prachMaxPrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
3998       }
3999
4000       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ZERO_CORRELATION_ZONE_CFG")) && (cur->ns == ns))
4001       {
4002          rachCfgCmn->zeroCorrZoneCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4003       }
4004
4005       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_PREAMBLE_RCVD_TGT_PWR")) && (cur->ns == ns))
4006       {
4007          rachCfgCmn->preambleRcvdTgtPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4008       }
4009
4010       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PREAMBLE_TRANS_MAX")) && (cur->ns == ns))
4011       {
4012          rachCfgCmn->preambleTransMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4013       }
4014
4015       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PWR_RAMPING_STEP")) && (cur->ns == ns))
4016       {
4017          rachCfgCmn->pwrRampingStep = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4018       }
4019
4020       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_RSP_WINDOW")) && (cur->ns == ns))
4021       {
4022          rachCfgCmn->raRspWindow = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4023       }
4024
4025       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RA_PREAMBLE")) && (cur->ns == ns))
4026       {
4027          rachCfgCmn->numRaPreamble = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4028       }
4029
4030       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_SSB_PER_RACH_OCC")) && (cur->ns == ns))
4031       {
4032          rachCfgCmn->numSsbPerRachOcc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4033       }
4034
4035       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CB_PREAMBLE_PER_SSB")) && (cur->ns == ns))
4036       {
4037          rachCfgCmn->numCbPreamblePerSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4038       }
4039
4040       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONT_RES_TIMER")) && (cur->ns == ns))
4041       {
4042          rachCfgCmn->contResTimer = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4043       }
4044
4045       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RSRP_THRESHOLD_SSB")) && (cur->ns == ns))
4046       {
4047          rachCfgCmn->rsrpThreshSsb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4048       }
4049
4050       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX_PRESENT")) && (cur->ns == ns))
4051       {
4052          rachCfgCmn->rootSeqIdxPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4053       }
4054
4055       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOT_SEQ_IDX")) && (cur->ns == ns))
4056       {
4057          rachCfgCmn->rootSeqIdx = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4058       }
4059
4060       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_SUBCARRIER_SPACING")) && (cur->ns == ns))
4061       {
4062          rachCfgCmn->msg1Scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4063       }
4064
4065       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRACH_RESTRICTED_SET_CFG")) && (cur->ns== ns))
4066       {
4067          rachCfgCmn->restrictedSetCfg = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4068       }
4069
4070       cur = cur -> next;
4071    }
4072
4073    rachCfgCmn->msg1FreqStart = ((maxNumRb) - (prachMaxPrb));
4074    return ROK;
4075 }
4076
4077 /*******************************************************************
4078  *
4079  * @brief Fill SCS Specific Carrier
4080  *
4081  * @details
4082  *
4083  *    Function : parseScsSpecCarrier
4084  *
4085  *    Functionality: Fill SCS Specific Carrier
4086  *
4087  * @params[in] XML document pointer
4088  *             XML namespace
4089  *             Current node in XML
4090  *             Pointer to structure to be filled
4091  * @return ROK     - success
4092  *         RFAILED - failure
4093  *
4094  * ****************************************************************/
4095 uint8_t parseScsSpecCarrier(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,ScsSpecCarrier *scsSpecCrr)
4096 {
4097    memset(scsSpecCrr, 0, sizeof(ScsSpecCarrier));
4098    cur = cur -> xmlChildrenNode;
4099    while(cur != NULL)
4100    {
4101       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_SUBCARRIER_OFFSET")) && (cur->ns == ns))
4102       {
4103          scsSpecCrr->scsOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4104       }
4105
4106       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
4107       {
4108          scsSpecCrr->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4109       }
4110
4111       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_BW")) && (cur->ns == ns))
4112       {
4113          scsSpecCrr->scsBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4114       }
4115       cur = cur -> next;
4116    }
4117    return ROK;
4118 }
4119
4120 /*******************************************************************
4121  *
4122  * @brief Fill UL Config Common 
4123  *
4124  * @details
4125  *
4126  *    Function : parseUlCfgCommon
4127  *
4128  *    Functionality: Fill UL Config Common
4129  *
4130  * @params[in] XML document pointer
4131  *             XML namespace
4132  *             Current node in XML
4133  *             Pointer to structure to be filled
4134  * @return ROK     - success
4135  *         RFAILED - failure
4136  *
4137  * ****************************************************************/
4138 uint8_t parseUlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,UlCfgCommon *ulCfgCmn)
4139 {
4140    memset(ulCfgCmn, 0, sizeof(UlCfgCommon));
4141    cur = cur -> xmlChildrenNode;
4142    while(cur != NULL)
4143    {
4144       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
4145       {
4146          ulCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4147       }
4148
4149       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_P_MAX")) && (cur->ns == ns))
4150       {
4151          ulCfgCmn->pMax = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4152       }
4153
4154       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns))
4155       {
4156          ulCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4157       }
4158
4159       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIME_ALLIGN_TIMER_COMM")) && (cur->ns == ns))
4160       {
4161          ulCfgCmn->timeAlignTimerComm = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4162       }
4163
4164       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns))
4165       {
4166          if(parseScsSpecCarrier(doc, ns, cur, &ulCfgCmn->ulScsCarrier) != ROK)
4167          {
4168             return RFAILED;
4169          }
4170       }
4171
4172       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RACH_CFG_COMMON")) && (cur->ns == ns))
4173       {
4174          if(parseRachCfgCommon(doc, ns, cur, &ulCfgCmn->rachCfg) != ROK)
4175          {
4176             return RFAILED;
4177          }
4178       }
4179
4180       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUSCH_CFG_COMMON")) && (cur->ns == ns))
4181       {
4182          if(parsePuschCfgCommon(doc, ns, cur, &ulCfgCmn->puschCfg) != ROK)
4183          {
4184             return RFAILED;
4185          }
4186       }
4187       
4188       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PUCCH_CFG_COMMON")) && (cur->ns == ns))
4189       {
4190          if(parsePucchCfgCommon(doc, ns, cur, &ulCfgCmn->pucchCfg) != ROK)
4191          {
4192             return RFAILED;
4193          }
4194       }
4195
4196       cur = cur -> next;
4197    }
4198    return ROK;
4199 }
4200
4201 /*******************************************************************
4202  *
4203  * @brief Fill TDD UL DL Configuration Common
4204  *
4205  * @details
4206  *
4207  *    Function : parseTddUlDlCfgCommon
4208  *
4209  *    Functionality: Fill TDD UL DL Configuration Common
4210  *
4211  * @params[in] XML document pointer
4212  *             XML namespace
4213  *             Current node in XML
4214  *             Pointer to structure to be filled
4215  * @return ROK     - success
4216  *         RFAILED - failure
4217  *
4218  * ****************************************************************/
4219 uint8_t parseTddUlDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TddUlDlCfgCommon *tddUlDlCfgCmn)
4220 {
4221    memset(tddUlDlCfgCmn, 0, sizeof(TddUlDlCfgCommon));
4222    cur = cur -> xmlChildrenNode;
4223    while(cur != NULL)
4224    {
4225       if ((!xmlStrcmp(cur->name, (const xmlChar *)"REF_SCS")) && (cur->ns == ns))
4226       {
4227          tddUlDlCfgCmn->refScs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4228       }
4229
4230       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TX_PRD")) && (cur->ns == ns))
4231       {
4232          tddUlDlCfgCmn->txPrd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4233       }
4234
4235       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SLOTS")) && (cur->ns == ns))
4236       {
4237          tddUlDlCfgCmn->numDlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4238       }
4239
4240       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_DL_SYMBOLS")) && (cur->ns == ns))
4241       {
4242          tddUlDlCfgCmn->numDlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4243       }
4244
4245       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SLOTS")) && (cur->ns == ns))
4246       {
4247          tddUlDlCfgCmn->numUlSlots = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4248       }
4249
4250       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_UL_SYMBOLS")) && (cur->ns == ns))
4251       {
4252          tddUlDlCfgCmn->numUlSymbols = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4253       }
4254
4255       cur = cur -> next;
4256    }
4257    return ROK;
4258 }
4259
4260 /*******************************************************************
4261  *
4262  * @brief Fill PCCH Configuration 
4263  *
4264  * @details
4265  *
4266  *    Function : parsePcchCfg
4267  *
4268  *    Functionality: Fill PCCH Configuration
4269  *
4270  * @params[in] XML document pointer
4271  *             XML namespace
4272  *             Current node in XML
4273  *             Pointer to structure to be filled
4274  * @return ROK     - success
4275  *         RFAILED - failure
4276  *
4277  * ****************************************************************/
4278 uint8_t parsePcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PcchCfg *pcchCfg)
4279 {
4280    xmlNodePtr child = NULLP;
4281    xmlNodePtr firstPdcchNode = NULLP;
4282    uint8_t  idx = 0;
4283
4284    memset(pcchCfg, 0, sizeof(PcchCfg));
4285    cur = cur -> xmlChildrenNode;
4286    while(cur != NULL)
4287    {
4288       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DFLT_PAGING_CYCLE")) && (cur->ns == ns))
4289       {
4290          pcchCfg->dfltPagingCycle = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4291       }
4292
4293       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NAND_PAGING_FRM_OFFSET")) && (cur->ns == ns))
4294       {
4295          pcchCfg->nAndPagingFrmOffsetType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4296       }
4297
4298       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PAGE_FRM_OFFSET")) && (cur->ns == ns))
4299       {
4300          pcchCfg->pageFrameOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4301       }
4302
4303       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NS")) && (cur->ns == ns))
4304       {
4305          pcchCfg->ns = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4306       }
4307
4308       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_TYPE")) && (cur->ns == ns))
4309       {
4310          pcchCfg->firstPDCCHMontioringType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4311       }
4312
4313       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
4314       {
4315          child = cur->xmlChildrenNode;
4316          while(child != NULL)
4317          {
4318             if ((!xmlStrcmp(child->name, (const xmlChar *)"FIRST_PDCCH_LIST")) && (child->ns == ns))
4319             {
4320                firstPdcchNode = child->xmlChildrenNode;
4321                while (firstPdcchNode != NULL)
4322                {
4323                   if ((!xmlStrcmp(firstPdcchNode->name, (const xmlChar *)"FIRST_PDCCH_MONITORING_INFO")) && (firstPdcchNode->ns == ns))
4324                   {
4325                      pcchCfg->firstPDCCHMontioringInfo[idx] = atoi((char *)xmlNodeListGetString(doc, firstPdcchNode->xmlChildrenNode, 1));
4326                      idx++;
4327                   }
4328                   firstPdcchNode = firstPdcchNode->next;
4329                }
4330             }
4331             child = child -> next;
4332          }
4333       }
4334       cur = cur -> next;
4335    }
4336    return ROK;
4337 }
4338
4339 /*******************************************************************
4340  *
4341  * @brief Fill PDSCH Time Domain Resource Allocation
4342  *
4343  * @details
4344  *
4345  *    Function : parsePdschTimeDomRsrcAlloc
4346  *
4347  *    Functionality: Fill PDSCH Time Domain Resource Allocation
4348  *
4349  * @params[in] XML document pointer
4350  *             XML namespace
4351  *             Current node in XML
4352  *             Pointer to structure to be filled
4353  * @return ROK     - success
4354  *         RFAILED - failure
4355  *
4356  * ****************************************************************/
4357 uint8_t parsePdschTimeDomRsrcAlloc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc)
4358 {
4359    uint16_t startSymbol;
4360    uint16_t lenSymbol;
4361
4362    memset(pdschTimeDomRsrcAlloc, 0, sizeof(PdschTimeDomainRsrcAlloc));
4363    cur = cur -> xmlChildrenNode;
4364    while(cur != NULL)
4365    {
4366       if ((!xmlStrcmp(cur->name, (const xmlChar *)"K0")) && (cur->ns == ns))
4367       {
4368          pdschTimeDomRsrcAlloc->k0 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4369       }
4370
4371       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAP_TYPE")) && (cur->ns == ns))
4372       {
4373          pdschTimeDomRsrcAlloc->mapType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4374       }
4375
4376       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_START_SYMBOL")) && (cur->ns == ns))
4377       {
4378          startSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4379       }
4380
4381       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_LENGTH_SYMBOL")) && (cur->ns == ns))
4382       {
4383          lenSymbol = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4384       }
4385
4386       cur = cur -> next;
4387    }
4388    pdschTimeDomRsrcAlloc->sliv = calcSliv(startSymbol, lenSymbol);
4389    return ROK;
4390 }
4391
4392 /*******************************************************************
4393  *
4394  * @brief Fill PDSCH Configuration Common
4395  *
4396  * @details
4397  *
4398  *    Function : parsePdschCfgCommon
4399  *
4400  *    Functionality: Fill PDSCH Configuration Common
4401  *
4402  * @params[in] XML document pointer
4403  *             XML namespace
4404  *             Current node in XML
4405  *             Pointer to structure to be filled
4406  * @return ROK     - success
4407  *         RFAILED - failure
4408  *
4409  * ****************************************************************/
4410 uint8_t parsePdschCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,PdschCfgCommon *pdschCfgCmn)
4411 {
4412    uint8_t     idx = 0;
4413    xmlNodePtr  child = NULLP; 
4414    xmlNodePtr  listChild = NULLP; 
4415
4416    memset(pdschCfgCmn, 0, sizeof(PdschCfgCommon));
4417    cur = cur -> xmlChildrenNode;
4418    while(cur != NULL)
4419    {
4420       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
4421       {
4422          pdschCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4423       }
4424
4425       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_TIME_DOM_RSRS_ALLOC")) && (cur->ns == ns))
4426       {
4427          pdschCfgCmn->numTimeDomRsrcAlloc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4428       }
4429
4430       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC_LIST")) && (cur->ns == ns))
4431       {
4432          child = cur->xmlChildrenNode;
4433          while (child != NULL)
4434          {
4435             if ((!xmlStrcmp(child->name, (const xmlChar *)"LIST")) && (child->ns == ns))
4436             {
4437                listChild = child->xmlChildrenNode;
4438                while (listChild != NULL)
4439                {
4440                   if ((!xmlStrcmp(listChild->name, (const xmlChar *)"PDSCH_TIME_DOM_RSRC_ALLOC")) && (listChild->ns == ns))
4441                   {
4442                      if(parsePdschTimeDomRsrcAlloc(doc, ns, listChild, &pdschCfgCmn->timeDomAlloc[idx]) != ROK)
4443                      {
4444                         return RFAILED;
4445                      }
4446                      idx++;
4447                   }
4448                   listChild = listChild->next;
4449                }
4450             }
4451             child = child->next;
4452          }
4453       }
4454       cur = cur -> next;
4455    }
4456    return ROK;
4457 }
4458
4459 /*******************************************************************
4460  *
4461  * @brief Fill BCCH Configuration
4462  *
4463  * @details
4464  *
4465  *    Function : parseBcchCfg
4466  *
4467  *    Functionality: Fill BCCH Configuration
4468  *
4469  * @params[in] XML document pointer
4470  *             XML namespace
4471  *             Current node in XML
4472  *             Pointer to structure to be filled
4473  * @return ROK     - success
4474  *         RFAILED - failure
4475  *
4476  * ****************************************************************/
4477 uint8_t parseBcchCfg(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, BcchCfg *bcchCfg)
4478 {
4479    memset(bcchCfg, 0, sizeof(BcchCfg));
4480    cur = cur -> xmlChildrenNode;
4481    while(cur != NULL)
4482    {
4483       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MOB_PRD_COEFF")) && (cur->ns == ns))
4484       {
4485          bcchCfg->modPrdCoeff = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4486       }
4487       cur = cur -> next;
4488    }
4489    return ROK;
4490 }
4491
4492 /*******************************************************************
4493  *
4494  * @brief Fill PDCCH Configuration Common
4495  *
4496  * @details
4497  *
4498  *    Function : parsePdcchConfigCommon
4499  *
4500  *    Functionality: Fill PDCCH Configuration Common
4501  *
4502  * @params[in] XML document pointer
4503  *             XML namespace
4504  *             Current node in XML
4505  *             Pointer to structure to be filled
4506  * @return ROK     - success
4507  *         RFAILED - failure
4508  *
4509  * ****************************************************************/
4510 uint8_t parsePdcchConfigCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, PdcchCfgCommon *pdccgCfgCmn)
4511 {
4512    uint8_t idx = 0;
4513    xmlNodePtr child = NULLP;
4514    xmlNodePtr listChild = NULLP;
4515
4516    memset(pdccgCfgCmn, 0, sizeof( PdcchCfgCommon));
4517    cur = cur -> xmlChildrenNode;
4518    while(cur != NULL)
4519    {
4520       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PRESENT")) && (cur->ns == ns))
4521       {
4522          pdccgCfgCmn->present = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4523       }
4524
4525       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CORESET_0_INDEX")) && (cur->ns == ns))
4526       {
4527          pdccgCfgCmn->ctrlRsrcSetZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4528       }
4529
4530       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCHSPACE_0_INDEX")) && (cur->ns == ns))
4531       {
4532          pdccgCfgCmn->searchSpcZero = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4533       }
4534
4535       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID")) && (cur->ns == ns))
4536       {
4537          pdccgCfgCmn->searchSpcId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4538       }
4539
4540       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CTRL_RSRC_SET_ID")) && (cur->ns == ns))
4541       {
4542          pdccgCfgCmn->ctrlRsrcSetId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4543       }
4544
4545       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MONITOR_SLOT_PRD_OFFPRESENT")) && (cur->ns == ns))
4546       {
4547          pdccgCfgCmn->monitorSlotPrdAndOffPresent = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4548       }
4549
4550       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LIST")) && (cur->ns == ns))
4551       {
4552          child = cur->xmlChildrenNode;
4553          while (child)
4554          {
4555             if ((!xmlStrcmp(child->name, (const xmlChar *)"MONITOR_LIST")) && (child->ns == ns))
4556             {
4557                listChild = child->xmlChildrenNode;
4558                while (listChild != NULL)
4559                {
4560                   if ((!xmlStrcmp(listChild->name, (const xmlChar *)"MONITOR_SYMBOL_INSLOT")) && (listChild->ns == ns))
4561                   {
4562                      pdccgCfgCmn->monitorSymbolsInSlot[idx] = atoi((char *)xmlNodeListGetString(doc, listChild->xmlChildrenNode, 1));
4563                      idx++;
4564                   }
4565                   listChild = listChild->next;
4566                }
4567             }
4568             child = child->next;
4569          }
4570       }
4571
4572       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL1")) && (cur->ns == ns))
4573       {
4574          pdccgCfgCmn->numCandAggLvl1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4575       }
4576
4577       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL2")) && (cur->ns == ns))
4578       {
4579          pdccgCfgCmn->numCandAggLvl2 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4580       }
4581
4582       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL4")) && (cur->ns == ns))
4583       {
4584          pdccgCfgCmn->numCandAggLvl4 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4585       }
4586
4587       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL8")) && (cur->ns == ns))
4588       {
4589          pdccgCfgCmn->numCandAggLvl8 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4590       }
4591
4592       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUMC_AGG_LVL16")) && (cur->ns == ns))
4593       {
4594          pdccgCfgCmn->numCandAggLvl16 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4595       }
4596
4597       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SEARCH_SPC_TYPE")) && (cur->ns == ns))
4598       {
4599          pdccgCfgCmn->searchSpcType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4600       }
4601
4602       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SERACH_SPACE_DCI_FORMAT")) && (cur->ns == ns))
4603       {
4604          pdccgCfgCmn->commSrchSpcDciFrmt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4605       }
4606
4607       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_SIB1")) && (cur->ns == ns))
4608       {
4609          pdccgCfgCmn->searchSpcSib1 = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4610       }
4611
4612       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_SEARCH_SPACE_ID_PAGING")) && (cur->ns == ns))
4613       {
4614          pdccgCfgCmn->pagingSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4615       }
4616
4617       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RA_PDCCH_SEARCH_SPACE_ID_PAGING")) && (cur->ns == ns))
4618       {
4619          pdccgCfgCmn->raSearchSpc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4620       }
4621
4622       cur = cur -> next;
4623    }
4624    return ROK;
4625 }
4626
4627 /*******************************************************************
4628  *
4629  * @brief Fill DL Configuration Common
4630  *
4631  * @details
4632  *
4633  *    Function : parseDlCfgCommon
4634  *
4635  *    Functionality: Fill DL Configuration Common
4636  *
4637  * @params[in] XML document pointer
4638  *             XML namespace
4639  *             Current node in XML
4640  *             Pointer to structure to be filled
4641  * @return ROK     - success
4642  *         RFAILED - failure
4643  *
4644  * ****************************************************************/
4645 uint8_t parseDlCfgCommon(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,DlCfgCommon *dlCfgCmn)
4646 {
4647    memset(dlCfgCmn, 0, sizeof(DlCfgCommon));
4648    cur = cur -> xmlChildrenNode;
4649    while(cur != NULL)
4650    {
4651       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_FREQ_BAND")) && (cur->ns == ns))
4652       {
4653          dlCfgCmn->freqBandInd = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4654       }
4655
4656       if ((!xmlStrcmp(cur->name, (const xmlChar *)"OFFSET_TO_POINT_A")) && (cur->ns == ns))
4657       {
4658          dlCfgCmn->offsetToPointA = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4659       }
4660
4661       if ((!xmlStrcmp(cur->name, (const xmlChar *)"FREQ_LOC_BW")) && (cur->ns == ns))
4662       {
4663          dlCfgCmn->locAndBw = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4664       }
4665
4666       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCS_SPEC_CARRIER")) && (cur->ns == ns))
4667       {
4668          if(parseScsSpecCarrier(doc, ns, cur, &dlCfgCmn->dlScsCarrier) != ROK)
4669          {
4670             return RFAILED;
4671          }
4672       }
4673
4674       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDCCH_CFG_COMMON")) && (cur->ns == ns))
4675       {
4676          if(parsePdcchConfigCommon(doc, ns, cur, &dlCfgCmn->pdcchCfg) != ROK)
4677          {
4678             return RFAILED;
4679          }
4680       }
4681
4682       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PDSCH_CFG_COMMON")) && (cur->ns == ns))
4683       {
4684          if(parsePdschCfgCommon(doc, ns, cur, &dlCfgCmn->pdschCfg) != ROK)
4685          {
4686             return RFAILED;
4687          }
4688       }
4689
4690       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BCCH_CFG")) && (cur->ns == ns))
4691       {
4692          if(parseBcchCfg(doc, ns, cur, &dlCfgCmn->bcchCfg) != ROK)
4693          {
4694             return RFAILED;
4695          }
4696       }
4697
4698       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PCCH_CFG")) && (cur->ns == ns))
4699       {
4700          if(parsePcchCfg(doc, ns, cur, &dlCfgCmn->pcchCfg) != ROK)
4701          {
4702             return RFAILED;
4703          }
4704       }
4705
4706       cur = cur -> next;
4707    }
4708    return ROK;
4709 }
4710 /*******************************************************************
4711  *
4712  * @brief Fill Serving Cell Config Common SIB
4713  *
4714  * @details
4715  *
4716  *    Function : parseSrvCellCfgCmnSib
4717  *
4718  *    Functionality: Fill Serving Cell Config Common SIB
4719  *
4720  * @params[in] XML document pointer
4721  *             XML namespace
4722  *             Current node in XML
4723  *             Pointer to structure to be filled
4724  * @return ROK     - success
4725  *         RFAILED - failure
4726  *
4727  * ****************************************************************/
4728 uint8_t parseSrvCellCfgCmnSib(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SrvCellCfgCommSib *srvCellCfgCmnSib)
4729 {
4730    memset(srvCellCfgCmnSib, 0, sizeof(SrvCellCfgCommSib));
4731    cur = cur -> xmlChildrenNode;
4732    while(cur != NULL)
4733    {
4734       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NR_SCS")) && (cur->ns == ns))
4735       {
4736          srvCellCfgCmnSib->scs = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4737       }
4738
4739       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_POS_INBURST")) && (cur->ns == ns))
4740       {
4741          srvCellCfgCmnSib->ssbPosInBurst = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4742       }
4743
4744       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PERIODICITY")) && (cur->ns == ns))
4745       {
4746          srvCellCfgCmnSib->ssbPrdServingCell = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4747       }
4748
4749       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SSB_PBCH_PWR")) && (cur->ns == ns))
4750       {
4751          srvCellCfgCmnSib->ssPbchBlockPwr = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4752       }
4753
4754       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DL_CFG_COMMON")) && (cur->ns == ns))
4755       {
4756          if(parseDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->dlCfg) != ROK)
4757          {
4758             return RFAILED;
4759          }
4760       }
4761
4762       if ((!xmlStrcmp(cur->name, (const xmlChar *)"UL_CFG_COMMON")) && (cur->ns == ns))
4763       {
4764          if(parseUlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->ulCfg) != ROK)
4765          {
4766             return RFAILED;
4767          }
4768       }
4769
4770       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TDD_UL_DL_CFG_COMMON")) && (cur->ns == ns))
4771       {
4772          if(parseTddUlDlCfgCommon(doc, ns, cur, &srvCellCfgCmnSib->tddCfg) != ROK)
4773          {
4774             return RFAILED;
4775          }
4776       }
4777
4778       cur = cur -> next;
4779    }
4780    return ROK;
4781 }
4782
4783 /*******************************************************************
4784  *
4785  * @brief Fill SI Scheduling Information 
4786  *
4787  * @details
4788  *
4789  *    Function : parseSiSchedInfo
4790  *
4791  *    Functionality: Fill SI Scheduling Information
4792  *
4793  * @params[in] XML document pointer
4794  *             XML namespace
4795  *             Current node in XML
4796  *             Pointer to structure to be filled
4797  * @return ROK     - success
4798  *         RFAILED - failure
4799  *
4800  * ****************************************************************/
4801 uint8_t parseSiSchedInfo(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,SiSchedInfo *siSchedInfo)
4802 {
4803    memset(siSchedInfo, 0, sizeof(SiSchedInfo));
4804    cur = cur -> xmlChildrenNode;
4805    while(cur != NULL)
4806    {
4807       if ((!xmlStrcmp(cur->name, (const xmlChar *)"WIN_LEN")) && (cur->ns == ns))
4808       {
4809          siSchedInfo->winLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4810       }
4811
4812       if ((!xmlStrcmp(cur->name, (const xmlChar *)"BROADCAST_STA")) && (cur->ns == ns))
4813       {
4814          siSchedInfo->broadcastSta = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4815       }
4816
4817       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PERIODICITY")) && (cur->ns == ns))
4818       {
4819          siSchedInfo->preiodicity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4820       }
4821
4822       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB_TYPE")) && (cur->ns == ns))
4823       {
4824          siSchedInfo->sibType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4825       }
4826
4827       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_VAL_TAG")) && (cur->ns == ns))
4828       {
4829          siSchedInfo->sibValTag = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4830       }
4831
4832       cur = cur -> next;
4833    }
4834    return ROK;
4835 }
4836
4837 /*******************************************************************
4838  *
4839  * @brief Fill SIB1 Parameters
4840  *
4841  * @details
4842  *
4843  *    Function : parseSib1Params
4844  *
4845  *    Functionality: Fill SIB1 Parameters
4846  *
4847  * @params[in] XML document pointer
4848  *             XML namespace
4849  *             Current node in XML
4850  *             Pointer to structure to be filled
4851  * @return ROK     - success
4852  *         RFAILED - failure
4853  *
4854  * ****************************************************************/
4855 uint8_t parseSib1Params(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,Sib1Params *sib1Params)
4856 {
4857    memset(sib1Params, 0, sizeof(Sib1Params));
4858    cur = cur -> xmlChildrenNode;
4859    while(cur != NULL)
4860    {
4861       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
4862       {
4863          if(parsePlmn(doc, ns, cur, &sib1Params->plmn) != ROK)
4864          {
4865             return RFAILED;
4866          }
4867       }
4868
4869       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TAC")) && (cur->ns == ns))
4870       {
4871          sib1Params-> tac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4872       }
4873
4874       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RANAC")) && (cur->ns == ns))
4875       {
4876          sib1Params->ranac = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4877       }
4878
4879       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_IDENTITY")) && (cur->ns == ns))
4880       {
4881          sib1Params->cellIdentity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4882       }
4883
4884       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CELL_RESVD_OPUSE")) && (cur->ns == ns))
4885       {
4886          sib1Params->cellResvdForOpUse = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4887       }
4888
4889       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_CNT")) && (cur->ns == ns))
4890       {
4891          sib1Params->connEstFailCnt = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4892       }
4893
4894       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFF_VALID")) && (cur->ns == ns))
4895       {
4896          sib1Params->connEstFailOffValidity = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4897       }
4898
4899       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CONN_EST_FAIL_OFFSET")) && (cur->ns == ns))
4900       {
4901          sib1Params->connEstFailOffset = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4902       }
4903
4904       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SI_SHED_INFO")) && (cur->ns == ns))
4905       {
4906          if(parseSiSchedInfo(doc, ns, cur, &sib1Params->siSchedInfo) != ROK)
4907          {
4908             return RFAILED;
4909          }
4910       }
4911
4912       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SRV_CELLCFG_COM_SIB")) && (cur->ns == ns))
4913       {
4914          if(parseSrvCellCfgCmnSib(doc, ns, cur, &sib1Params->srvCellCfgCommSib) != ROK)
4915          {
4916             return RFAILED;
4917          }
4918       }
4919
4920       cur = cur -> next;
4921    }
4922    return ROK;
4923 }
4924
4925 /*******************************************************************
4926  *
4927  * @brief Fill RRM Policy List
4928  *
4929  * @details
4930  *
4931  *    Function : parseRrmPolicyList
4932  *
4933  *    Functionality: Fill RRM Policy List
4934  *
4935  * @params[in] XML document pointer
4936  *             XML namespace
4937  *             Current node in XML
4938  *             Pointer to structure to be filled
4939  * @return ROK     - success
4940  *         RFAILED - failure
4941  *
4942  * ****************************************************************/
4943 uint8_t parseRrmPolicyList(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,RrmPolicyMemberList *rrmPolicyMemberList)
4944 {
4945    memset(rrmPolicyMemberList, 0, sizeof(RrmPolicyMemberList));
4946    cur = cur->xmlChildrenNode;
4947    while(cur != NULL)
4948    {
4949       if ((!xmlStrcmp(cur->name, (const xmlChar *)"PLMN")) && (cur->ns == ns))
4950       {
4951          if(parsePlmn(doc, ns, cur, &rrmPolicyMemberList->plmn) != ROK)
4952          {
4953             return RFAILED;
4954          }
4955       }
4956
4957       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SNSSAI")) && (cur->ns == ns))
4958       {
4959          if(parseSnssai(doc, ns, cur, &rrmPolicyMemberList->snssai) != ROK)
4960          {
4961             return RFAILED;
4962          }
4963       }
4964
4965       cur = cur -> next;
4966    }
4967    return ROK;
4968 }
4969
4970 /*******************************************************************
4971  *
4972  * @brief Fill RRM Policy Ratio
4973  *
4974  * @details
4975  *
4976  *    Function : parseRrmPolicyRatio
4977  *
4978  *    Functionality: Fill RRM Policy Ratio
4979  *
4980  * @params[in] XML document pointer
4981  *             XML namespace
4982  *             Current node in XML
4983  *             Pointer to structure to be filled
4984  * @return ROK     - success
4985  *         RFAILED - failure
4986  *
4987  * ****************************************************************/
4988 uint8_t parseRrmPolicyRatio(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, RrmPolicyRatio *rrmPolicyRatio)
4989 {
4990    memset(rrmPolicyRatio, 0, sizeof(RrmPolicyRatio));
4991    cur = cur -> xmlChildrenNode;
4992    while(cur != NULL)
4993    {
4994       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_RATIO")) && (cur->ns == ns))
4995       {
4996          rrmPolicyRatio->maxRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
4997       }
4998
4999       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIN_RATIO")) && (cur->ns == ns))
5000       {
5001          rrmPolicyRatio->minRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5002       }
5003
5004       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DEDICATED_RATIO")) && (cur->ns == ns))
5005       {
5006          rrmPolicyRatio->dedicatedRatio = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5007       }
5008
5009       cur = cur -> next;
5010    }
5011    return ROK;
5012 }
5013
5014 /*******************************************************************
5015 /*******************************************************************
5016  *
5017  * @brief Fill MAC Slice RRM Policy
5018  *
5019  * @details
5020  *
5021  *    Function : parseMacSliceRrmPolicy
5022  *
5023  *    Functionality: Fill MAC Slice RRM Policy
5024  *
5025  * @params[in] XML document pointer
5026  *             XML namespace
5027  *             Current node in XML
5028  *             Pointer to structure to be filled
5029  * @return ROK     - success
5030  *         RFAILED - failure
5031  *
5032  * ****************************************************************/
5033 uint8_t parseMacSliceRrmPolicy(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, MacSliceRrmPolicy *rrmPolicy)
5034 {
5035    uint8_t memIdx = 0;
5036
5037    memset(rrmPolicy, 0, sizeof(MacSliceRrmPolicy));
5038    cur = cur -> xmlChildrenNode;
5039    while(cur != NULL)
5040    {
5041       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RESOURCE_TYPE")) && (cur->ns == ns))
5042       {
5043          rrmPolicy->resourceType = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5044       }
5045
5046       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRC_POLICY_MEM")) && (cur->ns == ns))
5047       {
5048          rrmPolicy->numOfRrmPolicyMem = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5049       }
5050
5051       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_MUM_LIST")) && (cur->ns == ns))
5052       {
5053          DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList,\
5054                rrmPolicy->numOfRrmPolicyMem * sizeof(RrmPolicyMemberList*));
5055
5056          if(!rrmPolicy->rRMPolicyMemberList)
5057          {
5058             DU_LOG("\nERROR  --> DU APP : %s: Memory allocation failed at line %d", __func__, __LINE__);
5059             return RFAILED;
5060          }
5061
5062          for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++)
5063          {
5064             DU_ALLOC_SHRABL_BUF(rrmPolicy->rRMPolicyMemberList[memIdx], sizeof(RrmPolicyMemberList));
5065             if (rrmPolicy->rRMPolicyMemberList[memIdx] == NULLP)
5066             {
5067                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
5068                return RFAILED;
5069             }
5070
5071             if(parseRrmPolicyList(doc, ns, cur, rrmPolicy->rRMPolicyMemberList[memIdx]) != ROK)
5072             {
5073                return RFAILED;
5074             }
5075          }
5076       }
5077
5078       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RRM_POLICY_RATIO")) && (cur->ns == ns))
5079       {
5080          if(parseRrmPolicyRatio(doc, ns, cur, &rrmPolicy->policyRatio) != ROK)
5081          {
5082             return RFAILED;
5083          }
5084       }
5085
5086       cur = cur -> next;
5087    }
5088    return ROK;
5089 }
5090
5091 /*******************************************************************
5092  *
5093  * @brief Fill MAC Slice Configuration
5094  *
5095  * @details
5096  *
5097  *    Function : parseMacSliceCfgReq
5098  *
5099  *    Functionality: Fill MAC Slice Configuration
5100  *
5101  * @params[in] XML document pointer
5102  *             XML namespace
5103  *             Current node in XML
5104  *             Pointer to structure to be filled
5105  * @return ROK     - success
5106  *         RFAILED - failure
5107  *
5108  * ****************************************************************/
5109 uint8_t parseMacSliceCfgReq(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur,MacSliceCfgReq *macSliceCfgReq)
5110 {
5111    uint8_t policyIdx = 0;
5112    memset(macSliceCfgReq, 0, sizeof(MacSliceCfgReq));
5113    cur = cur -> xmlChildrenNode;
5114    while(cur != NULL)
5115    {
5116       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_RRC_POLICY")) && (cur->ns == ns))
5117       {
5118          macSliceCfgReq->numOfRrmPolicy = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5119       }
5120
5121       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_SLICE_RRM_POLICY")) && (cur->ns == ns))
5122       {
5123          DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy,  macSliceCfgReq->numOfRrmPolicy * sizeof(MacSliceRrmPolicy*));
5124          if(!macSliceCfgReq->listOfRrmPolicy)
5125          {
5126             DU_LOG("\nERROR  --> DU APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
5127             return RFAILED;
5128          }
5129
5130          for(policyIdx = 0; policyIdx < macSliceCfgReq->numOfRrmPolicy; policyIdx++)
5131          {
5132             DU_ALLOC_SHRABL_BUF(macSliceCfgReq->listOfRrmPolicy[policyIdx], sizeof(MacSliceRrmPolicy));
5133             if (macSliceCfgReq->listOfRrmPolicy[policyIdx] == NULLP)
5134             {
5135                DU_LOG("\nERROR  --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
5136             }
5137             
5138             if(parseMacSliceRrmPolicy(doc, ns, cur, macSliceCfgReq->listOfRrmPolicy[policyIdx]) != ROK)
5139             {
5140                return RFAILED;
5141             }
5142          }
5143       }
5144       cur = cur -> next;
5145    }
5146    return ROK;
5147 }
5148 #endif
5149
5150 #ifdef THREAD_AFFINITY
5151 /*******************************************************************
5152  *
5153  * @brief Set thread affinity to the core configured via XML file
5154  *
5155  * @details
5156  *
5157  *    Function : parseThreadAffinity
5158  *
5159  *    Functionality: Set thread affinity to the core configured 
5160  *       via XML file
5161  *
5162  * @params[in] XML document pointer
5163  *             XML namespace
5164  *             Current node in XML
5165  *             Thread information
5166  * @return ROK     - success
5167  *         RFAILED - failure
5168  *
5169  * ****************************************************************/
5170 uint8_t parseThreadAffinity(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ThreadInfo *threads)
5171 {
5172    cur = cur -> xmlChildrenNode;
5173    while(cur != NULL)
5174    {
5175       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_APP_CORE")) && (cur->ns == ns))
5176       {
5177          threads->duAppCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5178          ODU_SET_THREAD_AFFINITY(&threads->duAppSTskId, SS_AFFINITY_MODE_EXCL, threads->duAppCoreId, 0);
5179       }
5180
5181       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP_CORE")) && (cur->ns == ns))
5182       {
5183          threads->egtpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5184          ODU_SET_THREAD_AFFINITY(&threads->egtpSTskId, SS_AFFINITY_MODE_EXCL, threads->egtpCoreId, 0);
5185       }
5186
5187       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_MAC_CORE")) && (cur->ns == ns))
5188       {
5189          threads->rlcMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5190          ODU_SET_THREAD_AFFINITY(&threads->rlcMacSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcMacCoreId, 0);
5191       }
5192
5193       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RLC_UL_CORE")) && (cur->ns == ns))
5194       {
5195          threads->rlcUlCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5196          ODU_SET_THREAD_AFFINITY(&threads->rlcUlSTskId, SS_AFFINITY_MODE_EXCL, threads->rlcUlCoreId, 0);
5197       }
5198
5199       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCH_CORE")) && (cur->ns == ns))
5200       {
5201          threads->schCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5202          ODU_SET_THREAD_AFFINITY(&threads->schSTskId, SS_AFFINITY_MODE_EXCL, threads->schCoreId, 0);
5203       }
5204
5205       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP_CORE")) && (cur->ns == ns))
5206       {
5207          threads->sctpCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5208          ODU_SET_THREAD_AFFINITY(&threads->sctpSTskId, SS_AFFINITY_MODE_EXCL, threads->sctpCoreId, 0);
5209       }
5210
5211       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOWER_MAC_CORE")) && (cur->ns == ns))
5212       {
5213          threads->lwrMacCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5214          ODU_SET_THREAD_AFFINITY(&threads->lwrMacSTskId, SS_AFFINITY_MODE_EXCL, threads->lwrMacCoreId, 0);
5215       }
5216
5217       cur = cur -> next;
5218    }
5219    return ROK;
5220 }
5221 #endif
5222
5223 /*******************************************************************
5224  *
5225  * @brief Fill tmrTqCp
5226  *
5227  * @details
5228  *
5229  *    Function : parseTmrTqCp
5230  *
5231  *    Functionality: Fill tmrTqCp
5232  *
5233  * @params[in] XML document pointer
5234  *             XML namespace
5235  *             Current node in XML
5236  *             Pointer to structure to be filled
5237  * @return ROK     - success
5238  *         RFAILED - failure
5239  *
5240  * ****************************************************************/
5241 uint8_t parseTmrTqCp(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, CmTqCp *tmrTqCp)
5242 {
5243    memset(tmrTqCp, 0, sizeof(CmTqCp));
5244    cur = cur ->xmlChildrenNode;
5245    while(cur != NULL)
5246    {
5247       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_LEN")) && (cur->ns == ns))
5248       {
5249          tmrTqCp->tmrLen = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5250       }
5251       cur = cur -> next;
5252    }
5253    return ROK;
5254 }
5255
5256 /*******************************************************************
5257  *
5258  * @brief Fill DU timer Parameters
5259  *
5260  * @details
5261  *
5262  *    Function : parseDuTimerParams
5263  *
5264  *    Functionality: Fill DU timer Parmeters
5265  *
5266  * @params[in] XML document pointer
5267  *             XML namespace
5268  *             Current node in XML
5269  *             Pointer to structure to be filled
5270  * @return ROK     - success
5271  *         RFAILED - failure
5272  *
5273  * ****************************************************************/
5274 uint8_t parseDuTimerParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, DuTimers  *duTimers)
5275 {
5276    memset(duTimers, 0, sizeof(DuTimers));
5277    
5278    cur = cur->xmlChildrenNode;
5279    while (cur != NULL)
5280    {
5281       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_TQ_CP")) && (cur->ns == ns))
5282       {
5283          if(parseTmrTqCp(doc, ns, cur, &duTimers->tmrTqCp) != ROK)
5284          {
5285             return RFAILED;
5286          }
5287          else
5288          {
5289             /* Initialzie the timer queue */   
5290             memset(&(duTimers->tmrTq), 0, sizeof(CmTqType) * duTimers->tmrTqCp.tmrLen);
5291          }
5292       }
5293
5294       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TIMER_RESOLUTION")) && (cur->ns == ns))
5295       {
5296          duTimers->tmrRes = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5297       }
5298       cur = cur -> next;
5299    }
5300    return ROK;
5301 }
5302
5303 /*******************************************************************
5304  *
5305  * @brief Fill TNL assoc 
5306  *
5307  * @details
5308  *
5309  *    Function : parseTnlAssoc
5310  *
5311  *    Functionality: Fill TNL assoc
5312  *
5313  * @params[in] XML document pointer
5314  *             XML namespace
5315  *             Current node in XML
5316  *             Pointer to structure to be filled
5317  * @return ROK     - success
5318  *         RFAILED - failure
5319  *
5320  * ****************************************************************/
5321 uint8_t parseTnlAssoc(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, TNLAssociation *tnlAssoc)
5322 {
5323    char *duIpV4Addr;
5324    char *ricIpV4Addr;
5325    CmInetIpAddr duIp;
5326    CmInetIpAddr ricIp;
5327
5328    memset(tnlAssoc, 0, sizeof(TNLAssociation));
5329    cur = cur ->xmlChildrenNode;
5330    while(cur != NULL)
5331    {
5332       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_IP")) && (cur->ns == ns))
5333       {
5334          duIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5335          cmInetAddr(duIpV4Addr, &(duIp));
5336          tnlAssoc->localIpAddress.ipV4Pres = true;
5337          tnlAssoc->localIpAddress.ipV4Addr = duIp;
5338       }
5339
5340       if ((!xmlStrcmp(cur->name, (const xmlChar *)"LOCAL_PORT")) && (cur->ns == ns))
5341       {
5342          tnlAssoc->localPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5343       }
5344
5345       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESTINATION_IP")) && (cur->ns == ns))
5346       {
5347          ricIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5348          cmInetAddr(ricIpV4Addr, &(ricIp));
5349          tnlAssoc->destIpAddress.ipV4Pres = true;
5350          tnlAssoc->destIpAddress.ipV4Addr = ricIp;
5351       }
5352
5353       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DESTINATION_PORT")) && (cur->ns == ns))
5354       {
5355          tnlAssoc->destPort = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5356       }
5357
5358       if ((!xmlStrcmp(cur->name, (const xmlChar *)"ASSOC_USAGE")) && (cur->ns == ns))
5359       {
5360          tnlAssoc->usage = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5361       }
5362       cur = cur -> next;
5363    }
5364    return ROK;
5365 }
5366
5367 /*******************************************************************
5368  *
5369  * @brief Fill E2 config Parameters
5370  *
5371  * @details
5372  *
5373  *    Function : parseE2ConfigParams
5374  *
5375  *    Functionality: Fill E2 config Parmeters
5376  *
5377  * @params[in] XML document pointer
5378  *             XML namespace
5379  *             Current node in XML
5380  *             Pointer to structure to be filled
5381  * @return ROK     - success
5382  *         RFAILED - failure
5383  *
5384  * ****************************************************************/
5385 uint8_t parseE2ConfigParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, E2apDb *e2apDb)
5386 {
5387    uint8_t tnlIdx=0;
5388    xmlNodePtr child = NULLP;
5389
5390    memset(e2apDb, 0, sizeof(E2apDb));
5391    cur = cur->xmlChildrenNode;
5392    while (cur != NULL)
5393    {
5394       if ((!xmlStrcmp(cur->name, (const xmlChar *)"E2_NODE_ID")) && (cur->ns == ns))
5395       {
5396          e2apDb->e2NodeId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5397       }
5398
5399       if ((!xmlStrcmp(cur->name, (const xmlChar *)"NUM_OF_TNL_ASSOC")) && (cur->ns == ns))
5400       {
5401          e2apDb->numOfTNLAssoc = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5402       }
5403
5404       if ((!xmlStrcmp(cur->name, (const xmlChar *)"TNL_ASSOC_LIST")) && (cur->ns == ns))
5405       {
5406          child = cur->xmlChildrenNode;
5407          while(child != NULL)
5408          {
5409             if ((!xmlStrcmp(child->name, (const xmlChar *)"TNL_ASSOC")) && (child->ns == ns))
5410            {
5411               if(parseTnlAssoc(doc, ns, child,&e2apDb->tnlAssoc[tnlIdx]) != ROK)
5412               {
5413                  return RFAILED;
5414               }
5415               tnlIdx++;
5416
5417            }
5418            child = child -> next;
5419         }
5420      }
5421      cur = cur -> next;
5422    }
5423    return ROK;
5424 }
5425
5426 /*******************************************************************
5427  *
5428  * @brief Fill DU Config Parmeters 
5429  *
5430  * @details
5431  *
5432  *    Function : parseDuCfgParams
5433  *
5434  *    Functionality:
5435  *
5436  * @params[in] XML document pointer
5437  *             XML namespace
5438  *             Current node in XML
5439  * @return ROK     - success
5440  *         RFAILED - failure
5441  *
5442  * ****************************************************************/
5443 uint8_t parseDuCfgParams(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur)
5444 {
5445    char *tempDuName = "";
5446    char *duIpV4Addr;
5447    char *cuIpV4Addr;
5448    char *ricIpV4Addr;
5449    CmInetIpAddr duIp;
5450    CmInetIpAddr cuIp;
5451    CmInetIpAddr ricIp;
5452
5453    cur = cur->xmlChildrenNode;
5454    while(cur != NULL)
5455    {
5456       if ((!xmlStrcmp(cur->name, (const xmlChar *)"THREAD_AFFINITY")) && (cur->ns == ns))
5457       {
5458 #ifdef THREAD_AFFINITY      
5459          if(parseThreadAffinity(doc, ns, cur, &duCfgParam.threadInfo) != ROK)
5460          {
5461             return RFAILED;
5462          }
5463 #endif         
5464       }
5465
5466       if ((!xmlStrcmp(cur->name, (const xmlChar *)"GNB_ID")) && (cur->ns == ns))
5467       {
5468          duCb.gnbId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5469       }
5470
5471       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_ID")) && (cur->ns == ns))
5472       {
5473          duCfgParam.duId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5474       }
5475
5476       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_NAME")) && (cur->ns == ns))
5477       {
5478          tempDuName =(char*) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5479          DU_ALLOC(duCfgParam.duName, strlen(tempDuName));
5480          if(!duCfgParam.duName)
5481          {
5482             DU_LOG("\nERROR --> DU_APP: %s: Memory allocation failed at line %d", __func__, __LINE__);
5483             return RFAILED;
5484          }
5485          strcpy((char*)duCfgParam.duName, tempDuName);
5486       }
5487
5488       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_DRB")) && (cur->ns == ns))
5489       {
5490          duCfgParam.maxNumDrb = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5491       }
5492
5493       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE_SUPPORTED")) && (cur->ns == ns))
5494       {
5495          duCfgParam.maxSupportedUes = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5496       }
5497
5498       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAX_NUM_UE")) && (cur->ns == ns))
5499       {
5500          duCfgParam.maxUe = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
5501       }
5502
5503 #ifdef O1_ENABLE
5504       if( getStartupConfig(&g_cfg) != ROK )
5505       {
5506          RETVALUE(RFAILED);
5507       }
5508       cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &duIp);
5509       cmInetAddr((S8*)g_cfg.CU_IPV4_Addr, &cuIp);
5510       cmInetAddr((S8*)g_cfg.RIC_IPV4_Addr, &ricIp);
5511
5512 #else
5513       if ((!xmlStrcmp(cur->name, (const xmlChar *)"DU_IP_V4_ADDR")) && (cur->ns == ns))
5514       {
5515          duIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5516          cmInetAddr(duIpV4Addr, &(duIp));
5517       }
5518
5519       if ((!xmlStrcmp(cur->name, (const xmlChar *)"CU_IP_V4_ADDR")) && (cur->ns == ns))
5520       {
5521          cuIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5522          cmInetAddr(cuIpV4Addr, &(cuIp));
5523       }
5524
5525       if ((!xmlStrcmp(cur->name, (const xmlChar *)"RIC_IP_V4_ADDR")) && (cur->ns == ns))
5526       {
5527          ricIpV4Addr = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
5528          cmInetAddr(ricIpV4Addr, &(ricIp));
5529       }
5530 #endif
5531
5532       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SCTP")) && (cur->ns == ns))
5533       {
5534          if(parseSctpParams(doc, ns, cur, &duCfgParam.sctpParams) != ROK)
5535          {
5536             return RFAILED;
5537          }
5538          duCfgParam.sctpParams.duIpAddr.ipV4Pres = true;
5539          duCfgParam.sctpParams.duIpAddr.ipV4Addr = duIp;
5540          duCfgParam.sctpParams.cuIpAddr.ipV4Pres = true;
5541          duCfgParam.sctpParams.cuIpAddr.ipV4Addr = cuIp;
5542          duCfgParam.sctpParams.ricIpAddr.ipV4Pres = true;
5543          duCfgParam.sctpParams.ricIpAddr.ipV4Addr = ricIp;
5544       }
5545
5546       if ((!xmlStrcmp(cur->name, (const xmlChar *)"EGTP")) && (cur->ns == ns))
5547       {
5548          if(parseEgtpParams(doc, ns, cur, &duCfgParam.egtpParams) != ROK)
5549          {
5550             return RFAILED;
5551          }
5552          duCfgParam.egtpParams.localIp.ipV4Addr = duIp;
5553          duCfgParam.egtpParams.localIp.ipV4Pres = true;
5554          duCfgParam.egtpParams.destIp.ipV4Pres = true;
5555          duCfgParam.egtpParams.destIp.ipV4Addr = cuIp;
5556          duCfgParam.egtpParams.maxTunnelId = duCfgParam.maxNumDrb * duCfgParam.maxSupportedUes; 
5557       }
5558
5559 #ifdef XML_BASED_CONFIG
5560       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MIB_PARAMS")) && (cur->ns == ns))
5561       {
5562          if(parseMibParams(doc, ns, cur, &duCfgParam.mibParams) != ROK)
5563          {
5564             return RFAILED;
5565          }
5566       }
5567
5568       if ((!xmlStrcmp(cur->name, (const xmlChar *)"F1_DU_SRVD_CELL_INFO")) && (cur->ns == ns))
5569       {
5570          if(parseF1DuServedCellInfo(doc, ns, cur, &duCfgParam.srvdCellLst[0]) != ROK)
5571          {
5572             return RFAILED;
5573          }
5574       }
5575
5576       if ((!xmlStrcmp(cur->name, (const xmlChar *)"MAC_CELL_CFG")) && (cur->ns == ns))
5577       {
5578          if(parseMacCellCfg(doc, ns, cur, &duCfgParam.macCellCfg) != ROK)
5579          {
5580             return RFAILED;
5581          }
5582       }
5583
5584       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SIB1_PARAMS")) && (cur->ns == ns))
5585       {
5586          if(parseSib1Params(doc, ns, cur, &duCfgParam.sib1Params) != ROK)
5587          {
5588             return RFAILED;
5589          }
5590       }
5591
5592       if ((!xmlStrcmp(cur->name, (const xmlChar *)"SLICE_CFG")) && (cur->ns == ns))
5593       {
5594          if(parseMacSliceCfgReq(doc, ns, cur, &duCfgParam.tempSliceCfg) != ROK)
5595          {
5596             return RFAILED;
5597          }
5598       }
5599 #endif      
5600
5601       if((!xmlStrcmp(cur->name, (const xmlChar *)"DU_TIMER_INFO")) && (cur->ns == ns))
5602       {
5603          if(parseDuTimerParams(doc, ns, cur, &duCb.duTimersInfo) != ROK)
5604          {
5605             return RFAILED;
5606          }
5607       }
5608
5609       if((!xmlStrcmp(cur->name, (const xmlChar *)"E2AP_CFG")) && (cur->ns == ns))
5610       {
5611          if(parseE2ConfigParams(doc, ns, cur, &duCb.e2apDb) != ROK)
5612          {
5613             return RFAILED;
5614          }
5615       }
5616       cur = cur -> next;
5617    }
5618    return ROK;
5619 }
5620
5621 /*******************************************************************
5622  *
5623  * @brief Reads config and posts message to du_app on completion
5624  *
5625  * @details
5626  *
5627  *    Function : duReadCfg
5628  *
5629  *    Functionality:
5630  *      - Reads configuration from xml file and stores in DB
5631  *      - Post to du_app for further processing
5632  *
5633  * @params[in] void
5634  * @return ROK     - success
5635  *         RFAILED - failure
5636  *
5637  * ****************************************************************/
5638 uint8_t duReadCfg()
5639 {
5640    const char *filename = "../build/config/odu_config.xml";
5641    xmlDocPtr doc = NULLP;
5642    xmlNodePtr cur = NULLP;
5643    xmlNsPtr ns = NULLP;
5644
5645    doc = xmlParseFile(filename);
5646    if(doc == NULL)
5647    {
5648       DU_LOG("\nERROR  --> DU_APP: Failed to parse the XML file");
5649       return RFAILED;
5650    }
5651
5652    cur = xmlDocGetRootElement(doc);
5653    ns = xmlSearchNsByHref(doc, cur, (const xmlChar *)"urn:o-ran:odu:configuration");
5654    if(ns == NULL)
5655    {
5656       DU_LOG("\nERROR  --> DU_APP: XML Namespace not found.\n");
5657       xmlFreeDoc(doc);
5658       xmlCleanupParser();
5659       return RFAILED;
5660    }
5661
5662    parseDuCfgParams(doc, ns, cur);
5663
5664    xmlFreeDoc(doc);
5665    xmlCleanupParser();
5666
5667    Pst pst;
5668    Buffer *mBuf;
5669
5670    /* Read configs into duCfgParams */
5671    if(readCfg() != ROK)
5672    {
5673       DU_LOG("\nERROR  -->  DU_APP : Reading configuration failed");
5674       return RFAILED;
5675    }
5676    printDuConfig();
5677
5678    /* Fill pst structure */
5679    memset(&(pst), 0, sizeof(Pst));
5680    pst.srcEnt = (Ent)ENTDUAPP;
5681    pst.srcInst = (Inst)DU_INST;
5682    pst.srcProcId = DU_PROC;
5683    pst.dstEnt = pst.srcEnt;
5684    pst.dstInst = pst.srcInst;
5685    pst.dstProcId = pst.srcProcId;
5686    pst.event = EVTCFG;
5687    pst.selector = ODU_SELECTOR_TC;
5688    pst.pool= DU_POOL;
5689
5690    /* Initialize the timer blocks */
5691    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), 1);
5692    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer.timer), 1);
5693    cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.timer), 1);
5694
5695    /* Timer Registration request to system services */
5696    if (ODU_REG_TMR_MT(pst.srcEnt, pst.srcInst, duCb.duTimersInfo.tmrRes, duActvTmr) != ROK)
5697    {
5698       DU_LOG("\nERROR  -->  DU_APP : Failed to register timer");
5699       return RFAILED;
5700    }   
5701               
5702    if(ODU_GET_MSG_BUF(DFLT_REGION, DU_POOL, &mBuf) != ROK)
5703    {
5704       DU_LOG("\nERROR  -->  DU_APP : Memory allocation failed in duReadCfg");
5705       return RFAILED;
5706    }
5707
5708    if (ODU_POST_TASK(&pst, mBuf) != ROK)
5709    {
5710       DU_LOG("\nERROR  -->  DU_APP : ODU_POST_TASK failed in duReadCfg");
5711       return RFAILED;
5712    }
5713
5714    return ROK;
5715 }
5716
5717 /*******************************************************************
5718  *
5719  * @brief Prints all DU Configuration
5720  *
5721  * @details
5722  *
5723  *    Function : printDuConfig
5724  *
5725  *    Functionality:
5726  *      - Prints all DU configurations
5727  *
5728  * @params[in] void
5729  * @return void
5730  *
5731  * ****************************************************************/
5732 void printDuConfig()
5733 {
5734    uint8_t sliceIdx = 0, pfIdx = 0, rsrcIdx = 0, ssbMaskIdx = 0, fdmIdx = 0;
5735    uint8_t monitoringSymbIdx = 0, poIdx = 0, policyIdx = 0, memIdx = 0;
5736    __attribute__((unused)) SctpParams *sctp;
5737    __attribute__((unused)) F1EgtpParams *egtp;
5738    __attribute__((unused)) MibParams *mib;
5739    __attribute__((unused)) F1RrcVersion *f1RrcVersion;
5740    F1DuCellInfo *f1DuCellInfo;
5741    F1CellInfo *f1CellInfo;
5742    __attribute__((unused)) F1DuSysInfo *duSysInfo;
5743    __attribute__((unused)) F1BrdcstPlmnInfo *brdcstPlmnInfo;
5744    NrModeInfo *nrModeInfo; 
5745    __attribute__((unused)) F1NrFddInfo *f1NrFddInfo;
5746    F1SrvdPlmn *srvdPlmn;
5747    SupportedSliceList *sliceSuppLst;
5748    MacCellCfg *macCellCfg;
5749    __attribute__((unused)) CarrierCfg *carrierCfg;
5750    CellCfg *cellCfg;
5751    PlmnInfoList *plmnInfoList;
5752    Sib1CellCfg *sib1Cfg;
5753    SchPageCfg *pageCfg;
5754    __attribute__((unused)) PdcchConfigSib1 *pdcchConfigSib1;
5755    BwpDlConfig *bwpDlCfg;
5756    __attribute__((unused)) BwpParams *bwp;
5757    PdcchConfigCommon *pdcchCfgCmn;
5758    SearchSpaceCfg *searchSpaceCfg;
5759    __attribute__((unused)) CandidatesInfo *candidateInfo;
5760    PdschConfigCommon *pdschCfgCmn;
5761    __attribute__((unused)) PdschCfgCommTimeDomRsrcAlloc *pdschCmnTimeDomRsrcAlloc;
5762    BwpUlConfig *bwpUlCfg;
5763    __attribute__((unused)) PucchConfigCommon *pucchCfgCmn;
5764    PuschConfigCommon *puschCfgCmn;
5765    __attribute__((unused)) PuschTimeDomRsrcAlloc *puschTimeDomRsrcAlloc;
5766    __attribute__((unused)) SsbCfg *ssbCfg;
5767    __attribute__((unused)) CsiRsCfg *csiRsCfg;
5768    PrachCfg *prachCfg;
5769    __attribute__((unused)) PrachFdmInfo *prachFdmInfo;
5770    __attribute__((unused)) PrecodingConf *precodCfg;
5771    __attribute__((unused)) BeamformingConf *beamFormingCfg;
5772    Sib1Params *sib1Params;
5773    __attribute__((unused)) SiSchedInfo *siSchedInfo;
5774    SrvCellCfgCommSib *srvCellCfgCmnSib;
5775    DlCfgCommon *dlCfgCmn;
5776    PdcchCfgCommon *pdcchCfgCommon;
5777    PdschCfgCommon *pdschCfgCommon;
5778    __attribute__((unused)) PdschTimeDomainRsrcAlloc *pdschTimeDomRsrcAlloc;
5779    __attribute__((unused)) BcchCfg *bcchCfg;
5780    __attribute__((unused)) PcchCfg *pcchCfg;
5781    UlCfgCommon *ulCfgCmn;
5782    RachCfgCommon *rachCfgCmn;
5783    PuschCfgCommon *puschCfgCommon;
5784    __attribute__((unused)) PuschCfgCmnTimeDomAlloc *puschCmnTimeDomRsrsAlloc;
5785    PucchCfgCommon *pucchCfgCommon;
5786    __attribute__((unused)) TddUlDlCfgCommon *tddUlDlCfgCmn;
5787    MacSliceCfgReq *macSliceCfg;
5788    MacSliceRrmPolicy *rrmPolicy;
5789    __attribute__((unused)) RrmPolicyRatio *rrmPolicyRatio;
5790    __attribute__((unused)) RrmPolicyMemberList *rrmPolicyMemberList;
5791
5792 #ifdef NR_TDD
5793    F1NrTddInfo *f1NrTddInfo;
5794    TDDCfg *tddCfg;
5795 #endif
5796
5797    DU_LOG("\n ** DU CONFIGURATION ** \n");
5798    DU_LOG("DU ID %d\n", duCfgParam.duId);
5799    DU_LOG("DU Name %s\n", duCfgParam.duName);
5800
5801    DU_LOG("\n ** Thread Affinity ** \n");
5802    DU_LOG("DU APP CORE ID %d\n", duCfgParam.threadInfo.duAppCoreId);
5803    DU_LOG("EGTP CORE ID %d\n", duCfgParam.threadInfo.egtpCoreId);
5804    DU_LOG("SCTP CORE ID %d\n", duCfgParam.threadInfo.sctpCoreId);
5805    DU_LOG("RLC-UL CORE ID %d\n", duCfgParam.threadInfo.rlcUlCoreId);
5806    DU_LOG("RLC-DL and MAC CORE ID %d\n", duCfgParam.threadInfo.rlcMacCoreId);
5807    DU_LOG("SCH CORE ID %d\n", duCfgParam.threadInfo.schCoreId);
5808    DU_LOG("Lower MAC CORE ID %d\n", duCfgParam.threadInfo.lwrMacCoreId);
5809
5810    DU_LOG("MAX NUM DRB %d\n", duCfgParam.maxNumDrb);
5811    DU_LOG("MAX SUPPORTED UE %d\n", duCfgParam.maxSupportedUes);
5812    DU_LOG("MAX UE %d\n",duCfgParam.maxUe);
5813
5814    sctp = &duCfgParam.sctpParams;
5815    DU_LOG("\n ** SCTP PARAMETER ** \n");
5816    DU_LOG("DU IPv4 Address present %u\n", sctp->duIpAddr.ipV4Pres);
5817    DU_LOG("DU IP Address %u\n", sctp->duIpAddr.ipV4Addr);
5818    DU_LOG("CU IPv4 Address present %u\n", sctp->cuIpAddr.ipV4Pres);
5819    DU_LOG("CU IP Address %u\n", sctp->cuIpAddr.ipV4Addr);
5820    DU_LOG("RIC IPv4 Address present %u\n", sctp->ricIpAddr.ipV4Pres);
5821    DU_LOG("RIC IP Address %u\n", sctp->ricIpAddr.ipV4Addr);
5822    DU_LOG("SCTP Port at DU for F1 Interface %d\n", sctp->duPort[F1_INTERFACE]);
5823    DU_LOG("SCTP Port at CU for F1 Interface %d\n", sctp->cuPort);
5824    DU_LOG("SCTP Port at DU for E2 Interface %d\n", sctp->duPort[E2_INTERFACE]);
5825    DU_LOG("SCTP Port at RIC for E2 Interface %d\n", sctp->ricPort);
5826
5827    egtp = &duCfgParam.egtpParams;
5828    DU_LOG("\n ** EGTP PARAMETER ** \n");
5829    DU_LOG("DU IP Address %d\n", egtp->localIp.ipV4Addr);
5830    DU_LOG("CU IP Address %d\n", egtp->destIp.ipV4Addr);
5831    DU_LOG("EGTP Port at DU %d\n", egtp->localPort);
5832    DU_LOG("EGTP Port at CU %d\n", egtp->destPort);
5833    DU_LOG("Minimum Tunnel ID %d\n", egtp->minTunnelId);
5834    DU_LOG("Maximum Tunnel ID %d\n",egtp->maxTunnelId);
5835
5836    mib = &duCfgParam.mibParams;
5837    DU_LOG("\n ** MIB PARAMETER ** \n");
5838    DU_LOG("System Frame Number %d\n", mib->sysFrmNum);
5839    DU_LOG("Subcarrier Spacing Common %ld\n", mib->subCarrierSpacingCommon);
5840    DU_LOG("SSB Subcarrier Offset %ld\n", mib->ssb_SubcarrierOffset);
5841    DU_LOG("DMRS Type-A Position %ld\n", mib->dmrs_TypeA_Position);
5842    DU_LOG("Control Resource Set Zero %ld\n", mib->controlResourceSetZero);
5843    DU_LOG("Search Space Zero %ld\n", mib->searchSpaceZero);
5844    DU_LOG("Cell Barred %ld\n", mib->cellBarred);
5845    DU_LOG("Intra Frequency Reselection %ld\n", mib->intraFreqReselection);
5846    
5847    duSysInfo = &duCfgParam.srvdCellLst[0].duSysInfo;
5848    DU_LOG("\n ** DU System Information ** \n");
5849    DU_LOG("MIB length %d\n", duSysInfo->mibLen);
5850    DU_LOG("MIB message  %s\n", duSysInfo->mibMsg);
5851    DU_LOG("SIB1 length  %d\n", duSysInfo->sib1Len);
5852    DU_LOG("SIB1 message  %s\n", duSysInfo->sib1Msg);
5853    
5854    f1DuCellInfo = &duCfgParam.srvdCellLst[0].duCellInfo;
5855    DU_LOG("\n ** DU Cell Information ** \n");
5856
5857    f1CellInfo = &f1DuCellInfo->cellInfo;
5858    DU_LOG("NR PCI %d\n", f1CellInfo->nrPci);
5859    DU_LOG("DU TAC %d\n", f1DuCellInfo->tac);   
5860    DU_LOG("EPS TAC %d\n", f1DuCellInfo->epsTac);
5861    DU_LOG("Measurement Time Configuration Duration %d\n", f1DuCellInfo->measTimeCfgDuration);
5862    DU_LOG("Cell Direction %d\n", f1DuCellInfo->cellDir);
5863    DU_LOG("Cell Type %d\n", f1DuCellInfo->cellType);
5864
5865    DU_LOG("\n ** Cell  Info : NR CGI ** \n");
5866    DU_LOG("Cell Id %d\n",f1CellInfo->nrCgi.cellId);
5867    DU_LOG("PLMN : mcc[0] %d\n", f1CellInfo->nrCgi.plmn.mcc[0]);
5868    DU_LOG("PLMN : mcc[1] %d\n", f1CellInfo->nrCgi.plmn.mcc[1]);
5869    DU_LOG("PLMN : mcc[2] %d\n", f1CellInfo->nrCgi.plmn.mcc[2]);
5870    DU_LOG("PLMN : mnc[0] %d\n", f1CellInfo->nrCgi.plmn.mnc[0]);
5871    DU_LOG("PLMN : mnc[1] %d\n", f1CellInfo->nrCgi.plmn.mnc[1]);
5872    DU_LOG("PLMN : mnc[2] %d\n", f1CellInfo->nrCgi.plmn.mnc[2]);
5873
5874    srvdPlmn = &f1CellInfo->srvdPlmn[0];
5875    DU_LOG("\n ** Cell  Info : Served PLMN ** \n");
5876    DU_LOG("PLMN : mcc[0] %d\n", srvdPlmn->plmn.mcc[0]);
5877    DU_LOG("PLMN : mcc[1] %d\n", srvdPlmn->plmn.mcc[1]);
5878    DU_LOG("PLMN : mcc[2] %d\n", srvdPlmn->plmn.mcc[2]);
5879    DU_LOG("PLMN : mnc[0] %d\n", srvdPlmn->plmn.mnc[0]);
5880    DU_LOG("PLMN : mnc[1] %d\n", srvdPlmn->plmn.mnc[1]);
5881    DU_LOG("PLMN : mnc[2] %d\n", srvdPlmn->plmn.mnc[2]);
5882    DU_LOG("EXT_PLMN : mcc[0] %d\n", srvdPlmn->extPlmn.mcc[0]);
5883    DU_LOG("EXT_PLMN : mcc[1] %d\n", srvdPlmn->extPlmn.mcc[1]);
5884    DU_LOG("EXT_PLMN : mcc[2] %d\n", srvdPlmn->extPlmn.mcc[2]);
5885    DU_LOG("EXT_PLMN : mnc[0] %d\n", srvdPlmn->extPlmn.mnc[0]);
5886    DU_LOG("EXT_PLMN : mnc[1] %d\n", srvdPlmn->extPlmn.mnc[1]);
5887    DU_LOG("EXT_PLMN : mnc[2] %d\n", srvdPlmn->extPlmn.mnc[2]);
5888
5889    sliceSuppLst = &srvdPlmn->taiSliceSuppLst;
5890    DU_LOG("\n ** Cell  Info : Served PLMN : Supported Slice List ** \n");
5891    DU_LOG("Number of Slices supported %d\n", sliceSuppLst->numSupportedSlices);
5892    for (sliceIdx = 0; sliceIdx < sliceSuppLst->numSupportedSlices; sliceIdx++)
5893    {
5894       DU_LOG("Slice\n");
5895       DU_LOG("\tSST %d\n", (*sliceSuppLst->snssai[sliceIdx]).sst);
5896       DU_LOG("\tSD %d %d %d\n", (*sliceSuppLst->snssai[sliceIdx]).sd[0], (*sliceSuppLst->snssai[sliceIdx]).sd[1], \
5897          (*sliceSuppLst->snssai[sliceIdx]).sd[2]);
5898    }
5899    
5900    brdcstPlmnInfo = &f1DuCellInfo->brdcstPlmnInfo[0];
5901    DU_LOG("\n ** DU Cell Information : Broadcast PLMN Info ** \n");
5902    DU_LOG("TAC %d\n", brdcstPlmnInfo->tac);
5903    DU_LOG("NR Cell Id %d\n", brdcstPlmnInfo->nrCellId);
5904    DU_LOG("RANAC %d\n", brdcstPlmnInfo->ranac);
5905
5906    DU_LOG("PLMN : mcc[0] %d\n", brdcstPlmnInfo->plmn[0].mcc[0]);
5907    DU_LOG("PLMN : mcc[1] %d\n", brdcstPlmnInfo->plmn[0].mcc[1]);
5908    DU_LOG("PLMN : mcc[2] %d\n", brdcstPlmnInfo->plmn[0].mcc[2]);
5909    DU_LOG("PLMN : mnc[0] %d\n", brdcstPlmnInfo->plmn[0].mnc[0]);
5910    DU_LOG("PLMN : mnc[1] %d\n", brdcstPlmnInfo->plmn[0].mnc[1]);
5911    DU_LOG("PLMN : mnc[2] %d\n", brdcstPlmnInfo->plmn[0].mnc[2]);
5912     
5913    DU_LOG("EXT_PLMN : mcc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[0]);
5914    DU_LOG("EXT_PLMN : mcc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[1]);
5915    DU_LOG("EXT_PLMN : mcc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mcc[2]);
5916    DU_LOG("EXT_PLMN : mnc[0] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[0]);
5917    DU_LOG("EXT_PLMN : mnc[1] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[1]);
5918    DU_LOG("EXT_PLMN : mnc[2] %d\n", brdcstPlmnInfo->extPlmn[0].mnc[2]);
5919
5920    nrModeInfo = &f1DuCellInfo->f1Mode;
5921    f1NrFddInfo = &nrModeInfo->mode.fdd;
5922    DU_LOG("\n ** DU Cell Information : NR Mode Info ** \n");
5923 #ifndef NR_TDD   
5924    DU_LOG("\n ** NR Mode Info : FDD ** \n");
5925    DU_LOG("\n ** NR Mode Info : FDD : UL NR Frequency ** \n");
5926    DU_LOG("NR ARFCN %d\n", f1NrFddInfo->ulNrFreqInfo.nrArfcn);
5927    DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->ulNrFreqInfo.sulInfo.sulArfcn);
5928    DU_LOG("SUL : Transmission BW Subcarrier Spacing %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrScs);
5929    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->ulNrFreqInfo.sulInfo.sulTxBw.nrb);
5930    DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].nrFreqBand);
5931    DU_LOG("SUL Band %d\n", f1NrFddInfo->ulNrFreqInfo.freqBand[0].sulBand[0]);
5932
5933    DU_LOG("\n ** NR Mode Info : FDD : DL NR Frequency ** \n");
5934    DU_LOG("NR ARFCN %d\n", f1NrFddInfo->dlNrFreqInfo.nrArfcn);
5935    DU_LOG("SUL : ARFCN %d\n",f1NrFddInfo->dlNrFreqInfo.sulInfo.sulArfcn);
5936    DU_LOG("SUL : Transmission BW Subcarrier Sapcing %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrScs);
5937    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrFddInfo->dlNrFreqInfo.sulInfo.sulTxBw.nrb);
5938    DU_LOG("NR Frequency Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].nrFreqBand);
5939    DU_LOG("SUL Band %d\n", f1NrFddInfo->dlNrFreqInfo.freqBand[0].sulBand[0]);
5940
5941    DU_LOG("\n ** NR Mode Info : FDD : UL Transmission Bandwidth ** \n");
5942    DU_LOG("Subscarrier spacing %d\n", f1NrFddInfo->ulTxBw.nrScs);
5943    DU_LOG("Number of RBs %d\n", f1NrFddInfo->ulTxBw.nrb);
5944   
5945    DU_LOG("\n ** NR Mode Info : FDD : DL Transmission Bandwidth ** \n");
5946    DU_LOG("Subcarrier Spacing %d\n", f1NrFddInfo->dlTxBw.nrScs);
5947    DU_LOG("Number of RBs %d\n", f1NrFddInfo->dlTxBw.nrb);
5948
5949 #else
5950
5951    f1NrTddInfo = &nrModeInfo ->mode.tdd; 
5952
5953    DU_LOG("\n ** NR Mode Info : TDD : NR Frequency ** \n");
5954    DU_LOG("NR ARFCN %d\n", f1NrTddInfo->nrFreqInfo.nrArfcn);
5955    DU_LOG("SUL : ARFCN %d\n",f1NrTddInfo->nrFreqInfo.sulInfo.sulArfcn);
5956    DU_LOG("SUL : Transmission BW Subscarrier Spacing %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrScs);
5957    DU_LOG("SUL : Number of RBs in Transmission BW %d\n", f1NrTddInfo->nrFreqInfo.sulInfo.sulTxBw.nrb);
5958    DU_LOG("NR Frequency Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].nrFreqBand);
5959    DU_LOG("SUL Band %d\n", f1NrTddInfo->nrFreqInfo.freqBand[0].sulBand[0]);
5960
5961    DU_LOG("\n ** NR Mode Info : TDD : NR Transmission Bandwidth ** \n");
5962    DU_LOG("Subcarrier Spacing %d\n", f1NrTddInfo->nrTxBw.nrScs);
5963    DU_LOG("Number of RBs %d\n", f1NrTddInfo->nrTxBw.nrb);
5964 #endif
5965
5966    macCellCfg = &duCfgParam.macCellCfg;
5967    DU_LOG("\n ** MAC CELL CONFIGURATION ** \n");
5968    DU_LOG("Cell Id %d\n", macCellCfg->cellId);
5969
5970    DU_LOG("\n ** MAC Cell Configuration : Carrier Configuration ** \n");
5971    carrierCfg = &macCellCfg ->carrCfg;
5972    DU_LOG("DL Bandwidth %d\n", carrierCfg->dlBw);
5973    DU_LOG("DL ARFCN %d\n", carrierCfg->arfcnDL);
5974    DU_LOG("UL Bandwidth %d\n", carrierCfg->ulBw);
5975    DU_LOG("UL ARFCN %d\n", carrierCfg->arfcnUL);
5976    DU_LOG("Number of Transmission Antenna %d\n", carrierCfg->numTxAnt);
5977    DU_LOG("Number of Received Antenna %d\n", carrierCfg->numRxAnt);
5978
5979    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration ** \n");
5980    cellCfg = &macCellCfg ->cellCfg;
5981    DU_LOG("Operational State %d\n", cellCfg->opState);
5982    DU_LOG("Administration State %d\n", cellCfg->adminState);
5983    DU_LOG("Cell Current State %d\n", cellCfg->cellState);
5984    DU_LOG("NR PCI %d\n", cellCfg->phyCellId);
5985    DU_LOG("TAC: %d\n", cellCfg->tac);
5986    DU_LOG("SSB Freqeuncy %d\n", cellCfg->ssbFreq);
5987    DU_LOG("Subcarrier Spacing: %d\n", cellCfg->subCarrSpacing);
5988    DU_LOG("Duplex Mode %d\n", cellCfg->dupType);
5989
5990    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : PLMN Info List ** \n");
5991    plmnInfoList = &cellCfg ->plmnInfoList[0];
5992    DU_LOG("PLMN : mcc[0] %d\n", plmnInfoList->plmn.mcc[0]);
5993    DU_LOG("PLMN : mcc[1] %d\n", plmnInfoList->plmn.mcc[1]);
5994    DU_LOG("PLMN : mcc[2] %d\n", plmnInfoList->plmn.mcc[2]);
5995    DU_LOG("PLMN : mnc[0] %d\n", plmnInfoList->plmn.mnc[0]);
5996    DU_LOG("PLMN : mnc[1] %d\n", plmnInfoList->plmn.mnc[1]);
5997    DU_LOG("PLMN : mnc[2] %d\n", plmnInfoList->plmn.mnc[2]);
5998
5999    DU_LOG("Number of Slice supported %d\n", plmnInfoList->suppSliceList.numSupportedSlices);
6000    for(sliceIdx = 0; sliceIdx < plmnInfoList->suppSliceList.numSupportedSlices; sliceIdx++)
6001    {
6002       DU_LOG("Slice\n");
6003       DU_LOG("\nSST %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sst);
6004       DU_LOG("\nSD %d %d %d\n", (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[0], \
6005          (*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[1],(*plmnInfoList->suppSliceList.snssai[sliceIdx]).sd[2]);
6006    }
6007    
6008    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 ** \n");
6009    sib1Cfg = &cellCfg->sib1Cfg;
6010    DU_LOG("SIB1 PDU Length %d", sib1Cfg->sib1PduLen);
6011    DU_LOG("SIB1 PDU %s", sib1Cfg->sib1Pdu);
6012
6013    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : Paging Configuration ** \n");
6014    pageCfg = &sib1Cfg->pagingCfg;
6015
6016    DU_LOG("Number of Paging Occassion %d\n", pageCfg->numPO);
6017    if (pageCfg->poPresent == true)
6018       DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : TRUE\n");
6019    else 
6020       DU_LOG("FirstPDCCH-Monitoring Paging Occassion present : FALSE\n");
6021
6022    for(pfIdx = 0; pfIdx < MAX_PO_PER_PF; pfIdx++)
6023    {
6024       DU_LOG("Paging Occassion at Paging Frame [%d] : %d\n", pfIdx, pageCfg->pagingOcc[pfIdx]);
6025    }
6026
6027    pdcchConfigSib1 = &sib1Cfg->pdcchCfgSib1;
6028    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : SIB1 : PDCCH ** \n");
6029    DU_LOG("Coreset Zero Index %d\n", pdcchConfigSib1->coresetZeroIndex);
6030    DU_LOG("Search Space Zero Index %d\n", pdcchConfigSib1->searchSpaceZeroIndex);
6031
6032    bwpDlCfg = &cellCfg->initialDlBwp;
6033    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP Configuration ** \n");
6034
6035    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : BWP ** \n");
6036    bwp = &bwpDlCfg->bwp;
6037    DU_LOG("First PRB %d\n", bwp->firstPrb);
6038    DU_LOG("Number of PRBs %d\n", bwp->numPrb);
6039    DU_LOG("Subcarrier Spacing %d\n", bwp->scs);
6040    DU_LOG("Cyclic Perfix %d\n", bwp->cyclicPrefix);
6041
6042    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common ** \n");
6043    pdcchCfgCmn = &bwpDlCfg->pdcchCommon;
6044    DU_LOG("RA Search Space ID %d\n", pdcchCfgCmn->raSearchSpaceId);
6045
6046    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDCCH Config Common : Search Space ** \n");
6047    searchSpaceCfg = &pdcchCfgCmn->commonSearchSpace;
6048    DU_LOG("Search Space ID %d\n", searchSpaceCfg->searchSpaceId);
6049    DU_LOG("Coreset ID %d\n", searchSpaceCfg->coresetId);
6050    DU_LOG("Monitoring Slot %d\n", searchSpaceCfg->monitoringSlot);
6051    DU_LOG("Duration %d\n", searchSpaceCfg->duration);
6052    DU_LOG("Monitoring Symbol %x\n", searchSpaceCfg->monitoringSymbol);
6053
6054    candidateInfo = &searchSpaceCfg->candidate;
6055    DU_LOG("Number of Candidates in Aggregation Level_1 %d\n", candidateInfo->aggLevel1);
6056    DU_LOG("Number of Candidates in Aggregation Level_2 %d\n", candidateInfo->aggLevel2);
6057    DU_LOG("Number of Candidates in Aggregation Level_4 %d\n", candidateInfo->aggLevel4);
6058    DU_LOG("Number of Candidates in Aggregation Level_8 %d\n", candidateInfo->aggLevel8);
6059    DU_LOG("Number of Candidates in Aggregation Level_16 %d\n", candidateInfo->aggLevel16);
6060
6061    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : DL BWP : PDSCH Config Common ** \n");
6062    pdschCfgCmn = &bwpDlCfg->pdschCommon;
6063    DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCmn->numTimeDomAlloc);
6064   
6065    for (rsrcIdx = 0; rsrcIdx <  pdschCfgCmn->numTimeDomAlloc; rsrcIdx++)
6066    {
6067       DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx);
6068       pdschCmnTimeDomRsrcAlloc = &pdschCfgCmn->timeDomRsrcAllocList[rsrcIdx];
6069       DU_LOG("\tK0 %d\n", pdschCmnTimeDomRsrcAlloc->k0);
6070       DU_LOG("\tPDSCH Mapping Type %d\n", pdschCmnTimeDomRsrcAlloc->mappingType);
6071       DU_LOG("\tPDSCH Start Symbol %d\n", pdschCmnTimeDomRsrcAlloc->startSymbol);
6072       DU_LOG("\tPDSCH Symbol Length %d\n", pdschCmnTimeDomRsrcAlloc->lengthSymbol);
6073    }
6074
6075    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP Configuration ** \n");
6076    bwpUlCfg = &cellCfg->initialUlBwp;
6077
6078    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : BWP ** \n");
6079    DU_LOG("First PRB %d\n", bwpUlCfg->bwp.firstPrb);
6080    DU_LOG("Number of PRBs %d\n", bwpUlCfg->bwp.numPrb);
6081    DU_LOG("Subcarrier Spacing %d\n", bwpUlCfg->bwp.scs);
6082    DU_LOG("Cyclic Prefix %d\n", bwpUlCfg->bwp.cyclicPrefix);
6083    
6084    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUCCH Config Common ** \n");
6085    pucchCfgCmn = &bwpUlCfg->pucchCommon;
6086    DU_LOG("PUCCH Resource Common %d\n", pucchCfgCmn->pucchResourceCommon);
6087    DU_LOG("Group Hopping %d\n", pucchCfgCmn->pucchGroupHopping);
6088
6089    DU_LOG("\n ** MAC Cell Configuration : Cell Configuration : UL BWP : PUSCH Config Common ** \n");
6090    puschCfgCmn = &bwpUlCfg ->puschCommon;
6091    DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCmn->numTimeDomRsrcAlloc);
6092    for (rsrcIdx = 0; rsrcIdx <  puschCfgCmn->numTimeDomRsrcAlloc; rsrcIdx++)
6093    {
6094       DU_LOG("Time Domain Resource Allocation Idx %d\n", rsrcIdx);
6095       puschTimeDomRsrcAlloc = &puschCfgCmn->timeDomRsrcAllocList[rsrcIdx];
6096       DU_LOG("\tK2 %d\n", puschTimeDomRsrcAlloc->k2);
6097       DU_LOG("\tPUSCH Mapping Type %d\n", puschTimeDomRsrcAlloc->mappingType);
6098       DU_LOG("\tPUSCH Start Symbol %d\n", puschTimeDomRsrcAlloc->startSymbol);
6099       DU_LOG("\tPUSCH Symbol Length %d\n", puschTimeDomRsrcAlloc->symbolLength);
6100       DU_LOG("\tPUSCH Start Symbol And Length %d\n", puschTimeDomRsrcAlloc->startSymbolAndLength);
6101    }
6102
6103    DU_LOG("\n ** MAC Cell Configuration : SSB Configuration** \n");
6104    ssbCfg = &macCellCfg ->ssbCfg;
6105    DU_LOG("SSB PDCH Power %d\n", ssbCfg->ssbPbchPwr);
6106    DU_LOG("Subcarrier Spacing Common %d\n", ssbCfg->scsCmn);
6107    DU_LOG("SSB Offset from Point A %d\n", ssbCfg->ssbOffsetPointA);
6108    DU_LOG("SSB Periodicity in msec %d\n", ssbCfg->ssbPeriod);
6109    DU_LOG("SSB Subcarrier Offset %d\n", ssbCfg->ssbScOffset);
6110    for (ssbMaskIdx = 0; ssbMaskIdx < SSB_MASK_SIZE; ssbMaskIdx++)
6111    {
6112       DU_LOG("SSB Mask[%d] :%d\n", ssbMaskIdx, ssbCfg->ssbMask[ssbMaskIdx]);
6113    }
6114    DU_LOG("Beam ID %d\n", ssbCfg->beamId[0]);
6115    DU_LOG("BETA PSS %d\n", ssbCfg->betaPss);
6116    DU_LOG("BCH Payloag Flag %d\n", ssbCfg->bchPayloadFlag);
6117    DU_LOG("MIB PDU %d %d %d", ssbCfg->mibPdu[0], ssbCfg->mibPdu[1], ssbCfg->mibPdu[2]);
6118    DU_LOG("DMRS Type-A Position %d\n", ssbCfg->dmrsTypeAPos);
6119
6120    DU_LOG("\n ** MAC Cell Configuration : CSI RS Configuration ** \n");
6121    csiRsCfg = &macCellCfg->csiRsCfg;
6122    DU_LOG("Frequency Domain Allocation %s\n", csiRsCfg->csiFreqDomainAlloc);
6123    DU_LOG("Number of Ports %d\n", csiRsCfg->csiNrofPorts);
6124    DU_LOG("First OFDM Symbol in Time Domain %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain);
6125    DU_LOG("First OFDM Symbol in Timer Domain 2 %d\n", csiRsCfg->csirsfirstOFDMSymbolInTimeDomain2);
6126    DU_LOG("CDM Type %d\n", csiRsCfg->csirscdmType);
6127    DU_LOG("Density %d\n", csiRsCfg->csirsdensity);
6128    DU_LOG("Density dot 5:%d\n", csiRsCfg->csirsdensitydot5);
6129    DU_LOG("Power Control Offset %d\n", csiRsCfg->powerControlOffset);
6130    DU_LOG("Power Control Offset Search Space %d\n", csiRsCfg->powerControlOffsetSS);
6131    DU_LOG("Periodicity And Offset %d\n", csiRsCfg->periodicityAndOffset);
6132
6133    DU_LOG("\n ** MAC Cell Configuration : PRACH Configuration ** \n");
6134    prachCfg = &macCellCfg->prachCfg;
6135    DU_LOG("PRACH Sequence Length %d\n", prachCfg->prachSeqLen);
6136    DU_LOG("Subcarrier Spacing %d\n", prachCfg->prachSubcSpacing);
6137    DU_LOG("Number of PRACH FDM %d\n", prachCfg->msg1Fdm);
6138    DU_LOG("PRACH Configuration Index %d\n", prachCfg->prachCfgIdx);
6139    DU_LOG("PRACH Restricted Set Configuration %d\n", prachCfg->prachRstSetCfg);
6140    DU_LOG("Number of SSB per RACH occassion %d\n", prachCfg->ssbPerRach);
6141    DU_LOG("Number of RA preambles %d\n", prachCfg->totalNumRaPreamble);
6142    DU_LOG("Number of Contention Based Preamble per SSB %d\n", prachCfg->numCbPreamblePerSsb);
6143    DU_LOG("PRACH Frequeny Start Offset %d\n", prachCfg->msg1FreqStart);
6144    DU_LOG("RA Contention Resolution Timer %d\n", prachCfg->raContResTmr);
6145    DU_LOG("RSRP Threshold %d\n", prachCfg->rsrpThreshSsb);
6146    DU_LOG("RA Response Window %d\n", prachCfg->raRspWindow); 
6147    for(fdmIdx = 0; fdmIdx < prachCfg->msg1Fdm; fdmIdx++)
6148    {
6149       prachFdmInfo = &prachCfg->fdm[fdmIdx];
6150       DU_LOG("FDM[%d]\n", fdmIdx);
6151       DU_LOG("\tRoot Sequence Index %d\n", prachFdmInfo->rootSeqIdx);
6152       DU_LOG("\tNumber of Root Sequence %d\n", prachFdmInfo->numRootSeq);
6153       DU_LOG("\tK1 %d\n", prachFdmInfo->k1);
6154       DU_LOG("\tZero Correlation Zone Configuration %d\n", prachFdmInfo->zeroCorrZoneCfg);   
6155    }
6156
6157 #ifdef NR_TDD
6158    DU_LOG("\n ** MAC Cell Configuration : TDD Configuration ** \n");
6159    tddCfg = &macCellCfg->tddCfg;
6160    DU_LOG("TDD Slot Periodicity %d\n", tddCfg->tddPeriod);
6161    DU_LOG("Number of DL Slots %d\n", tddCfg->nrOfDlSlots);
6162    DU_LOG("Number of DL Symbols %d\n", tddCfg->nrOfDlSymbols);
6163    DU_LOG("Number of UL Slots %d\n", tddCfg->nrOfUlSlots);
6164    DU_LOG("Number of UL Symbols %d\n", tddCfg->nrOfUlSymbols);
6165 #endif
6166
6167    DU_LOG("\n ** MAC Cell Configuration : Precoding Configuration ** \n");
6168    precodCfg = &macCellCfg->precodingConf;
6169    DU_LOG("Number of Layers %d\n", precodCfg->numLayers);
6170    DU_LOG("Number of Antenna Ports %d\n", precodCfg->numAntPorts);
6171
6172    DU_LOG("\n ** MAC Cell Config : BEAM FORMING  CFG ** \n");
6173    beamFormingCfg = &macCellCfg ->beamCfg;
6174    DU_LOG("Number of Beams %d\n", beamFormingCfg->numOfBeams);
6175    DU_LOG("Number of Tx RUs %d\n", beamFormingCfg->numTxRUs);
6176    DU_LOG("Beam Index %d\n", beamFormingCfg->beamIdx);
6177    DU_LOG("Beam Type %d\n", beamFormingCfg->beamType);
6178    DU_LOG("Beam Azimuth %d\n", beamFormingCfg->beamAzimuth);
6179    DU_LOG("Beam Tilt %d\n", beamFormingCfg->beamTilt);
6180    DU_LOG("Beam Horizontal Width %d\n", beamFormingCfg->beamHorizWidth);
6181    DU_LOG("Beam Vertical Width %d\n", beamFormingCfg->beamVertWidth);
6182    DU_LOG("Coverage Shape %d\n", beamFormingCfg->coverageShape);
6183    DU_LOG("Digitak Tilt %d\n",beamFormingCfg ->digitalTilt);
6184    DU_LOG("Digital Azimuth %d\n", beamFormingCfg->digitalAzimuth);
6185
6186    DU_LOG("\n ** SIB1 Configuration ** \n");
6187    sib1Params = &duCfgParam.sib1Params;
6188    DU_LOG("TAC %d\n", sib1Params->tac);
6189    DU_LOG("RANAC %ld\n", sib1Params->ranac);
6190    DU_LOG("Cell ID %d\n", sib1Params->cellIdentity);
6191    DU_LOG("Cell Reserved for Operational Use %ld\n", sib1Params->cellResvdForOpUse);
6192    DU_LOG("Connection Establishment Failure Count %ld\n", sib1Params->connEstFailCnt);
6193    DU_LOG("Connection Establishment Failure Offset Valid %ld\n", sib1Params->connEstFailOffValidity);
6194    DU_LOG("Connection Establishment Failure Offset %ld\n", sib1Params->connEstFailOffset);
6195    DU_LOG("PLMN : mcc[0] %d\n", sib1Params->plmn.mcc[0]);
6196    DU_LOG("PLMN : mcc[1] %d\n", sib1Params->plmn.mcc[1]);
6197    DU_LOG("PLMN : mcc[2] %d\n", sib1Params->plmn.mcc[2]);
6198    DU_LOG("PLMN : mnc[0] %d\n", sib1Params->plmn.mnc[0]);
6199    DU_LOG("PLMN : mnc[1] %d\n", sib1Params->plmn.mnc[1]);
6200    DU_LOG("PLMN : mnc[2] %d\n", sib1Params->plmn.mnc[2]);
6201
6202    DU_LOG("\n ** SIB1 : SI Scheduling Info ** \n");
6203    siSchedInfo = &sib1Params ->siSchedInfo;
6204    DU_LOG("Windown Length %ld\n", siSchedInfo->winLen);
6205    DU_LOG("Broadcast Status %ld\n", siSchedInfo->broadcastSta);
6206    DU_LOG("Periodicity %ld\n", siSchedInfo->preiodicity);
6207    DU_LOG("SIB Type %ld\n", siSchedInfo->sibType);
6208    DU_LOG("SIB Value Tag %ld\n", siSchedInfo->sibValTag);
6209
6210    DU_LOG("\n ** SIB1 : Serving Cell Configuration Common SIB ** \n");
6211    srvCellCfgCmnSib = &sib1Params->srvCellCfgCommSib;
6212    DU_LOG("Subcarrier Spacing %ld\n", srvCellCfgCmnSib->scs);
6213    DU_LOG("SSB Position in Burst %d\n", srvCellCfgCmnSib->ssbPosInBurst);
6214    DU_LOG("SSB Periodicity %ld\n", srvCellCfgCmnSib->ssbPrdServingCell);
6215    DU_LOG("SS PBCH Power %ld\n", srvCellCfgCmnSib->ssPbchBlockPwr);
6216
6217    DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common ** \n");
6218    dlCfgCmn = &srvCellCfgCmnSib->dlCfg;
6219    DU_LOG("Frequency Band Indicator %ld\n", dlCfgCmn->freqBandInd);
6220    DU_LOG("Offset to Point A %ld\n", dlCfgCmn->offsetToPointA);
6221    DU_LOG("Frequency Location And Bandwidth %ld\n", dlCfgCmn->locAndBw);
6222    DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsOffset);
6223    DU_LOG("Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scs);
6224    DU_LOG("Bandwidth considering Subcarrier Spacing %ld\n", dlCfgCmn->dlScsCarrier.scsBw);
6225
6226    DU_LOG("\n ** SIB1 : Serving Cell Config Common SIB : DL Config Common : PDCCH Config Common ** \n");
6227    pdcchCfgCommon = &dlCfgCmn->pdcchCfg;
6228    if(pdcchCfgCommon->present)
6229    {
6230       DU_LOG("Control Resource Set Zero Index %ld\n", pdcchCfgCommon->ctrlRsrcSetZero);
6231       DU_LOG("Search Space Zero Index %ld\n", pdcchCfgCommon->searchSpcZero);
6232       DU_LOG("Search Space ID %ld\n", pdcchCfgCommon->searchSpcId);
6233       DU_LOG("Control Resource Set ID %ld\n", pdcchCfgCommon->ctrlRsrcSetId);
6234       DU_LOG("Monitoring Slot Periodicity and Offset Present %d\n", pdcchCfgCommon->monitorSlotPrdAndOffPresent);
6235       DU_LOG("Monitoring Slot Periodicity and Offset %ld\n", pdcchCfgCommon->monitorSlotPrdAndOff);
6236       for (monitoringSymbIdx = 0; monitoringSymbIdx < 2; monitoringSymbIdx++)
6237       {
6238          DU_LOG("Monitoring Symbols in Slot [%d] %d\n",monitoringSymbIdx,  pdcchCfgCommon->monitorSymbolsInSlot[monitoringSymbIdx]);
6239       }
6240       DU_LOG("Number of Candidates for Aggregation Level_1 %ld\n", pdcchCfgCommon->numCandAggLvl1);
6241       DU_LOG("Number of Candidates for Aggregation Level_2 %ld\n", pdcchCfgCommon->numCandAggLvl2);
6242       DU_LOG("Number of Candidates for Aggregation Level_4 %ld\n", pdcchCfgCommon->numCandAggLvl4);
6243       DU_LOG("Number of Candidates for Aggregation Level_8 %ld\n", pdcchCfgCommon->numCandAggLvl8);
6244       DU_LOG("Number of Candidates for Aggregation Level_16 %ld\n", pdcchCfgCommon->numCandAggLvl16);
6245       DU_LOG("Seach Space Type %d\n", pdcchCfgCommon->searchSpcType);
6246       DU_LOG("Common Search Space DCI Format %d\n", pdcchCfgCommon->commSrchSpcDciFrmt);
6247       DU_LOG("SIB1 Search Space ID %ld\n", pdcchCfgCommon->searchSpcSib1);
6248       DU_LOG("Paging Search Space ID %ld\n", pdcchCfgCommon->pagingSearchSpc);
6249       DU_LOG("RA Search Space ID %ld\n", pdcchCfgCommon->raSearchSpc);
6250    }
6251    else
6252    {
6253       DU_LOG("PDCCH Config Common not Present");
6254    }
6255
6256    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PDSCH Config Common ** \n");
6257    pdschCfgCommon = &dlCfgCmn->pdschCfg;
6258    DU_LOG("PDSCH Config Common Present %d\n", pdschCfgCommon->present);
6259    if(pdschCfgCommon->present)
6260    {
6261       DU_LOG("Number of Time Domain Resource Allocation %d\n", pdschCfgCommon->numTimeDomRsrcAlloc);
6262       for (rsrcIdx = 0; rsrcIdx < pdschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++)
6263       {
6264          pdschTimeDomRsrcAlloc = &pdschCfgCommon->timeDomAlloc[rsrcIdx];
6265          DU_LOG("PDSCH Timer Domain Resource Allocation [%d]", rsrcIdx);
6266          DU_LOG("K0 %ld\n", pdschTimeDomRsrcAlloc->k0);
6267          DU_LOG("MappingType %ld\n", pdschTimeDomRsrcAlloc->mapType);
6268          DU_LOG("SLIV %d\n", pdschTimeDomRsrcAlloc->sliv);
6269       }
6270    }
6271    else
6272    {
6273       DU_LOG("PDSCH Config Common not Present");
6274    }
6275
6276    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : BCCH Config Common ** \n");
6277    bcchCfg = &dlCfgCmn->bcchCfg;
6278    DU_LOG("Modification Period Coefficient %ld\n", bcchCfg->modPrdCoeff);
6279
6280    DU_LOG("\n ** SIB1 : Serving Cell Config Common : DL Config Common : PCCH Config Common ** \n");
6281    pcchCfg = &dlCfgCmn->pcchCfg;
6282    DU_LOG("Default Paging Cycle %d\n", pcchCfg->dfltPagingCycle);
6283    DU_LOG("Number of PF in Paging Cycle %d\n", pcchCfg->nAndPagingFrmOffsetType);
6284    DU_LOG("PF Offset %d\n", pcchCfg->pageFrameOffset);
6285    DU_LOG("NS - Number of P0 in PF %d\n", pcchCfg->ns);
6286    DU_LOG("First PDCCH Monitoring Occassion of each P0 Type %d\n", pcchCfg->firstPDCCHMontioringType);
6287    for (poIdx = 0; poIdx < MAX_PO_PER_PF; poIdx++)
6288    {
6289       DU_LOG("First PDCCH Monitoring Occassion in P0 [%d] %d\n", poIdx, pcchCfg->firstPDCCHMontioringInfo[poIdx]);
6290    }
6291
6292    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common ** \n");
6293    ulCfgCmn = &srvCellCfgCmnSib->ulCfg;
6294    DU_LOG("Frequency Band Indicator %ld\n", ulCfgCmn->freqBandInd);
6295    DU_LOG("Maximum Transmission Power %ld\n", ulCfgCmn->pMax);
6296    DU_LOG("Frequency Location and Bandwidth %ld\n", ulCfgCmn->locAndBw);
6297    DU_LOG("Time Alignment Timer %ld\n", ulCfgCmn->timeAlignTimerComm);
6298    DU_LOG("Offset to Point A considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsOffset);
6299    DU_LOG("Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scs);
6300    DU_LOG("Carrier BW considering Subcarrier Spacing %ld\n", ulCfgCmn->ulScsCarrier.scsBw);
6301
6302    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : RACH Config Common ** \n");
6303    rachCfgCmn = &ulCfgCmn ->rachCfg;
6304    if(rachCfgCmn->present)
6305    {
6306       DU_LOG("PRACH Configuration Index %ld\n", rachCfgCmn->prachCfgIdx);
6307       DU_LOG("Number of PRACH FDM %ld\n", rachCfgCmn->msg1Fdm);
6308       DU_LOG("PRACH Frequeny Start Offset %ld\n", rachCfgCmn->msg1FreqStart);
6309       DU_LOG("Zero Correaltion Zone Configuration %ld\n", rachCfgCmn->zeroCorrZoneCfg);
6310       DU_LOG("Target Power Level of Received Preamble %ld\n", rachCfgCmn->preambleRcvdTgtPwr);
6311       DU_LOG("Maximum number of Preamble Transmission %ld\n", rachCfgCmn->preambleTransMax);
6312       DU_LOG("Power Ramping Step %ld\n", rachCfgCmn->pwrRampingStep);
6313       DU_LOG("RA Response Window %ld\n", rachCfgCmn->raRspWindow);
6314       DU_LOG("Total Number of RA Preambles %ld\n", rachCfgCmn->numRaPreamble);
6315       DU_LOG("Number of SSB per RACH Occassion %ld\n", rachCfgCmn->numSsbPerRachOcc);
6316       DU_LOG("Number of Contention Based Preamble per SSB %ld\n", rachCfgCmn->numCbPreamblePerSsb);
6317       DU_LOG("Contention Resolution Timer %ld\n", rachCfgCmn->contResTimer);
6318       DU_LOG("RSRP Threshold %ld\n", rachCfgCmn->rsrpThreshSsb);
6319       DU_LOG("Root Sequence Index Present %d\n", rachCfgCmn->rootSeqIdxPresent);
6320       DU_LOG("Root Sequence Index %ld\n", rachCfgCmn->rootSeqIdx);
6321       DU_LOG("Subcarrier Spacing %ld\n", rachCfgCmn->msg1Scs);
6322       DU_LOG("Restricted Set Configuration %ld\n", rachCfgCmn->restrictedSetCfg);
6323    }
6324    else
6325    {
6326       DU_LOG("RACH Config Common not present\n");
6327    }
6328
6329    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUSCH Config Common ** \n");
6330    puschCfgCommon = &ulCfgCmn ->puschCfg;
6331    if(puschCfgCommon->puschCfgPresent)
6332    {
6333       DU_LOG("MSG3 Delta from RACH Preamble %ld\n", puschCfgCommon->msg3DeltaPreamble);
6334       DU_LOG("P0 Nominal With Grant %ld\n", puschCfgCommon->p0NominalWithGrant);
6335       DU_LOG("Number of Time Domain Resource Allocation %d\n", puschCfgCommon->numTimeDomRsrcAlloc);
6336       for(rsrcIdx = 0; rsrcIdx < puschCfgCommon->numTimeDomRsrcAlloc; rsrcIdx++)
6337       {
6338          puschCmnTimeDomRsrsAlloc = &puschCfgCommon ->timeDomAllocList[rsrcIdx];
6339          DU_LOG("Time Domain Resource Alloc [%d]", rsrcIdx);
6340          DU_LOG("\tK2 %ld\n", puschCmnTimeDomRsrsAlloc->k2);
6341          DU_LOG("\tMapping Type %ld\n", puschCmnTimeDomRsrsAlloc->mapType);
6342          DU_LOG("\tSLIV %d\n", puschCmnTimeDomRsrsAlloc->sliv);
6343       }
6344    }
6345    else
6346    {
6347       DU_LOG("PUSCH Config Common not present\n");
6348    }
6349    
6350    DU_LOG("\n ** SIB1 : Serving Cell Config Common : UL Config Common : PUCCH Config Common **\n");
6351    pucchCfgCommon = &ulCfgCmn->pucchCfg;
6352    if(pucchCfgCommon->present)
6353    {
6354       DU_LOG("Resource Common %ld\n", pucchCfgCommon->rsrcComm);
6355       DU_LOG("Group Hopping %ld\n", pucchCfgCommon->grpHop);
6356       DU_LOG("P0 Nominal %ld\n", pucchCfgCommon->p0Nominal);
6357    }
6358    else
6359    {
6360       DU_LOG("PUCCH Config Common not present\n");
6361    }
6362  
6363    DU_LOG("\n ** SIB1 : Serving Cell Config Common : TDD UL DL Config Common ** \n");
6364    tddUlDlCfgCmn = &srvCellCfgCmnSib->tddCfg;
6365    DU_LOG("Reference Subcarrier Spacing %ld\n", tddUlDlCfgCmn->refScs);
6366    DU_LOG("Transmission Periodicity %ld\n", tddUlDlCfgCmn->txPrd);
6367    DU_LOG("Number of DL Slots %ld\n", tddUlDlCfgCmn->numDlSlots);
6368    DU_LOG("Number of DL Symbols %ld\n", tddUlDlCfgCmn->numDlSymbols);
6369    DU_LOG("Number of UL Slots %ld\n", tddUlDlCfgCmn->numUlSlots);
6370    DU_LOG("Number of UL Symbols %ld\n", tddUlDlCfgCmn->numUlSymbols);
6371
6372    DU_LOG("\n ** MAC SLICE CONFIG REQUEST ** \n");
6373    macSliceCfg = &duCfgParam.tempSliceCfg;
6374    DU_LOG("Number of RRM Policy %d\n",macSliceCfg->numOfRrmPolicy);
6375
6376    for(policyIdx = 0; policyIdx < macSliceCfg->numOfRrmPolicy; policyIdx++)
6377    {
6378       rrmPolicy = macSliceCfg->listOfRrmPolicy[policyIdx];
6379       DU_LOG("RRM Policy [%d]", policyIdx);
6380       DU_LOG("\tResource Type %d\n", rrmPolicy->resourceType);
6381
6382       rrmPolicyRatio = &rrmPolicy ->policyRatio;
6383       DU_LOG("\tPolicy Maximum Ratio %d\n", rrmPolicyRatio->maxRatio);
6384       DU_LOG("\tPolicy Minimum Ratio %d\n", rrmPolicyRatio->minRatio);
6385       DU_LOG("\tPolicy Deidcated Ration %d\n", rrmPolicyRatio->dedicatedRatio);
6386       DU_LOG("\tNumber of RRM Policy Member %d\n", rrmPolicy->numOfRrmPolicyMem);   
6387       
6388       for(memIdx = 0; memIdx < rrmPolicy->numOfRrmPolicyMem; memIdx++)
6389       {
6390          rrmPolicyMemberList = rrmPolicy->rRMPolicyMemberList[memIdx];
6391          DU_LOG("\tRRM Policy Member [%d]", memIdx);
6392          DU_LOG("\t\tPLMN : mcc[0] %d\n", rrmPolicyMemberList->plmn.mcc[0]);
6393          DU_LOG("\t\tPLMN : mcc[1] %d\n", rrmPolicyMemberList->plmn.mcc[1]);
6394          DU_LOG("\t\tPLMN : mcc[2] %d\n", rrmPolicyMemberList->plmn.mcc[2]);
6395          DU_LOG("\t\tPLMN : mnc[0] %d\n", rrmPolicyMemberList->plmn.mnc[0]);
6396          DU_LOG("\t\tPLMN : mnc[1] %d\n", rrmPolicyMemberList->plmn.mnc[1]);
6397          DU_LOG("\t\tPLMN : mnc[2] %d\n", rrmPolicyMemberList->plmn.mnc[2]);
6398          DU_LOG("\t\tSST %d\n",rrmPolicyMemberList->snssai.sst);
6399          DU_LOG("\t\tSD %d %d %d\n",rrmPolicyMemberList->snssai.sd[0],rrmPolicyMemberList->snssai.sd[1],rrmPolicyMemberList->snssai.sd[2]);
6400       }
6401    }
6402 }
6403
6404 /**********************************************************************
6405   End of file
6406  **********************************************************************/
6407