[Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-450] PAGING memory fixes
[o-du/l2.git] / src / du_app / du_f1ap_msg_hdl.c
index 5c907be..2bdb40a 100644 (file)
 #include "UPTransportLayerInformation.h"
 #include "GTPTunnel.h"
 #include "SupportedSULFreqBandItem.h"
-#include "du_sys_info_hdl.h"
 #include "du_e2ap_msg_hdl.h"
 #include "du_f1ap_conversions.h"
 #include "CNUEPagingIdentity.h"
 #include "PCCH-Config.h"
+#include "SCS-SpecificCarrier.h"
+#include "FrequencyInfoDL.h"
+#include "DownlinkConfigCommon.h"
+#include "FrequencyInfoUL.h"
+#include "UplinkConfigCommon.h"
+#include "TDD-UL-DL-ConfigCommon.h"
+#include "RACH-ConfigDedicated.h"
+#include "CFRA-SSB-Resource.h"
+#include "BWP-UplinkCommon.h"
+#include "ReconfigurationWithSync.h"
+#include "du_sys_info_hdl.h"
 
 #ifdef O1_ENABLE
 #include "CmInterface.h"
@@ -352,30 +362,6 @@ uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
    return ROK;
 }
 
-/*******************************************************************
- *
- * @brief Builds NRCell ID 
- *
- * @details
- *
- *    Function : BuildNrCellId
- *
- *    Functionality: Building the NR Cell ID
- *
- * @params[in] BIT_STRING_t *nrcell
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-S16 BuildNrCellId(BIT_STRING_t *nrcell)
-{
-   memset(nrcell->buf, 0, nrcell->size);
-   nrcell->buf[4]   = duCfgParam.sib1Params.cellIdentity; 
-   nrcell->bits_unused = 4;
-   return ROK;
-}
-
 /*******************************************************************
  *
  * @brief Builds Nrcgi 
@@ -415,7 +401,7 @@ uint8_t BuildNrcgi(NRCGI_t *nrcgi)
    {
       return RFAILED;
    }
-   BuildNrCellId(&nrcgi->nRCellIdentity);
+   fillBitString(&nrcgi->nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
 
    return ROK;
 }
@@ -6187,749 +6173,1798 @@ uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg)
 
    return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Builds Spcell config 
+ * @brief Fills SCS specific carrier list in DL frequency info
  *
  * @details
  *
- *    Function : BuildSpCellCfg 
+ *    Function : BuildScsSpecificCarrierListDl
  *
- *    Functionality: Builds sp cell config in DuToCuRrcContainer
+ *    Functionality: Fills SCS specific carrier list in DL frequency info
  *
- * @params[in] SpCellConfig_t spCellCfg
+ * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
+uint8_t BuildScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
 {
-   spCellCfg->servCellIndex = NULLP;
-   DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
-   if(!spCellCfg->servCellIndex)
+   uint8_t elementCnt = 0, listIdx = 0;
+   ScsSpecCarrier duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.dlScsCarrier;
+
+   elementCnt = ODU_VALUE_ONE;
+   scsCarrierList->list.count = elementCnt;
+   scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
+
+   DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
+   if(!scsCarrierList->list.array)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for scs carrier list array \
+         in BuildScsSpecificCarrierListDl()");
       return RFAILED;
    }
 
-   if(ueCb == NULLP)
-      *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
-   else
-      *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx;
+   for(listIdx = 0; listIdx < elementCnt; listIdx++)
+   {
+      DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
+      if(!scsCarrierList->list.array[listIdx])
+      {    
+         DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for SCS Specific Carrier list array \
+            element in BuildScsSpecificCarrierListDl()");
+         return RFAILED;
+      }    
+   }
 
-   spCellCfg->reconfigurationWithSync = NULLP;
-   spCellCfg->rlf_TimersAndConstants = NULLP;
-   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
+   listIdx = 0;
+   scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
+   scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
+   scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
 
-   DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
-   if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills DL frequency info in DL config common
+ *
+ * @details
+ *
+ *    Function : BuildFreqInfoDl
+ *
+ *    Functionality: Fills DL frequency info in DL config common
+ *
+ * @params[in] Pointer to DownlinkConfigCommon_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
+{
+   uint8_t freqBandIdx = 0, elementCnt = 0;
+   DlCfgCommon  dlCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg;
+
+   /* TODO : Fill SSB Absolute Frequency */
+   /*
+      DU_ALLOC(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
+      if(!frequencyInfoDL->absoluteFrequencySSB)
+      {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for SSB Absolute Frequency in BuildFreqInfoDl()");
+      return RFAILED;
+      }
+      frequencyInfoDL->absoluteFrequencySSB = ?;
+      */
+
+   /* NR Multi Frequency Band List */
+   elementCnt = ODU_VALUE_ONE;
+   frequencyInfoDL->frequencyBandList.list.count = elementCnt;
+   frequencyInfoDL->frequencyBandList.list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
+
+   DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
+   if(!frequencyInfoDL->frequencyBandList.list.array)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for Frequency Band List array in BuildFreqInfoDl()");
       return RFAILED;
    }
-   *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
 
-   spCellCfg->spCellConfigDedicated = NULLP;
-   DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
-   if(!spCellCfg->spCellConfigDedicated)
+   for(freqBandIdx = 0; freqBandIdx < elementCnt; freqBandIdx++)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
-      return RFAILED;
+      DU_ALLOC(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
+      if(!frequencyInfoDL->frequencyBandList.list.array[freqBandIdx])
+      {
+         DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoDl()");
+         return RFAILED;
+      }
    }
-   if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
+
+   freqBandIdx = 0;
+   *(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx]) = dlCfg.freqBandInd;
+
+   /* TODO : Absolute Frequency to Point A */
+   //frequencyInfoDL->absoluteFrequencyPointA
+
+   /* Subcarrier Spacing specifc carrier List */
+   if((BuildScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList)) != ROK)
    {
-      DU_LOG("\nERROR  -->  F1AP : BuildSpCellCfgDed failed");
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill SCS specific carrier list DL in BuildFreqInfoDl()");
       return RFAILED;
    }
 
    return ROK;
+
 }
 
 /*******************************************************************
  *
- * @brief Builds Phy cell group config 
+ * @brief Fills DL config common in Serving cell config common
  *
  * @details
  *
- *    Function : BuildPhyCellGrpCfg 
+ *    Function : BuildDlConfigCommon
  *
- *    Functionality: Builds Phy cell group config in DuToCuRrcContainer
+ *    Functionality: Fills DL config common in Serving cell config common
  *
- * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg 
+ * @params[in] Pointer to DownlinkConfigCommon_t
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
+uint8_t BuildDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
 {
-   phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
-   phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
-
-   phyCellGrpCfg->p_NR_FR1 = NULLP;
-   DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
-   if(!phyCellGrpCfg->p_NR_FR1)
+   /* DL Frequency Info */
+   DU_ALLOC(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
+   if(!dlCfgCommon->frequencyInfoDL)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
+      DU_LOG("\nERROR  --> DU APP : Memory allocation failed for DL frequency info in BuildDlConfigCommon()");
+      return RFAILED;
+   }
+   if((BuildFreqInfoDl(dlCfgCommon->frequencyInfoDL))!= ROK)
+   {
+      DU_LOG("\nERROR  --> DU APP : Failed to fill DL frequency info in BuildDlConfigCommon()");
       return RFAILED;
    }
 
-   if(ueCb == NULLP)
+   /* DL BWP config common */
+   DU_ALLOC(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
+   if(!dlCfgCommon->initialDownlinkBWP)
    {
-      *(phyCellGrpCfg->p_NR_FR1)             = P_NR_FR1;
-      phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
+      DU_LOG("\nERROR  --> DU APP : Memory allocation failed for DL BWP config common in BuildDlConfigCommon()");
+      return RFAILED;
    }
-   else
+   if((BuildBwpDlCommon(dlCfgCommon->initialDownlinkBWP)) != ROK)
    {
-      *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1;
-      phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook;
+      DU_LOG("\nERROR  --> DU APP : Failed to fill DL DWP config common in BuildDlConfigCommon()");
+      return RFAILED;
    }
 
-   phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
-   phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
-   phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
-   phyCellGrpCfg->sp_CSI_RNTI = NULLP;
-   phyCellGrpCfg->cs_RNTI = NULLP;
-   phyCellGrpCfg->ext1 = NULLP;
-   phyCellGrpCfg->ext2 = NULLP;
-
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds Mac cell group config 
+ * @brief Fills SCS specific carrier list in UL frequency Info
  *
  * @details
  *
- *    Function : BuildMacCellGrpCfg 
+ *    Function : BuildScsSpecificCarrierListUl
  *
- *    Functionality: Builds Mac cell group config in DuToCuRrcContainer
+ *    Functionality: Fills SCS specific carrier list in UL frequency Info
  *
- * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
+ * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
+uint8_t BuildScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
 {
-   macCellGrpCfg->drx_Config = NULLP;
-   macCellGrpCfg->schedulingRequestConfig = NULLP;
-   DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
-   if(!macCellGrpCfg->schedulingRequestConfig)
+   uint8_t elementCnt = 0, listIdx = 0; 
+   ScsSpecCarrier   duScsSpecCarrier = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.ulScsCarrier;
+
+   elementCnt = ODU_VALUE_ONE;
+   scsCarrierList->list.count = elementCnt;
+   scsCarrierList->list.size = elementCnt * sizeof(SCS_SpecificCarrier_t *);
+
+   DU_ALLOC(scsCarrierList->list.array, scsCarrierList->list.size);
+   if(!scsCarrierList->list.array)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed");
       return RFAILED;
    }
 
-   if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
+   for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
    {
-      DU_LOG("\nERROR  -->  F1AP : BuildSchedulingReqConfig failed");
-      return RFAILED;
+      DU_ALLOC(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
+      if(!scsCarrierList->list.array[listIdx])
+      {    
+         DU_LOG("\nERROR  -->  DU APP : SCS Specific Carrier list memory allocation failed");
+         return RFAILED;
+      }    
    }
+   listIdx = 0; 
+   scsCarrierList->list.array[listIdx]->offsetToCarrier = duScsSpecCarrier.scsOffset;
+   scsCarrierList->list.array[listIdx]->subcarrierSpacing = duScsSpecCarrier.scs;
+   scsCarrierList->list.array[listIdx]->carrierBandwidth = duScsSpecCarrier.scsBw;
 
-   macCellGrpCfg->bsr_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
-   if(!macCellGrpCfg->bsr_Config)
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills frequency info in UL config common
+ *
+ * @details
+ *
+ *    Function : BuildFreqInfoUl
+ *
+ *    Functionality: Fills frequency info in UL config common
+ *
+ * @params[in] Pointer to FrequencyInfoUL_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
+{
+   uint8_t elementCnt = 0, listIdx= 0;
+   UlCfgCommon  ulCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg;
+
+   /* NR Multi Frequency Band List */
+   DU_ALLOC(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
+   if(!frequencyInfoUL->frequencyBandList)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for frequency band list in BuildFreqInfoUl()");
       return RFAILED;
    }
 
-   if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
+   elementCnt = ODU_VALUE_ONE;
+   frequencyInfoUL->frequencyBandList->list.count = elementCnt;
+   frequencyInfoUL->frequencyBandList->list.size = elementCnt * sizeof(FreqBandIndicatorNR_t *);
+
+   DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
+   if(!frequencyInfoUL->frequencyBandList->list.array)
    {
-      DU_LOG("\nERROR  -->  F1AP : BuildBsrConfig failed");
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for frequency band array in BuildFreqInfoUl()");
       return RFAILED;
    }
 
-   macCellGrpCfg->tag_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
-   if(!macCellGrpCfg->tag_Config)
+   for(listIdx = 0; listIdx < elementCnt; listIdx++)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
-      return RFAILED;
+      DU_ALLOC(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
+      if(!frequencyInfoUL->frequencyBandList->list.array[listIdx])
+      {
+         DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for frequency band array element in BuildFreqInfoUl()");
+         return RFAILED;
+      }
    }
 
-   if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
-   {
-      DU_LOG("\nERROR  -->  F1AP : BuildTagConfig failed");
+   listIdx = 0;
+   *(frequencyInfoUL->frequencyBandList->list.array[listIdx]) = ulCfg.freqBandInd;
+
+   /* TODO : Fill Absolute frequency point A */
+   /*
+      DU_ALLOC(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
+      if(!frequencyInfoUL->absoluteFrequencyPointA)
+      {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for absolute frequency point A in BuildFreqInfoUl()");
       return RFAILED;
-   }
+      }
+    *(frequencyInfoUL->absoluteFrequencyPointA) = ?;
+    */
 
-   macCellGrpCfg->phr_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
-   if(!macCellGrpCfg->phr_Config)
+   /* Subcarrier Spacing specifc carrier */
+   if((BuildScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList)) != ROK) 
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      DU_LOG("\nERROR  --> DU APP : Failed to fill SCS Specific Carrier list UL in BuildFreqInfoUl()");
       return RFAILED;
    }
 
-   if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
+   /* P-MAX */
+   DU_ALLOC(frequencyInfoUL->p_Max, sizeof(P_Max_t));
+   if(!frequencyInfoUL->p_Max)
    {
-      DU_LOG("\nERROR  -->  F1AP : BuildPhrConfig failed");
+      DU_LOG("\nERROR  -->  DU APP : UL Frequency Infoo  memory allocation failure");
       return RFAILED;
    }
-
-   macCellGrpCfg->skipUplinkTxDynamic = false;
-   macCellGrpCfg->ext1 = NULLP;
+   *frequencyInfoUL->p_Max = ulCfg.pMax;
 
    return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees memeory allocated for SearchSpcToAddModList
+ * @brief Fills UL config common in Serving cell config common
  *
  * @details
  *
- *    Function : FreeSearchSpcToAddModList
+ *    Function : BuildUlConfigCommon
  *
- *    Functionality: Deallocating memory of SearchSpcToAddModList
+ *    Functionality: Fills UL config common in Serving cell config common
  *
- * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+ * @params[in] Pointer to UplinkConfigCommon_t
  *
- * @return void
+ * @return ROK     - success
+ *         RFAILED - failure
  *
4221 * ****************************************************************/
-void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
+ * ****************************************************************/
+uint8_t BuildUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
 {
-   uint8_t idx1=0;
-   uint8_t idx2=0;
-   struct  SearchSpace *searchSpc=NULLP;
+   /* UL Frequency Info */
+   DU_ALLOC(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
+   if(!ulCfgCommon->frequencyInfoUL)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for UL frequency info in BuildUlConfigCommon()");
+      return RFAILED;
+   }
 
-   if(searchSpcList->list.array)
+   if((BuildFreqInfoUl(ulCfgCommon->frequencyInfoUL)) != ROK)
    {
-      if(searchSpcList->list.array[idx2])
-      {
-        searchSpc = searchSpcList->list.array[idx2];
-        if(searchSpc->controlResourceSetId)
-        {
-           if(searchSpc->monitoringSlotPeriodicityAndOffset)
-           {
-              if(searchSpc->monitoringSymbolsWithinSlot)
-              {
-                 if(searchSpc->monitoringSymbolsWithinSlot->buf)
-                 {
-                    if(searchSpc->nrofCandidates)
-                    {
-                       if(searchSpc->searchSpaceType)
-                       {
-                          DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
-                                sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
-                          DU_FREE(searchSpc->searchSpaceType, sizeof(struct
-                                   SearchSpace__searchSpaceType));
-                       }
-                       DU_FREE(searchSpc->nrofCandidates,
-                             sizeof(struct SearchSpace__nrofCandidates));
-                    }
-                    DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
-                          searchSpc->monitoringSymbolsWithinSlot->size);
-                 }
-                 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
-                       sizeof(BIT_STRING_t));
-              }
-              DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
-                    sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
-           }
-           DU_FREE(searchSpc->controlResourceSetId,
-                 sizeof(ControlResourceSetId_t));
-        }
-      }
-      for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
-      {
-        DU_FREE(searchSpcList->list.array[idx1],
-              sizeof(struct SearchSpace));
-      }
-      DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill frequency info UL in BuildUlConfigCommon()");
+      return RFAILED;
+   }
+
+   /* UL BWP common */
+   DU_ALLOC(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
+   if(!ulCfgCommon->initialUplinkBWP)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for initial UL BWP in BuildUlConfigCommon()");
+      return RFAILED;
    }
+
+   if((BuildBwpUlCommon(ulCfgCommon->initialUplinkBWP)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill BWP UL common in BuildUlConfigCommon()");
+      return RFAILED;
+   }
+
+   /* Time Alignment timer */
+   ulCfgCommon->dummy = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.timeAlignTimerComm;
+
+   return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for PdschTimeDomAllocList
+ * @brief Fills SSB position in burst in SP cell config common
  *
  * @details
  *
- *    Function : FreePdschTimeDomAllocList
+ *    Function : BuildSsbPosInBurst
  *
- *    Functionality: Deallocating memory of PdschTimeDomAllocList
+ *    Functionality: 
+ *       Fills SSB position in burst in SP cell config common
  *
- * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+ * @params[in] Pointer to struct ServingCellConfigCommon__ssb_PositionsInBurst
  *
- * @return void
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSsbPosInBurst(struct ServingCellConfigCommon__ssb_PositionsInBurst *ssbPosInBurst)
+{
+   uint8_t bitStringSizeInBytes = 0;
+
+   ssbPosInBurst->present = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap;
+
+   /* As per spec 38.331,in the definition of ServingCellConfigCommon */
+   bitStringSizeInBytes = 1;
+   ssbPosInBurst->choice.mediumBitmap.size = bitStringSizeInBytes * sizeof(uint8_t);
+
+   DU_ALLOC(ssbPosInBurst->choice.mediumBitmap.buf, ssbPosInBurst->choice.mediumBitmap.size);
+   if(!ssbPosInBurst->choice.mediumBitmap.buf)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory Allocation failed for medium bit map buffer in BuildSsbPosInBurst()");
+      return RFAILED;
+   }
+
+   if((fillBitString(&ssbPosInBurst->choice.mediumBitmap, 0, bitStringSizeInBytes, \
+               duCfgParam.sib1Params.srvCellCfgCommSib.ssbPosInBurst)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill medium bit map in BuildSsbPosInBurst()");
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills SP cell config common in Reconfig with Sync
+ *
+ * @details
+ *
+ *    Function : BuildSpCellConfigCommon
+ *
+ *    Functionality: Fills SP cell config common in Reconfig with Sync
+ *
+ * @params[in] Pointer to ServingCellConfigCommon_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
+{
+   /* Physical Cell Identity */
+   DU_ALLOC(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
+   if(!spCellConfigCommon->physCellId)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for physical cell id in BuildSpCellConfigCommon()");
+      return RFAILED;
+   } 
+   *(spCellConfigCommon->physCellId) = NR_PCI;
+
+   /* Downlink Config Common */
+   DU_ALLOC(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
+   if(!spCellConfigCommon->downlinkConfigCommon)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for DL Config Common in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   if((BuildDlConfigCommon(spCellConfigCommon->downlinkConfigCommon)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill DL config commin in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+
+   /* Uplinlink Config Common */
+   DU_ALLOC(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
+   if(!spCellConfigCommon->uplinkConfigCommon)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for UL Config Common in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   if((BuildUlConfigCommon(spCellConfigCommon->uplinkConfigCommon)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill UL config commin in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+
+   /* Timing Advance offset */
+   DU_ALLOC(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
+   if(!spCellConfigCommon->n_TimingAdvanceOffset)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for Timing Advance Offset in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   *(spCellConfigCommon->n_TimingAdvanceOffset) = ServingCellConfigCommon__n_TimingAdvanceOffset_n0;
+
+   /* SSB Position In Burst */
+   DU_ALLOC(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
+   if(!spCellConfigCommon->ssb_PositionsInBurst)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for SSB Position In Burst in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   if((BuildSsbPosInBurst(spCellConfigCommon->ssb_PositionsInBurst)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill SSB Position In Burst in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+
+   /* SSB Periodicity in Serving cell */
+   DU_ALLOC(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
+   if(!spCellConfigCommon->ssb_periodicityServingCell)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for SSB Periodicity serving cell in \
+         BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   *(spCellConfigCommon->ssb_periodicityServingCell) = \
+      convertSsbPeriodicityValueToEnum(duCfgParam.sib1Params.srvCellCfgCommSib.ssbPrdServingCell);
+
+   /* DMRS Type A position */
+   spCellConfigCommon->dmrs_TypeA_Position = convertDmrsTypeAPosValueToEnum(duCfgParam.macCellCfg.dmrsTypeAPos);
+
+   /* SSB subcarrier spacing */
+   DU_ALLOC(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
+   if(!spCellConfigCommon->ssbSubcarrierSpacing)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for sub-carrier spacing in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   *(spCellConfigCommon->ssbSubcarrierSpacing) = duCfgParam.sib1Params.srvCellCfgCommSib.scs;
+
+   /* TDD UL-DL configuration common */
+   DU_ALLOC(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
+   if(!spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for TDD UL-DL config common in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+   if((BuildTddUlDlCfgComm(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to fill TDD UL-DL config common in BuildSpCellConfigCommon()");
+      return RFAILED;
+   }
+
+   /* SS PBCH Block Power */
+   spCellConfigCommon->ss_PBCH_BlockPower = duCfgParam.sib1Params.srvCellCfgCommSib.ssPbchBlockPwr;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills dedicated RACH configuration in Reconfiguration with sync
+ *
+ * @details
+ *
+ *    Function : BuildRecfgWithSync
+ *
+ *    Functionality: 
+ *       Fills dedicated RACH configuration in Reconfiguration with sync
+ *
+ * @params[in] DU UE CB
+ *             Pointer to Rach config dedicated struct
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildRachConfigDedicated(DuUeCb *ueCb, struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
+{
+   uint8_t elementCnt = 0, listIdx = 0;
+   CFRA_t *cfra = NULLP;
+   struct CFRA__resources__ssb *ssbResource = NULLP;
+   RachCfgCommon duRachCfg = duCfgParam.sib1Params.srvCellCfgCommSib.ulCfg.rachCfg;
+
+   rachCfgDed->present = ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink;
+
+   /* Uplink */
+   DU_ALLOC(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
+   if(!rachCfgDed->choice.uplink)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for RACH uplink configuration in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+
+   /* CFRA : Contention free Random Access */
+   DU_ALLOC(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
+   if(!rachCfgDed->choice.uplink->cfra)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for CFRA in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+   cfra = rachCfgDed->choice.uplink->cfra;
+
+   /* CFRA occassions */
+   DU_ALLOC(cfra->occasions, sizeof(struct CFRA__occasions));
+   if(!cfra->occasions)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for CFRA occassion in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+
+   /* CFRA occassions : RACH generic configuration */
+   cfra->occasions->rach_ConfigGeneric.prach_ConfigurationIndex = duRachCfg.prachCfgIdx;
+   cfra->occasions->rach_ConfigGeneric.msg1_FDM = duRachCfg.msg1Fdm;
+   cfra->occasions->rach_ConfigGeneric.msg1_FrequencyStart = duRachCfg.msg1FreqStart;
+   cfra->occasions->rach_ConfigGeneric.zeroCorrelationZoneConfig = duRachCfg.zeroCorrZoneCfg;
+   cfra->occasions->rach_ConfigGeneric.preambleReceivedTargetPower = duRachCfg.preambleRcvdTgtPwr;
+   cfra->occasions->rach_ConfigGeneric.preambleTransMax = duRachCfg.preambleTransMax;
+   cfra->occasions->rach_ConfigGeneric.powerRampingStep = duRachCfg.pwrRampingStep;
+   cfra->occasions->rach_ConfigGeneric.ra_ResponseWindow = duRachCfg.raRspWindow;
+
+   /* CFRA occassions : SSB per RACH occasion */
+   DU_ALLOC(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
+   if(!cfra->occasions->ssb_perRACH_Occasion)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for SSB per RACH occassion in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+   *(cfra->occasions->ssb_perRACH_Occasion) = convertCFRASsbPerRachOccasionValueToEnum(duCfgParam.macCellCfg.prachCfg.ssbPerRach);
+
+   /* CFRA resource */
+   cfra->resources.present = CFRA__resources_PR_ssb;
+
+   /* CFRA resource : SSB */
+   DU_ALLOC(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
+   if(!cfra->resources.choice.ssb)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for CFRA resource - SSB in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+   ssbResource = cfra->resources.choice.ssb;
+
+   /* CFRA SSB resource list */
+   elementCnt = ueCb->cfraResource.numSsb;
+   ssbResource->ssb_ResourceList.list.count = elementCnt;
+   ssbResource->ssb_ResourceList.list.size = elementCnt * sizeof(CFRA_SSB_Resource_t *);
+
+   DU_ALLOC(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
+   if(!ssbResource->ssb_ResourceList.list.array)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for SSB resource list in BuildRachConfigDedicated()");
+      return RFAILED;
+   }
+
+   for(listIdx = 0; listIdx < elementCnt; listIdx++)
+   {
+      DU_ALLOC(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
+      if(!ssbResource->ssb_ResourceList.list.array[listIdx])
+      {
+         DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for SSB resource list element in BuildRachConfigDedicated()");  
+         return RFAILED;
+      }
+      ssbResource->ssb_ResourceList.list.array[listIdx]->ssb = ueCb->cfraResource.ssbResource[listIdx].ssbIdx;
+      ssbResource->ssb_ResourceList.list.array[listIdx]->ra_PreambleIndex = ueCb->cfraResource.ssbResource[listIdx].raPreambleIdx;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills reconfiguration with sync in SP cell config
+ *
+ * @details
+ *
+ *    Function : BuildRecfgWithSync
+ *
+ *    Functionality: Fills reconfiguration with sync in SP cell config
+ *
+ * @params[in] DU UE CB
+ *             Pointer to ReconfigurationWithSync_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildRecfgWithSync(DuUeCb *ueCb, ReconfigurationWithSync_t *recfgWithSync)
+{
+   /* SP Cell Config Common */  
+   DU_ALLOC(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
+   if(!recfgWithSync->spCellConfigCommon)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for spCellConfigCommon in BuildRecfgWithSync()");
+      return RFAILED;
+   }
+
+   if((BuildSpCellConfigCommon(recfgWithSync->spCellConfigCommon)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to build SpCellConfigCommon in BuildRecfgWithSync()");
+      return RFAILED;
+   }
+
+   /* New UE Identity */
+   recfgWithSync->newUE_Identity = ueCb->crnti;
+
+   /* T304 timer */
+   recfgWithSync->t304 = ReconfigurationWithSync__t304_ms1000;
+
+   /* RACH configuration dedicated */
+   DU_ALLOC(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
+   if(!recfgWithSync->rach_ConfigDedicated)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to allocate memory for RACH config dedicated in BuildRecfgWithSync()");
+      return RFAILED;
+   }
+
+   if((BuildRachConfigDedicated(ueCb, recfgWithSync->rach_ConfigDedicated)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Failed to build RACH config dedicated in BuildRecfgWithSync()");
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Spcell config 
+ *
+ * @details
+ *
+ *    Function : BuildSpCellCfg 
+ *
+ *    Functionality: Builds sp cell config in DuToCuRrcContainer
+ *
+ * @params[in] SpCellConfig_t spCellCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
+{
+   spCellCfg->servCellIndex = NULLP;
+   DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
+   if(!spCellCfg->servCellIndex)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      return RFAILED;
+   }
+
+   if(ueCb == NULLP)
+      *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
+   else
+      *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx;
+
+   spCellCfg->reconfigurationWithSync = NULLP;
+   if(ueCb && (ueCb->ueState == UE_HANDIN_IN_PROGRESS))
+   {
+      DU_ALLOC(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
+      if(!spCellCfg->reconfigurationWithSync)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+         return RFAILED;
+      }
+
+      if((BuildRecfgWithSync(ueCb, spCellCfg->reconfigurationWithSync)) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Building of reconfiguration with sync failed at BuildSpCellCfg");
+         return RFAILED;
+      }
+   }
+
+   spCellCfg->rlf_TimersAndConstants = NULLP;
+   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
+
+   DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+   if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      return RFAILED;
+   }
+   *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
+
+   spCellCfg->spCellConfigDedicated = NULLP;
+   DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+   if(!spCellCfg->spCellConfigDedicated)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      return RFAILED;
+   }
+   if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildSpCellCfgDed failed");
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Phy cell group config 
+ *
+ * @details
+ *
+ *    Function : BuildPhyCellGrpCfg 
+ *
+ *    Functionality: Builds Phy cell group config in DuToCuRrcContainer
+ *
+ * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
+{
+   phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
+   phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
+
+   phyCellGrpCfg->p_NR_FR1 = NULLP;
+   DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+   if(!phyCellGrpCfg->p_NR_FR1)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildPhyCellGrpCfg");
+      return RFAILED;
+   }
+
+   if(ueCb == NULLP)
+   {
+      *(phyCellGrpCfg->p_NR_FR1)             = P_NR_FR1;
+      phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
+   }
+   else
+   {
+      *(phyCellGrpCfg->p_NR_FR1) = ueCb->macUeCfg.phyCellGrpCfg.pNrFr1;
+      phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = ueCb->macUeCfg.phyCellGrpCfg.pdschHarqAckCodebook;
+   }
+
+   phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
+   phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
+   phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
+   phyCellGrpCfg->sp_CSI_RNTI = NULLP;
+   phyCellGrpCfg->cs_RNTI = NULLP;
+   phyCellGrpCfg->ext1 = NULLP;
+   phyCellGrpCfg->ext2 = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Mac cell group config 
+ *
+ * @details
+ *
+ *    Function : BuildMacCellGrpCfg 
+ *
+ *    Functionality: Builds Mac cell group config in DuToCuRrcContainer
+ *
+ * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
+{
+   macCellGrpCfg->drx_Config = NULLP;
+   macCellGrpCfg->schedulingRequestConfig = NULLP;
+   DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+   if(!macCellGrpCfg->schedulingRequestConfig)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      return RFAILED;
+   }
+
+   if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildSchedulingReqConfig failed");
+      return RFAILED;
+   }
+
+   macCellGrpCfg->bsr_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+   if(!macCellGrpCfg->bsr_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      return RFAILED;
+   }
+
+   if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildBsrConfig failed");
+      return RFAILED;
+   }
+
+   macCellGrpCfg->tag_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
+   if(!macCellGrpCfg->tag_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      return RFAILED;
+   }
+
+   if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildTagConfig failed");
+      return RFAILED;
+   }
+
+   macCellGrpCfg->phr_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
+   if(!macCellGrpCfg->phr_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      return RFAILED;
+   }
+
+   if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildPhrConfig failed");
+      return RFAILED;
+   }
+
+   macCellGrpCfg->skipUplinkTxDynamic = false;
+   macCellGrpCfg->ext1 = NULLP;
+
+   return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Frees memeory allocated for SearchSpcToAddModList
+ *
+ * @details
+ *
+ *    Function : FreeSearchSpcToAddModList
+ *
+ *    Functionality: Deallocating memory of SearchSpcToAddModList
+ *
+ * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+ *
+ * @return void
+ *
+ 4221 * ****************************************************************/
+void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
+{
+   uint8_t idx1=0;
+   uint8_t idx2=0;
+   struct  SearchSpace *searchSpc=NULLP;
+
+   if(searchSpcList->list.array)
+   {
+      if(searchSpcList->list.array[idx2])
+      {
+        searchSpc = searchSpcList->list.array[idx2];
+        if(searchSpc->controlResourceSetId)
+        {
+           if(searchSpc->monitoringSlotPeriodicityAndOffset)
+           {
+              if(searchSpc->monitoringSymbolsWithinSlot)
+              {
+                 if(searchSpc->monitoringSymbolsWithinSlot->buf)
+                 {
+                    if(searchSpc->nrofCandidates)
+                    {
+                       if(searchSpc->searchSpaceType)
+                       {
+                          DU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
+                                sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
+                          DU_FREE(searchSpc->searchSpaceType, sizeof(struct
+                                   SearchSpace__searchSpaceType));
+                       }
+                       DU_FREE(searchSpc->nrofCandidates,
+                             sizeof(struct SearchSpace__nrofCandidates));
+                    }
+                    DU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
+                          searchSpc->monitoringSymbolsWithinSlot->size);
+                 }
+                 DU_FREE(searchSpc->monitoringSymbolsWithinSlot,
+                       sizeof(BIT_STRING_t));
+              }
+              DU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
+                    sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
+           }
+           DU_FREE(searchSpc->controlResourceSetId,
+                 sizeof(ControlResourceSetId_t));
+        }
+      }
+      for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
+      {
+        DU_FREE(searchSpcList->list.array[idx1],
+              sizeof(struct SearchSpace));
+      }
+      DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
+   }
+}
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for PdschTimeDomAllocList
+ *
+ * @details
+ *
+ *    Function : FreePdschTimeDomAllocList
+ *
+ *    Functionality: Deallocating memory of PdschTimeDomAllocList
+ *
+ * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+ *
+ * @return void
  *
  * ****************************************************************/
 void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
 {
-   uint8_t idx1=0;
+   uint8_t idx1=0;
+
+   if(timeDomAllocList->choice.setup)
+   {
+      if(timeDomAllocList->choice.setup->list.array)
+      {
+         for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
+         {
+            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
+            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
+                  sizeof(struct PDSCH_TimeDomainResourceAllocation));
+         }
+         DU_FREE(timeDomAllocList->choice.setup->list.array, \
+               timeDomAllocList->choice.setup->list.size);
+      }
+      DU_FREE(timeDomAllocList->choice.setup,\
+            sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+   }
+}
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for PuschTimeDomAllocList
+ *
+ *@details
+ *
+ *    Function : FreePuschTimeDomAllocList
+ *
+ *    Functionality: Deallocating memory of PuschTimeDomAllocList
+ *
+ * @params[in] PUSCH_Config_t *puschCfg
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
+{
+   uint8_t rsrcListIdx=0;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
+
+   if(puschCfg->pusch_TimeDomainAllocationList)
+   {
+      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
+      if(timeDomAllocList_t->choice.setup)
+      {
+         if(timeDomAllocList_t->choice.setup->list.array)
+         {
+            for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
+            {
+               DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
+               DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
+                     sizeof(PUSCH_TimeDomainResourceAllocation_t));
+            }
+            DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
+                  timeDomAllocList_t->choice.setup->list.size);
+         }
+         DU_FREE(timeDomAllocList_t->choice.setup, \
+               sizeof(struct PUSCH_TimeDomainResourceAllocationList));
+      }
+      DU_FREE(puschCfg->transformPrecoder, sizeof(long));
+      DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
+            sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
+   }
+
+}
+
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for Dedicated PUCCH config
+ *
+ * @details
+ *
+ *    Function : FreeBWPUlDedPucchCfg
+ *
+ *    Functionality: Deallocating memory of Dedicated PUCCH cfg
+ *
+ * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
+{
+   uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
+   PUCCH_Config_t *pucchCfg = NULLP;
+   PUCCH_ResourceSet_t *rsrcSet = NULLP;
+   PUCCH_Resource_t *rsrc = NULLP;
+
+   if(ulBwpPucchCfg)
+   {
+      if(ulBwpPucchCfg->choice.setup)
+      {
+         pucchCfg = ulBwpPucchCfg->choice.setup;
+
+         //Free resource set list
+         if(pucchCfg->resourceSetToAddModList)
+         {
+            if(pucchCfg->resourceSetToAddModList->list.array)
+            {
+               for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
+               {
+                  rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
+                  if(rsrcSet->resourceList.list.array)
+                  {
+                     for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
+                     {
+                        DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+                     }
+                     DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
+                  }
+                  DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
+               }
+               DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
+            }
+            DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
+         }
+
+         //Free resource list
+         if(pucchCfg->resourceToAddModList)
+         {
+            if(pucchCfg->resourceToAddModList->list.array)
+            {
+               for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
+               {
+                  rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
+                  DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+                  DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
+               }
+               DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
+            }
+            DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
+         }
+
+         //PUCCH Format 1
+         if(pucchCfg->format1)
+         {
+            if(pucchCfg->format1->choice.setup)
+            {
+               DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
+               DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
+            }
+            DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
+         }
+         
+         //DL DATA TO UL ACK
+         if(pucchCfg->dl_DataToUL_ACK)
+         {
+            if(pucchCfg->dl_DataToUL_ACK->list.array)
+            {
+               for(k1Idx = 0; k1Idx <  pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
+               {
+                  DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
+               }
+               DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
+            }
+            DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+         }
+
+         DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
+      }
+      DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for InitialUlBWP
+ *
+ * @details
+ *
+ *    Function : FreeInitialUlBWP
+ *
+ *    Functionality: Deallocating memory of InitialUlBWP
+ *
+ * @params[in] BWP_UplinkDedicated_t *ulBwp
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+{
+   uint8_t  rSetIdx, rsrcIdx;
+   SRS_Config_t   *srsCfg = NULLP;
+   PUSCH_Config_t *puschCfg = NULLP;
+   struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
+   struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
+   struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
+   struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
+
+   FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
+
+   if(ulBwp->pusch_Config)
+   {
+      if(ulBwp->pusch_Config->choice.setup)
+      {
+         puschCfg=ulBwp->pusch_Config->choice.setup;
+         if(puschCfg->dataScramblingIdentityPUSCH)
+         {
+            if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+            {
+               FreePuschTimeDomAllocList(puschCfg);
+               dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+               if(dmrsUlCfg->choice.setup)
+               {
+                  if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+                  {
+                     if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+                     {
+                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
+                              sizeof(long));
+                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
+                              sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+                     }
+                     DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
+                           sizeof(long));
+                  }
+                  DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
+               }
+               DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
+                     sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
+            }
+            DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
+         }
+         DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+      }
+      DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
+
+      /* Free SRS-Config */
+      if(ulBwp->srs_Config)
+      {
+         if(ulBwp->srs_Config->choice.setup)
+         {
+            srsCfg = ulBwp->srs_Config->choice.setup;
+
+            /* Free Resource Set to add/mod list */
+            if(srsCfg->srs_ResourceSetToAddModList)
+            {
+               rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
+               if(rsrcSetList->list.array)
+               {
+                  rSetIdx = 0;
+
+                  /* Free SRS resource Id list in this SRS resource set */
+                  if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+                  {
+                     rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+
+                     if(rsrcIdList->list.array)
+                     {
+                        for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+                        {
+                           DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+                        }
+                        DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
+                     }
+                     DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+                           sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+                  }
+
+                  /* Free resource type info for this SRS resource set */
+                  DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+                        sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+
+                  /* Free memory for each resource set */
+                  for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+                  {
+                     DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+                  }
+                  DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); 
+               }
+               DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
+                     sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+            }
+
+            /* Free resource to add/modd list */
+            if(srsCfg->srs_ResourceToAddModList)
+            {
+               resourceList = srsCfg->srs_ResourceToAddModList;
+               if(resourceList->list.array)
+               {
+                  rsrcIdx = 0;
+                  DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
+                        sizeof(struct SRS_Resource__transmissionComb__n2));
+                  DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
+                        sizeof(struct SRS_Resource__resourceType__aperiodic));
+
+                  for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+                  {
+                     DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+                  }
+                  DU_FREE(resourceList->list.array, resourceList->list.size);
+               }
+               DU_FREE(srsCfg->srs_ResourceToAddModList, \
+                     sizeof(struct SRS_Config__srs_ResourceToAddModList));
+            }
+
+            DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+         }
+         DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+      }
+   }
+}      
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for initialUplinkBWP
+ *
+ * @details
+ *
+ *    Function : FreeinitialUplinkBWP
+ *
+ *    Functionality: Deallocating memory of initialUplinkBWP
+ *
+ * @params[in] UplinkConfig_t *ulCfg
+ *
+ * @return void
+ *         
+ *
+ * ****************************************************************/
+void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
+{
+   BWP_UplinkDedicated_t *ulBwp=NULLP; 
+   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+
+   if(ulCfg->initialUplinkBWP)
+   {
+      ulBwp=ulCfg->initialUplinkBWP;
+      if(ulCfg->firstActiveUplinkBWP_Id)
+      {
+        if(ulCfg->pusch_ServingCellConfig)
+        {
+           puschCfg=ulCfg->pusch_ServingCellConfig;
+           if(puschCfg->choice.setup)
+           {
+              if(puschCfg->choice.setup->ext1)
+              {
+                 DU_FREE(puschCfg->choice.setup->ext1->\
+                       processingType2Enabled,sizeof(BOOLEAN_t));
+                 DU_FREE(puschCfg->choice.setup->ext1->\
+                       maxMIMO_Layers,sizeof(long));
+                 DU_FREE(puschCfg->choice.setup->ext1, \
+                       sizeof(struct PUSCH_ServingCellConfig__ext1));
+              }
+              DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+           }
+           DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+        }
+        DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+      }
+      FreeInitialUlBWP(ulBwp);
+      DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+   }
+}
+/*******************************************************************
+ *
+ * @brief Frees emmory allocated for BWPDlDedPdschCfg
+ *
+ * @details
+ *
+ *    Function : FreeBWPDlDedPdschCfg
+ *
+ *    Functionality: Deallocating memory of BWPDlDedPdschCfg
+ *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return void
+ *
+ *
+ * ****************************************************************/
+void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
+{
+   struct PDSCH_Config *pdschCfg=NULLP;
+   struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
+   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
+   struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
+
+   if(dlBwp->pdsch_Config->choice.setup)
+   {
+      pdschCfg=dlBwp->pdsch_Config->choice.setup;
+      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+      {
+        if(pdschCfg->pdsch_TimeDomainAllocationList)
+        {
+           timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
+           if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
+           {
+              prbBndlType=&pdschCfg->prb_BundlingType;
+              DU_FREE(prbBndlType->choice.staticBundling,\
+                    sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
+              DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
+           }
+           FreePdschTimeDomAllocList(timeDomAllocList);
+           DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
+                 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
+        }
+        dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
+        if(dmrsDlCfg->choice.setup)
+        {
+           DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
+                 sizeof(long));
+           DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
+        }
+        DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
+              sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+      }
+      DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+   }
+}
+/*******************************************************************
+ *
+ * @brief Frees emmory allocated for BWPDlDedPdcchCfg
+ *
+ * @details
+ *
+ *    Function : FreeBWPDlDedPdcchCfg
+ *
+ *    Functionality: Deallocating memory of BWPDlDedPdcchCfg
+ *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return void
+ *         
+ *
+ * ****************************************************************/
+void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
+{
+   uint8_t idx1=0;
+   uint8_t idx2=0;
+   struct PDCCH_Config *pdcchCfg=NULLP;
+   struct ControlResourceSet *controlRSet=NULLP;
+   struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
+
+   if(dlBwp->pdcch_Config->choice.setup)
+   {
+      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
+      if(pdcchCfg->controlResourceSetToAddModList)
+      {
+        controlRSetList = pdcchCfg->controlResourceSetToAddModList;
+        if(controlRSetList->list.array)
+        {
+           controlRSet = controlRSetList->list.array[idx2];
+           if(controlRSet)
+           {
+              if(controlRSet->frequencyDomainResources.buf)
+              {
+                 if(controlRSet->pdcch_DMRS_ScramblingID)
+                 {
+                    if(pdcchCfg->searchSpacesToAddModList)
+                    {
+                       FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
+                       DU_FREE(pdcchCfg->searchSpacesToAddModList, \
+                             sizeof(struct PDCCH_Config__searchSpacesToAddModList));
+                    }
+                    DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
+                 }
+                 DU_FREE(controlRSet->frequencyDomainResources.buf, \
+                       controlRSet->frequencyDomainResources.size);
+              }
+           }
+           for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
+           {
+              DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
+           }
+           DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
+        }
+        DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
+              sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
+      }
+      DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
+   }
+}      
+
+/*******************************************************************
+ *
+ * @brief Free SCS specific carrier list in DL frequency info
+ *
+ * @details
+ *
+ *    Function : FreeScsSpecificCarrierListDl
+ *
+ *    Functionality: Free SCS specific carrier list in DL frequency info
+ *
+ * @params[in] Pointer to struct FrequencyInfoDL__scs_SpecificCarrierList
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeScsSpecificCarrierListDl(struct FrequencyInfoDL__scs_SpecificCarrierList *scsCarrierList)
+{
+   uint8_t listIdx = 0;
 
-   if(timeDomAllocList->choice.setup)
+   if(!scsCarrierList->list.array)
    {
-      if(timeDomAllocList->choice.setup->list.array)
+      for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
       {
-         for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
-         {
-            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1]->k0, sizeof(long));
-            DU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
-                  sizeof(struct PDSCH_TimeDomainResourceAllocation));
-         }
-         DU_FREE(timeDomAllocList->choice.setup->list.array, \
-               timeDomAllocList->choice.setup->list.size);
+         DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
       }
-      DU_FREE(timeDomAllocList->choice.setup,\
-            sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+      DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
    }
 }
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for PuschTimeDomAllocList
+ * @brief Free DL frequency info in DL config common
  *
- *@details
+ * @details
  *
- *    Function : FreePuschTimeDomAllocList
+ *    Function : FreeFreqInfoDl
  *
- *    Functionality: Deallocating memory of PuschTimeDomAllocList
+ *    Functionality: Free DL frequency info in DL config common
  *
- * @params[in] PUSCH_Config_t *puschCfg
+ * @params[in] Pointer to DownlinkConfigCommon_t
  *
  * @return void
  *
  * ****************************************************************/
-void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
+void FreeFreqInfoDl(FrequencyInfoDL_t *frequencyInfoDL)
 {
-   uint8_t rsrcListIdx=0;
-   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
+   uint8_t freqBandIdx = 0;
 
-   if(puschCfg->pusch_TimeDomainAllocationList)
+   /* SSB Absolute Frequency */
+   DU_FREE(frequencyInfoDL->absoluteFrequencySSB, sizeof(ARFCN_ValueNR_t));
+
+   /* NR Multi Frequency Band List */
+   if(frequencyInfoDL->frequencyBandList.list.array)
    {
-      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
-      if(timeDomAllocList_t->choice.setup)
+      for(freqBandIdx = 0; freqBandIdx < frequencyInfoDL->frequencyBandList.list.count; freqBandIdx++)
       {
-         if(timeDomAllocList_t->choice.setup->list.array)
-         {
-            for(rsrcListIdx = 0; rsrcListIdx<timeDomAllocList_t->choice.setup->list.count; rsrcListIdx++)
-            {
-               DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx]->k2, sizeof(long));
-               DU_FREE(timeDomAllocList_t->choice.setup->list.array[rsrcListIdx],\
-                     sizeof(PUSCH_TimeDomainResourceAllocation_t));
-            }
-            DU_FREE(timeDomAllocList_t->choice.setup->list.array, \
-                  timeDomAllocList_t->choice.setup->list.size);
-         }
-         DU_FREE(timeDomAllocList_t->choice.setup, \
-               sizeof(struct PUSCH_TimeDomainResourceAllocationList));
+         DU_FREE(frequencyInfoDL->frequencyBandList.list.array[freqBandIdx], sizeof(FreqBandIndicatorNR_t));
       }
-      DU_FREE(puschCfg->transformPrecoder, sizeof(long));
-      DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
-            sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
+      DU_FREE(frequencyInfoDL->frequencyBandList.list.array, frequencyInfoDL->frequencyBandList.list.size);
    }
 
+   /* Subcarrier Spacing specifc carrier List */
+   FreeScsSpecificCarrierListDl(&frequencyInfoDL->scs_SpecificCarrierList);
 }
 
 /*******************************************************************
  *
- * @brief Frees memory allocated for Dedicated PUCCH config
+ * @brief Free DL config common in Serving cell config common
  *
  * @details
  *
- *    Function : FreeBWPUlDedPucchCfg
+ *    Function : FreeDlConfigCommon
  *
- *    Functionality: Deallocating memory of Dedicated PUCCH cfg
+ *    Functionality: Free DL config common in Serving cell config common
  *
- * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
+ * @params[in] Pointer to DownlinkConfigCommon_t
  *
  * @return void
  *
  * ****************************************************************/
-void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
+void FreeDlConfigCommon(DownlinkConfigCommon_t *dlCfgCommon)
 {
-   uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
-   PUCCH_Config_t *pucchCfg = NULLP;
-   PUCCH_ResourceSet_t *rsrcSet = NULLP;
-   PUCCH_Resource_t *rsrc = NULLP;
-
-   if(ulBwpPucchCfg)
+   /* DL Frequency Info */
+   if(dlCfgCommon->frequencyInfoDL)
    {
-      if(ulBwpPucchCfg->choice.setup)
-      {
-         pucchCfg = ulBwpPucchCfg->choice.setup;
-
-         //Free resource set list
-         if(pucchCfg->resourceSetToAddModList)
-         {
-            if(pucchCfg->resourceSetToAddModList->list.array)
-            {
-               for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
-               {
-                  rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
-                  if(rsrcSet->resourceList.list.array)
-                  {
-                     for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
-                     {
-                        DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
-                     }
-                     DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
-                  }
-                  DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
-               }
-               DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
-            }
-            DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
-         }
+      FreeFreqInfoDl(dlCfgCommon->frequencyInfoDL);
+      DU_FREE(dlCfgCommon->frequencyInfoDL, sizeof(FrequencyInfoDL_t));
+   }
 
-         //Free resource list
-         if(pucchCfg->resourceToAddModList)
-         {
-            if(pucchCfg->resourceToAddModList->list.array)
-            {
-               for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
-               {
-                  rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
-                  DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
-                  DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
-               }
-               DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
-            }
-            DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
-         }
+   /* DL BWP config common */
+   if(dlCfgCommon->initialDownlinkBWP)
+   {
+      FreeBwpDlCommon(dlCfgCommon->initialDownlinkBWP);
+      DU_FREE(dlCfgCommon->initialDownlinkBWP, sizeof(BWP_DownlinkCommon_t));
+   }
+}
 
-         //PUCCH Format 1
-         if(pucchCfg->format1)
-         {
-            if(pucchCfg->format1->choice.setup)
-            {
-               DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
-               DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
-            }
-            DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
-         }
-         
-         //DL DATA TO UL ACK
-         if(pucchCfg->dl_DataToUL_ACK)
-         {
-            if(pucchCfg->dl_DataToUL_ACK->list.array)
-            {
-               for(k1Idx = 0; k1Idx <  pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
-               {
-                  DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
-               }
-               DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
-            }
-            DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
-         }
+/*******************************************************************
+ *
+ * @brief Free SCS specific carrier list in UL frequency Info
+ *
+ * @details
+ *
+ *    Function : FreeScsSpecificCarrierListUl
+ *
+ *    Functionality: Free SCS specific carrier list in UL frequency Info
+ *
+ * @params[in] Pointer to struct FrequencyInfoUL__scs_SpecificCarrierList
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeScsSpecificCarrierListUl(struct FrequencyInfoUL__scs_SpecificCarrierList *scsCarrierList)
+{
+   uint8_t listIdx = 0;
 
-         DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
+   if(scsCarrierList->list.array)
+   {
+      for(listIdx = 0; listIdx < scsCarrierList->list.count; listIdx++)
+      {
+         DU_FREE(scsCarrierList->list.array[listIdx], sizeof(SCS_SpecificCarrier_t));
       }
-      DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+      DU_FREE(scsCarrierList->list.array, scsCarrierList->list.size);
    }
 }
 
 /*******************************************************************
  *
- * @brief Frees memory allocated for InitialUlBWP
+ * @brief Free frequency info in UL config common
  *
  * @details
  *
- *    Function : FreeInitialUlBWP
+ *    Function : FreeFreqInfoUl
  *
- *    Functionality: Deallocating memory of InitialUlBWP
+ *    Functionality: Free frequency info in UL config common
  *
- * @params[in] BWP_UplinkDedicated_t *ulBwp
+ * @params[in] Pointer to FrequencyInfoUL_t
  *
  * @return void
  *
  * ****************************************************************/
-void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+void FreeFreqInfoUl(FrequencyInfoUL_t *frequencyInfoUL)
 {
-   uint8_t  rSetIdx, rsrcIdx;
-   SRS_Config_t   *srsCfg = NULLP;
-   PUSCH_Config_t *puschCfg = NULLP;
-   struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
-   struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
-   struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
-   struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
-
-   FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
+   uint8_t listIdx= 0;
 
-   if(ulBwp->pusch_Config)
+   /* NR Multi Frequency Band List */
+   if(!frequencyInfoUL->frequencyBandList)
    {
-      if(ulBwp->pusch_Config->choice.setup)
+      if(frequencyInfoUL->frequencyBandList->list.array)
       {
-         puschCfg=ulBwp->pusch_Config->choice.setup;
-         if(puschCfg->dataScramblingIdentityPUSCH)
+         for(listIdx = 0; listIdx < frequencyInfoUL->frequencyBandList->list.count; listIdx++)
          {
-            if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
-            {
-               FreePuschTimeDomAllocList(puschCfg);
-               dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
-               if(dmrsUlCfg->choice.setup)
-               {
-                  if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
-                  {
-                     if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
-                     {
-                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
-                              sizeof(long));
-                        DU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
-                              sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
-                     }
-                     DU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
-                           sizeof(long));
-                  }
-                  DU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
-               }
-               DU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
-                     sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
-            }
-            DU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
+            DU_FREE(frequencyInfoUL->frequencyBandList->list.array[listIdx], sizeof(FreqBandIndicatorNR_t));
          }
-         DU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+         DU_FREE(frequencyInfoUL->frequencyBandList->list.array, frequencyInfoUL->frequencyBandList->list.size);
       }
-      DU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
-
-      /* Free SRS-Config */
-      if(ulBwp->srs_Config)
-      {
-         if(ulBwp->srs_Config->choice.setup)
-         {
-            srsCfg = ulBwp->srs_Config->choice.setup;
-
-            /* Free Resource Set to add/mod list */
-            if(srsCfg->srs_ResourceSetToAddModList)
-            {
-               rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
-               if(rsrcSetList->list.array)
-               {
-                  rSetIdx = 0;
-
-                  /* Free SRS resource Id list in this SRS resource set */
-                  if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
-                  {
-                     rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
-
-                     if(rsrcIdList->list.array)
-                     {
-                        for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
-                        {
-                           DU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
-                        }
-                        DU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
-                     }
-                     DU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
-                           sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
-                  }
+      DU_FREE(frequencyInfoUL->frequencyBandList, sizeof(MultiFrequencyBandListNR_t));
+   }
 
-                  /* Free resource type info for this SRS resource set */
-                  DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
-                        sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+   /* Absolute frequency point A */
+   DU_FREE(frequencyInfoUL->absoluteFrequencyPointA, sizeof(ARFCN_ValueNR_t));
 
-                  /* Free memory for each resource set */
-                  for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
-                  {
-                     DU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
-                  }
-                  DU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); 
-               }
-               DU_FREE(srsCfg->srs_ResourceSetToAddModList, \
-                     sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
-            }
+   /* Subcarrier Spacing specifc carrier */
+   FreeScsSpecificCarrierListUl(&frequencyInfoUL->scs_SpecificCarrierList);
 
-            /* Free resource to add/modd list */
-            if(srsCfg->srs_ResourceToAddModList)
-            {
-               resourceList = srsCfg->srs_ResourceToAddModList;
-               if(resourceList->list.array)
-               {
-                  rsrcIdx = 0;
-                  DU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
-                        sizeof(struct SRS_Resource__transmissionComb__n2));
-                  DU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
-                        sizeof(struct SRS_Resource__resourceType__aperiodic));
+   /* P-MAX */
+   DU_FREE(frequencyInfoUL->p_Max, sizeof(P_Max_t));
+}
 
-                  for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
-                  {
-                     DU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
-                  }
-                  DU_FREE(resourceList->list.array, resourceList->list.size);
-               }
-               DU_FREE(srsCfg->srs_ResourceToAddModList, \
-                     sizeof(struct SRS_Config__srs_ResourceToAddModList));
-            }
+/*******************************************************************
+ *
+ * @brief Free UL config common in Serving cell config common
+ *
+ * @details
+ *
+ *    Function : FreeUlConfigCommon
+ *
+ *    Functionality: Free UL config common in Serving cell config common
+ *
+ * @params[in] Pointer to UplinkConfigCommon_t
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeUlConfigCommon(UplinkConfigCommon_t *ulCfgCommon)
+{
+   /* UL Frequency Info */
+   if(ulCfgCommon->frequencyInfoUL)
+   {
+      FreeFreqInfoUl(ulCfgCommon->frequencyInfoUL);
+      DU_FREE(ulCfgCommon->frequencyInfoUL, sizeof(FrequencyInfoUL_t));
+   }
 
-            DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
-         }
-         DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
-      }
+   /* UL BWP common */
+   if(ulCfgCommon->initialUplinkBWP)
+   {
+      FreeBwpUlCommon(ulCfgCommon->initialUplinkBWP);
+      DU_FREE(ulCfgCommon->initialUplinkBWP, sizeof(BWP_UplinkCommon_t));
    }
-}      
+}
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for initialUplinkBWP
+ * @brief Free SP cell config common in Reconfig with Sync
  *
  * @details
  *
- *    Function : FreeinitialUplinkBWP
+ *    Function : FreeSpCellConfigCommon
  *
- *    Functionality: Deallocating memory of initialUplinkBWP
+ *    Functionality: Free SP cell config common in Reconfig with Sync
  *
- * @params[in] UplinkConfig_t *ulCfg
+ * @params[in] Pointer to ServingCellConfigCommon_t
  *
  * @return void
- *         
  *
  * ****************************************************************/
-void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
+void FreeSpCellConfigCommon(ServingCellConfigCommon_t *spCellConfigCommon)
 {
-   BWP_UplinkDedicated_t *ulBwp=NULLP; 
-   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+   /* Free Physical cell identity */
+   DU_FREE(spCellConfigCommon->physCellId, sizeof(PhysCellId_t));
 
-   if(ulCfg->initialUplinkBWP)
+   /* Free Downlink Config common */
+   if(spCellConfigCommon->downlinkConfigCommon)
    {
-      ulBwp=ulCfg->initialUplinkBWP;
-      if(ulCfg->firstActiveUplinkBWP_Id)
-      {
-        if(ulCfg->pusch_ServingCellConfig)
-        {
-           puschCfg=ulCfg->pusch_ServingCellConfig;
-           if(puschCfg->choice.setup)
-           {
-              if(puschCfg->choice.setup->ext1)
-              {
-                 DU_FREE(puschCfg->choice.setup->ext1->\
-                       processingType2Enabled,sizeof(BOOLEAN_t));
-                 DU_FREE(puschCfg->choice.setup->ext1->\
-                       maxMIMO_Layers,sizeof(long));
-                 DU_FREE(puschCfg->choice.setup->ext1, \
-                       sizeof(struct PUSCH_ServingCellConfig__ext1));
-              }
-              DU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
-           }
-           DU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
-        }
-        DU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
-      }
-      FreeInitialUlBWP(ulBwp);
-      DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+      FreeDlConfigCommon(spCellConfigCommon->downlinkConfigCommon);
+      DU_FREE(spCellConfigCommon->downlinkConfigCommon, sizeof(DownlinkConfigCommon_t));
    }
+
+   /* Free Uplink Config common */
+   if(spCellConfigCommon->uplinkConfigCommon)
+   {
+      FreeUlConfigCommon(spCellConfigCommon->uplinkConfigCommon);
+      DU_FREE(spCellConfigCommon->uplinkConfigCommon, sizeof(UplinkConfigCommon_t));
+   }
+
+   /* Free Timing Advance offset */
+   DU_FREE(spCellConfigCommon->n_TimingAdvanceOffset, sizeof(long));
+
+   /* Free SSB Position in Burst */
+   if(spCellConfigCommon->ssb_PositionsInBurst)
+   {
+      DU_FREE(spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.buf, \
+         spCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap.size);
+      DU_FREE(spCellConfigCommon->ssb_PositionsInBurst, sizeof(struct ServingCellConfigCommon__ssb_PositionsInBurst));
+   }
+
+   /* Free SSB Periodicity in Serving cell */
+   DU_FREE(spCellConfigCommon->ssb_periodicityServingCell, sizeof(long));
+
+   /* Free SSB subcarrier spacing */
+   DU_FREE(spCellConfigCommon->ssbSubcarrierSpacing, sizeof(SubcarrierSpacing_t));
+
+   /* TDD UL-DL configuration common */
+   DU_FREE(spCellConfigCommon->tdd_UL_DL_ConfigurationCommon, sizeof(TDD_UL_DL_ConfigCommon_t));
 }
+
 /*******************************************************************
  *
- * @brief Frees emmory allocated for BWPDlDedPdschCfg
+ * @brief Free dedicated RACH configuration in Reconfiguration with sync
  *
  * @details
  *
- *    Function : FreeBWPDlDedPdschCfg
+ *    Function : FreeRecfgWithSync
  *
- *    Functionality: Deallocating memory of BWPDlDedPdschCfg
+ *    Functionality:
+ *       Free dedicated RACH configuration in Reconfiguration with sync
  *
- * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ * @params[in] Pinter to Rach config dedicated struct
  *
  * @return void
  *
- *
  * ****************************************************************/
-void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
+void FreeRachConfigDedicated(struct ReconfigurationWithSync__rach_ConfigDedicated *rachCfgDed)
 {
-   struct PDSCH_Config *pdschCfg=NULLP;
-   struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
-   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
-   struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
+   uint8_t listIdx = 0;
+   CFRA_t *cfra = NULLP;
+   struct CFRA__resources__ssb *ssbResource = NULLP;
 
-   if(dlBwp->pdsch_Config->choice.setup)
+   /* Uplink */
+   if(rachCfgDed->choice.uplink)
    {
-      pdschCfg=dlBwp->pdsch_Config->choice.setup;
-      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+      /* CFRA : Contention free Random Access */
+      if(rachCfgDed->choice.uplink->cfra)
       {
-        if(pdschCfg->pdsch_TimeDomainAllocationList)
-        {
-           timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
-           if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
-           {
-              prbBndlType=&pdschCfg->prb_BundlingType;
-              DU_FREE(prbBndlType->choice.staticBundling,\
-                    sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
-              DU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
-           }
-           FreePdschTimeDomAllocList(timeDomAllocList);
-           DU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
-                 sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
-        }
-        dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
-        if(dmrsDlCfg->choice.setup)
-        {
-           DU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
-                 sizeof(long));
-           DU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
-        }
-        DU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
-              sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+         cfra = rachCfgDed->choice.uplink->cfra;
+
+         /* CFRA occassions */
+         if(cfra->occasions)
+         {
+            /* CFRA occassions : SSB per RACH occasion */
+            DU_FREE(cfra->occasions->ssb_perRACH_Occasion, sizeof(long));
+            DU_FREE(cfra->occasions, sizeof(struct CFRA__occasions));
+         }
+
+         /* CFRA resource */
+         cfra->resources.present = CFRA__resources_PR_ssb;
+
+         /* CFRA resource : SSB */
+         if(cfra->resources.choice.ssb)
+         {
+            ssbResource = cfra->resources.choice.ssb;
+
+            /* CFRA SSB resource list */
+            if(ssbResource->ssb_ResourceList.list.array)
+            {
+               for(listIdx = 0; listIdx < ssbResource->ssb_ResourceList.list.count; listIdx++)
+               {
+                  DU_FREE(ssbResource->ssb_ResourceList.list.array[listIdx], sizeof(CFRA_SSB_Resource_t));
+               }
+               DU_FREE(ssbResource->ssb_ResourceList.list.array, ssbResource->ssb_ResourceList.list.size);
+            }
+            DU_FREE(cfra->resources.choice.ssb, sizeof(struct CFRA__resources__ssb));
+         }
+         DU_FREE(rachCfgDed->choice.uplink->cfra, sizeof(CFRA_t));
       }
-      DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+      DU_FREE(rachCfgDed->choice.uplink, sizeof(RACH_ConfigDedicated_t));
    }
 }
+
 /*******************************************************************
  *
- * @brief Frees emmory allocated for BWPDlDedPdcchCfg
+ * @brief Frees reconfiguration with sync in SP cell config
  *
  * @details
  *
- *    Function : FreeBWPDlDedPdcchCfg
+ *    Function : FreeRecfgWithSync
  *
- *    Functionality: Deallocating memory of BWPDlDedPdcchCfg
+ *    Functionality: Fress reconfiguration with sync in SP cell config
  *
- * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ * @params[in] Pointer to ReconfigurationWithSync_t
  *
  * @return void
- *         
  *
  * ****************************************************************/
-void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
+void FreeRecfgWithSync(ReconfigurationWithSync_t *recfgWithSync)
 {
-   uint8_t idx1=0;
-   uint8_t idx2=0;
-   struct PDCCH_Config *pdcchCfg=NULLP;
-   struct ControlResourceSet *controlRSet=NULLP;
-   struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
+   /* Free SP Cell config common */
+   if(recfgWithSync->spCellConfigCommon)
+   {
+      FreeSpCellConfigCommon(recfgWithSync->spCellConfigCommon);
+      DU_FREE(recfgWithSync->spCellConfigCommon, sizeof(ServingCellConfigCommon_t));
+   }
 
-   if(dlBwp->pdcch_Config->choice.setup)
+   /* Free Dedicated RACH configuration */
+   if(recfgWithSync->rach_ConfigDedicated)
    {
-      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
-      if(pdcchCfg->controlResourceSetToAddModList)
-      {
-        controlRSetList = pdcchCfg->controlResourceSetToAddModList;
-        if(controlRSetList->list.array)
-        {
-           controlRSet = controlRSetList->list.array[idx2];
-           if(controlRSet)
-           {
-              if(controlRSet->frequencyDomainResources.buf)
-              {
-                 if(controlRSet->pdcch_DMRS_ScramblingID)
-                 {
-                    if(pdcchCfg->searchSpacesToAddModList)
-                    {
-                       FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
-                       DU_FREE(pdcchCfg->searchSpacesToAddModList, \
-                             sizeof(struct PDCCH_Config__searchSpacesToAddModList));
-                    }
-                    DU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
-                 }
-                 DU_FREE(controlRSet->frequencyDomainResources.buf, \
-                       controlRSet->frequencyDomainResources.size);
-              }
-           }
-           for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
-           {
-              DU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
-           }
-           DU_FREE(controlRSetList->list.array, controlRSetList->list.size);
-        }
-        DU_FREE(pdcchCfg->controlResourceSetToAddModList, \
-              sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
-      }
-      DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
+      FreeRachConfigDedicated(recfgWithSync->rach_ConfigDedicated);
+      DU_FREE(recfgWithSync->rach_ConfigDedicated, sizeof(struct ReconfigurationWithSync__rach_ConfigDedicated));
    }
-}      
+}
 
 /*******************************************************************
  *
@@ -6978,11 +8013,46 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
                macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
                if(rlcConfig)
                {
-                  if(rlcConfig->choice.am)
+                  switch(rlcConfig->present)
                   {
-                     DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
-                     DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
-                     DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+                     case RLC_Config_PR_am:
+                        {
+                           if(rlcConfig->choice.am)
+                           {
+                              DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
+                              DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
+                              DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+                           }
+                           break;
+                        }
+                     case RLC_Config_PR_um_Bi_Directional:
+                        {
+                           if(rlcConfig->choice.um_Bi_Directional)
+                           {
+                              DU_FREE(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t)); 
+                              DU_FREE(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+                              DU_FREE(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
+                           }
+                           break;
+                        }
+                     case RLC_Config_PR_um_Uni_Directional_UL:
+                        {
+                           if(rlcConfig->choice.um_Uni_Directional_UL)
+                           {
+                              DU_FREE(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+                              DU_FREE(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
+                           }
+                           break;
+                        }
+                     case RLC_Config_PR_um_Uni_Directional_DL:
+                        {
+                           if(rlcConfig->choice.um_Uni_Directional_DL )
+                           {
+                              DU_FREE(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+                              DU_FREE(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
+                           }
+                           break;
+                        }
                   }    
                   DU_FREE(rlcConfig, sizeof(struct RLC_Config));
                }
@@ -7032,6 +8102,7 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
       }
       if(macCellGrpCfg->bsr_Config)
       {
+         DU_FREE(macCellGrpCfg->bsr_Config->logicalChannelSR_DelayTimer, sizeof(long));
          DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
       }
       tagConfig = macCellGrpCfg->tag_Config;
@@ -7073,61 +8144,74 @@ uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
    spCellCfg = cellGrpCfg->spCellConfig;
    if(spCellCfg)
    {
-      if(spCellCfg->servCellIndex)
+      /* Free serving cell index */
+      DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+
+      /* Free Reconfiguration with sync */
+      if(spCellCfg->reconfigurationWithSync)
+      {
+         FreeRecfgWithSync(spCellCfg->reconfigurationWithSync);
+         DU_FREE(spCellCfg->reconfigurationWithSync, sizeof(ReconfigurationWithSync_t));
+      }
+
+      /* Free rlmInSyncOutOfSyncThreshold */
+      DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+
+      /* Free SP Cell config dedicated */
+      if(spCellCfg->spCellConfigDedicated)
       {
-         if(spCellCfg->rlmInSyncOutOfSyncThreshold)
+         srvCellCfg = spCellCfg->spCellConfigDedicated;
+
+         /* Free TDD UL-DL config dedicated */
+         DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
+
+         /* Free Initial Downlink BWP */
+         if(srvCellCfg->initialDownlinkBWP)
          {
-            if(spCellCfg->spCellConfigDedicated)
+            dlBwp = srvCellCfg->initialDownlinkBWP;
+
+            /* Free DL BWP PDCCH Config */
+            if(dlBwp->pdcch_Config)
             {
-               srvCellCfg = spCellCfg->spCellConfigDedicated;
-               if(srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
-               {
-                  if(srvCellCfg->initialDownlinkBWP)
-                  {
-                     dlBwp = srvCellCfg->initialDownlinkBWP;
-                     if(srvCellCfg->firstActiveDownlinkBWP_Id)
-                     {
-                        if(srvCellCfg->defaultDownlinkBWP_Id)
-                        {
-                           if(srvCellCfg->uplinkConfig)
-                           {
-                              if(srvCellCfg->pdsch_ServingCellConfig)
-                              {
-                                 pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
-                                 if(pdschCfg->choice.setup)
-                                 {
-                                    DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
-                                    DU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
-                                 }
-                                 DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct
-                                          ServingCellConfig__pdsch_ServingCellConfig));
-                              }  
-                              FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
-                              DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));       
-                           }
-                           DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
-                        }
-                        DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
-                     }
-                     if(dlBwp->pdcch_Config)
-                     {
-                        if(dlBwp->pdsch_Config)
-                        {
-                           FreeBWPDlDedPdschCfg(dlBwp);
-                           DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
-                        }
-                        FreeBWPDlDedPdcchCfg(dlBwp);
-                        DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
-                     }
-                     DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
-                  }
-                  DU_FREE(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
-               }
-               DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+               FreeBWPDlDedPdcchCfg(dlBwp);
+               DU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
+            }
+
+            /* Free DL BWP PDSCH config */
+            if(dlBwp->pdsch_Config)
+            {
+               FreeBWPDlDedPdschCfg(dlBwp);
+               DU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
+            }
+            DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+         }
+
+         /* Free First Active Downlink BWP */
+         DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+
+         /* Free Default downlink BWP */
+         DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+
+         /* Free Uplink config */
+         if(srvCellCfg->uplinkConfig)
+         {
+            FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
+            DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t)); 
+         }
+
+         /* Free PDSCH serving cell config */
+         if(srvCellCfg->pdsch_ServingCellConfig)
+         {
+            pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
+            if(pdschCfg->choice.setup)
+            {
+               DU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
+               DU_FREE(pdschCfg->choice.setup, sizeof(struct PDSCH_ServingCellConfig));
             }
-            DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+            DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
          }
-         DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+
+         DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
       }
       DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
    }
@@ -11920,9 +13004,9 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t   *ueSetReq)
 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
 {
    int8_t ueIdx = -1;
-   uint8_t  ret=0, ieIdx=0, ieExtIdx = 0, cellIdx=0, servCellIdx = 0;
+   uint8_t  ret=0, ieIdx=0, ieExtIdx = 0, servCellIdx = 0;
    bool ueCbFound = false, hoInProgress = false;
-   uint16_t nrCellId = 0;
+   uint16_t nrCellId = 0,  cellIdx=0;
    uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
    DuUeCb   *duUeCb = NULL;
    UEContextSetupRequest_t   *ueSetReq = NULL;
@@ -12018,6 +13102,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
                   duUeCb->f1UeDb = NULL;
                   duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
                   duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
+                  GET_CRNTI(duUeCb->crnti, duUeCb->gnbDuUeF1apId);
                   duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
                }
 
@@ -12566,7 +13651,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
 
       ueSetRsp =
          &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
-      elementCnt = 4;
+      elementCnt = 5;
       ueSetRsp->protocolIEs.list.count = elementCnt;
       ueSetRsp->protocolIEs.list.size = \
                                         elementCnt * sizeof(UEContextSetupResponse_t *);
@@ -12626,6 +13711,14 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
                                                             UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
       BuildCellGroupConfigRrc(ueCb, &ueSetRsp->protocolIEs.list.array[idx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
 
+      /* CRNTI */
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id  = ProtocolIE_ID_id_C_RNTI;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present = UEContextSetupResponseIEs__value_PR_C_RNTI;
+      ueSetRsp->protocolIEs.list.array[idx]->value.choice.C_RNTI = ueCb->crnti; 
+
+
       /* Drb Setup List */
       idx++;
       ueSetRsp->protocolIEs.list.array[idx]->id  = \
@@ -12710,12 +13803,20 @@ uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
    {
       case UE_CTXT_SETUP:
          {
-            BuildAndSendUeContextSetupRsp(cellId,ueId);
+            if((BuildAndSendUeContextSetupRsp(cellId,ueId)) != ROK)
+            {
+               DU_LOG("\nERROR  -->  F1AP : Failed at BuildAndSendUeContextSetupRsp()");
+               return RFAILED;
+            }
             break;
          }
       case UE_CTXT_MOD:
          {
-            BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1]);
+            if((BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1])) != ROK)
+            {
+               DU_LOG("\nERROR  -->  F1AP : Failed at BuildAndSendUeContextModRsp");
+               return RFAILED;
+            }
             break;
          }
       default:
@@ -14239,32 +15340,29 @@ uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
          BuildCellGroupConfigRrc(ueCb, &ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
       }
 
-      if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || (ueCb->f1UeDb->actionType == UE_CTXT_MOD))
+      if((ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY) || ((ueCb->f1UeDb->actionType == UE_CTXT_MOD) && (ueCb->f1UeDb->duUeCfg.numDrbSetupMod)))
       { 
-         if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+         ieIdx++;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                           UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
+         if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
          {
-            ieIdx++;
-            ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_SetupMod_List;
-            ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-            ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                              UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List;
-            if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
+            for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
             {
-               for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
+               if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
                {
-                  if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
-                  {
-                     memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
-                  }
+                  memcpy(&ueCb->f1UeDb->duUeCfg.upTnlInfo[ueCb->f1UeDb->duUeCfg.numDrbSetupMod++], duCb.upTnlCfg[tnlIdx], sizeof(UpTnlCfg));
                }
             }
-            ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
-                     value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
-            if(ret != ROK)
-            {
-               DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
-               break;
-            }
+         }
+         ret = BuildDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
+                  value.choice.DRBs_SetupMod_List) , &ueCb->f1UeDb->duUeCfg);
+         if(ret != ROK)
+         {
+            DU_LOG( "\nERROR  -->  F1AP : Failed to build DRB setupmod List ");
+            break;
          }
       }
 
@@ -15419,7 +16517,7 @@ void freeAperDecodePagingMsg(Paging_t   *paging)
 uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg) 
 {
    uint8_t ieIdx = 0, cellListIdx = 0;
-   uint16_t cellId = 0, cellIdx = 0;
+   uint16_t cellId = 0;
    Paging_t   *paging = NULLP;
    PagingCell_list_t  *pagingCelllist = NULLP;
    PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
@@ -15448,7 +16546,7 @@ uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
                   case ProtocolIE_ID_id_UEIdentityIndexValue:
                      {
                         bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
-                                         &tmpPagingParam->ueId);
+                                         &tmpPagingParam->pagUeId);
                         break;
                      }
 
@@ -15504,19 +16602,9 @@ uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg)
                                  pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellListIdx];
                                  pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
                                  bitStringToInt(&pagingCellItem->nRCGI.nRCellIdentity, &cellId);
-                                 GET_CELL_IDX(cellId, cellIdx);
-                                 if(duCb.actvCellLst[cellIdx])
-                                 {
-                                    /* fill Ue Paging information*/
-                                    if(FillPagingInfoInCellCb(duCb.actvCellLst[cellIdx], tmpPagingParam)!= ROK)
-                                    {
-                                       DU_LOG("\nERROR  --> DU APP : CellCb:%d not present to fill UE Paging Information",cellIdx);
-                                       continue;
-                                    }
-                                 }
-                                 else
+                                 if(processPagingMsg(cellId, tmpPagingParam) != ROK)
                                  {
-                                    DU_LOG("\nERROR  --> F1AP : CellId:%d Not in Activelist",cellId);
+                                    DU_LOG("\nERROR  --> DU APP : Paging Processing Failed at CellId:%d",cellId);
                                     continue;
                                  }
                               }