Merge "[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-435] Memory related Fixes in CU stub...
[o-du/l2.git] / src / du_app / du_f1ap_msg_hdl.c
index ca02b47..63630e6 100644 (file)
 
 /* This file contains F1AP message handler functions */
 #include "common_def.h"
+#include "ckw.h"
+#include "ckw.x"
+#include "kwu.h"
+#include "kwu.x"
+#include "lkw.h"
 #include "lrg.h"
 #include "legtp.h"
 #include "lkw.x"
 #include "lrg.x"
+#include "F1AP-PDU.h"
 #include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_app_rlc_inf.h"
 #include "du_mgr_main.h"
+#include "du_mgr.h"
 #include "du_utils.h"
+#include "du_ue_mgr.h"
 #include "RAT-Type.h"
 #include "FeatureSetUplinkPerCC.h"
 #include "FeatureSetDownlinkPerCC.h"
@@ -62,6 +70,7 @@
 #include "DMRS-DownlinkConfig.h"
 #include "PDSCH-Config.h"
 #include "BWP-DownlinkDedicated.h"
+#include "BWP-Downlink.h"
 #include "PUSCH-TimeDomainResourceAllocation.h"
 #include "PUSCH-TimeDomainResourceAllocationList.h"
 #include "DMRS-UplinkConfig.h"
 #include "SchedulingRequestResourceConfig.h"
 #include<ProtocolIE-Field.h>
 #include "ProtocolExtensionField.h"
-#include "F1AP-PDU.h"
 #include "odu_common_codec.h"
 #include "du_mgr.h"
 #include "du_cell_mgr.h"
 #include "du_f1ap_msg_hdl.h"
+#include "DRBs-Setup-Item.h"
+#include "DLUPTNLInformation-ToBeSetup-List.h"
+#include "DLUPTNLInformation-ToBeSetup-Item.h"
+#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"
+
+#ifdef O1_ENABLE
+#include "CmInterface.h"
+extern StartupConfig g_cfg;
+#endif
 
 DuCfgParams duCfgParam;
 
+/******************************************************************
+ *
+ * @brief Function to fetch lcId based on DRB Id
+ *
+ * @details
+ *
+ *    Function : fetchLcId
+ *
+ *    @params[in] drbId
+ *
+ *    Functionality: Function to fetch lcId based on DRB Id
+ *
+ * Returns: lcId - SUCCESS
+ *          RFAILED - FAILURE
+ *****************************************************************/
+
+uint8_t fetchLcId(uint8_t drbId)
+{
+   uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
+
+   for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+   {
+      for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+      {
+         if(duCb.actvCellLst[cellIdx] != NULLP)
+         {
+            numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs;
+            for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
+            {
+               if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId && \
+                  duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbType == RB_TYPE_DRB)
+               {
+                  lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId;
+                  return lcId;
+               }
+            }
+         }
+      }
+   }
+   DU_LOG("\nERROR   -->  DU_APP: fetchLcId() failed for drbId %d", drbId);
+   return RFAILED;
+}
+
+/*******************************************************************
+*
+* @brief Adding F1AP pdu to reserved pdu list
+*
+* @details
+*
+*    Function : addToReservedF1apPduList 
+*
+*    Functionality: Adding F1AP pdu to reserved pdu list.
+*     These pdu are awaiting aknowledgment from CU
+*
+* @params[in] uint8_t transId, F1AP_PDU_t *f1apMsg
+*
+* @return ROK - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+void addToReservedF1apPduList(uint8_t transId, F1AP_PDU_t *f1apPdu)
+{
+   CmLList         *node = NULLP;
+   ReservedF1apPduInfo *pduInfo = NULLP;
+   DU_ALLOC(pduInfo, sizeof(ReservedF1apPduInfo));
+   if(pduInfo)
+   {
+      DU_ALLOC(node, sizeof(CmLList));
+      if(node)
+      {
+         pduInfo->transId = transId;
+         pduInfo->f1apMsg = (void*) f1apPdu;
+
+         node->node = (PTR)pduInfo;
+         cmLListAdd2Tail(&duCb.reservedF1apPduList, node);
+      }
+   }
+}
+
+/*******************************************************************
+*
+* @brief searching for F1AP pdu from ReservedF1apPduList 
+*
+* @details
+*
+*    Function : searchFromReservedF1apPduList 
+*
+*    Functionality: searching for F1AP pdu information
+*
+* @params[in] uint8_t transId
+*
+* @return pointer to F1AP_PDU_t
+*
+* ****************************************************************/
+
+CmLList *searchFromReservedF1apPduList(uint8_t transId)
+{
+   CmLList         *node;
+   ReservedF1apPduInfo *f1apPdu;
+   if(duCb.reservedF1apPduList.count)
+   {
+      CM_LLIST_FIRST_NODE(&duCb.reservedF1apPduList, node);
+      while(node)
+      {
+         f1apPdu = (ReservedF1apPduInfo*)node->node;
+         if(f1apPdu->transId == transId)
+         {
+            return node;
+         }
+         node = node->next;
+      }
+   }
+   return NULL;
+}
+
+/*******************************************************************
+*
+* @brief deleting F1AP pdu information from ReservedF1apPduList
+*
+* @details
+*
+*    Function : deleteFromReservedF1apPduList 
+*
+*    Functionality: deleting pdu information from ReservedF1apPduList
+*
+* @params[in] CmLList *node 
+*
+* @return void 
+*
+* ****************************************************************/
+
+void deleteFromReservedF1apPduList(CmLList *node)
+{
+   ReservedF1apPduInfo *f1apPdu;
+
+   if(node != NULL)
+   {
+      f1apPdu = (ReservedF1apPduInfo *)node->node;
+      cmLListDelFrm(&duCb.reservedF1apPduList, node);
+      DU_FREE(f1apPdu, sizeof(ReservedF1apPduInfo));
+      DU_FREE(node, sizeof(CmLList));
+      node = NULL;
+   }
+}
+
 /*******************************************************************
  *
  * @brief Builds Uplink Info for NR 
@@ -202,7 +371,7 @@ uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
 S16 BuildNrCellId(BIT_STRING_t *nrcell)
 {
    memset(nrcell->buf, 0, nrcell->size);
-   nrcell->buf[4]   = 16
+   nrcell->buf[4]   = duCfgParam.sib1Params.cellIdentity
    nrcell->bits_unused = 4;
    return ROK;
 }
@@ -284,6 +453,89 @@ uint8_t BuildFiveGSTac(Served_Cell_Information_t *servcell)
    servcell->fiveGS_TAC->buf[2] = duCfgParam.srvdCellLst[0].duCellInfo.tac;
    return ROK;  
 }
+
+/*******************************************************************
+ *
+ * @brief fill nr frequency information
+ *
+ * @details
+ *
+ *    Function : fillNrTddInfo 
+ *
+ *    Functionality: fill nr frequency information
+ *
+ * @params[in] NRFreqInfo_t freqInfo
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillNrTddInfo(TDD_Info_t *tddInfo)
+{
+   uint8_t elementCnt = 1, freqBandListIdx = 0, supportedBandIdx = 0;
+   NRFreqInfo_t *freqInfo = NULLP;
+
+   if(tddInfo == NULLP)
+   {
+      DU_LOG("\nERROR  --> DU APP : Null pointer received at fillNrTddInfo");
+      return RFAILED;
+   }
+   
+   freqInfo = &tddInfo->nRFreqInfo;
+   freqInfo->nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.nrArfcn; 
+
+   freqInfo->freqBandListNr.list.count = elementCnt; 
+   freqInfo->freqBandListNr.list.size = freqInfo->freqBandListNr.list.count  * sizeof(FreqBandNrItem_t *);
+   DU_ALLOC(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
+   if(!freqInfo->freqBandListNr.list.array)
+   {
+      DU_LOG("\nERROR  --> DU APP : Memory allocation failed at fillNrTddInfo");
+      return RFAILED;
+   }
+
+   for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
+   {
+      DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx],  sizeof(FreqBandNrItem_t ));
+      if(!freqInfo->freqBandListNr.list.array[freqBandListIdx])
+      {
+         DU_LOG("\nERROR  --> DU APP : Memory allocation failed at fillNrTddInfo");
+         return RFAILED;
+      }
+
+      freqInfo->freqBandListNr.list.array[freqBandListIdx]->freqBandIndicatorNr = duCfgParam.srvdCellLst[0].duCellInfo.\
+      f1Mode.mode.tdd.nrFreqInfo.freqBand[0].nrFreqBand;
+      freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count = elementCnt;
+      freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size = freqInfo->freqBandListNr.list.array[freqBandListIdx]->\
+      supportedSULBandList.list.count * sizeof(SupportedSULFreqBandItem_t*);
+
+      DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
+            freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
+      if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
+      {
+         DU_LOG("\nERROR  --> DU APP : Memory allocation failed at fillNrTddInfo");
+         return RFAILED;
+      }
+
+      for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
+      {
+         DU_ALLOC(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
+               sizeof(SupportedSULFreqBandItem_t));
+         if(!freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx])
+         {
+            DU_LOG("\nERROR  --> DU APP : Memory allocation failed at fillNrTddInfo");
+            return RFAILED;
+         }
+
+         freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx]->freqBandIndicatorNr =\
+         duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.freqBand[0].sulBand[0];
+      }
+   }
+
+   tddInfo->transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrScs;
+   tddInfo->transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.tdd.nrFreqInfo.sulInfo.sulTxBw.nrb;
+
+   return ROK;
+}
+
 /*******************************************************************
  *
  * @brief Builds NR Mode 
@@ -303,38 +555,63 @@ uint8_t BuildNrMode(NR_Mode_Info_t *mode)
 {
    uint8_t BuildDLNRInforet=0;
    uint8_t BuildULNRInforet=0; 
-   /* FDD Mode */
+   
+#ifdef NR_TDD
+   mode->present = NR_Mode_Info_PR_tDD;
+#else
    mode->present = NR_Mode_Info_PR_fDD;
+#endif   
+   
    if(mode->present == NR_Mode_Info_PR_fDD)
    {
       DU_ALLOC(mode->choice.fDD,sizeof(FDD_Info_t));
       if(mode->choice.fDD == NULLP)
       {
-        return RFAILED;
+         DU_LOG("\nERROR  --> Memory allocation failed in BuildNrMode");
+         return RFAILED;
       }
       BuildULNRInforet = BuildULNRInfo(&mode->choice.fDD->uL_NRFreqInfo);
       if(BuildULNRInforet != ROK)
       {
-        return RFAILED;    
+         DU_LOG("\nERROR  --> Failed to build UlNrFreqInfo");
+         return RFAILED;    
       }
       BuildDLNRInforet = BuildDLNRInfo(&mode->choice.fDD->dL_NRFreqInfo);
       if(BuildDLNRInforet != ROK)
       {
-        return RFAILED;
+         DU_LOG("\nERROR  --> Failed to build DlNrFreqInfo");
+         return RFAILED;
+      }
+      mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
+                                                          duCfgParam.srvdCellLst[0].duCellInfo.\
+                                                          f1Mode.mode.fdd.ulTxBw.nrScs;
+      mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
+                                                          duCfgParam.srvdCellLst[0].duCellInfo.\
+                                                          f1Mode.mode.fdd.ulTxBw.nrb;
+      mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
+                                                          duCfgParam.srvdCellLst[0].duCellInfo.\
+                                                          f1Mode.mode.fdd.dlTxBw.nrScs;
+      mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
+                                                          duCfgParam.srvdCellLst[0].duCellInfo.\
+                                                          f1Mode.mode.fdd.dlTxBw.nrb;
+   }
+   else if(mode->present == NR_Mode_Info_PR_tDD) 
+   {
+      DU_ALLOC(mode->choice.tDD,sizeof(TDD_Info_t));
+      if(mode->choice.tDD == NULLP)
+      {
+         DU_LOG("\nERROR  --> Memory allocation failed in BuildNrMode");
+         return RFAILED;
+      }
+
+      if(fillNrTddInfo(mode->choice.tDD) != ROK)
+      {
+         DU_LOG("\nERROR  --> Failed to fill Nr TDD information");
+         return RFAILED;
       }
+
    }
-   mode->choice.fDD->uL_Transmission_Bandwidth.nRSCS = \
-                                                      duCfgParam.srvdCellLst[0].duCellInfo.\
-                                                      f1Mode.mode.fdd.ulTxBw.nrScs;
-   mode->choice.fDD->uL_Transmission_Bandwidth.nRNRB = \
-                                                      duCfgParam.srvdCellLst[0].duCellInfo.\
-                                                      f1Mode.mode.fdd.ulTxBw.nrb;
-   mode->choice.fDD->dL_Transmission_Bandwidth.nRSCS = \
-                                                      duCfgParam.srvdCellLst[0].duCellInfo.\
-                                                      f1Mode.mode.fdd.dlTxBw.nrScs;
-   mode->choice.fDD->dL_Transmission_Bandwidth.nRNRB = \
-                                                      duCfgParam.srvdCellLst[0].duCellInfo.\
-                                                      f1Mode.mode.fdd.dlTxBw.nrb;
+
    return ROK;
 }
 /*******************************************************************
@@ -354,95 +631,107 @@ uint8_t BuildNrMode(NR_Mode_Info_t *mode)
  * ****************************************************************/
 uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
 {
-   uint8_t idx;
-   uint8_t plmnidx;
-   uint8_t extensionCnt=1;
-   uint8_t sliceId=0;
-   uint8_t sdId;
+   uint8_t idx=0, plmnidx=0, sliceLstIdx=0;
+   uint8_t elementCnt=0, extensionCnt=0;
+
+   extensionCnt=IE_EXTENSION_LIST_COUNT;
    DU_ALLOC(*ieExtend,sizeof(ProtocolExtensionContainer_4624P3_t));
    if((*ieExtend) == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
       return RFAILED;
    }
    (*ieExtend)->list.count = extensionCnt;
    (*ieExtend)->list.size = \
-                           extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
+                            extensionCnt * sizeof(ServedPLMNs_ItemExtIEs_t *);
    DU_ALLOC((*ieExtend)->list.array,(*ieExtend)->list.size);
    if((*ieExtend)->list.array == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
       return RFAILED;
    }
    for(plmnidx=0;plmnidx<extensionCnt;plmnidx++)
    {
       DU_ALLOC((*ieExtend)->list.array[plmnidx],\
-           sizeof(ServedPLMNs_ItemExtIEs_t));
+            sizeof(ServedPLMNs_ItemExtIEs_t));
       if((*ieExtend)->list.array[plmnidx] == NULLP)
       {
-        return RFAILED;
+         DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
+         return RFAILED;
       }
    }
+   
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
    idx = 0;
    (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
    (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
    (*ieExtend)->list.array[idx]->extensionValue.present = \
-                                                         ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.count = 1;
+   ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
    (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.size = sizeof(SliceSupportItem_t *);
-   DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array,sizeof(SliceSupportItem_t *));
-   if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array == NULLP)
-   {
-      return RFAILED;
-   }
-   DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId],sizeof(SliceSupportItem_t));
-   if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId] == NULLP) 
-   {
-      return RFAILED;
-   }
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sST.size = sizeof(uint8_t);
-   DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
-        .list.array[sliceId]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
-        extensionValue.choice.SliceSupportList.\
-        list.array[sliceId]->sNSSAI.sST.size);
-   if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
-        .list.array[sliceId]->sNSSAI.sST.buf == NULLP)
-   {
-      return RFAILED;
-   }
+      list.count = elementCnt;
    (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sST.buf[0] = 3;
+      list.size = (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+      list.count * sizeof(SliceSupportItem_t *);
+
    DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t));
+         list.array, elementCnt * sizeof(SliceSupportItem_t *));
    if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId]->sNSSAI.sD == NULLP)
+         list.array == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
       return RFAILED;
    }
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sD->size = 3*sizeof(uint8_t);
-   DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId]->sNSSAI.sD->buf,(*ieExtend)->list.array[idx]->extensionValue.choice.\
-        SliceSupportList.list.array[sliceId]->sNSSAI.sD->size);
-   if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-        list.array[sliceId]->sNSSAI.sD->buf == NULLP)
+
+   for(sliceLstIdx =0; sliceLstIdx<elementCnt; sliceLstIdx++)
    {
-      return RFAILED;
+      DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx],sizeof(SliceSupportItem_t));
+      if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx] == NULLP) 
+      {
+         DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
+         return RFAILED;
+      }
+      (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+         list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
+      DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
+            .list.array[sliceLstIdx]->sNSSAI.sST.buf,(*ieExtend)->list.array[idx]->\
+            extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx]->sNSSAI.sST.size);
+      if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList\
+            .list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
+         return RFAILED;
+      }
+      (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+         list.array[sliceLstIdx]->sNSSAI.sST.buf[0] = duCfgParam.srvdCellLst[0].duCellInfo.\
+         cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
+      
+      DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
+      if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
+         return RFAILED;
+      }
+      (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+         list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
+      DU_ALLOC((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx]->sNSSAI.sD->buf, (*ieExtend)->list.array[idx]->extensionValue.choice.\
+            SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
+      if((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+            list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : BuildExtensions(): Memory allocation failed");
+         return RFAILED;
+      }
+      memcpy((*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[0].duCellInfo.\
+      cellInfo.srvdPlmn[0].taiSliceSuppLst.snssai[sliceLstIdx]->sd, (*ieExtend)->list.array[idx]->\
+      extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->sNSSAI.sD->size);
    }
-   sdId = 0;
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sD->buf[sdId] = 3;
-   sdId++;
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sD->buf[sdId] = 6;
-   sdId++;
-   (*ieExtend)->list.array[idx]->extensionValue.choice.SliceSupportList.\
-      list.array[sliceId]->sNSSAI.sD->buf[sdId] = 9;
    return ROK;
 }
 /*******************************************************************
@@ -597,16 +886,15 @@ uint8_t BuildServedCellList(GNB_DU_Served_Cells_List_t *duServedCell)
       return RFAILED;
    }
    /* MIB */
-   srvCellItem->gNB_DU_System_Information->mIB_message.size =\
-                                                            strlen(( char *)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg);
+   srvCellItem->gNB_DU_System_Information->mIB_message.size = duCfgParam.srvdCellLst[0].duSysInfo.mibLen;
    DU_ALLOC(srvCellItem->gNB_DU_System_Information->mIB_message.buf,
         srvCellItem->gNB_DU_System_Information->mIB_message.size);
    if(!srvCellItem->gNB_DU_System_Information->mIB_message.buf)
    {
       return RFAILED;
    }
-   strcpy((char *)srvCellItem->gNB_DU_System_Information->mIB_message.buf,
-        (char *)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg);
+   memcpy(srvCellItem->gNB_DU_System_Information->mIB_message.buf, duCfgParam.srvdCellLst[0].duSysInfo.mibMsg, \
+                  srvCellItem->gNB_DU_System_Information->mIB_message.size);
 
    /* SIB1 */
    srvCellItem->gNB_DU_System_Information->sIB1_message.size =\
@@ -703,7 +991,7 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
  *
  * @details
  *
- *    Function : SendF1APMsg
+ *    Function : sendF1APMsg
  *
  *    Functionality: Sends F1 msg over SCTP
  *
@@ -713,26 +1001,26 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t SendF1APMsg(Region region, Pool pool)
+uint8_t sendF1APMsg()
 {
-   Buffer *mBuf;
-
-   if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
+   Buffer *mBuf = NULLP;
+  
+   if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
    {
       if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
       {
-        ODU_PRINT_MSG(mBuf, 0,0);
+           ODU_PRINT_MSG(mBuf, 0,0);
 
-        if(sctpSend(mBuf, F1_INTERFACE) != ROK)
-        {
-           DU_LOG("\nF1AP : SCTP Send failed");
-           ODU_PUT_MSG_BUF(mBuf);
-           return RFAILED;
-        }
+           if(sctpSend(mBuf, F1_INTERFACE) != ROK)
+           {
+              DU_LOG("\nERROR  -->  F1AP : SCTP Send failed");
+              ODU_PUT_MSG_BUF(mBuf);
+              return RFAILED;
+           }
       }
       else
       {
-        DU_LOG("\nF1AP : ODU_ADD_POST_MSG_MULT failed");
+        DU_LOG("\nERROR  -->  F1AP : ODU_ADD_POST_MSG_MULT failed");
         ODU_PUT_MSG_BUF(mBuf);
         return RFAILED;
       }
@@ -740,11 +1028,11 @@ uint8_t SendF1APMsg(Region region, Pool pool)
    }
    else
    {
-      DU_LOG("\nF1AP : Failed to allocate memory");
+      DU_LOG("\nERROR  -->  F1AP : Failed to allocate memory");
       return RFAILED;
    }
    return ROK; 
-} /* SendF1APMsg */
+} /* sendF1APMsg */
 
 /*******************************************************************
  *
@@ -787,205 +1075,255 @@ void FreeRrcVer(RRC_Version_t *rrcVer)
       DU_FREE(rrcVer->latest_RRC_Version.buf,rrcVer->latest_RRC_Version.size);
    }
 }
+
 /*******************************************************************
  *
- * @brief  deallocating the memory of function BuildAndSendF1SetupReq()
+ * @brief Deallocating memory of TDD NrFreqInfo 
  *
  * @details
  *
- *    Function :  FreeServedCellList
+ *    Function : freeTddNrFreqInfo 
  *
- *    Functionality:  deallocating the memory of function BuildServedCellList
+ *    Functionality: freeTddNrFreqInfo 
+ *
+ * @params[in]  F1AP_PDU_t *f1apDuCfg
+ *
+ * @return ROK     - void
+ *
+ * ****************************************************************/
+void freeTddNrFreqInfo(NRFreqInfo_t *freqInfo)
+{
+   uint8_t freqBandListIdx = 0, supportedBandIdx = 0;
+
+   if(freqInfo->freqBandListNr.list.array)
+   {
+      for(freqBandListIdx = 0; freqBandListIdx<freqInfo->freqBandListNr.list.count; freqBandListIdx++)
+      {
+         if(freqInfo->freqBandListNr.list.array[freqBandListIdx])
+         {
+            if(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array)
+            {
+               for(supportedBandIdx = 0; supportedBandIdx<freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.count; supportedBandIdx++)
+               {
+                  DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array[supportedBandIdx],\
+                        sizeof(SupportedSULFreqBandItem_t));
+               }
+               DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.array,\
+                     freqInfo->freqBandListNr.list.array[freqBandListIdx]->supportedSULBandList.list.size);
+
+            }
+            DU_FREE(freqInfo->freqBandListNr.list.array[freqBandListIdx],  sizeof(FreqBandNrItem_t ));
+         }
+      }
+      DU_FREE(freqInfo->freqBandListNr.list.array, freqInfo->freqBandListNr.list.size );
+   }
+}
 
+/*******************************************************************
  *
- * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
+ * @brief Deallocating memory allocated for Nr fdd frequencey mode 
  *
- * @return void
+ * @details
+ *
+ *    Function : freeFddNrFreqInfo 
+ *
+ *    Functionality:Free memory allocated for Nr fdd frequencey mode 
+ *
+ * @params[in]  
+ *
+ * @return ROK     - void
  *
  * ****************************************************************/
-void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
+void freeFddNrFreqInfo(FDD_Info_t *fDD)
 {
-   uint8_t   plmnCnt=1;
-   uint8_t  servId=0;
-   uint8_t sliceId=0;
-   uint8_t  ieId=0;
-   uint8_t   extensionCnt=1;
-   uint8_t plmnidx=0;
-   GNB_DU_Served_Cells_Item_t *srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
-   if(duServedCell->list.array!=NULLP)
+   uint8_t arrIdx =0;
+
+   if(fDD != NULLP)
    {
-      if(duServedCell->list.array[0]!=NULLP)
+      if(fDD->uL_NRFreqInfo.freqBandListNr.list.array != NULLP)
       {
-        if(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf!=NULLP)
-        {
-           if(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf !=NULLP)
-           {
-              if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
-              {
-                 if(srvCellItem->served_Cell_Information.fiveGS_TAC->buf!=NULLP)
-                 {
-                    if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
-                    {
-                       if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[0]!=NULLP)
-                       {
-                          if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->pLMN_Identity.buf!=NULLP)
-                          {
-                             if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions!=NULLP)
-                             {
-                                if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array!=NULLP)
-                                {
-                                   if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]!=NULLP)
-                                   {
-                                      if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                            extensionValue.choice.SliceSupportList.list.array!=NULLP)
-                                      {
-                                         if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                               extensionValue.choice.SliceSupportList.list.array[sliceId]!= NULLP)
-                                         {
-                                            if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                                  extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sST.buf!=NULLP)
-                                            {
-                                               if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                                     extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD!=NULLP)
-                                               {
-                                                  if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->\
-                                                        list.array[0]->extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD->buf!=NULLP)
-                                                  {
-                                                     if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD!=NULLP)
-                                                     {
-                                                        if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\
-                                                              freqBandListNr.list.array!=NULLP)
-                                                        {
-                                                           if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.\
-                                                                 freqBandListNr.list.array[0]!=NULLP)
-                                                           {
-                                                              if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\
-                                                                    freqBandListNr.list.array)
-                                                              {
-                                                                 if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\
-                                                                       freqBandListNr.list.array[0]!=NULLP)
-                                                                 {
-                                                                    if(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf!=NULLP)
-                                                                    {
-                                                                       if(!srvCellItem->gNB_DU_System_Information)
-                                                                       {
-                                                                          if(srvCellItem->gNB_DU_System_Information->mIB_message.buf!=NULLP)
-                                                                          {
-                                                                             if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf!=NULLP)
-                                                                             { 
-                                                                                DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
-                                                                                      srvCellItem->gNB_DU_System_Information->sIB1_message.size);
-                                                                                DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg,\
-                                                                                      srvCellItem->gNB_DU_System_Information->sIB1_message.size);
-                                                                             }
-                                                                             DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
-                                                                                   srvCellItem->gNB_DU_System_Information->mIB_message.size);
-                                                                             DU_FREE(duCfgParam.srvdCellLst[0].duSysInfo.mibMsg,\
-                                                                                   strlen((char*)duCfgParam.srvdCellLst[0].duSysInfo.mibMsg));
-                                                                          }
-                                                                          DU_FREE(srvCellItem->gNB_DU_System_Information,sizeof(GNB_DU_System_Information_t));
-                                                                       }
-                                                                       DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
-                                                                             srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
-                                                                    }
-                                                                    DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\
-                                                                          freqBandListNr.list.array[0],sizeof(FreqBandNrItem_t));
-                                                                 }
-                                                                 DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->dL_NRFreqInfo.\
-                                                                       freqBandListNr.list.array,sizeof(FreqBandNrItem_t *));
-                                                              }
-                                                              DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.\
-                                                                    list.array[0],sizeof(FreqBandNrItem_t));
-                                                           }
-                                                           DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD->uL_NRFreqInfo.freqBandListNr.\
-                                                                 list.array,sizeof(FreqBandNrItem_t*));
-                                                        }
-                                                        DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD,sizeof(FDD_Info_t));
-                                                     }
-                                                     DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\
-                                                           iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->\
-                                                           sNSSAI.sD->buf,srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->
-                                                           list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->sNSSAI.sD->size);
-                                                  }
-                                                  DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\
-                                                        iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.\
-                                                        list.array[sliceId]->sNSSAI.sD,sizeof(OCTET_STRING_t));
-                                               }
-                                               DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->\
-                                                     iE_Extensions->list.array[ieId]->extensionValue.choice.SliceSupportList.list.array[sliceId]->\
-                                                     sNSSAI.sST.buf,sizeof(uint8_t));
-                                            }
-                                            DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                                  extensionValue.choice.SliceSupportList.list.array[sliceId],sizeof(SliceSupportItem_t));
-                                         }
-                                         DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[servId]->iE_Extensions->list.array[0]->\
-                                               extensionValue.choice.SliceSupportList.list.array,sizeof(SliceSupportItem_t*));
-                                      }
-                                      DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\
-                                            array[servId]->iE_Extensions->list.array[plmnidx],sizeof(ServedPLMNs_ItemExtIEs_t));
-                                   }
-                                   DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\
-                                         array[servId]->iE_Extensions->list.array,\
-                                         extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
-                                }
-                                DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\
-                                      array[servId]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
-                             }
-                             DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.\
-                                   array[servId]->pLMN_Identity.buf,srvCellItem->served_Cell_Information.\
-                                   servedPLMNs.list.array[servId]->pLMN_Identity.size
-                                   * sizeof(uint8_t));
-                          }
-                          DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnidx],\
-                                sizeof(ServedPLMNs_Item_t *));
-                       }
-                       DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
-                             sizeof(ServedPLMNs_Item_t *));
-                    }
-                    DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
-                          sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
-                 }
-                 DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
-              }
-              DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
-                    srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size *
-                    sizeof(uint8_t));
-           }
-           DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
-                 srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size *
-                 sizeof(uint8_t));
-        }
-        DU_FREE(duServedCell->list.array[plmnidx],sizeof(GNB_DU_Served_Cells_ItemIEs_t));
+         DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.\
+               array[arrIdx], sizeof(FreqBandNrItem_t));
+         DU_FREE(fDD->uL_NRFreqInfo.freqBandListNr.list.array, \
+               fDD->uL_NRFreqInfo.freqBandListNr.list.size);
+      }
+
+      if(fDD->dL_NRFreqInfo.freqBandListNr.list.array != NULLP)
+      {
+         DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.\
+               array[arrIdx], sizeof(FreqBandNrItem_t));
+         DU_FREE(fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
+               fDD->dL_NRFreqInfo.freqBandListNr.list.size);
       }
-      DU_FREE(duServedCell->list.array,plmnCnt*sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
+      DU_FREE(fDD,sizeof(FDD_Info_t));
    }
 }
+
 /*******************************************************************
  *
  * @brief  deallocating the memory of function BuildAndSendF1SetupReq()
  *
  * @details
  *
- *    Function :  FreeF1SetupReq
+ *    Function :  FreeServedCellList
  *
- *    Functionality:  deallocating the memory of function BuildAndSendF1SetupReq
+ *    Functionality:  deallocating the memory of function BuildServedCellList
+
  *
- * @params[in] F1AP_PDU_t *f1apMsg
+ * @params[in] GNB_DU_Served_Cells_List_t *duServedCell
  *
  * @return void
  *
  * ****************************************************************/
-void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
+void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
 {
-   uint8_t ieIdx, ieIdx2;
-   F1SetupRequest_t *f1SetupReq=NULLP;
+   uint8_t   plmnCnt=MAX_PLMN;
+   uint8_t  extensionCnt=IE_EXTENSION_LIST_COUNT;
+   uint8_t  plmnIdx=0, sliceIdx=0;
+   GNB_DU_Served_Cells_Item_t *srvCellItem;
+   ServedPLMNs_Item_t  *servedPlmnItem;
+   SliceSupportItem_t  *sliceSupportItem;
 
-   if(f1apMsg != NULLP)
+   if(duServedCell->list.array!=NULLP)
    {
-      if(f1apMsg->choice.initiatingMessage != NULLP)
+      if(duServedCell->list.array[0]!=NULLP)
       {
-        f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
-        if(f1SetupReq->protocolIEs.list.array != NULLP)
+         srvCellItem= &duServedCell->list.array[0]->value.choice.GNB_DU_Served_Cells_Item;
+
+         DU_FREE(srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
+               srvCellItem->served_Cell_Information.nRCGI.pLMN_Identity.size * sizeof(uint8_t));
+         DU_FREE(srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
+               srvCellItem->served_Cell_Information.nRCGI.nRCellIdentity.size * sizeof(uint8_t));
+
+         if(srvCellItem->served_Cell_Information.fiveGS_TAC!=NULLP)
+         {
+            DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC->buf,\
+                  sizeof(srvCellItem->served_Cell_Information.fiveGS_TAC->size));
+            DU_FREE(srvCellItem->served_Cell_Information.fiveGS_TAC,sizeof(FiveGS_TAC_t));
+         }
+
+         if(srvCellItem->served_Cell_Information.servedPLMNs.list.array!=NULLP)
+         {
+            if(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx] != NULLP)
+            {
+               servedPlmnItem = srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx];
+               DU_FREE(servedPlmnItem->pLMN_Identity.buf, servedPlmnItem->pLMN_Identity.size);
+
+               if(servedPlmnItem->iE_Extensions != NULLP)
+               {
+                  if(servedPlmnItem->iE_Extensions->list.array != NULLP)
+                  {
+                     if(servedPlmnItem->iE_Extensions->list.array[0] != NULLP)
+                     {
+                        if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
+                              SliceSupportList.list.array != NULLP)
+                        {
+                           for(sliceIdx =0; sliceIdx<servedPlmnItem->iE_Extensions->list.array[0]->\
+                                 extensionValue.choice.SliceSupportList.list.count; sliceIdx++)
+                           {
+                              if(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
+                                    SliceSupportList.list.array[sliceIdx] != NULLP)
+                              {
+                                 sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[0]->\
+                                                    extensionValue.choice.SliceSupportList.list.array[sliceIdx];
+
+                                 DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sizeof(uint8_t));
+
+                                 if(sliceSupportItem->sNSSAI.sD != NULLP)
+                                 {
+                                    DU_FREE(sliceSupportItem->sNSSAI.sD->buf,\
+                                          sliceSupportItem->sNSSAI.sD->size);
+                                    DU_FREE(sliceSupportItem->sNSSAI.sD, sizeof(OCTET_STRING_t));
+                                 }
+
+                                 DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.\
+                                       choice.SliceSupportList.list.array[sliceIdx], sizeof(SliceSupportItem_t));
+                              }
+                           }
+                           DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
+                                 SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
+                                 extensionValue.choice.SliceSupportList.list.size);
+                        }
+                        DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
+                              sizeof(ServedPLMNs_ItemExtIEs_t));
+                     }
+                     DU_FREE(servedPlmnItem->iE_Extensions->list.array,\
+                           extensionCnt*sizeof(ServedPLMNs_ItemExtIEs_t*));
+                  }
+                  DU_FREE(servedPlmnItem->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P3_t));
+               }
+               DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array[plmnIdx],\
+                     sizeof(ServedPLMNs_Item_t));
+            }
+            DU_FREE(srvCellItem->served_Cell_Information.servedPLMNs.list.array,\
+                  sizeof(ServedPLMNs_Item_t *));
+         }
+
+         if(srvCellItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
+         {
+            freeFddNrFreqInfo(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
+         }
+         else   
+         {
+            if(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD != NULLP)
+            {
+               freeTddNrFreqInfo(&srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
+               DU_FREE(srvCellItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
+            }
+         }
+         
+         DU_FREE(srvCellItem->served_Cell_Information.measurementTimingConfiguration.buf,\
+               srvCellItem->served_Cell_Information.measurementTimingConfiguration.size);
+
+         if(srvCellItem->gNB_DU_System_Information != NULLP)
+         {
+            if(srvCellItem->gNB_DU_System_Information->mIB_message.buf != NULLP)
+            {
+               DU_FREE(srvCellItem->gNB_DU_System_Information->mIB_message.buf,\
+                     srvCellItem->gNB_DU_System_Information->mIB_message.size);
+            }
+
+            if(srvCellItem->gNB_DU_System_Information->sIB1_message.buf != NULLP)
+            { 
+               DU_FREE(srvCellItem->gNB_DU_System_Information->sIB1_message.buf,\
+                     srvCellItem->gNB_DU_System_Information->sIB1_message.size);
+            }
+
+            DU_FREE(srvCellItem->gNB_DU_System_Information, sizeof(GNB_DU_System_Information_t));
+         }
+
+         DU_FREE(duServedCell->list.array[0], sizeof(GNB_DU_Served_Cells_ItemIEs_t));
+      }
+      DU_FREE(duServedCell->list.array, plmnCnt * sizeof(GNB_DU_Served_Cells_ItemIEs_t*));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief  deallocating the memory of function BuildAndSendF1SetupReq()
+ *
+ * @details
+ *
+ *    Function :  FreeF1SetupReq
+ *
+ *    Functionality:  deallocating the memory of function BuildAndSendF1SetupReq
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t ieIdx, ieIdx2;
+   F1SetupRequest_t *f1SetupReq=NULLP;
+
+   if(f1apMsg != NULLP)
+   {
+      if(f1apMsg->choice.initiatingMessage != NULLP)
+      {
+        f1SetupReq = &f1apMsg->choice.initiatingMessage->value.choice.F1SetupRequest;
+        if(f1SetupReq->protocolIEs.list.array != NULLP)
         {
            for(ieIdx = 0; ieIdx < f1SetupReq->protocolIEs.list.count; ieIdx++)
            {
@@ -1011,11 +1349,10 @@ void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
                        FreeRrcVer(&f1SetupReq->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version);
                        break;
                     default:
-                       DU_LOG("\nInvalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
+                       DU_LOG("\nERROR  -->  Invalid Event Type %ld", f1SetupReq->protocolIEs.list.array[ieIdx]->id);
                        break;
                  }
               }
-              break;
            }
            for(ieIdx2=0; ieIdx2< ieIdx; ieIdx2++)
            {
@@ -1053,7 +1390,7 @@ uint8_t BuildAndSendF1SetupReq()
    asn_enc_rval_t             encRetVal;        /* Encoder return value */
    ret= RFAILED;
 
-   DU_LOG("\nF1AP : Building F1 Setup Request\n");
+   DU_LOG("\nINFO   -->  F1AP : Building F1 Setup Request\n");
    do
    {
       DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
@@ -1182,24 +1519,33 @@ uint8_t BuildAndSendF1SetupReq()
       /* Encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG("\nF1AP : Could not encode F1SetupRequest structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Could not encode F1SetupRequest structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
       }
       else
       {
-        DU_LOG("\nF1AP : Created APER encoded buffer for F1SetupRequest\n");
-        for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
-        {
-           printf("%x",encBuf[ieIdx]);
-        }
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for F1SetupRequest\n");
+         for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+         {
+            printf("%x",encBuf[ieIdx]);
+         }
+         
+         duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize = encBufSize;
+         DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, encBufSize);
+         if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
+         {
+             DU_LOG("\nERROR  -->  F1AP : Memory allocation failed to store the encoding of f1setup req");
+             return RFAILED;
+         }
+         memcpy(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, &encBuf, duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize);
       }
 
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
-        DU_LOG("\nF1AP : Sending F1 Setup request failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Sending F1 Setup request failed");
+         break;
       }
 
       ret=ROK;
@@ -1211,6 +1557,113 @@ uint8_t BuildAndSendF1SetupReq()
    return ret;
 }/* End of BuildAndSendF1SetupReq */
 
+/*******************************************************************
+ *
+ * @brief Deallocating memory allocated for Served_Cells_To_Modify_Item_t
+ *
+ * @details
+ *
+ *    Function : freeCellsToModifyItem 
+ *
+ *    Functionality: Deallocating memory of variables allocated in
+ *                    BuildAndSendDUConfigUpdate function
+ *
+ * @params[in]  Served_Cells_To_Modify_Item_t *modifyItem
+ *
+ * @return ROK     - void
+ *
+ * ****************************************************************/
+
+void freeCellsToModifyItem(Served_Cells_To_Modify_Item_t *modifyItem)
+{
+   uint8_t arrIdx=0, servedPlmnIdx=0, sliceLstIdx=0;
+   ServedPLMNs_Item_t *servedPlmnItem = NULLP;
+   SliceSupportItem_t *sliceSupportItem = NULLP;
+
+   DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf, modifyItem->oldNRCGI.pLMN_Identity.size);
+   DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf, modifyItem->oldNRCGI.nRCellIdentity.size);
+
+   DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
+           modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
+   DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
+         modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);
+
+   if(modifyItem->served_Cell_Information.servedPLMNs.list.array != NULLP)
+   {
+      if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx] != NULLP)
+      {
+         servedPlmnItem = modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx];
+
+         DU_FREE(servedPlmnItem->pLMN_Identity.buf,servedPlmnItem->pLMN_Identity.size);
+
+         if(servedPlmnItem->iE_Extensions != NULLP)
+         {
+            if(servedPlmnItem->iE_Extensions->list.array != NULLP)
+            {
+               if(servedPlmnItem->iE_Extensions->list.array[arrIdx] != NULLP)
+               {
+                  if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                        list.array != NULLP)
+                  {
+                     for(sliceLstIdx =0; sliceLstIdx<servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
+                           extensionValue.choice.SliceSupportList.list.count; sliceLstIdx++)
+                     {
+                        if(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                              list.array[sliceLstIdx] != NULLP)
+                        {
+
+                           sliceSupportItem = servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                              SliceSupportList.list.array[sliceLstIdx];
+
+                           DU_FREE(sliceSupportItem->sNSSAI.sST.buf, sliceSupportItem->sNSSAI.sST.size);
+                           if(sliceSupportItem->sNSSAI.sD != NULLP)
+                           {
+                              DU_FREE(sliceSupportItem->sNSSAI.sD->buf, sliceSupportItem->sNSSAI.sD->size);
+                              DU_FREE(sliceSupportItem->sNSSAI.sD,sizeof(OCTET_STRING_t));
+                           }
+                           DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                 SliceSupportList.list.array[sliceLstIdx], sizeof(SliceSupportItem_t));
+                        }
+                     }
+                     DU_FREE(servedPlmnItem->iE_Extensions->list.array[arrIdx]->extensionValue.\
+                           choice.SliceSupportList.list.array,\
+                           servedPlmnItem->iE_Extensions->list.array[arrIdx]->\
+                           extensionValue.choice.SliceSupportList.list.size);
+                  }
+               }
+               for(servedPlmnIdx=0; servedPlmnIdx< servedPlmnItem->iE_Extensions->list.count ; servedPlmnIdx++)
+               {
+                  DU_FREE(servedPlmnItem->iE_Extensions->list.array[servedPlmnIdx], sizeof(ServedPLMNs_ItemExtIEs_t ));
+               }
+               DU_FREE(servedPlmnItem->iE_Extensions->list.array, servedPlmnItem->iE_Extensions->list.size);
+            }
+            DU_FREE(servedPlmnItem->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
+         }
+      }
+      for(servedPlmnIdx=0; servedPlmnIdx<modifyItem->served_Cell_Information.servedPLMNs.list.count; servedPlmnIdx++)
+      {
+         DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[servedPlmnIdx], sizeof(ServedPLMNs_Item_t));
+      }
+      DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
+         modifyItem->served_Cell_Information.servedPLMNs.list.size);
+   }
+   
+   if(modifyItem->served_Cell_Information.nR_Mode_Info.present == NR_Mode_Info_PR_fDD)
+   {
+      freeFddNrFreqInfo(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD);
+   }  
+   else
+   {
+      if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD)
+      {
+         freeTddNrFreqInfo(&modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD->nRFreqInfo);
+         DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
+      }
+   }
+   DU_FREE(modifyItem->served_Cell_Information.measurementTimingConfiguration.buf,\
+      modifyItem->served_Cell_Information.measurementTimingConfiguration.size);
+}
+
 /*******************************************************************
  *
  * @brief Deallocating memory of BuildAndSendDUConfigUpdate
@@ -1229,231 +1682,87 @@ uint8_t BuildAndSendF1SetupReq()
  * ****************************************************************/
 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
 {
-   uint8_t  i;
-   uint8_t  idx;
+   uint8_t  ieIdx=0, cellModifyIdx=0, cellDeleteIdx=0;
    GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
-   Served_Cells_To_Modify_List_t  *cellsToModify;
-   Served_Cells_To_Modify_Item_t *modifyItem;
-   idx=0;
-   i=1;
+   Served_Cells_To_Modify_List_t  *cellsToModify=NULLP;
+   Served_Cells_To_Delete_List_t  *cellsToDelete=NULLP;
+   Served_Cells_To_Delete_Item_t  *deleteItem = NULLP;
+   Served_Cells_To_Delete_ItemIEs_t *deleteItemIe = NULLP;
+
    if(f1apDuCfg != NULLP)
    {
       if(f1apDuCfg->choice.initiatingMessage != NULLP)
       {
-        duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
-                      value.choice.GNBDUConfigurationUpdate;
-        if(duCfgUpdate->protocolIEs.list.array != NULLP)
-        {
-           if(duCfgUpdate->protocolIEs.list.array[i] != NULLP)
-           {
-              cellsToModify = &duCfgUpdate->protocolIEs.list.array[i]->\
-                              value.choice.Served_Cells_To_Modify_List;
-              if(cellsToModify->list.array != NULLP)
-              {
-                 if(cellsToModify->list.array[idx] != NULLP)
-                 {
-                    modifyItem=&cellsToModify->list.array[idx]->value.choice.\
-                               Served_Cells_To_Modify_Item;
-                    if(modifyItem->oldNRCGI.pLMN_Identity.buf != NULLP)
-                    {
-                       if(modifyItem->oldNRCGI.nRCellIdentity.buf != NULLP)
-                       {
-                          if(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf != NULLP)
-                          {
-                             if(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf
-                                   != NULLP)
-                             { 
-                                if(modifyItem->served_Cell_Information.servedPLMNs.list.array\
-                                      != NULLP)
-                                {
-                                   if(!modifyItem->served_Cell_Information.servedPLMNs.list.array[idx])
-                                   {
-                                      if(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                            array[idx]->pLMN_Identity.buf != NULLP)
-                                      {
-                                         if(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                               array[idx]->iE_Extensions!= NULLP)
-                                         {
-                                            if(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                  array[idx]->iE_Extensions->list.array != NULLP)
-                                            {
-                                               if(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                     array[idx]->iE_Extensions->list.array[idx])
-                                               {
-                                                  if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                        iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                        list.array !=NULLP)
-                                                  {
-                                                     if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                           iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                           list.array[idx]!=NULLP)
-                                                     {   
-                                                        if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                              iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                              list.array[idx]->sNSSAI.sST.buf!=NULLP)
-                                                        {
-                                                           if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                                 iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                                 list.array[idx]->sNSSAI.sD != NULLP)
-                                                           { 
-                                                              if(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                                    iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                                    list.array[idx]->sNSSAI.sD->buf!=NULLP)
-                                                              {
-                                                                 if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.fDD
-                                                                       !=NULLP)
-                                                                 {
-                                                                    if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\
-                                                                          fDD->uL_NRFreqInfo.freqBandListNr.list.array!=NULLP)
-                                                                    {
-                                                                       if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\
-                                                                             fDD->uL_NRFreqInfo.freqBandListNr.list.array[idx]!=NULLP)
-                                                                       {
-                                                                          if(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\
-                                                                                fDD->dL_NRFreqInfo.freqBandListNr.list.array !=NULLP)
-                                                                          {
-                                                                             if(modifyItem->served_Cell_Information.nR_Mode_Info.\
-                                                                                   choice.fDD->dL_NRFreqInfo.freqBandListNr.list.\
-                                                                                   array[idx]!= NULLP)
-                                                                             {
-                                                                                if(modifyItem->served_Cell_Information.\
-                                                                                      measurementTimingConfiguration.buf !=NULLP)
-                                                                                {
-                                                                                   idx=2;
-                                                                                   if(duCfgUpdate->protocolIEs.list.array[idx]->value.\
-                                                                                         choice.GNB_DU_ID.buf!=NULLP)
-                                                                                   {
-                                                                                      DU_FREE(duCfgUpdate->protocolIEs.list.\
-                                                                                            array[idx]->value.choice.GNB_DU_ID.buf,\
-                                                                                            duCfgUpdate->protocolIEs.list.array[idx]->\
-                                                                                            value.choice.GNB_DU_ID.size);
-                                                                                   }
-                                                                                   idx=0;
-                                                                                   DU_FREE(modifyItem->served_Cell_Information.\
-                                                                                         measurementTimingConfiguration.\
-                                                                                         buf,modifyItem->served_Cell_Information.\
-                                                                                         measurementTimingConfiguration.size);
-                                                                                }
-                                                                                DU_FREE(modifyItem->served_Cell_Information.\
-                                                                                      nR_Mode_Info.choice.fDD->dL_NRFreqInfo.freqBandListNr.\
-                                                                                      list.array[idx],sizeof(FreqBandNrItem_t));
-                                                                             }
-                                                                             DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info\
-                                                                                   .choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array,\
-                                                                                   modifyItem->served_Cell_Information.nR_Mode_Info.\
-                                                                                   choice.fDD->dL_NRFreqInfo.freqBandListNr.list.size);
-                                                                          }
-                                                                          DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.\
-                                                                                choice.fDD->uL_NRFreqInfo.freqBandListNr.list.\
-                                                                                array[idx],sizeof(FreqBandNrItem_t));
-                                                                       }
-                                                                       DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.\
-                                                                             choice.\
-                                                                             fDD->uL_NRFreqInfo.freqBandListNr.list.\
-                                                                             array,modifyItem->served_Cell_Information.nR_Mode_Info.choice.\
-                                                                             fDD->uL_NRFreqInfo.freqBandListNr.list.size);
-                                                                    }
-                                                                    DU_FREE(modifyItem->served_Cell_Information.nR_Mode_Info.choice.\
-                                                                          fDD,sizeof(FDD_Info_t));
-                                                                 }
-                                                                 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                                       array[idx]->iE_Extensions->list.array[idx]->extensionValue.choice.\
-                                                                       SliceSupportList.\
-                                                                       list.array[idx]->sNSSAI.sD->buf,modifyItem->served_Cell_Information.\
-                                                                       servedPLMNs.list.array[idx]->iE_Extensions->list.array[idx]->\
-                                                                       extensionValue.choice.SliceSupportList.list.array[idx]->\
-                                                                       sNSSAI.sD->size);
-
-                                                              }
-                                                              DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                                    array[idx]->\
-                                                                    iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                                    list.array[idx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
-                                                           }
-                                                           DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                                 iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                                 list.array[idx]->sNSSAI.sST.buf,modifyItem->served_Cell_Information.\
-                                                                 servedPLMNs.\
-                                                                 list.array[idx]->iE_Extensions->list.array[idx]->extensionValue.choice.\
-                                                                 SliceSupportList.list.array[idx]->sNSSAI.sST.size);
-                                                        }
-                                                        DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                              iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                              list.array[idx],sizeof(SliceSupportItem_t));
-                                                     }
-                                                     DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                           iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.\
-                                                           list.array,\
-                                                           modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->\
-                                                           iE_Extensions->list.array[idx]->extensionValue.choice.SliceSupportList.list.size);
-                                                  }
-                                               }
-                                               for(i=0;i<modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                     array[idx]->iE_Extensions->list.count;i++)
-                                               {
-                                                  DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                        array[idx]->iE_Extensions->list.array[i],\
-                                                        sizeof(ServedPLMNs_ItemExtIEs_t ));
-                                               }
-                                               DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                     array[idx]->iE_Extensions->list.array,modifyItem->served_Cell_Information.servedPLMNs.
-                                                     list.array[idx]->iE_Extensions->list.size);
-                                            }
-                                            DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                                  array[idx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
-                                         }
-                                         DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
-                                               array[idx]->pLMN_Identity.buf,
-                                               modifyItem->served_Cell_Information.servedPLMNs.list.array[idx]->pLMN_Identity.size);
-                                      }
-                                   }
-                                   for(i=0;i<modifyItem->served_Cell_Information.servedPLMNs.list.count;i++)
-                                   {
-                                      if(modifyItem->served_Cell_Information.servedPLMNs.list.array[i]
-                                            != NULLP)
-                                      {
-                                         DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[i],\
-                                               sizeof(ServedPLMNs_Item_t));
-                                      }
-                                   }
-                                   DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array,\
-                                         modifyItem->served_Cell_Information.servedPLMNs.list.size);
-                                }
-                                DU_FREE(modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.buf,\
-                                      modifyItem->served_Cell_Information.nRCGI.nRCellIdentity.size);          
-                             }
-                             DU_FREE(modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.buf,\
-                                   modifyItem->served_Cell_Information.nRCGI.pLMN_Identity.size);
-                          }
-                          DU_FREE(modifyItem->oldNRCGI.nRCellIdentity.buf,\
-                                modifyItem->oldNRCGI.nRCellIdentity.size);
-                       }
-                       DU_FREE(modifyItem->oldNRCGI.pLMN_Identity.buf,\
-                             modifyItem->oldNRCGI.pLMN_Identity.size);
-                    }
-                 }
-                 for(i=0; i<cellsToModify->list.count ;i++)
-                 {
-                    if(cellsToModify->list.array[i] != NULLP)
-                    {
-                       DU_FREE(cellsToModify->list.array[i],\
-                             sizeof(Served_Cells_To_Modify_ItemIEs_t));
-                    } 
-                 }
-                 DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
-              }
-           }
-           for(i=0;i<duCfgUpdate->protocolIEs.list.count;i++)
-           {
-              if(duCfgUpdate->protocolIEs.list.array[i] !=NULLP)
-              {
-                 DU_FREE(duCfgUpdate->protocolIEs.list.array[i],\
-                       sizeof(GNBDUConfigurationUpdateIEs_t));
-              }
-           }
-           DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
-        }
-        DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+         duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->\
+                       value.choice.GNBDUConfigurationUpdate;
+         if(duCfgUpdate->protocolIEs.list.array != NULLP)
+         {
+            for(ieIdx=0; ieIdx<duCfgUpdate->protocolIEs.list.count; ieIdx++)
+            {
+               if(duCfgUpdate->protocolIEs.list.array[ieIdx] != NULLP)
+               {
+                  switch(duCfgUpdate->protocolIEs.list.array[ieIdx]->id)
+                  {
+                     case ProtocolIE_ID_id_Served_Cells_To_Modify_List:
+                        {
+                           cellsToModify = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
+                                           value.choice.Served_Cells_To_Modify_List;
+                           if(cellsToModify->list.array != NULLP)
+                           {
+                              for(cellModifyIdx=0; cellModifyIdx<cellsToModify->list.count ;cellModifyIdx++)
+                              {
+                                 if(cellsToModify->list.array[cellModifyIdx] != NULLP)
+                                 {
+                                    freeCellsToModifyItem(&cellsToModify->list.array[cellModifyIdx]->value.choice.\
+                                          Served_Cells_To_Modify_Item);
+                                    DU_FREE(cellsToModify->list.array[cellModifyIdx],\
+                                          sizeof(Served_Cells_To_Modify_ItemIEs_t));
+                                 }
+                              }
+                              DU_FREE(cellsToModify->list.array,cellsToModify->list.size);
+                           }
+                           break;
+                        }
+                     case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
+                        {
+                           cellsToDelete = &duCfgUpdate->protocolIEs.list.array[ieIdx]->\
+                                           value.choice.Served_Cells_To_Delete_List;
+                           if(cellsToDelete->list.array != NULLP)
+                           {
+                              for(cellDeleteIdx=0; cellDeleteIdx<cellsToDelete->list.count ;cellDeleteIdx++)
+                              {
+                                 if(cellsToDelete->list.array[cellDeleteIdx] != NULLP)
+                                 {
+                                    deleteItemIe = ((Served_Cells_To_Delete_ItemIEs_t*)\
+                                          cellsToDelete->list.array[cellDeleteIdx]);
+                                    deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
+                                    DU_FREE(deleteItem->oldNRCGI.pLMN_Identity.buf,\
+                                          deleteItem->oldNRCGI.pLMN_Identity.size); 
+                                    DU_FREE(deleteItem->oldNRCGI.nRCellIdentity.buf,\
+                                          deleteItem->oldNRCGI.nRCellIdentity.size);
+                                    DU_FREE(cellsToDelete->list.array[cellDeleteIdx],\
+                                          sizeof(Served_Cells_To_Delete_ItemIEs_t));
+                                 }
+                              }
+                              DU_FREE(cellsToDelete->list.array,cellsToDelete->list.size);
+                           }
+
+                           break;
+                        }
+                     case ProtocolIE_ID_id_gNB_DU_ID:
+                        {
+                           DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
+                                 duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
+                           break;
+                        }
+                  }
+                  DU_FREE(duCfgUpdate->protocolIEs.list.array[ieIdx],\
+                        sizeof(GNBDUConfigurationUpdateIEs_t));
+               }
+            }
+            DU_FREE(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
+         }
+         DU_FREE(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
       }
       DU_FREE(f1apDuCfg, (Size)sizeof(F1AP_PDU_t));
    }
@@ -1478,119 +1787,135 @@ void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg)
 
 uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
 {
-   uint8_t ieIdx, ieListCnt;
+   uint8_t ieIdx=0, arrayIdx=0, ieListCnt=0, elementCnt=0, sliceLstIdx=0;
 
-   servedPlmn->list.array[0]->pLMN_Identity.size = 3*sizeof(uint8_t);
-   DU_ALLOC(servedPlmn->list.array[0]->pLMN_Identity.buf, servedPlmn->list.\
-        array[0]->pLMN_Identity.size);
-   if(servedPlmn->list.array[0]->pLMN_Identity.buf == NULLP)
+   servedPlmn->list.array[arrayIdx]->pLMN_Identity.size = 3*sizeof(uint8_t);
+   DU_ALLOC(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf, servedPlmn->list.\
+         array[arrayIdx]->pLMN_Identity.size);
+   if(servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
       return RFAILED;
    }
-   buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.plmn[0],\
-        servedPlmn->list.array[0]->pLMN_Identity.buf);
-   DU_ALLOC(servedPlmn->list.array[0]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
-   if(servedPlmn->list.array[0]->iE_Extensions == NULLP)
+   buildPlmnId(duCfgParam.srvdCellLst[arrayIdx].duCellInfo.cellInfo.srvdPlmn[arrayIdx].plmn,\
+         servedPlmn->list.array[arrayIdx]->pLMN_Identity.buf);
+   DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
+   if(servedPlmn->list.array[arrayIdx]->iE_Extensions == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
       return RFAILED;
    }
 
    ieListCnt=1;
-   servedPlmn->list.array[0]->iE_Extensions->list.count = ieListCnt;
-   servedPlmn->list.array[0]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
-   DU_ALLOC(servedPlmn->list.array[0]->iE_Extensions->list.array,servedPlmn->list.array[0]->\
-        iE_Extensions->list.size);
-   if(servedPlmn->list.array[0]->iE_Extensions->list.array == NULLP)
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.count = ieListCnt;
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.size = ieListCnt *sizeof(ServedPLMNs_ItemExtIEs_t *);
+   DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array,servedPlmn->list.array[arrayIdx]->\
+         iE_Extensions->list.size);
+   if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array == NULLP)
    {
+      DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
       return RFAILED;
    }
-   for(ieIdx=0;ieIdx<ieListCnt;ieIdx++)
+   for(ieIdx=arrayIdx;ieIdx<ieListCnt;ieIdx++)
    {
-      DU_ALLOC(servedPlmn->list.array[0]->iE_Extensions->list.array[ieIdx],\
-           sizeof(ServedPLMNs_ItemExtIEs_t));
-      if(servedPlmn->list.array[0]->iE_Extensions->list.array[ieIdx] == NULLP)
+      DU_ALLOC(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx],\
+            sizeof(ServedPLMNs_ItemExtIEs_t));
+      if(servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx] == NULLP)
       {
-        return RFAILED;
+         DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+         return RFAILED;
       }
    }
-   //plmnIeExt = servedPlmn->list.array[0]->iE_Extensions; 
-   servedPlmn->list.array[0]->iE_Extensions->list.array[0]->id =ProtocolIE_ID_id_TAISliceSupportList;
-   servedPlmn->list.array[0]->iE_Extensions->list.array[0]->criticality = Criticality_ignore;
-   servedPlmn->list.array[0]->iE_Extensions->list.array[0]->extensionValue.present = \
-      ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
-   servedPlmn->list.array[0]->iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.count = 1;
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.size = sizeof(SliceSupportItem_t *);
-   DU_ALLOC(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array,servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.size);
-   if(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array == NULLP)
-   {
-      return RFAILED;
-   }
-
-   DU_ALLOC(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0],sizeof( SliceSupportItem_t));
-   if(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0] == NULLP)
-   {
-      return RFAILED;
-   }
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sST.size = sizeof(uint8_t);
-   DU_ALLOC(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sST.buf,servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.list.array[0]->sNSSAI.sST.size);
-   if(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sST.buf == NULLP)
-   {
-      return RFAILED;
-   }
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sST.buf[0] = 3;
-   DU_ALLOC(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sD,sizeof(OCTET_STRING_t));
-   if(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sD == NULLP)
-   {
-      return RFAILED;
-   }
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sD->size = 3*sizeof(uint8_t);
-   DU_ALLOC(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sD->buf,servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sD->size);
-   if(servedPlmn->list.array[0]->\
-        iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-        list.array[0]->sNSSAI.sD->buf == NULLP)
-   {
-      return RFAILED;
-   }
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sD->buf[0] = 3;
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sD->buf[1] = 6;
-   servedPlmn->list.array[0]->\
-      iE_Extensions->list.array[0]->extensionValue.choice.SliceSupportList.\
-      list.array[0]->sNSSAI.sD->buf[2] = 9;
+   
+   ieIdx = 0;
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices; 
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
+   ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
+   servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.count = elementCnt;
+   servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.size = elementCnt * sizeof(SliceSupportItem_t *);
+   DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
+         iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+         list.array,servedPlmn->list.array[arrayIdx]->\
+         iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.size);
+   if(servedPlmn->list.array[arrayIdx]->\
+         iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+         list.array == NULLP)
+   {
+      DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+      return RFAILED;
+   }
+
+   for(sliceLstIdx =0; sliceLstIdx< elementCnt; sliceLstIdx++)
+   {
+      DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx],sizeof( SliceSupportItem_t));
+      if(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx] == NULLP)
+      {   
+         DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+         return RFAILED;
+      }
+      
+      servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sST.size = sizeof(uint8_t);
+      DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sST.buf,servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.list.array[sliceLstIdx]->\
+      sNSSAI.sST.size);
+      
+      if(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sST.buf == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+         return RFAILED;
+      }
+      servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sST.buf[arrayIdx] =  duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
+      cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sst;
+
+      DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
+      if(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+         return RFAILED;
+      }
+      servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->size = 3 * sizeof(uint8_t);
+      DU_ALLOC(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->buf,servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->size);
+      if(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->buf == NULLP)
+      {
+         DU_LOG("ERROR  --> DU_APP : fillServedPlmns(): Memory allocation failed");
+         return RFAILED;
+      }
+      memcpy(servedPlmn->list.array[arrayIdx]->\
+      iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->buf, duCfgParam.srvdCellLst[arrayIdx].duCellInfo.\
+      cellInfo.srvdPlmn[arrayIdx].taiSliceSuppLst.snssai[sliceLstIdx]->sd,\
+      servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.choice.SliceSupportList.\
+      list.array[sliceLstIdx]->sNSSAI.sD->size);
+   }
    return ROK;
 }
 
@@ -1604,64 +1929,70 @@ uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
  *
  *    Functionality: Fills Nr Fdd Info required in ServCellInfo IE
  *
- * @params[in] Pointer to NR_Mode_Info_t *
+ * @params[in] FDD_Info_t *fDD
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  *****************************************************************/
 
-uint8_t fillNrFddInfo(NR_Mode_Info_t *nrFdd)
+uint8_t fillNrFddInfo(FDD_Info_t *fDD)
 {
-   nrFdd->choice.fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
+   fDD->uL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.\
       f1Mode.mode.fdd.ulNrFreqInfo.nrArfcn;
-   nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
-   nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
-   DU_ALLOC(nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.\
-        array, nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.size);
-   if(nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
+   fDD->uL_NRFreqInfo.freqBandListNr.list.count = 1;
+   fDD->uL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t*);
+   DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.\
+        array, fDD->uL_NRFreqInfo.freqBandListNr.list.size);
+   if(fDD->uL_NRFreqInfo.freqBandListNr.list.array == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillNrFddInfo");
       return RFAILED;
    }
-   DU_ALLOC(nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
+
+   DU_ALLOC(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0], \
       sizeof(FreqBandNrItem_t));
-   if(nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
+   if(fDD->uL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillNrFddInfo");
       return RFAILED;
    }
-   nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
+   
+   fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
       duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.ulNrFreqInfo.\
       freqBand[0].nrFreqBand;
-   nrFdd->choice.fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
-   nrFdd->choice.fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
+   fDD->uL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
+   fDD->dL_NRFreqInfo.nRARFCN = duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.\
       dlNrFreqInfo.nrArfcn;
-   nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
-   nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
-   DU_ALLOC(nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array,nrFdd->\
-        choice.fDD->dL_NRFreqInfo.freqBandListNr.list.size);
-   if(nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
+   fDD->dL_NRFreqInfo.freqBandListNr.list.count = 1;
+   fDD->dL_NRFreqInfo.freqBandListNr.list.size = sizeof(FreqBandNrItem_t *);
+   DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array, fDD->dL_NRFreqInfo.freqBandListNr.list.size);
+   if(fDD->dL_NRFreqInfo.freqBandListNr.list.array == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillNrFddInfo");
       return RFAILED;
    }
-   DU_ALLOC(nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array[0],\
-        sizeof(FreqBandNrItem_t));
-   if(nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
+   
+   DU_ALLOC(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0],  sizeof(FreqBandNrItem_t));
+   if(fDD->dL_NRFreqInfo.freqBandListNr.list.array[0] == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillNrFddInfo");
       return RFAILED;
    }
-   nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
+
+   fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->freqBandIndicatorNr = \
       duCfgParam.srvdCellLst[0].duCellInfo.f1Mode.mode.fdd.dlNrFreqInfo.\
       freqBand[0].nrFreqBand;
-   nrFdd->choice.fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
+   fDD->dL_NRFreqInfo.freqBandListNr.list.array[0]->supportedSULBandList.list.count=0;
    
    /*Transmission Bandwidth*/
-   nrFdd->choice.fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
+   fDD->uL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
       f1Mode.mode.fdd.ulTxBw.nrScs;
-   nrFdd->choice.fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
+   fDD->uL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
       f1Mode.mode.fdd.ulTxBw.nrb;
-   nrFdd->choice.fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
+   fDD->dL_Transmission_Bandwidth.nRSCS = duCfgParam.srvdCellLst[0].duCellInfo.\
       f1Mode.mode.fdd.dlTxBw.nrScs;
-   nrFdd->choice.fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
+   fDD->dL_Transmission_Bandwidth.nRNRB = duCfgParam.srvdCellLst[0].duCellInfo.\
       f1Mode.mode.fdd.dlTxBw.nrb;
 
    return ROK;
@@ -1686,7 +2017,7 @@ uint8_t fillNrFddInfo(NR_Mode_Info_t *nrFdd)
 
 uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
 {
-   uint8_t tmp, ieIdx, ieListCnt;
+   uint8_t ieIdx, ieListCnt;
 
    /*nRCGI*/
    srvCellInfo->nRCGI.pLMN_Identity.size =3*sizeof(uint8_t);
@@ -1694,6 +2025,7 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
         srvCellInfo->nRCGI.pLMN_Identity.size);
    if(srvCellInfo->nRCGI.pLMN_Identity.buf == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
       return RFAILED;
    }
    buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
@@ -1702,17 +2034,12 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
    DU_ALLOC(srvCellInfo->nRCGI.nRCellIdentity.buf,\
         srvCellInfo->nRCGI.nRCellIdentity.size);
    if(srvCellInfo->nRCGI.nRCellIdentity.buf == NULLP)
-   {
+   {   
+      DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
       return RFAILED;
    }
-   for (tmp = 0 ; tmp < srvCellInfo->\
-        nRCGI.nRCellIdentity.size-1 ; tmp++)
-   {
-      srvCellInfo->nRCGI.nRCellIdentity.buf[tmp] = 0;
-   }
-   srvCellInfo->nRCGI.nRCellIdentity.buf[4] = 16;
-   srvCellInfo->nRCGI.nRCellIdentity.bits_unused =4;
-
+   
+   fillBitString(&srvCellInfo->nRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
    /*nRPCI*/
    srvCellInfo->nRPCI = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
 
@@ -1720,36 +2047,55 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
    ieListCnt = 1;
    srvCellInfo->servedPLMNs.list.count = ieListCnt;
    srvCellInfo->servedPLMNs.list.size = ieListCnt*sizeof(ServedPLMNs_Item_t *);
-   DU_ALLOC(srvCellInfo->servedPLMNs.list.array,\
-        srvCellInfo->servedPLMNs.list.size);
+   DU_ALLOC(srvCellInfo->servedPLMNs.list.array, srvCellInfo->servedPLMNs.list.size);
    if(srvCellInfo->servedPLMNs.list.array == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
       return RFAILED;
    }
    for(ieIdx=0; ieIdx < ieListCnt; ieIdx++)
    {
-      DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx],\
-           sizeof(ServedPLMNs_Item_t));
+      DU_ALLOC(srvCellInfo->servedPLMNs.list.array[ieIdx], sizeof(ServedPLMNs_Item_t));
       if(srvCellInfo->servedPLMNs.list.array[ieIdx]== NULLP)
       {
-        return RFAILED;
+         DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
+         return RFAILED;
       }
    }
    if(fillServedPlmns(&srvCellInfo->servedPLMNs))
    {
+      DU_LOG("\nERROR  --> Failed to fill Served Plmn info");
       return RFAILED;
    }
 
+#ifndef NR_TDD
    /*nR Mode Info with FDD*/
    srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_fDD;
-   DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD,\
-         sizeof(FDD_Info_t));
+   DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.fDD, sizeof(FDD_Info_t));
    if(srvCellInfo->nR_Mode_Info.choice.fDD == NULLP)
    {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
+      return RFAILED;
+   }
+   if(fillNrFddInfo(srvCellInfo->nR_Mode_Info.choice.fDD))
+   {
+       DU_LOG("\nERROR  --> Failed to fill the Nr FDD information");
+      return RFAILED;
+   }
+#else
+   srvCellInfo->nR_Mode_Info.present = NR_Mode_Info_PR_tDD;   
+   DU_ALLOC(srvCellInfo->nR_Mode_Info.choice.tDD, sizeof(TDD_Info_t));
+   if(srvCellInfo->nR_Mode_Info.choice.tDD == NULLP)
+   {
+      DU_LOG("\nERROR  --> Memory allocation failed in fillServedCellInfo");
       return RFAILED;
    }
-   if(fillNrFddInfo(&srvCellInfo->nR_Mode_Info))
+   if(fillNrTddInfo(srvCellInfo->nR_Mode_Info.choice.tDD) != ROK)
+   {
+      DU_LOG("\nERROR  --> Failed to fill the Nr TDD information");
       return RFAILED;
+   }
+#endif
 
    /*Measurement timing Config*/
    srvCellInfo->measurementTimingConfiguration.size = sizeof(uint8_t);
@@ -1784,8 +2130,6 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
 
 uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
 {
-   uint8_t ieIdx;
-
    /*pLMN_Identity*/
    modifyItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
    DU_ALLOC(modifyItem->oldNRCGI.pLMN_Identity.buf,modifyItem->oldNRCGI.pLMN_Identity.size);
@@ -1804,12 +2148,7 @@ uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
    {
       return RFAILED;
    }
-   for(ieIdx = 0; ieIdx < modifyItem->oldNRCGI.nRCellIdentity.size-1; ieIdx++)
-   {
-      modifyItem->oldNRCGI.nRCellIdentity.buf[ieIdx] = 0;
-   }
-   modifyItem->oldNRCGI.nRCellIdentity.buf[4] = 16;
-   modifyItem->oldNRCGI.nRCellIdentity.bits_unused = 4;
+   fillBitString(&modifyItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
 
    if(fillServedCellInfo(&modifyItem->served_Cell_Information))
       return RFAILED;
@@ -1866,6 +2205,105 @@ uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
    else
       return ROK;
 }
+/*******************************************************************
+ *
+ * @brief filling the DeleteItemList
+ *
+ * @details
+ *
+ *    Function : fillCellToDeleteItem 
+ *
+ *    Functionality: Filling the DeleteItemIe 
+ *
+ * @params[in] Pointer to Served_Cells_To_Delete_ItemIEs_t 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ *****************************************************************/
+uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe)
+{
+   Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
+   
+   deleteItemIe->id = ProtocolIE_ID_id_Served_Cells_To_Delete_Item;
+   deleteItemIe->criticality = Criticality_reject;
+   deleteItemIe->value.present =\
+   Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item;
+   deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
+
+   /*pLMN_Identity*/
+   deleteItem->oldNRCGI.pLMN_Identity.size = 3*sizeof(uint8_t);
+   DU_ALLOC(deleteItem->oldNRCGI.pLMN_Identity.buf,deleteItem->oldNRCGI.pLMN_Identity.size);
+   if(deleteItem->oldNRCGI.pLMN_Identity.buf == NULLP)
+   {
+      DU_LOG("ERROR  --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
+      return RFAILED;
+   }
+   buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn,\
+         deleteItem->oldNRCGI.pLMN_Identity.buf);
+
+   /*nRCellIdentity*/
+   deleteItem->oldNRCGI.nRCellIdentity.size = 5*sizeof(uint8_t);
+   DU_ALLOC(deleteItem->oldNRCGI.nRCellIdentity.buf,\
+         deleteItem->oldNRCGI.nRCellIdentity.size);
+   if(deleteItem->oldNRCGI.nRCellIdentity.buf == NULLP)
+   {
+      DU_LOG("ERROR  --> F1AP: fillCellToDeleteItem(): Failed to allocate the memory");
+      return RFAILED;
+   }
+   fillBitString(&deleteItem->oldNRCGI.nRCellIdentity, ODU_VALUE_FOUR, ODU_VALUE_FIVE, duCfgParam.sib1Params.cellIdentity);
+   return ROK;
+} 
+/*******************************************************************
+ *
+ * @brief Builds ServCellToDeleteList
+ *
+ * @details
+ *
+ *    Function : buildServCellToDeleteList
+ *
+ *    Functionality: Builds the serv cell to delete List
+ *
+ * @params[in] Pointer to Served_Cells_To_Delete_List_t *
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ *****************************************************************/
+uint8_t buildServCellToDeleteList(Served_Cells_To_Delete_List_t *cellsToDelete)
+{
+   uint8_t ieListCnt, arrIdx;
+   
+   ieListCnt = 1;
+   cellsToDelete->list.count = ieListCnt;
+   cellsToDelete->list.size = ieListCnt*sizeof(Served_Cells_To_Delete_ItemIEs_t *);
+   
+   DU_ALLOC(cellsToDelete->list.array,cellsToDelete->list.size);
+   if(cellsToDelete->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
+      return RFAILED;
+   }
+   
+   for(arrIdx=0; arrIdx< ieListCnt; arrIdx++)
+   {
+      DU_ALLOC(cellsToDelete->list.array[arrIdx],sizeof(Served_Cells_To_Delete_ItemIEs_t));
+      if(cellsToDelete->list.array[arrIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  --> F1AP : buildServCellToDeleteList(): Memory allocation failed");
+         return RFAILED;
+      }
+   }
+   
+   arrIdx=0;
+   if(fillCellToDeleteItem((Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx]) !=ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP: buildServCellToDeleteList(): failed to fill Served_Cells_To_Delete_ItemIEs");
+      return RFAILED;
+   }
+   return ROK;
+}
 
 /*******************************************************************
  *
@@ -1885,94 +2323,124 @@ uint8_t buildServCellToModList(Served_Cells_To_Modify_List_t *cellsToModify)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildAndSendDUConfigUpdate()
+uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
 {
-   uint8_t ret, ieIdx, elementCnt;
+   uint8_t ret =0, ieIdx=0, elementCnt=0;
+   bool memAlloctionFailure = false;
    F1AP_PDU_t                 *f1apDuCfg = NULLP;
    GNBDUConfigurationUpdate_t *duCfgUpdate = NULLP;
    asn_enc_rval_t encRetVal;     /* Encoder return value */
+   
    memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
    ret= RFAILED;
 
    while(true)
    {
-      DU_LOG("\nF1AP : Building DU config update\n");
+      DU_LOG("\nINFO   -->  F1AP : Building DU config update\n");
       /* Allocate the memory for F1DuCfg */
       DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
       if(f1apDuCfg == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
+         break;
       }
 
       f1apDuCfg->present = F1AP_PDU_PR_initiatingMessage;
       DU_ALLOC(f1apDuCfg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
       if(f1apDuCfg->choice.initiatingMessage == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendDUConfigUpdate(): Memory allocation for F1AP-PDU failed");
+         break;
       }
 
       f1apDuCfg->choice.initiatingMessage->procedureCode = \
-                                                          ProcedureCode_id_gNBDUConfigurationUpdate;
+                                                           ProcedureCode_id_gNBDUConfigurationUpdate;
       f1apDuCfg->choice.initiatingMessage->criticality = Criticality_reject;
       f1apDuCfg->choice.initiatingMessage->value.present = \
-                                                          InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
+                                                           InitiatingMessage__value_PR_GNBDUConfigurationUpdate;
       duCfgUpdate = &f1apDuCfg->choice.initiatingMessage->value.\
-                   choice.GNBDUConfigurationUpdate;
+                    choice.GNBDUConfigurationUpdate;
       elementCnt = 3;
       duCfgUpdate->protocolIEs.list.count = elementCnt;
       duCfgUpdate->protocolIEs.list.size = \
-                                          elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
+                                           elementCnt * sizeof(GNBDUConfigurationUpdateIEs_t*);
 
       /* Initialize the F1Setup members */
       DU_ALLOC(duCfgUpdate->protocolIEs.list.array,duCfgUpdate->protocolIEs.list.size);
       if(duCfgUpdate->protocolIEs.list.array == NULLP)
       {
-        DU_LOG("F1AP : Memory allocation for F1RequestIEs failed");
-        break;
+         DU_LOG("ERROR  -->  F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
+         break;
       }
       for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
       {
-        DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
-        if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
-        {
-           break;
-        }
+         DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx],sizeof(GNBDUConfigurationUpdateIEs_t));
+         if(duCfgUpdate->protocolIEs.list.array[ieIdx] == NULLP)
+         {
+            DU_LOG("ERROR  -->  F1AP : BuildAndSendDUConfigUpdate(): Memory allocation failed");
+            memAlloctionFailure = true;
+            break;
+         }
+      }
+      
+      if(memAlloctionFailure == true)
+      {
+         break;
       }
-
       /*TransactionID*/
       ieIdx = 0;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->id=ProtocolIE_ID_id_TransactionID;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
-         GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
+      GNBDUConfigurationUpdateIEs__value_PR_TransactionID;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = TRANS_ID;
-
-      /*Served Cell to Modify */
+      
       ieIdx++;
-      duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
-                                                     ProtocolIE_ID_id_Served_Cells_To_Modify_List;
-      duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
-      duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
-        GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
-      if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
-        Served_Cells_To_Modify_List))
-         break;
-
+      if(servCellAction == SERV_CELL_TO_MODIFY)
+      {
+         /*Served Cell to Modify */
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
+         ProtocolIE_ID_id_Served_Cells_To_Modify_List;
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
+         GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List;
+         if(buildServCellToModList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
+                  Served_Cells_To_Modify_List))
+         {
+            DU_LOG("ERROR  --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToModList");
+            break;
+         }
+      }
+      else
+      {
+         /*Served Cell to Delete */ 
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->id = \
+         ProtocolIE_ID_id_Served_Cells_To_Delete_List;
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality =Criticality_reject;
+         duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
+         GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List;
+         if(buildServCellToDeleteList(&duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
+         Served_Cells_To_Delete_List)!=ROK)
+         {
+            DU_LOG("ERROR  --> DU APP : BuildAndSendDUConfigUpdate(): failed to build ServCellToDeleteList");
+            break;
+         }
+         
+      }
       // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
       /*GNB DU ID */
       ieIdx++;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_ID;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->value.present = \
-       GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
+      GNBDUConfigurationUpdateIEs__value_PR_GNB_DU_ID;
       duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size = sizeof(uint8_t);
       DU_ALLOC(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf,\
-           duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
+            duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.size);
       if(duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf == NULLP)
       {
-        break;
+         DU_LOG("ERROR  --> DU APP : BuildAndSendDUConfigUpdate(): Memory allocation failed for GNB_DU_ID");
+         break;
       }
       duCfgUpdate->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_ID.buf[0] = duCfgParam.duId;
 
@@ -1986,29 +2454,30 @@ uint8_t BuildAndSendDUConfigUpdate()
       /* Checking encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG("F1AP : Could not encode DUConfigUpdate structure (at %s)\n",encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
+         DU_LOG("ERROR  -->  F1AP : Could not encode DUConfigUpdate structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
       }
       else
       {
-        DU_LOG("\nF1AP : Created APER encoded buffer for DUConfigUpdate\n");
-        for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
-        {
-           printf("%x",encBuf[ieIdx]);
-        }
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for DUConfigUpdate\n");
+         for(ieIdx =0; ieIdx < encBufSize; ieIdx++)
+         {
+            printf("%x",encBuf[ieIdx]);
+         }
       }
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
-        DU_LOG("\nF1AP : Sending GND-DU Config Update failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Sending GNB-DU Config Update failed");
+         break;
       }
 
       ret = ROK;
       break;
    }
-   FreeDUConfigUpdate(f1apDuCfg);
-
+  
+   addToReservedF1apPduList(TRANS_ID,f1apDuCfg);
    return ret;
 }
 
@@ -2081,29 +2550,31 @@ void FreeULRRCMessageTransfer( F1AP_PDU_t *f1apMsg)
 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       uint16_t msgLen, uint8_t *rrcMsg)
 {
-   uint8_t   elementCnt;
-   uint8_t   idx1;
-   uint8_t   idx;
-   F1AP_PDU_t                  *f1apMsg = NULL;
-   ULRRCMessageTransfer_t      *ulRRCMsg;
+   uint8_t   elementCnt =0;
+   uint8_t   idx1 =0;
+   uint8_t   idx =0;
+   F1AP_PDU_t                  *f1apMsg = NULLP;
+   ULRRCMessageTransfer_t      *ulRRCMsg = NULLP;
    asn_enc_rval_t              encRetVal;        /* Encoder return value */
    uint8_t ret =RFAILED;
+   
+   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+
    while(true)
    {
-      DU_LOG("\n F1AP : Building UL RRC Message Transfer Message\n");
+      DU_LOG("\n INFO   -->  F1AP : Building UL RRC Message Transfer Message\n");
 
       DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
       if(f1apMsg == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
         break;
       }
-
       f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
       DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
       if(f1apMsg->choice.initiatingMessage == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for      F1AP-PDU failed");
         break;
       }
       f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_ULRRCMessageTransfer;
@@ -2121,7 +2592,7 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       DU_ALLOC(ulRRCMsg->protocolIEs.list.array, ulRRCMsg->protocolIEs.list.size);
       if(ulRRCMsg->protocolIEs.list.array == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for UL RRC MessageTransferIEs failed");
         break;
       }
       for(idx=0; idx<elementCnt; idx++)
@@ -2167,11 +2638,12 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size = msgLen;
       DU_ALLOC(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
            ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
-        if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
-        {
-           DU_LOG(" F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
-           break;
-        }
+      if(!ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for BuildAndSendULRRCMessageTransfer failed");
+        break;
+      }
+      memset(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, 0, msgLen);
       memcpy(ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, \
            rrcMsg, ulRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
 
@@ -2185,13 +2657,13 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       /* Encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG( "\n F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
+        DU_LOG( "\nERROR  -->  F1AP : Could not encode ULRRCMessageTransfer structure (at %s)\n",\
               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
         break;
       }
       else
       {
-        DU_LOG("\n F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
+        DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for ULRRCMessageTransfer\n");
         for(int i=0; i< encBufSize; i++)
         {
            printf("%x",encBuf[i]);
@@ -2199,9 +2671,9 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       }
 
       /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL)        !=      ROK)
+      if(sendF1APMsg() !=      ROK)
       {
-        DU_LOG("\n F1AP : Sending      UL RRC Message Transfer Failed");
+        DU_LOG("\nERROR  -->   F1AP : Sending  UL RRC Message Transfer Failed");
         break;
       }
       ret = ROK;
@@ -2228,7 +2700,7 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
+uint8_t BuildTagConfig(DuUeCb *ueCb, struct TAG_Config *tagConfig)
 {
    struct TAG_Config__tag_ToAddModList *tagList;
    uint8_t                     idx, elementCnt;
@@ -2238,11 +2710,15 @@ uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
    DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
    if(!tagConfig->tag_ToAddModList)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildTagConfig");
       return RFAILED;
    }
 
-   elementCnt = 1; //ODU_VALUE_ONE;
+   if(ueCb == NULLP)
+      elementCnt = ODU_VALUE_ONE;
+   else
+      elementCnt = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModListCount;
+
    tagList = tagConfig->tag_ToAddModList;
    tagList->list.count = elementCnt;
    tagList->list.size  =  elementCnt * sizeof(struct TAG *);
@@ -2251,7 +2727,7 @@ uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
    DU_ALLOC(tagList->list.array, tagList->list.size);
    if(!tagList->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildTagConfig");
       return RFAILED;
    }
 
@@ -2261,14 +2737,25 @@ uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
       DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
       if(!tagList->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildTagConfig");
+         return RFAILED;
       }
    }
 
-   idx = 0;
-   tagList->list.array[idx]->tag_Id = TAG_ID;
-   tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
+   if(ueCb == NULLP)
+   {
+      idx = 0;
+      tagList->list.array[idx]->tag_Id = TAG_ID;
+      tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
+   }
+   else
+   {
+      for(idx=0; idx<tagList->list.count; idx++)
+      {
+         tagList->list.array[idx]->tag_Id = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].tagId;
+         tagList->list.array[idx]->timeAlignmentTimer = ueCb->macUeCfg.macCellGrpCfg.tagCfg.addModList[idx].timeAlignTimer;
+      }
+   }
 
    return ROK;
 }
@@ -2289,7 +2776,7 @@ uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildPhrConfig(struct MAC_CellGroupConfig__phr_Config *phrConfig)
+uint8_t BuildPhrConfig(DuUeCb *ueCb, struct MAC_CellGroupConfig__phr_Config *phrConfig)
 {
 
    phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
@@ -2297,17 +2784,30 @@ uint8_t BuildPhrConfig(struct MAC_CellGroupConfig__phr_Config *phrConfig)
    DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
    if(!phrConfig->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildPhrConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildPhrConfig");
       return RFAILED;
    }
 
-   phrConfig->choice.setup->phr_PeriodicTimer        = PHR_PERIODIC_TMR;
-   phrConfig->choice.setup->phr_ProhibitTimer        = PHR_PROHIBHIT_TMR;
-   phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
-   phrConfig->choice.setup->multiplePHR              = false;
-   phrConfig->choice.setup->dummy                    = false;
-   phrConfig->choice.setup->phr_Type2OtherCell       = false;
-   phrConfig->choice.setup->phr_ModeOtherCG          = PHR_MODE_OTHER_CG;
+   if(ueCb == NULLP)
+   {
+      phrConfig->choice.setup->phr_PeriodicTimer        = PHR_PERIODIC_TMR;
+      phrConfig->choice.setup->phr_ProhibitTimer        = PHR_PROHIBHIT_TMR;
+      phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
+      phrConfig->choice.setup->multiplePHR              = false;
+      phrConfig->choice.setup->dummy                    = false;
+      phrConfig->choice.setup->phr_Type2OtherCell       = false;
+      phrConfig->choice.setup->phr_ModeOtherCG          = PHR_MODE_OTHER_CG;
+   }
+   else
+   {
+      phrConfig->choice.setup->phr_PeriodicTimer        = ueCb->macUeCfg.macCellGrpCfg.phrCfg.periodicTimer;
+      phrConfig->choice.setup->phr_ProhibitTimer        = ueCb->macUeCfg.macCellGrpCfg.phrCfg.prohibitTimer;
+      phrConfig->choice.setup->phr_Tx_PowerFactorChange = ueCb->macUeCfg.macCellGrpCfg.phrCfg.txPowerFactor;
+      phrConfig->choice.setup->multiplePHR              = ueCb->macUeCfg.macCellGrpCfg.phrCfg.multiplePHR;
+      phrConfig->choice.setup->dummy                    = ueCb->macUeCfg.macCellGrpCfg.phrCfg.dummy;
+      phrConfig->choice.setup->phr_Type2OtherCell       = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrType2OtherCell;
+      phrConfig->choice.setup->phr_ModeOtherCG          = ueCb->macUeCfg.macCellGrpCfg.phrCfg.phrOtherCG;
+   }
 
    return ROK;
 }
@@ -2328,11 +2828,28 @@ uint8_t BuildPhrConfig(struct MAC_CellGroupConfig__phr_Config *phrConfig)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildBsrConfig(struct BSR_Config *bsrConfig)
+uint8_t BuildBsrConfig(DuUeCb *ueCb, struct BSR_Config *bsrConfig)
 {
-   bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
-   bsrConfig->retxBSR_Timer     = RETX_BSR_TMR;
-   bsrConfig->logicalChannelSR_DelayTimer = NULLP;
+   if(ueCb == NULLP)
+   {
+      bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
+      bsrConfig->retxBSR_Timer     = RETX_BSR_TMR;
+      bsrConfig->logicalChannelSR_DelayTimer = NULLP;
+   }
+   else
+   {
+      bsrConfig->periodicBSR_Timer = convertBsrPeriodicTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.periodicTimer);
+      bsrConfig->retxBSR_Timer     = convertBsrRetxTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.retxTimer);
+
+      bsrConfig->logicalChannelSR_DelayTimer = NULLP;
+      DU_ALLOC(bsrConfig->logicalChannelSR_DelayTimer, sizeof(long));
+      if(bsrConfig->logicalChannelSR_DelayTimer == NULLP)
+      {
+         DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildBsrConfig");
+         return RFAILED;
+      }
+      *(bsrConfig->logicalChannelSR_DelayTimer) = convertLcSrDelayTmrValueToEnum(ueCb->macUeCfg.macCellGrpCfg.bsrTmrCfg.srDelayTimer);
+   }
 
    return ROK;
 }
@@ -2353,7 +2870,7 @@ uint8_t BuildBsrConfig(struct BSR_Config *bsrConfig)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingRequestConfig)
+uint8_t BuildSchedulingReqConfig(DuUeCb *ueCb, struct SchedulingRequestConfig *schedulingRequestConfig)
 {
    struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
    uint8_t                     idx, elementCnt;
@@ -2363,11 +2880,15 @@ uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingReque
         sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
    if(!schedulingRequestConfig->schedulingRequestToAddModList)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSchedulingReqConfig");
       return RFAILED;
    }
 
-   elementCnt = 1; //ODU_VALUE_ONE;
+   if(ueCb == NULLP)
+      elementCnt = ODU_VALUE_ONE;
+   else
+      elementCnt = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModListCount;
+
    schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
    schReqList->list.count = elementCnt;
    schReqList->list.size  = elementCnt * sizeof(struct SchedulingRequestToAddMod *);
@@ -2376,33 +2897,54 @@ uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingReque
    DU_ALLOC(schReqList->list.array, schReqList->list.size);
    if(!schReqList->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSchedulingReqConfig");
       return RFAILED;
    }
 
-   for(idx=0;idx<schReqList->list.count; idx++)
+   for(idx=0; idx<schReqList->list.count; idx++)
    {
       schReqList->list.array[idx] = NULLP;
       DU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
       if(!schReqList->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSchedulingReqConfig");
+         return RFAILED;
       }
    }
 
-   idx = 0;
-   schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
+   if(ueCb == NULLP)
+   {
+      idx = 0;
+      schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
 
-   schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
-   DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
-   if(!schReqList->list.array[idx]->sr_ProhibitTimer)
+      schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
+      DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+      if(!schReqList->list.array[idx]->sr_ProhibitTimer)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSchedulingReqConfig");
+         return RFAILED;
+      }
+      *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
+      schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
+   }
+   else
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
-      return RFAILED;
+      for(idx=0; idx<schReqList->list.count; idx++)
+      {
+         schReqList->list.array[idx]->schedulingRequestId = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].schedReqId;
+
+         schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
+         DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+         if(!schReqList->list.array[idx]->sr_ProhibitTimer)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSchedulingReqConfig");
+            return RFAILED;
+         }
+         *(schReqList->list.array[idx]->sr_ProhibitTimer) = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srProhibitTmr;
+         schReqList->list.array[idx]->sr_TransMax = ueCb->macUeCfg.macCellGrpCfg.schReqCfg.addModList[idx].srTransMax;
+      }
    }
-   *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
-   schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
+
    schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
 
    return ROK;
@@ -2410,209 +2952,228 @@ uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingReque
 
 /*******************************************************************
  *
- * @brief Builds RLC Config
+ * @brief Builds RLC Configuration for AM mode
  *
  * @details
  *
- *    Function : BuildRlcConfig
+ *    Function : BuildRlcConfigAm
  *
- *    Functionality: Builds RLC Config in BuildRlcBearerToAddModList 
+ *    Functionality: 
+ *       Builds AM mode RLC Config in BuildRlcBearerToAddModList
  *
- * @params[in] RLC_Config *rlcConfig
+ * @params[in] AmBearerCfg *amCfg
+ *             RLC_Config_t  *rlcConfig
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildRlcConfig(struct RLC_Config *rlcConfig)
+uint8_t BuildRlcConfigAm(AmBearerCfg *amCfg, struct RLC_Config *rlcConfig)
 {
-
-   rlcConfig->present = RLC_Config_PR_am;
-
    rlcConfig->choice.am = NULLP;
    DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
    if(!rlcConfig->choice.am)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigAm");
       return RFAILED;
    }
 
-   /* UL */
+   /* Fill AM UL configuration */
    rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
    DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
    if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigAm");
       return RFAILED;
    }
-   *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
-   rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit  = T_POLL_RETRANSMIT;
-   rlcConfig->choice.am->ul_AM_RLC.pollPDU           = POLL_PDU;
-   rlcConfig->choice.am->ul_AM_RLC.pollByte          = POLL_BYTE;
-   rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold  = MAX_RETX_THRESHOLD;
 
-   /* DL */
+   /* Fill default AM UL configuration if input pointer to DU database is NULL */
+   if(amCfg == NULLP)
+   {
+      *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
+      rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit  = T_POLL_RETRANSMIT;
+      rlcConfig->choice.am->ul_AM_RLC.pollPDU           = POLL_PDU;
+      rlcConfig->choice.am->ul_AM_RLC.pollByte          = POLL_BYTE;
+      rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold  = MAX_RETX_THRESHOLD;
+   }
+   else
+   {
+      *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->dlAmCfg.snLenDl);
+      rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit  = covertPollRetxTmrValueToEnum(amCfg->dlAmCfg.pollRetxTmr);
+      rlcConfig->choice.am->ul_AM_RLC.pollPDU           = covertPollPduValueToEnum(amCfg->dlAmCfg.pollPdu);
+      rlcConfig->choice.am->ul_AM_RLC.pollByte          = covertPollByteValueToEnum(amCfg->dlAmCfg.pollByte);
+      rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold  = covertMaxRetxValueToEnum(amCfg->dlAmCfg.maxRetxTh);
+   }
+
+   /* Fill AM DL configuraion */
    rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
    DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
    if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigAm");
       return RFAILED;
    }
-   *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
-   rlcConfig->choice.am->dl_AM_RLC.t_Reassembly      = T_REASSEMBLY;
-   rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit  = T_STATUS_PROHIBHIT;
 
+   /* Fill default AM DL configuration if input pointer to DU database is NULL */
+   if(amCfg == NULLP)
+   {
+      *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
+      rlcConfig->choice.am->dl_AM_RLC.t_Reassembly      = T_REASSEMBLY;
+      rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit  = T_STATUS_PROHIBHIT;
+   }
+   else /* Fill AM configuration from DU database */
+   {
+      *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = covertAmSnLenFromIntEnumToRrcEnum(amCfg->ulAmCfg.snLenUl);
+      rlcConfig->choice.am->dl_AM_RLC.t_Reassembly      = convertReasmblTmrValueToEnum(amCfg->ulAmCfg.reAssemTmr);
+      rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit  = convertProhibitTmrValueToEnum(amCfg->ulAmCfg.statProhTmr);
+   }
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds MAC LC Config
+ * @brief Builds RLC Config for UM Bidirection
  *
  * @details
  *
- *    Function : BuildMacLCConfig 
+ *    Function : BuildRlcConfig UmBiDir
  *
- *    Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList 
+ *    Functionality: 
+ *       Builds RLC Config for UM Bidirection in BuildRlcBearerToAddModList 
  *
- * @params[in] struct LogicalChannelConfig macLcConfig
+ * @params[in] UmBiDirBearerCfg *umBiDirCfg
+ *             RLC_Config_t *rlcConfig
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildMacLCConfig(struct LogicalChannelConfig *macLcConfig)
+uint8_t BuildRlcConfigUmBiDir(UmBiDirBearerCfg *umBiDirCfg, struct RLC_Config *rlcConfig)
 {
-
-   macLcConfig->ul_SpecificParameters = NULLP;
-   DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
-   if(!macLcConfig->ul_SpecificParameters)
+   rlcConfig->choice.um_Bi_Directional = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Bi_Directional, sizeof(struct RLC_Config__um_Bi_Directional));
+   if(rlcConfig->choice.um_Bi_Directional == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
       return RFAILED;
    }
 
-   macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
-   macLcConfig->ul_SpecificParameters->prioritisedBitRate =    PRIORTISIED_BIT_RATE;
-   macLcConfig->ul_SpecificParameters->bucketSizeDuration =    BUCKET_SIZE_DURATION;
-   macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
-   macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
-   macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
-   macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
-
-   macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
-   DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
-   if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
+   /* Fill UM Bidirectional UL configuration */
+   rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+   if(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
       return RFAILED;
    }
-   *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
 
-   macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
-   DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID,   sizeof(SchedulingRequestId_t));
-   if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
+   if(umBiDirCfg != NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+      *(rlcConfig->choice.um_Bi_Directional->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->dlUmCfg.snLenDlUm);     
+   }
+
+   /* Fill UM Bidirectional DL configuration */
+   rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+   if(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmBiDir");
       return RFAILED;
    }
-   *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
 
-   macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
-   macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
-   macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
+   if(umBiDirCfg != NULLP)
+   {
+      *(rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umBiDirCfg->ulUmCfg.snLenUlUm);     
+      rlcConfig->choice.um_Bi_Directional->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umBiDirCfg->ulUmCfg.reAssemTmr);
+   }
 
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds RLC Bearer to Add/Mod list
+ * @brief Builds RLC Config for UM Uni directional UL
  *
  * @details
  *
- *    Function :BuildRlcBearerToAddModList 
+ *    Function : BuildRlcConfigUmUniDirUl
  *
- *    Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
+ *    Functionality: 
+ *       Builds RLC Config for UM Unidirection UL in BuildRlcBearerToAddModList 
  *
- * @params[in] rlc_BearerToAddModList
+ * @params[in] UmUniDirDlBearerCfg *umUniDirDlCfg
+ *             RLC_Config_t *rlcConfig
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
+uint8_t BuildRlcConfigUmUniDirUl(UmUniDirDlBearerCfg *umUniDirDlCfg, RLC_Config_t *rlcConfig)
 {
-   uint8_t                     idx, elementCnt;
-
-   elementCnt = 1;
-   rlcBearerList->list.count = elementCnt;
-   rlcBearerList->list.size  = elementCnt * sizeof(struct RLC_BearerConfig *);
-
-   rlcBearerList->list.array = NULLP;
-   DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
-   if(!rlcBearerList->list.array)
+   rlcConfig->choice.um_Uni_Directional_UL = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL , sizeof(struct RLC_Config__um_Uni_Directional_UL));
+   if(rlcConfig->choice.um_Uni_Directional_UL == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
       return RFAILED;
    }
 
-   for(idx=0; idx<rlcBearerList->list.count; idx++)
-   {
-      rlcBearerList->list.array[idx] = NULLP;
-      DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
-      if(!rlcBearerList->list.array[idx])
-      {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
-        return RFAILED;
-      }
-   }
-
-   idx = 0;
-   rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
-
-   DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, \
-      sizeof(struct RLC_BearerConfig__servedRadioBearer));
-   if(!rlcBearerList->list.array[idx]->servedRadioBearer)
+   rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+   if(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmUniDirUl");
       return RFAILED;
    }
 
-   rlcBearerList->list.array[idx]->servedRadioBearer->present = \
-      RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
-   rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = \
-      SRB1_LCID;
-
-   rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
-   rlcBearerList->list.array[idx]->rlc_Config = NULLP;
-   DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
-   if(!rlcBearerList->list.array[idx]->rlc_Config)
+   if(umUniDirDlCfg != NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
-      return RFAILED;
+      *(rlcConfig->choice.um_Uni_Directional_UL->ul_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirDlCfg->dlUmCfg.snLenDlUm);
    }
 
-   if(BuildRlcConfig(rlcBearerList->list.array[idx]->rlc_Config) != ROK)
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds RLC Config for UM Uni directional DL
+ *
+ * @details
+ *
+ *    Function : BuildRlcConfigUmUniDirDl
+ *
+ *    Functionality: 
+ *       Builds RLC Config for UM Unidirection DL in BuildRlcBearerToAddModList 
+ *
+ * @params[in] UmUniDirUlBearerCfg *umUniDirUlCfg
+ *             RLC_Config_t *rlcConfig
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildRlcConfigUmUniDirDl(UmUniDirUlBearerCfg *umUniDirUlCfg, RLC_Config_t *rlcConfig)
+{
+   rlcConfig->choice.um_Uni_Directional_DL = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL , sizeof(struct RLC_Config__um_Uni_Directional_DL));
+   if(rlcConfig->choice.um_Uni_Directional_DL == NULLP)
    {
-      DU_LOG("\nF1AP : BuildRlcConfig failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
       return RFAILED;
    }
 
-   rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
-   DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, \
-      sizeof(struct LogicalChannelConfig));
-   if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
+   rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength, sizeof(SN_FieldLengthUM_t));
+   if(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcConfigUmUniDirDl");
       return RFAILED;
    }
 
-   if(BuildMacLCConfig(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
+   if(umUniDirUlCfg != NULLP)
    {
-      DU_LOG("\nF1AP : BuildMacLCConfig failed");
-      return RFAILED;
+      *(rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.sn_FieldLength) = covertUmSnLenFromIntEnumToRrcEnum(umUniDirUlCfg->ulUmCfg.snLenUlUm);
+      rlcConfig->choice.um_Uni_Directional_DL->dl_UM_RLC.t_Reassembly = convertReasmblTmrValueToEnum(umUniDirUlCfg->ulUmCfg.reAssemTmr);
    }
 
    return ROK;
@@ -2620,152 +3181,470 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
 
 /*******************************************************************
  *
- * @brief Build Control resource set to add/modify list 
+ * @brief Builds RLC Config
  *
  * @details
  *
- *    Function : BuildControlRSetToAddModList
+ *    Function : BuildRlcConfig
  *
- *    Functionality: Build Control resource set to add/modify list
+ *    Functionality: Builds RLC Config in BuildRlcBearerToAddModList 
  *
- * @params[in] 
- * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
+ * @params[in] RLC_Config_t *rlcConfig
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildControlRSetToAddModList
-(
- struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
- )
+uint8_t BuildRlcConfig(RlcBearerCfg *rbCfg, struct RLC_Config *rlcConfig)
 {
-   uint8_t idx;
-   uint8_t elementCnt;
-   uint8_t numBytes, bitsUnused;
-   struct ControlResourceSet *controlRSet;
-   uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
-   uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
-
-
-   elementCnt = 1;
-   controlRSetList->list.count = elementCnt;
-   controlRSetList->list.size = \
-                               elementCnt * sizeof(struct ControlResourceSet *);
-
-   controlRSetList->list.array = NULLP;
-   DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
-   if(!controlRSetList->list.array)
+   
+   /* Fill default values if rbCfg is NULL */
+   if(rbCfg == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
-      return RFAILED;
+      rlcConfig->present = RLC_Config_PR_am;
+      BuildRlcConfigAm(NULLP, rlcConfig);
    }
-
-   for(idx = 0; idx < elementCnt; idx++)
+   /* If RbCfg is present, fill RLC configurations from DU Database */
+   else
    {
-      controlRSetList->list.array[idx] = NULLP;
-      DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
-      if(!controlRSetList->list.array[idx])
+      rlcConfig->present = covertRlcModeFromIntEnumToRrcEnum(rbCfg->rlcMode);
+      switch(rlcConfig->present)
       {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
-        return RFAILED;
+         case RLC_Config_PR_am:
+            BuildRlcConfigAm(rbCfg->u.amCfg, rlcConfig);
+            break;
+         case RLC_Config_PR_um_Bi_Directional:
+            BuildRlcConfigUmBiDir(rbCfg->u.umBiDirCfg, rlcConfig);
+            break;
+         case RLC_Config_PR_um_Uni_Directional_UL:
+            BuildRlcConfigUmUniDirUl(rbCfg->u.umUniDirDlCfg, rlcConfig);
+            break;
+         case RLC_Config_PR_um_Uni_Directional_DL:
+            BuildRlcConfigUmUniDirDl(rbCfg->u.umUniDirUlCfg, rlcConfig);
+            break;
+         case RLC_Config_PR_NOTHING:
+         default:
+            break;
       }
    }
 
-   idx=0;
-   controlRSet = controlRSetList->list.array[idx];
-
-   controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
-
-   /* size 6 bytes
-    * 3 LSBs unsued
-    * Bit string stored ff0000000000
-    */
-   numBytes = 6;
-   bitsUnused = 3;
-   controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
+   return ROK;
+}
 
-   controlRSet->frequencyDomainResources.buf = NULLP;
-   DU_ALLOC(controlRSet->frequencyDomainResources.buf, \
-        controlRSet->frequencyDomainResources.size);
-   if(!controlRSet->frequencyDomainResources.buf)
+/*******************************************************************
+ *
+ * @brief Builds MAC LC Config
+ *
+ * @details
+ *
+ *    Function : BuildMacLCConfig 
+ *
+ *    Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList 
+ *
+ * @params[in] struct LogicalChannelConfig macLcConfig
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildMacLCConfig(LcCfg *lcCfgDb, struct LogicalChannelConfig *macLcConfig)
+{
+   macLcConfig->ul_SpecificParameters = NULLP;
+   DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+   if(!macLcConfig->ul_SpecificParameters)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacLCConfig");
       return RFAILED;
    }
 
-   memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
-   coreset0EndPrb = CORESET0_END_PRB;
-   coreset1StartPrb = coreset0EndPrb + 6;
-   coreset1NumPrb = CORESET1_NUM_PRB;
-   /* calculate the PRBs */
-   freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
-   memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
-   controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
-
-   controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
-   controlRSet->cce_REG_MappingType.present = \
-                                             ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
+   if(lcCfgDb == NULLP)
+   {
+      macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
+      macLcConfig->ul_SpecificParameters->prioritisedBitRate = PRIORTISIED_BIT_RATE;
+      macLcConfig->ul_SpecificParameters->bucketSizeDuration = BUCKET_SIZE_DURATION;
+   }
+   else
+   {
+      macLcConfig->ul_SpecificParameters->priority = lcCfgDb->ulLcCfg.priority;
+      macLcConfig->ul_SpecificParameters->prioritisedBitRate = lcCfgDb->ulLcCfg.pbr;
+      macLcConfig->ul_SpecificParameters->bucketSizeDuration = lcCfgDb->ulLcCfg.bsd;
+   }
 
-   controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
-   controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
-   controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
-   controlRSet->tci_PresentInDCI = NULLP;
-#if 0
-   uint8_t tciStateIdx;
+   macLcConfig->ul_SpecificParameters->allowedServingCells = NULLP;
+   macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
+   macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
+   macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
 
-   DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
-        sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
-   if(!controlRset->tci_StatesPDCCH_ToAddList)
+   macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
+   DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
+   if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacLCConfig");
       return RFAILED;
    }
 
-   elementCnt = 1;
-   controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
-   controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
-   DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
-        controlRset->tci_StatesPDCCH_ToAddList->list.size)
-      if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
-      {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
-        return RFAILED;
+   if(lcCfgDb == NULLP)
+      *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
+   else
+      *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = lcCfgDb->ulLcCfg.lcGroup;
+
+   macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
+   DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID,   sizeof(SchedulingRequestId_t));
+   if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildMacLCConfig");
+      return RFAILED;
+   }
+
+   if(lcCfgDb == NULLP)
+      *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
+   else
+      *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = lcCfgDb->ulLcCfg.schReqId;
+
+   macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
+   macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
+   macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds RLC Bearer to Add/Mod list
+ *
+ * @details
+ *
+ *    Function :BuildRlcBearerToAddModList 
+ *
+ *    Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
+ *
+ * @params[in] rlc_BearerToAddModList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildRlcBearerToAddModList(DuUeCb *ueCb, struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
+{
+   uint8_t  idx = 0, lcIdx=0, macLcIdx = 0, elementCnt = 0;
+
+   if(ueCb == NULLP)
+      elementCnt = 1;
+   else if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
+      elementCnt = ueCb->rlcUeCfg.numLcs;
+   else
+   {
+      for(lcIdx = 0; lcIdx<ueCb->rlcUeCfg.numLcs; lcIdx++)
+      {
+         if(ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent == false)
+            elementCnt++;
       }
+   }
+   rlcBearerList->list.count = elementCnt;
+   rlcBearerList->list.size  = elementCnt * sizeof(struct RLC_BearerConfig *);
+
+   rlcBearerList->list.array = NULLP;
+   DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
+   if(!rlcBearerList->list.array)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+      return RFAILED;
+   }
 
-   for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
+   for(idx=0; idx<rlcBearerList->list.count; idx++)
    {
-      DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
-      if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
+      rlcBearerList->list.array[idx] = NULLP;
+      DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+      if(!rlcBearerList->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+         return RFAILED;
       }
    }
 
-   tciStateIdx = 0;
-   /* TODO */
-   *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
+   if(ueCb == NULLP)
+   {
+      idx=0;
+      rlcBearerList->list.array[idx]->logicalChannelIdentity = SRB1_LCID;
+      DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+      if(!rlcBearerList->list.array[idx]->servedRadioBearer)
+      {     
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+         return RFAILED;
+      }     
+      rlcBearerList->list.array[idx]->servedRadioBearer->present = RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
+      rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = SRB1_LCID;
+      rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
+
+      /* Fill RLC related Configurations for this Radio Bearer */
+      rlcBearerList->list.array[idx]->rlc_Config = NULLP;
+      DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
+      if(!rlcBearerList->list.array[idx]->rlc_Config)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+         return RFAILED;
+      }
+      if(BuildRlcConfig(NULLP, rlcBearerList->list.array[idx]->rlc_Config) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildRlcConfig failed");
+         return RFAILED;
+      }
 
-   DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
-   if(!controlRset->tci_PresentInDCI)
+      /* Fill MAC related configurations for this Radio Bearer */
+      rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
+      DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+      if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+         return RFAILED;
+      }
+      if(BuildMacLCConfig(NULLP, rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildMacLCConfig failed");
+         return RFAILED;
+      }
+   }
+   else
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
-      return RFAILED;
+      idx=0;
+      for(lcIdx=0; lcIdx<ueCb->rlcUeCfg.numLcs; lcIdx++)
+      {
+         if((ueCb->f1UeDb->actionType != UE_CTXT_CFG_QUERY) && (ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent == true))
+            continue;
+
+         /* Fill Logical channel identity */
+         rlcBearerList->list.array[idx]->logicalChannelIdentity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId;
+
+         /* Fill Radio Bearer Id and type (DRB/SRB) for this logical channel */
+         DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+         if(!rlcBearerList->list.array[idx]->servedRadioBearer)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+            return RFAILED;
+         }
+         rlcBearerList->list.array[idx]->servedRadioBearer->present = \
+                                                                      covertRbTypeFromIntEnumToRrcEnum(ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbType);
+         switch(rlcBearerList->list.array[idx]->servedRadioBearer->present)
+         {
+            case RLC_BearerConfig__servedRadioBearer_PR_srb_Identity: 
+               rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbId;
+               break;
+            case RLC_BearerConfig__servedRadioBearer_PR_drb_Identity:
+               rlcBearerList->list.array[idx]->servedRadioBearer->choice.drb_Identity = ueCb->rlcUeCfg.rlcLcCfg[lcIdx].rbId;
+               break;
+            case RLC_BearerConfig__servedRadioBearer_PR_NOTHING:
+            default:
+               break;
+         }
+         ueCb->rlcUeCfg.rlcLcCfg[lcIdx].isLcAddModRspSent = true;
+
+         rlcBearerList->list.array[idx]->reestablishRLC = NULLP;
+
+         /* Fill RLC related Configurations for this Radio Bearer */
+         rlcBearerList->list.array[idx]->rlc_Config = NULLP;
+         DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
+         if(!rlcBearerList->list.array[idx]->rlc_Config)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+            return RFAILED;
+         }
+         if(BuildRlcConfig(&ueCb->rlcUeCfg.rlcLcCfg[lcIdx], rlcBearerList->list.array[idx]->rlc_Config) != ROK)
+         {
+            DU_LOG("\nERROR  -->  F1AP : BuildRlcConfig failed");
+            return RFAILED;
+         }
+
+         /* Fill MAC related configurations for this Radio Bearer */
+         rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
+         DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+         if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+            return RFAILED;
+         }
+         for(macLcIdx = 0; macLcIdx < ueCb->macUeCfg.numLcs; macLcIdx++)
+         {
+            if(ueCb->macUeCfg.lcCfgList[macLcIdx].lcId == ueCb->rlcUeCfg.rlcLcCfg[lcIdx].lcId)
+            {
+               if(BuildMacLCConfig(&ueCb->macUeCfg.lcCfgList[macLcIdx], rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
+               {
+                  DU_LOG("\nERROR  -->  F1AP : BuildMacLCConfig failed");
+                  return RFAILED;
+               }
+               break;
+            }
+         }
+
+         idx++;
+      }
    }
-   /* TODO */
-   *(controlRset->tci_PresentInDCI);
-#endif
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Build Control resource set to add/modify list 
+ *
+ * @details
+ *
+ *    Function : BuildControlRSetToAddModList
+ *
+ *    Functionality: Build Control resource set to add/modify list
+ *
+ * @params[in] 
+ * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildControlRSetToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList)
+{
+   uint8_t idx;
+   uint8_t elementCnt;
+   uint8_t numBytes, bitsUnused;
+   struct ControlResourceSet *controlRSet;
+   uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
+   uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
+
+   if(pdcchCfg == NULLP)
+      elementCnt = 1;
+   else
+      elementCnt = pdcchCfg->numCRsetToAddMod;
+
+   controlRSetList->list.count = elementCnt;
+   controlRSetList->list.size = elementCnt * sizeof(struct ControlResourceSet *);
 
-   controlRSet->pdcch_DMRS_ScramblingID = NULLP;
-   DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
-   if(!controlRSet->pdcch_DMRS_ScramblingID)
+   controlRSetList->list.array = NULLP;
+   DU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
+   if(!controlRSetList->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
       return RFAILED;
    }
-   *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
 
+   for(idx = 0; idx < elementCnt; idx++)
+   {
+      controlRSetList->list.array[idx] = NULLP;
+      DU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
+      if(!controlRSetList->list.array[idx])
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
+      }
+   }
+
+   for(idx = 0; idx < elementCnt; idx++)
+   {
+      controlRSet = controlRSetList->list.array[idx];
+
+      if(pdcchCfg == NULLP)
+         controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
+      else
+         controlRSet->controlResourceSetId = pdcchCfg->cRSetToAddModList[idx].cRSetId;
+
+      /* size 6 bytes
+       * 3 LSBs unsued
+       * Bit string stored ff0000000000
+       */
+      numBytes = 6;
+      bitsUnused = 3;
+      controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
+
+      controlRSet->frequencyDomainResources.buf = NULLP;
+      DU_ALLOC(controlRSet->frequencyDomainResources.buf, controlRSet->frequencyDomainResources.size);
+      if(!controlRSet->frequencyDomainResources.buf)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
+      }
+
+      memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
+
+      if(pdcchCfg == NULLP)
+      {
+         coreset0EndPrb = CORESET0_END_PRB;
+         coreset1StartPrb = coreset0EndPrb + 6;
+         coreset1NumPrb = CORESET1_NUM_PRB;
+         /* calculate the PRBs */
+         fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
+         memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
+         controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
+
+         controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
+         controlRSet->cce_REG_MappingType.present = ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
+         controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
+      }
+      else
+      {
+         memcpy(controlRSet->frequencyDomainResources.buf, pdcchCfg->cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+         controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
+         controlRSet->duration = pdcchCfg->cRSetToAddModList[idx].duration;
+         controlRSet->cce_REG_MappingType.present = pdcchCfg->cRSetToAddModList[idx].cceRegMappingType;
+         controlRSet->precoderGranularity = pdcchCfg->cRSetToAddModList[idx].precoderGranularity;
+      }
+      controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
+      controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
+      controlRSet->tci_PresentInDCI = NULLP;
+
+#if 0
+      uint8_t tciStateIdx;
+
+      DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
+            sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
+      if(!controlRset->tci_StatesPDCCH_ToAddList)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
+      }
+
+      elementCnt = 1;
+      controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
+      controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
+      DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
+            controlRset->tci_StatesPDCCH_ToAddList->list.size)
+         if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+            return RFAILED;
+         }
+
+      for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
+      {
+         DU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
+         if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+            return RFAILED;
+         }
+      }
+
+      tciStateIdx = 0;
+      /* TODO */
+      *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
+
+      DU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
+      if(!controlRset->tci_PresentInDCI)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
+      }
+      /* TODO */
+      *(controlRset->tci_PresentInDCI);
+#endif
+
+      controlRSet->pdcch_DMRS_ScramblingID = NULLP;
+      DU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
+      if(!controlRSet->pdcch_DMRS_ScramblingID)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
+      }
+      if(pdcchCfg == NULLP)
+         *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
+      else
+         *(controlRSet->pdcch_DMRS_ScramblingID) = pdcchCfg->cRSetToAddModList[idx].dmrsScramblingId;
+   }
    return ROK;
 } /* End BuildControlRSetToAddModList */
 
@@ -2784,10 +3663,7 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildSearchSpcToAddModList
-(
- struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
- )
+uint8_t BuildSearchSpcToAddModList(PdcchConfig *pdcchCfg, struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
 {
    uint8_t idx;
    uint8_t numBytes;
@@ -2796,7 +3672,11 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
    uint8_t elementCnt;
    struct SearchSpace *searchSpc;
 
-   elementCnt = 1;
+   if(pdcchCfg == NULLP)
+      elementCnt = 1;
+   else
+      elementCnt = pdcchCfg->numSearchSpcToAddMod;
+
    searchSpcList->list.count = elementCnt;
    searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
 
@@ -2804,7 +3684,7 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
    DU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
    if(!searchSpcList->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
       return RFAILED;
    }
 
@@ -2814,109 +3694,127 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
       DU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
       if(!searchSpcList->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
       }
    }
 
-   idx = 0;
-   searchSpc = searchSpcList->list.array[idx];
-
-   searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
-
-   searchSpc->controlResourceSetId = NULLP;
-   DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
-   if(!searchSpc->controlResourceSetId)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
-   *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
-
-   searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
-   DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, \
-        sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
-   if(!searchSpc->monitoringSlotPeriodicityAndOffset)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
-   searchSpc->monitoringSlotPeriodicityAndOffset->present = \
-                                                           SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
-
-   searchSpc->duration = NULLP;
-   searchSpc->monitoringSymbolsWithinSlot = NULLP;
-   DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
-   if(!searchSpc->monitoringSymbolsWithinSlot)
+   for(idx = 0; idx < elementCnt; idx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
+      searchSpc = searchSpcList->list.array[idx];
 
-   /* Values taken from reference logs :
-    * size 2 bytes
-    * 2 LSBs unsued
-    * Bit string stores 8000
-    */
-   numBytes = 2;
-   bitsUnused = 2;
+      if(pdcchCfg == NULLP)
+         searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
+      else
+         searchSpc->searchSpaceId = pdcchCfg->searchSpcToAddModList[idx].searchSpaceId;
 
-   searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
-   searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
-   DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, \
-        searchSpc->monitoringSymbolsWithinSlot->size);
-   if(!searchSpc->monitoringSymbolsWithinSlot->buf)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
+      searchSpc->controlResourceSetId = NULLP;
+      DU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
+      if(!searchSpc->controlResourceSetId)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
+      if(pdcchCfg == NULLP)
+         *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
+      else
+         *(searchSpc->controlResourceSetId) = pdcchCfg->searchSpcToAddModList[idx].cRSetId;
 
-   byteIdx = 0;
-   searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = \
-                                                           PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
-   searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
-   searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
+      searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
+      DU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
+      if(!searchSpc->monitoringSlotPeriodicityAndOffset)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
+      if(pdcchCfg == NULLP)
+         searchSpc->monitoringSlotPeriodicityAndOffset->present = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+      else
+         searchSpc->monitoringSlotPeriodicityAndOffset->present = pdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset;
 
-   searchSpc->nrofCandidates = NULLP;
-   DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
-   if(!searchSpc->nrofCandidates)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
+      searchSpc->duration = NULLP;
+      searchSpc->monitoringSymbolsWithinSlot = NULLP;
+      DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
+      if(!searchSpc->monitoringSymbolsWithinSlot)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
 
-   searchSpc->nrofCandidates->aggregationLevel1 = \
-                                                 PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
-   searchSpc->nrofCandidates->aggregationLevel2 = \
-                                                 PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
-   searchSpc->nrofCandidates->aggregationLevel4 = \
-                                                 PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
-   searchSpc->nrofCandidates->aggregationLevel8 = \
-                                                 PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
-   searchSpc->nrofCandidates->aggregationLevel16 = \
-                                                  PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
+      /* Values taken from reference logs :
+       * size 2 bytes
+       * 2 LSBs unsued
+       * Bit string stores 8000
+       */
+      numBytes = 2;
+      bitsUnused = 2;
+      searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
+      searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
+      DU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, searchSpc->monitoringSymbolsWithinSlot->size);
+      if(!searchSpc->monitoringSymbolsWithinSlot->buf)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
+      if(pdcchCfg == NULLP)
+      {
+         byteIdx = 0;
+         searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
+         searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
+      }
+      else
+         memcpy(searchSpc->monitoringSymbolsWithinSlot->buf, pdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot, numBytes);
+      searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
 
-   searchSpc->searchSpaceType = NULLP;
-   DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
-   if(!searchSpc->searchSpaceType)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }
+      searchSpc->nrofCandidates = NULLP;
+      DU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
+      if(!searchSpc->nrofCandidates)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
 
-   searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
+      if(pdcchCfg == NULLP)
+      {
+         searchSpc->nrofCandidates->aggregationLevel1 = PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
+         searchSpc->nrofCandidates->aggregationLevel2 = PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
+         searchSpc->nrofCandidates->aggregationLevel4 = PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
+         searchSpc->nrofCandidates->aggregationLevel8 = PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
+         searchSpc->nrofCandidates->aggregationLevel16 = PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
+      }
+      else
+      {
+         searchSpc->nrofCandidates->aggregationLevel1 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1;
+         searchSpc->nrofCandidates->aggregationLevel2 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2;
+         searchSpc->nrofCandidates->aggregationLevel4 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4;
+         searchSpc->nrofCandidates->aggregationLevel8 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8;
+         searchSpc->nrofCandidates->aggregationLevel16 = pdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16;
+      }
 
-   searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
-   DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, \
-        sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
-   if(!searchSpc->searchSpaceType->choice.ue_Specific)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
-      return RFAILED;
-   }  
-   searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = \
-                                                                PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
+      searchSpc->searchSpaceType = NULLP;
+      DU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
+      if(!searchSpc->searchSpaceType)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }
+      if(pdcchCfg == NULLP)
+         searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
+      else
+         searchSpc->searchSpaceType->present = pdcchCfg->searchSpcToAddModList[idx].searchSpaceType;
 
+      searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
+      DU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
+      if(!searchSpc->searchSpaceType->choice.ue_Specific)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
+      }  
+      if(pdcchCfg == NULLP)
+         searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
+      else
+         searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = pdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat;
+   }
    return ROK;
 }/* End BuildSearchSpcToAddModList */
 
@@ -2936,35 +3834,35 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildBWPDlDedPdcchCfg(struct PDCCH_Config *pdcchCfg)
+uint8_t BuildBWPDlDedPdcchCfg(PdcchConfig *pdcchCfgDb, struct PDCCH_Config *pdcchCfg)
 {
    pdcchCfg->controlResourceSetToAddModList = NULLP;
-   DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, \
-        sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
+   DU_ALLOC(pdcchCfg->controlResourceSetToAddModList, sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
    if(!pdcchCfg->controlResourceSetToAddModList)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
       return RFAILED;
    }
 
-   if(BuildControlRSetToAddModList(pdcchCfg->controlResourceSetToAddModList) != ROK)
+   if(BuildControlRSetToAddModList(pdcchCfgDb, pdcchCfg->controlResourceSetToAddModList) != ROK)
    {
+      DU_LOG("\nERROR  --> F1AP : Failed in BuildControlRSetToAddModList()");
       return RFAILED;
    }
 
    pdcchCfg->controlResourceSetToReleaseList = NULLP;
 
    pdcchCfg->searchSpacesToAddModList = NULLP;
-   DU_ALLOC(pdcchCfg->searchSpacesToAddModList, \
-        sizeof(struct PDCCH_Config__searchSpacesToAddModList));
+   DU_ALLOC(pdcchCfg->searchSpacesToAddModList, sizeof(struct PDCCH_Config__searchSpacesToAddModList));
    if(!pdcchCfg->searchSpacesToAddModList)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
       return RFAILED;
    }
 
-   if(BuildSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList) != ROK)
+   if(BuildSearchSpcToAddModList(pdcchCfgDb, pdcchCfg->searchSpacesToAddModList) != ROK)
    {
+      DU_LOG("\nERROR  --> F1AP : Failed in BuildSearchSpcToAddModList()");
       return RFAILED;
    }
 
@@ -2993,17 +3891,14 @@ uint8_t BuildBWPDlDedPdcchCfg(struct PDCCH_Config *pdcchCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildDMRSDLPdschMapTypeA
-(
- struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
- )
+uint8_t BuildDMRSDLPdschMapTypeA(PdschConfig *pdschCfg, struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg)
 {
    dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
    dmrsDlCfg->choice.setup = NULLP;
    DU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
    if(!dmrsDlCfg->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
       return RFAILED;
    }
 
@@ -3012,10 +3907,13 @@ uint8_t BuildBWPDlDedPdcchCfg(struct PDCCH_Config *pdcchCfg)
    DU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
    if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
       return RFAILED;
    }
-   *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
+   if(pdschCfg == NULLP)
+      *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
+   else
+      *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = pdschCfg->dmrsDlCfgForPdschMapTypeA.addPos;
 
    dmrsDlCfg->choice.setup->maxLength = NULLP;
    dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
@@ -3064,38 +3962,34 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildPdschTimeDomAllocList
-(
- struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
- )
+uint8_t BuildPdschTimeDomAllocList(PdschConfig *pdschCfg, struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
 {
    uint8_t idx;
    uint8_t elementCnt;
    struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
 
-   timeDomAllocList->present = \
-                              PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
+   timeDomAllocList->present = PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
 
    timeDomAllocList->choice.setup = NULLP;
-   DU_ALLOC(timeDomAllocList->choice.setup, \
-        sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+   DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PDSCH_TimeDomainResourceAllocationList));
    if(!timeDomAllocList->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
       return RFAILED;
    }
 
-   elementCnt = 1;
+if(pdschCfg == NULLP)
+   elementCnt = 2;
+else
+elementCnt = pdschCfg->numTimeDomRsrcAlloc;
    timeDomAllocList->choice.setup->list.count = elementCnt;
-   timeDomAllocList->choice.setup->list.size = \
-                                              elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
+   timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
 
    timeDomAllocList->choice.setup->list.array = NULLP;
-   DU_ALLOC(timeDomAllocList->choice.setup->list.array, \
-        timeDomAllocList->choice.setup->list.size);
+   DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
    if(!timeDomAllocList->choice.setup->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
       return RFAILED;
    }
 
@@ -3103,23 +3997,60 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
    {
       timeDomAllocList->choice.setup->list.array[idx] = NULLP;
       DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
-           sizeof(struct PDSCH_TimeDomainResourceAllocation));
+            sizeof(struct PDSCH_TimeDomainResourceAllocation));
       if(!timeDomAllocList->choice.setup->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+         return RFAILED;
       }
    }
 
-   idx = 0;
-   timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
-
-   timeDomAlloc->k0 = NULLP;
-   timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
-   timeDomAlloc->startSymbolAndLength = \
-                                       calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
-
-   return ROK;
+   if(pdschCfg == NULLP)
+   {
+      idx = 0;
+      timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+      DU_ALLOC(timeDomAlloc->k0, sizeof(long));
+      if(!timeDomAlloc->k0)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+         return RFAILED;
+      }
+      *(timeDomAlloc->k0) = 0;
+      timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+      timeDomAlloc->startSymbolAndLength = \
+                                           calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
+
+      idx++;
+      timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+      DU_ALLOC(timeDomAlloc->k0, sizeof(long));
+      if(!timeDomAlloc->k0)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+         return RFAILED;
+      }
+      *(timeDomAlloc->k0) = 1;
+      timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+      timeDomAlloc->startSymbolAndLength = calcSliv(PDSCH_START_SYMBOL, PDSCH_LENGTH_SYMBOL);
+   }
+   else
+   {
+      for(idx = 0; idx < elementCnt; idx++)
+      {
+         timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+         DU_ALLOC(timeDomAlloc->k0, sizeof(long));
+         if(!timeDomAlloc->k0)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+            return RFAILED;
+         }
+         if(pdschCfg->timeDomRsrcAllociList[idx].k0)
+            *(timeDomAlloc->k0) = *(pdschCfg->timeDomRsrcAllociList[idx].k0);
+         timeDomAlloc->mappingType = pdschCfg->timeDomRsrcAllociList[idx].mappingType;
+         timeDomAlloc->startSymbolAndLength = pdschCfg->timeDomRsrcAllociList[idx].startSymbolAndLength;
+      }
+   }
+
+   return ROK;
 }
 
 /*******************************************************************
@@ -3139,19 +4070,19 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildPdschPrbBundlingType
-(
- struct PDSCH_Config__prb_BundlingType *prbBndlType
- )
+uint8_t BuildPdschPrbBundlingType(PdschConfig *pdschCfg, struct PDSCH_Config__prb_BundlingType *prbBndlType)
 {
-   prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
+   if(pdschCfg == NULLP)
+      prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
+   else
+      prbBndlType->present = pdschCfg->bundlingType;
 
    prbBndlType->choice.staticBundling = NULLP;
    DU_ALLOC(prbBndlType->choice.staticBundling, \
         sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
    if(!prbBndlType->choice.staticBundling)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschPrbBundlingType");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschPrbBundlingType");
       return RFAILED;
    }
    prbBndlType->choice.staticBundling->bundleSize = NULLP;
@@ -3175,20 +4106,19 @@ uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
+uint8_t BuildBWPDlDedPdschCfg(PdschConfig *pdschCfgDb, struct PDSCH_Config *pdschCfg)
 {
    pdschCfg->dataScramblingIdentityPDSCH = NULLP;
 
    pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
-   DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
-        sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+   DU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
    if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
       return RFAILED;
    }
 
-   if(BuildDMRSDLPdschMapTypeA(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
+   if(BuildDMRSDLPdschMapTypeA(pdschCfgDb, pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
    {
       return RFAILED;
    }
@@ -3201,7 +4131,7 @@ uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
    DU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
    if(!pdschCfg->tci_StatesToAddModList)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
       return RFAILED;
    }
    if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
@@ -3210,18 +4140,19 @@ uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
    }
 #endif
 
+if(pdschCfgDb == NULLP)
    pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
+else
+pdschCfg->resourceAllocation = pdschCfgDb->resourceAllocType;
 
    pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
-   DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, \
-        sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
+   DU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
    if(!pdschCfg->pdsch_TimeDomainAllocationList)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
       return RFAILED;
    }
-
-   if(BuildPdschTimeDomAllocList(pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
+   if(BuildPdschTimeDomAllocList(pdschCfgDb, pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
    {
       return RFAILED;
    }
@@ -3231,19 +4162,25 @@ uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
    pdschCfg->rateMatchPatternToReleaseList = NULLP;
    pdschCfg->rateMatchPatternGroup1 = NULLP;
    pdschCfg->rateMatchPatternGroup2 = NULLP;
-   pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
+   if(pdschCfgDb == NULLP)
+      pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
+   else
+      pdschCfg->rbg_Size = pdschCfgDb->rbgSize;
    pdschCfg->mcs_Table = NULLP;
 
    pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
    DU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
    if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
       return RFAILED;
    }
-   *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
+   if(pdschCfgDb == NULLP)
+      *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
+   else
+      *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = pdschCfgDb->numCodeWordsSchByDci;
 
-   if(BuildPdschPrbBundlingType(&pdschCfg->prb_BundlingType) != ROK)
+   if(BuildPdschPrbBundlingType(pdschCfgDb, &pdschCfg->prb_BundlingType) != ROK)
    {
       return RFAILED;
    }
@@ -3274,13 +4211,24 @@ uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
+uint8_t BuildInitialDlBWP(InitialDlBwp *initiDlBwp, BWP_DownlinkDedicated_t *dlBwp)
 {
+   PdcchConfig *pdcchCfg = NULLP;
+   PdschConfig *pdschCfg = NULLP;
+
+   if(initiDlBwp)
+   {
+      if(initiDlBwp->pdcchPresent)
+         pdcchCfg = &initiDlBwp->pdcchCfg;
+      if(initiDlBwp->pdschPresent)
+         pdschCfg = &initiDlBwp->pdschCfg;
+   }
+
    dlBwp->pdcch_Config = NULLP;
    DU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
    if(!dlBwp->pdcch_Config)
    {
-      DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failure in BuildInitialDlBWP");
       return RFAILED;
    }
    dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup; 
@@ -3289,10 +4237,10 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
    DU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
    if(!dlBwp->pdcch_Config->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failure in BuildInitialDlBWP");
       return RFAILED;
    }
-   if(BuildBWPDlDedPdcchCfg(dlBwp->pdcch_Config->choice.setup) != ROK)
+   if(BuildBWPDlDedPdcchCfg(pdcchCfg, dlBwp->pdcch_Config->choice.setup) != ROK)
    {
       return RFAILED;
    }
@@ -3301,7 +4249,7 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
    DU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
    if(!dlBwp->pdsch_Config)
    {
-      DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failure in BuildInitialDlBWP");
       return RFAILED;
    }
    dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
@@ -3310,11 +4258,11 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
    DU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
    if(!dlBwp->pdsch_Config->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failure in BuildInitialDlBWP");
       return RFAILED;
    }
 
-   if(BuildBWPDlDedPdschCfg(dlBwp->pdsch_Config->choice.setup) != ROK)
+   if(BuildBWPDlDedPdschCfg(pdschCfg, dlBwp->pdsch_Config->choice.setup) != ROK)
    {
       return RFAILED;
    }
@@ -3340,17 +4288,14 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildDMRSULPuschMapTypeA
-(
- struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
- )
+uint8_t BuildDMRSULPuschMapTypeA(DmrsUlCfg *ulDmrsCfgDb, struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg)
 {
    dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
    dmrsUlCfg->choice.setup= NULLP;
    DU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
    if(!dmrsUlCfg->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
       return RFAILED;
    }
 
@@ -3359,19 +4304,21 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
    DU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
    if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
       return RFAILED;
    }
-   *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS; 
+   if(ulDmrsCfgDb == NULLP)
+      *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS; 
+   else
+      *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = ulDmrsCfgDb->addPos;
 
    dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
    dmrsUlCfg->choice.setup->maxLength = NULLP;
    dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
-   DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, \
-        sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+   DU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
    if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
       return RFAILED;
    }
 
@@ -3380,10 +4327,13 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
         sizeof(long));
    if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
       return RFAILED;
    }
-   *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
+   if(ulDmrsCfgDb == NULLP)
+      *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
+   else
+      *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = ulDmrsCfgDb->transPrecodDisabled.scramblingId0;
 
    dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
    dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
@@ -3407,10 +4357,7 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildPuschTimeDomAllocList
-(
- struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
- )
+uint8_t BuildPuschTimeDomAllocList(PuschCfg *puschCfgDb, struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList)
 {
    uint8_t idx;
    uint8_t elementCnt;
@@ -3418,50 +4365,66 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
 
    timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
    timeDomAllocList->choice.setup = NULLP;
-   DU_ALLOC(timeDomAllocList->choice.setup, \
-        sizeof(struct PUSCH_TimeDomainResourceAllocationList));
+   DU_ALLOC(timeDomAllocList->choice.setup, sizeof(struct PUSCH_TimeDomainResourceAllocationList));
    if(!timeDomAllocList->choice.setup)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
       return RFAILED;
    }
 
-   elementCnt = 1;
+   if(puschCfgDb == NULLP)
+      elementCnt = 2;
+   else
+      elementCnt = puschCfgDb->numTimeDomRsrcAlloc;
+
    timeDomAllocList->choice.setup->list.count = elementCnt;
-   timeDomAllocList->choice.setup->list.size = \
-                                              elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
+   timeDomAllocList->choice.setup->list.size = elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
    timeDomAllocList->choice.setup->list.array = NULLP;
-   DU_ALLOC(timeDomAllocList->choice.setup->list.array, \
-        timeDomAllocList->choice.setup->list.size);
+   DU_ALLOC(timeDomAllocList->choice.setup->list.array, timeDomAllocList->choice.setup->list.size);
    if(!timeDomAllocList->choice.setup->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
       return RFAILED;
    }
 
    for(idx = 0; idx < elementCnt; idx++)
    {
       timeDomAllocList->choice.setup->list.array[idx] = NULLP;
-      DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx],\
-           sizeof(PUSCH_TimeDomainResourceAllocation_t));
+      DU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], sizeof(PUSCH_TimeDomainResourceAllocation_t));
       if(!timeDomAllocList->choice.setup->list.array[idx])
       {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+         return RFAILED;
       }
    }
 
-   idx = 0;
-   timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
-   DU_ALLOC(timeDomAlloc->k2, sizeof(long));
-   if(!timeDomAlloc->k2)
+   for(idx = 0; idx < elementCnt; idx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
-      return RFAILED;
+      timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+      DU_ALLOC(timeDomAlloc->k2, sizeof(long));
+      if(!timeDomAlloc->k2)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+         return RFAILED;
+      }
+      if(puschCfgDb == NULLP)
+      {
+         if(idx == 0)
+            *(timeDomAlloc->k2) = PUSCH_K2_CFG1;
+         else if(idx == 1)
+            *(timeDomAlloc->k2) = PUSCH_K2_CFG2;
+
+         timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
+         timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
+      }
+      else
+      {
+         *(timeDomAlloc->k2) = puschCfgDb->timeDomRsrcAllocList[idx].k2;
+         timeDomAlloc->mappingType = puschCfgDb->timeDomRsrcAllocList[idx].mappingType;
+         timeDomAlloc->startSymbolAndLength = puschCfgDb->timeDomRsrcAllocList[idx].startSymbolAndLength;
+      }
    }
-   *(timeDomAlloc->k2) = PUSCH_K2;
-   timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
-   timeDomAlloc->startSymbolAndLength = calcSliv(PUSCH_START_SYMBOL, PUSCH_LENGTH_SYMBOL);
+
    return ROK;
 }
 
@@ -3482,28 +4445,35 @@ uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
+uint8_t BuildBWPUlDedPuschCfg(PuschCfg *puschCfgDb, PUSCH_Config_t *puschCfg)
 {
+   DmrsUlCfg *ulDmrsCfg = NULLP;
+   
+   if(puschCfgDb)
+      ulDmrsCfg = &puschCfgDb->dmrsUlCfgForPuschMapTypeA;
+
    puschCfg->dataScramblingIdentityPUSCH = NULLP;
    DU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
    if(!puschCfg->dataScramblingIdentityPUSCH)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
       return RFAILED;
    }
-   *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
+   if(puschCfgDb == NULLP)
+      *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
+   else
+      *(puschCfg->dataScramblingIdentityPUSCH) = puschCfgDb->dataScramblingId;
 
    puschCfg->txConfig = NULLP;
    puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
-   DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
-        sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
+   DU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
    if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
       return RFAILED;
    }
 
-   if(BuildDMRSULPuschMapTypeA(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
+   if(BuildDMRSULPuschMapTypeA(ulDmrsCfg, puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
    {
       return RFAILED;
    }
@@ -3512,18 +4482,21 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
    puschCfg->pusch_PowerControl = NULLP;
    puschCfg->frequencyHopping = NULLP;
    puschCfg->frequencyHoppingOffsetLists = NULLP;
-   puschCfg->resourceAllocation = RES_ALLOC_TYPE;
+
+   if(puschCfgDb == NULLP)
+      puschCfg->resourceAllocation = RES_ALLOC_TYPE;
+   else
+      puschCfg->resourceAllocation = puschCfgDb->resourceAllocType;
 
    puschCfg->pusch_TimeDomainAllocationList = NULLP;
-   DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, \
-        sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
+   DU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
    if(!puschCfg->pusch_TimeDomainAllocationList)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
       return RFAILED;
    }
 
-   if(BuildPuschTimeDomAllocList(puschCfg->pusch_TimeDomainAllocationList) != ROK)
+   if(BuildPuschTimeDomAllocList(puschCfgDb, puschCfg->pusch_TimeDomainAllocationList) != ROK)
    {
       return RFAILED;
    }
@@ -3535,10 +4508,13 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
    DU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
    if(!puschCfg->transformPrecoder)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPuschCfg");
       return RFAILED;
    }
-   *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
+   if(puschCfgDb == NULLP)
+      *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
+   else
+      *(puschCfg->transformPrecoder) = puschCfgDb->transformPrecoder;
 
    puschCfg->codebookSubset = NULLP;
    puschCfg->maxRank = NULLP;
@@ -3551,5879 +4527,11020 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
 
 /*******************************************************************
  *
- * @brief Fills SRS resource to add/modify list 
+ * @brief Builds PUCCH resource set add/modify list
  *
  * @details
  *
- *    Function : BuildSrsRsrcAddModList
+ *    Function : BuildPucchRsrcSetAddModList
  *
- *    Functionality: Fills SRS resource to add/modify list
+ *    Functionality:
+ *      Builds PUCCH resource set add/modify list
+ *
+ * @params[in] : PucchResrcSetCfg *rsrcSetCfgDb
+ *               struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
  *
- * @params[in] 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
+uint8_t BuildPucchRsrcSetAddModList(PucchResrcSetCfg *rsrcSetCfgDb, \
+   struct PUCCH_Config__resourceSetToAddModList *resourceSetToAddModList)
 {
-   uint8_t   elementCnt;
-   uint8_t   rsrcIdx;
+   uint8_t elementCnt = 0, rsrcSetIdx = 0, rsrcIdx = 0;
+   PUCCH_ResourceSet_t *rsrcSet = NULLP;
 
-   elementCnt = 1;
-   resourceList->list.count = elementCnt;
-   resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
-   resourceList->list.array = NULLP;
-   DU_ALLOC(resourceList->list.array, resourceList->list.size);
-   if(!resourceList->list.array)
+   if(rsrcSetCfgDb == NULLP)
+      elementCnt = 1;
+   else
+      elementCnt = rsrcSetCfgDb->resrcSetToAddModListCount;
+
+   resourceSetToAddModList->list.count = elementCnt;
+   resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
+   DU_ALLOC(resourceSetToAddModList->list.array, resourceSetToAddModList->list.size);
+   if(resourceSetToAddModList->list.array == NULLP)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
       return RFAILED;
    }
-
-   for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+   for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
    {
-      DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
-      if(!resourceList->list.array[rsrcIdx])
+      DU_ALLOC(resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
+      if(resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
       {
-        DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
+         return RFAILED;
       }
    }
 
-   rsrcIdx = 0;
-   resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
-   resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
-   resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
-
-   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
-   DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
-        sizeof(struct SRS_Resource__transmissionComb__n2));
-   if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
+   for(rsrcSetIdx=0; rsrcSetIdx < resourceSetToAddModList->list.count; rsrcSetIdx++)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
-      return RFAILED;
-   }
-   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
-      = SRS_COMB_OFFSET_N2;
-   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
-      = SRS_CYCLIC_SHIFT_N2;
+      rsrcSet = resourceSetToAddModList->list.array[rsrcSetIdx];
 
-   resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
-                                                                     PUSCH_START_SYMBOL;
-   resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols =  \
-                                                                    SRS_Resource__resourceMapping__nrofSymbols_n1;
-   resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
-                                                                        SRS_Resource__resourceMapping__repetitionFactor_n1;
+      /* Resource set Id */
+      if(rsrcSetCfgDb == NULLP)
+         rsrcSet->pucch_ResourceSetId = 1;
+      else
+         rsrcSet->pucch_ResourceSetId = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcSetId;
+      /* Resource list of a resource set */
+      if(rsrcSetCfgDb == NULLP)
+         elementCnt = 1;
+      else
+         elementCnt = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcListCount;
+      rsrcSet->resourceList.list.count = elementCnt;
+      rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
+      DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
+      if(rsrcSet->resourceList.list.array == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
+         return RFAILED;
+      }
 
-   resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
-   resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
-   resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
-   resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
-   resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
-   resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
-                                                              SRS_Resource__groupOrSequenceHopping_neither;
+      for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
+      {
+         DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+         if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
+            return RFAILED;
+         }
+      }
+      for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
+      {
+         if(rsrcSetCfgDb == NULLP)
+            *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
+         else
+            *(rsrcSet->resourceList.list.array[rsrcIdx]) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].resrcList[rsrcIdx];
+      }
 
-   /* Setting resource type to aperiodic for intergration purposes */
-   resourceList->list.array[rsrcIdx]->resourceType.present = \
-                                                            SRS_Resource__resourceType_PR_aperiodic;
-   resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
-   DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
-        sizeof(struct SRS_Resource__resourceType__aperiodic));
-   if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
-   {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
-      return RFAILED;
+      /* Max payload size (minus 1) in a Resource set */
+      rsrcSet->maxPayloadMinus1 = NULLP;
+      if(rsrcSetCfgDb && rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize)
+      {
+         DU_ALLOC(rsrcSet->maxPayloadMinus1, sizeof(long));
+         if(rsrcSet->maxPayloadMinus1 == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcSetAddModList");
+            return RFAILED;
+         }
+         *(rsrcSet->maxPayloadMinus1) = rsrcSetCfgDb->resrcSetToAddModList[rsrcSetIdx].maxPayLoadSize;
+      }
    }
-   resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
-
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Build SRS resource set Add/mod list
+ * @brief Builds PUCCH resource add/modify list
  *
  * @details
  *
- *    Function : BuildSrsRsrcSetAddModList
+ *    Function : BuildPucchRsrcAdddModList
  *
- *    Functionality: Build SRS resource set Add/mod list
+ *    Functionality:
+ *      Builds PUCCH resource add/modify list
+ *
+ * @params[in] : PucchResrcCfg *rsrcSetCfgDb
+ *               struct PUCCH_Config__resourceSetToAddModList *rsrcSetAddModList
  *
- * @params[in] 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-   uint8_t BuildSrsRsrcSetAddModList
-(
- struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
- )
+uint8_t BuildPucchRsrcAddModList(PucchResrcCfg *rsrcCfgDb, struct PUCCH_Config__resourceToAddModList  *resourceToAddModList)
 {
-   uint8_t  elementCnt;
-   uint8_t  rSetIdx;
-   uint8_t  rsrcIdx;
-   struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
+   uint8_t elementCnt = 0, rsrcIdx = 0;
+   PUCCH_Resource_t *rsrc = NULLP;
 
-   elementCnt = 1;
-   rsrcSetList->list.count = elementCnt;
-   rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
-   rsrcSetList->list.array = NULLP;
-   DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
-   if(!rsrcSetList->list.array)
+   if(rsrcCfgDb == NULLP)
+      elementCnt = 1;
+   else
+      elementCnt = rsrcCfgDb->resrcToAddModListCount;
+   resourceToAddModList->list.count = elementCnt;
+   resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
+   DU_ALLOC(resourceToAddModList->list.array, resourceToAddModList->list.size);
+   if(resourceToAddModList->list.array == NULLP)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
       return RFAILED;
    }
-
-   for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+   for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
    {
-      DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
-      if(!rsrcSetList->list.array[rSetIdx])
+      DU_ALLOC(resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
+      if(resourceToAddModList->list.array[rsrcIdx] == NULLP)
       {
-        DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+         return RFAILED;
       }
    }
 
-   rSetIdx = 0;
-   rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
-
-   /* Fill Resource Id list in resource set */
-   rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
-   DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
-        sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
-   if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
-   {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
-      return RFAILED;
-   }
-
-   elementCnt = 1;
-   rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
-   rsrcIdList->list.count = elementCnt;
-   rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
-   rsrcIdList->list.array = NULLP;
-   DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
-   if(!rsrcIdList->list.array)
+   for(rsrcIdx=0; rsrcIdx < resourceToAddModList->list.count; rsrcIdx++)
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
-      return RFAILED;
-   }
+      rsrc = resourceToAddModList->list.array[rsrcIdx];
 
-   for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
-   {
-      DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
-      if(!rsrcIdList->list.array[rsrcIdx])
+      if(rsrcCfgDb == NULLP)
       {
-        DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
-        return RFAILED;
+         rsrc->pucch_ResourceId = 1;
+         rsrc->startingPRB = 0;
+         rsrc->format.present = PUCCH_Resource__format_PR_format1; 
+         DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+         if(rsrc->format.choice.format1 == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+            return RFAILED;
+         }  
+         rsrc->format.choice.format1->initialCyclicShift = 0;
+         rsrc->format.choice.format1->nrofSymbols = 4;
+         rsrc->format.choice.format1->startingSymbolIndex = 0;
+         rsrc->format.choice.format1->timeDomainOCC = 0;
       }
-   }
-
-   rsrcIdx = 0;
-   *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
+      else
+      {
+         rsrc->pucch_ResourceId = rsrcCfgDb->resrcToAddModList[rsrcIdx].resrcId;
+         rsrc->startingPRB = rsrcCfgDb->resrcToAddModList[rsrcIdx].startPrb;
+         if(rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop)
+         {
+            DU_ALLOC(rsrc->intraSlotFrequencyHopping, sizeof(long));
+            if(rsrc->intraSlotFrequencyHopping == NULLP)
+            {
+               DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+               return RFAILED;
+            }
+            *(rsrc->intraSlotFrequencyHopping) = rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop;
+         }
+         else
+            rsrc->intraSlotFrequencyHopping = NULLP;
 
-   /* Fill resource type */
-   rsrcSetList->list.array[rSetIdx]->resourceType.present = \
-                                                           SRS_ResourceSet__resourceType_PR_aperiodic;
+         if(rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop)
+         {
+            DU_ALLOC(rsrc->secondHopPRB, sizeof(PRB_Id_t));
+            if(rsrc->secondHopPRB == NULLP)
+            {
+               DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+               return RFAILED;
+            }
+            *(rsrc->secondHopPRB) = rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop;
+         }
+         else
+            rsrc->secondHopPRB = NULLP;
+         rsrc->format.present = covertPucchFormatIntEnumToRrcEnum(rsrcCfgDb->resrcToAddModList[rsrcIdx].pucchFormat); 
 
-   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
-   DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
-        sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
-   if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
-   {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
-      return RFAILED;
-   }
-   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
-      = APERIODIC_SRS_RESRC_TRIGGER;
+         switch(rsrc->format.present)
+         {
+            case PUCCH_Resource__format_PR_NOTHING:
+               break;
+            case PUCCH_Resource__format_PR_format0:
+               {
+                  DU_ALLOC(rsrc->format.choice.format0, sizeof(PUCCH_format0_t));
+                  if(rsrc->format.choice.format0 == NULLP)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+                     return RFAILED;
+                  }
+                  rsrc->format.choice.format0->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->initialCyclicShift;
+                  rsrc->format.choice.format0->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->numSymbols;
+                  rsrc->format.choice.format0->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->startSymbolIdx;
+                  break;
+               }
 
-   /* TODO : Fill values for below IEs as expected by Viavi */
-   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
-   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
+            case PUCCH_Resource__format_PR_format1:
+               {
+                  DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+                  if(rsrc->format.choice.format1 == NULLP)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+                     return RFAILED;
+                  }  
+                  rsrc->format.choice.format1->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->initialCyclicShift;
+                  rsrc->format.choice.format1->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->numSymbols;
+                  rsrc->format.choice.format1->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->startSymbolIdx;
+                  rsrc->format.choice.format1->timeDomainOCC = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->timeDomOCC;
+                  break;
+               }
 
+            case PUCCH_Resource__format_PR_format2:
+               {
+                  DU_ALLOC(rsrc->format.choice.format2, sizeof(PUCCH_format2_t));
+                  if(rsrc->format.choice.format2 == NULLP)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+                     return RFAILED;
+                  } 
+                  rsrc->format.choice.format2->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numPrbs;
+                  rsrc->format.choice.format2->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numSymbols;
+                  rsrc->format.choice.format2->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->startSymbolIdx;
+                  break;
+               }
 
-   rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
-   rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
-   rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
-   rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
-   rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
+            case PUCCH_Resource__format_PR_format3:
+               {
+                  DU_ALLOC(rsrc->format.choice.format3, sizeof(PUCCH_format3_t));
+                  if(rsrc->format.choice.format3 == NULLP)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+                     return RFAILED;
+                  }
+                  rsrc->format.choice.format3->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numPrbs;
+                  rsrc->format.choice.format3->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numSymbols;
+                  rsrc->format.choice.format3->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->startSymbolIdx;
+                  break;
+               }
 
+            case PUCCH_Resource__format_PR_format4:
+               {
+                  DU_ALLOC(rsrc->format.choice.format4, sizeof(PUCCH_format4_t));
+                  if(rsrc->format.choice.format4 == NULLP)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+                     return RFAILED;
+                  }
+                  rsrc->format.choice.format4->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->numSymbols;
+                  rsrc->format.choice.format4->occ_Length = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occLen;
+                  rsrc->format.choice.format4->occ_Index = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occIdx;
+                  rsrc->format.choice.format4->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->startSymbolIdx;
+                  break;
+               }
+         }
+      }
+   }
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds BWP UL dedicated SRS Config
+ * @brief Builds PUCCH format  config
  *
  * @details
  *
- *    Function : BuildBWPUlDedSrsCfg
+ *    Function : BuildPucchFormat
  *
- *    Functionality: Builds BWP UL dedicated SRS Config
+ *    Functionality: Builds PUCCH format  config
+ *
+ * @params[in] : PucchFormatCfg *formatDb
+ *               PUCCH_FormatConfig_t *format
  *
- * @params[in] SRS Config 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
+uint8_t BuildPucchFormat(PucchFormatCfg *formatDb, PUCCH_FormatConfig_t *format)
 {
-   srsCfg->srs_ResourceSetToReleaseList = NULLP;
-   srsCfg->srs_ResourceSetToAddModList = NULLP;
-   DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
-        sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
-   if(!srsCfg->srs_ResourceSetToAddModList)
+   /* Inter Slot Fequency hopping */
+   format->interslotFrequencyHopping = NULLP;
+   if((formatDb != NULLP) && (formatDb->interSlotFreqHop == true))
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedSrsCfg");
-      return RFAILED;
+      DU_ALLOC(format->interslotFrequencyHopping, sizeof(long));
+      if(format->interslotFrequencyHopping)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }
+      *(format->interslotFrequencyHopping) = PUCCH_FormatConfig__interslotFrequencyHopping_enabled;
    }
-   if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
+
+   /* Additional DMRS */
+   format->additionalDMRS = NULLP;
+   if((formatDb != NULLP) && (formatDb->addDmrs == true))
    {
-      return RFAILED;
+      DU_ALLOC(format->additionalDMRS, sizeof(long));
+      if(format->additionalDMRS)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }
+      *(format->additionalDMRS) = PUCCH_FormatConfig__additionalDMRS_true;
    }
 
-   srsCfg->srs_ResourceToReleaseList = NULLP;
-
-   /* Resource to Add/Modify list */
-   srsCfg->srs_ResourceToAddModList = NULLP;
-   DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
-        sizeof(struct SRS_Config__srs_ResourceToAddModList));
-   if(!srsCfg->srs_ResourceToAddModList)
+    /* Maximum code rate */
+   format->maxCodeRate = NULLP;
+   if((formatDb != NULLP) && (formatDb->maxCodeRate != 0))
    {
-      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedSrsCfg");
-      return RFAILED;
+      DU_ALLOC(format->maxCodeRate, sizeof(long));
+      if(format->maxCodeRate)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }  
+      *(format->maxCodeRate) = formatDb->maxCodeRate;
+   }
+   /* Number of slots */
+   format->nrofSlots = NULLP;
+   if((formatDb == NULLP) || ((formatDb != NULLP) && (formatDb->numSlots != 0)))
+   {
+      DU_ALLOC(format->nrofSlots, sizeof(long));
+      if(format->nrofSlots == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }
+      if(formatDb == NULLP)
+         *(format->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
+      else
+         *(format->nrofSlots) = formatDb->numSlots;
    }
 
-   if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
+   /* Pi2BPSK*/
+   format->pi2BPSK = NULLP;
+   if((formatDb != NULLP) && (formatDb->pi2BPSK == true))
    {
-      return RFAILED;
+      DU_ALLOC(format->pi2BPSK, sizeof(long));
+      if(format->pi2BPSK)
+      {     
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }     
+      *(format->pi2BPSK) = PUCCH_FormatConfig__pi2BPSK_enabled;
    }
 
-   srsCfg->tpc_Accumulation = NULLP;
+   /* Simultaneous HARQ ACK and CSI */
+   format->simultaneousHARQ_ACK_CSI = NULLP;
+   if((formatDb != NULLP) && (formatDb->harqAckCSI == true))
+   {
+      DU_ALLOC(format->simultaneousHARQ_ACK_CSI, sizeof(long));
+      if(format->simultaneousHARQ_ACK_CSI)
+      {     
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPucchFormat");
+         return RFAILED;
+      }     
+      *(format->simultaneousHARQ_ACK_CSI) = PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
+   }
 
    return ROK;
 }
 
 
-
 /*******************************************************************
  *
- * @brief Builds Pusch Serving cell Config
+ * @brief Builds PUCCH scheduling request list
  *
  * @details
  *
- *    Function : BuildPuschSrvCellCfg
+ *    Function : BuildPucchSchReqAddModList
  *
- *    Functionality: Builds Pusch Serving cell Config
+ *    Functionality:
+ *      Builds PUCCH scheduling request list
  *
- * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
+ * @params[in] : PucchSchedReqCfg *schReqDb
+ *               struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
+uint8_t BuildPucchSchReqAddModList(PucchSchedReqCfg *schReqDb, \
+   struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList)
 {
-   puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
-   puschCfg->choice.setup = NULLP;
-   DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
-   if(!puschCfg->choice.setup)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
-      return RFAILED;
-   }
+   uint8_t elementCnt = 0, schReqIdx = 0;
+   SchedulingRequestResourceConfig_t *schReqRsrc;
 
-   puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
-   puschCfg->choice.setup->rateMatching = NULLP;
-   puschCfg->choice.setup->xOverhead = NULLP;
-   puschCfg->choice.setup->ext1 = NULLP;
-   DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
-   if(!puschCfg->choice.setup->ext1)
+   elementCnt = schReqDb->schedAddModListCount;
+   schReqRsrcToAddModList->list.count = elementCnt;
+   schReqRsrcToAddModList->list.size = elementCnt *sizeof(struct SchedulingRequestResourceConfig *);
+
+   schReqRsrcToAddModList->list.array = NULLP;
+   DU_ALLOC(schReqRsrcToAddModList->list.array, schReqRsrcToAddModList->list.size);
+   if(schReqRsrcToAddModList->list.array == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
       return RFAILED;
    }
 
-   puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
-   DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
-   if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
+   for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
-      return RFAILED;
+      DU_ALLOC(schReqRsrcToAddModList->list.array[schReqIdx], schReqRsrcToAddModList->list.size);
+      if(schReqRsrcToAddModList->list.array[schReqIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+         return RFAILED;
+      }
    }
-   *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
 
-   puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
-   DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
-   if(!puschCfg->choice.setup->ext1->processingType2Enabled)
+   for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
-      return RFAILED;
+      schReqRsrc = schReqRsrcToAddModList->list.array[schReqIdx];
+      schReqRsrc->schedulingRequestResourceId = schReqDb->schedAddModList[schReqIdx].resrcId;
+      schReqRsrc->schedulingRequestID = schReqDb->schedAddModList[schReqIdx].requestId;
+
+      if(schReqDb->schedAddModList[schReqIdx].periodicity)
+      {
+         schReqRsrc->periodicityAndOffset = NULLP;
+         DU_ALLOC(schReqRsrc->periodicityAndOffset, sizeof(struct SchedulingRequestResourceConfig__periodicityAndOffset));
+         if(schReqRsrc->periodicityAndOffset == NULLP)
+         {
+            DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+            return RFAILED;
+         }
+
+         schReqRsrc->periodicityAndOffset->present = schReqDb->schedAddModList[schReqIdx].periodicity;
+         switch(schReqRsrc->periodicityAndOffset->present)
+         {
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_NOTHING:
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
+               schReqRsrc->periodicityAndOffset->choice.sym2 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
+               schReqRsrc->periodicityAndOffset->choice.sym6or7 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
+               schReqRsrc->periodicityAndOffset->choice.sl1 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
+               schReqRsrc->periodicityAndOffset->choice.sl2 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
+               schReqRsrc->periodicityAndOffset->choice.sl4 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
+               schReqRsrc->periodicityAndOffset->choice.sl5 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
+               schReqRsrc->periodicityAndOffset->choice.sl8 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
+               schReqRsrc->periodicityAndOffset->choice.sl10 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
+               schReqRsrc->periodicityAndOffset->choice.sl16 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
+               schReqRsrc->periodicityAndOffset->choice.sl20 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
+               schReqRsrc->periodicityAndOffset->choice.sl40 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
+               schReqRsrc->periodicityAndOffset->choice.sl80 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
+               schReqRsrc->periodicityAndOffset->choice.sl160 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
+               schReqRsrc->periodicityAndOffset->choice.sl320 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+            case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
+               schReqRsrc->periodicityAndOffset->choice.sl640 = schReqDb->schedAddModList[schReqIdx].offset;
+               break;
+         }
+      }
+
+      if(schReqDb->schedAddModList[schReqIdx].resrc)
+      {
+         schReqRsrc->resource = NULLP;
+         DU_ALLOC(schReqRsrc->resource, sizeof(PUCCH_ResourceId_t));
+         if(schReqRsrc->resource == NULLP)
+         {
+            DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+            return RFAILED;
+         }
+         *(schReqRsrc->resource) = schReqDb->schedAddModList[schReqIdx].resrc;
+
+      }
    }
-   *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds inital UL BWP
+ * @brief Builds PUCCH multi csi resource list
  *
  * @details
  *
- *    Function : BuildInitialUlBWP
+ *    Function : BuildPucchMultiCsiRsrcList
  *
- *    Functionality: Builds initial UL BWP
+ *    Functionality:
+ *      Builds PUCCH multi csi resource list
+ *
+ * @params[in] : PucchMultiCsiCfg *multiCsiDb
+ *               struct PUCCH_Config__multi_CSI_PUCCH_ResourceList  *multiCsiRsrcList
  *
- * @params[in] BWP_UplinkDedicated_t *ulBwp
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+uint8_t BuildPucchMultiCsiRsrcList(PucchMultiCsiCfg *multiCsiDb, struct PUCCH_Config__multi_CSI_PUCCH_ResourceList  *multiCsiRsrcList)
 {
-   ulBwp->pucch_Config = NULLP;
-
-   /* Fill BWP UL dedicated PUSCH config */
-   ulBwp->pusch_Config = NULLP;
-   DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
-   if(!ulBwp->pusch_Config)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
-      return RFAILED;
-   }
-
-   ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
-   ulBwp->pusch_Config->choice.setup = NULLP;
-   DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
-   if(!ulBwp->pusch_Config->choice.setup)
-   {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
-      return RFAILED;
-   }
-
-   if(BuildBWPUlDedPuschCfg(ulBwp->pusch_Config->choice.setup) != ROK)
-   {
-      return RFAILED;
-   }
-
-   ulBwp->configuredGrantConfig = NULLP;
+   uint8_t elementCnt = 0, rsrcIdx = 0;
 
-   /* Fill BPW UL dedicated SRS config */
-   ulBwp->srs_Config = NULLP;
-   DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
-   if(!ulBwp->srs_Config)
+   elementCnt = multiCsiDb->multiCsiResrcListCount;
+   multiCsiRsrcList->list.count = elementCnt;
+   multiCsiRsrcList->list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
+   multiCsiRsrcList->list.array = NULLP;
+   DU_ALLOC(multiCsiRsrcList->list.array, multiCsiRsrcList->list.size);
+   if(multiCsiRsrcList->list.array == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
+      DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
       return RFAILED;
    }
 
-   ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
-   ulBwp->srs_Config->choice.setup = NULLP;
-   DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
-   if(!ulBwp->srs_Config->choice.setup)
+   for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
-      return RFAILED;
+      DU_ALLOC(multiCsiRsrcList->list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+      if(multiCsiRsrcList->list.array[rsrcIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
+         return RFAILED;
+      }
    }
 
-   if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
+   for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
    {
-      return RFAILED;   
+      *(multiCsiRsrcList->list.array[rsrcIdx]) = multiCsiDb->multiCsiResrcList[rsrcIdx];
    }
-
-   ulBwp->beamFailureRecoveryConfig = NULLP;
-
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds UL config
+ * @brief Builds DL data -to- Ul Ack list
+ *
  * @details
  *
- *    Function : BuildUlCfg 
+ *    Function : BuildDlDataToUlAckList
  *
- *    Functionality: Builds UL config in spCellCfgDed
+ *    Functionality: Builds DL data -to- Ul Ack list
  *
- * @params[in] UplinkConfig_t *ulCfg
+ * @params[in] : PucchDlDataToUlAck *dlDataToUlAckDb
+ *               struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildUlCfg(UplinkConfig_t *ulCfg)
+uint8_t BuildDlDataToUlAckList(PucchDlDataToUlAck *dlDataToUlAckDb, struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList)
 {
-   ulCfg->initialUplinkBWP = NULLP;
-   DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
-   if(!ulCfg->initialUplinkBWP)
-   {
-      DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
-      return RFAILED;
-   }
+   uint8_t elementCnt = 0, arrIdx = 0;
+
+   if(dlDataToUlAckDb == NULLP)
+      elementCnt = 2;
+   else
+      elementCnt = dlDataToUlAckDb->dlDataToUlAckListCount;
 
-   if(BuildInitialUlBWP(ulCfg->initialUplinkBWP) != ROK)
+   dlDataToUlACKList->list.count = elementCnt;
+   dlDataToUlACKList->list.size = elementCnt * sizeof(long *);
+   DU_ALLOC(dlDataToUlACKList->list.array, dlDataToUlACKList->list.size);
+   if(dlDataToUlACKList->list.array == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDlDataToUlAckList");
       return RFAILED;
-   }
+   }   
 
-   ulCfg->uplinkBWP_ToReleaseList = NULLP;
-   ulCfg->uplinkBWP_ToAddModList = NULLP;
-   ulCfg->firstActiveUplinkBWP_Id = NULLP;
-   DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
-   if(!ulCfg->firstActiveUplinkBWP_Id)
+   for(arrIdx = 0; arrIdx <  dlDataToUlACKList->list.count; arrIdx++)
    {
-      DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
-      return RFAILED;
+      DU_ALLOC(dlDataToUlACKList->list.array[arrIdx], sizeof(long));
+      if(dlDataToUlACKList->list.array[arrIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDlDataToUlAckList");
+         return RFAILED;
+      }   
    }
-   *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
 
-   ulCfg->pusch_ServingCellConfig = NULLP;
-   DU_ALLOC(ulCfg->pusch_ServingCellConfig, \
-        sizeof(struct UplinkConfig__pusch_ServingCellConfig));
-   if(!ulCfg->pusch_ServingCellConfig)
+   if(dlDataToUlAckDb == NULLP)
    {
-      DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
-      return RFAILED;
+      arrIdx = 0;
+      *(dlDataToUlACKList->list.array[arrIdx++]) = 1;
+      *(dlDataToUlACKList->list.array[arrIdx]) = 2;
    }
-
-   if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
+   else
    {
-      return RFAILED;
+      for(arrIdx = 0; arrIdx <  dlDataToUlACKList->list.count; arrIdx++)
+      {
+         *(dlDataToUlACKList->list.array[arrIdx]) = dlDataToUlAckDb->dlDataToUlAckList[arrIdx];
+      }
    }
-
-   ulCfg->carrierSwitching = NULLP;
-   ulCfg->ext1 = NULLP;
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds PDSCH serving cell config
+ * @brief Builds BWP UL dedicated PUCCH Config
+ *
  * @details
  *
- *    Function : BuildPdschSrvCellCfg
+ *    Function : BuildBWPUlDedPucchCfg
  *
- *    Functionality: Builds PDSCH serving cell config in spCellCfgDed
+ *    Functionality:
+ *      Builds BWP UL dedicated PUCCH Config
  *
- * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg 
+ * @params[in] : PUCCH_Config_t *pucchCfg
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildPdschSrvCellCfg(struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
+uint8_t BuildBWPUlDedPucchCfg(PucchCfg *pucchCfgDb, PUCCH_Config_t *pucchCfg)
 {
-   pdschCfg->present =  ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
-   pdschCfg->choice.setup = NULLP;
-   DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
-   if(!pdschCfg->choice.setup)
+   PucchResrcSetCfg *rsrcSetCfgDb = NULLP;
+   PucchResrcCfg *rsrcCfgDb = NULLP;
+   PucchFormatCfg *format1Db = NULLP;
+   PucchFormatCfg *format2Db = NULLP;
+   PucchFormatCfg *format3Db = NULLP;
+   PucchFormatCfg *format4Db = NULLP;
+   PucchSchedReqCfg *schReqDb = NULLP;   
+   PucchMultiCsiCfg  *multiCsiDb = NULLP;
+   PucchDlDataToUlAck *dlDataToUlAckDb = NULLP;
+
+   if(pucchCfgDb)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschSrvCellCfg");
-      return RFAILED;
+      rsrcSetCfgDb = pucchCfgDb->resrcSet;
+      rsrcCfgDb = pucchCfgDb->resrc;
+      format1Db = pucchCfgDb->format1;
+      format2Db = pucchCfgDb->format2;
+      format3Db = pucchCfgDb->format3;
+      format4Db = pucchCfgDb->format4;
+      schReqDb = pucchCfgDb->schedReq;
+      multiCsiDb = pucchCfgDb->multiCsiCfg;
+      dlDataToUlAckDb = pucchCfgDb->dlDataToUlAck;
    }
 
-   pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
-   pdschCfg->choice.setup->xOverhead = NULLP;
-   pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
-   DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
-   if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
+   /* RESOURCE SET */
+   DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
+   if(pucchCfg->resourceSetToAddModList == NULL)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
-   *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)= PDSCH_NUM_HARQ_PROC;
-   pdschCfg->choice.setup->pucch_Cell = NULLP;
-   pdschCfg->choice.setup->ext1 = NULLP;
-
-   return ROK;
-}
-
-/*******************************************************************
- *
- * @brief Builds CSI Meas config
- * @details
- *
- *    Function : BuildCsiMeasCfg 
- *
- *    Functionality: Builds CSI Meas config in spCellCfgDed
- *
- * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
-{
-
-   return ROK;
-}
 
-/*******************************************************************
- *
- * @brief Builds Spcell config dedicated
- * @details
- *
- *    Function : BuildSpCellCfgDed
- *
- *    Functionality: Builds sp cell config dedicated in spCellCfg
- *
- * @params[in] ServingCellConfig_t srvCellCfg
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildSpCellCfgDed(ServingCellConfig_t *srvCellCfg)
-{
-   srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
-   DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
-   if(!srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
+   if(BuildPucchRsrcSetAddModList(rsrcSetCfgDb, pucchCfg->resourceSetToAddModList) != ROK)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
 
-   srvCellCfg->initialDownlinkBWP = NULLP;
-   DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
-   if(!srvCellCfg->initialDownlinkBWP)
+   /* PUCCH RESOURCE */
+   DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
+   if(pucchCfg->resourceToAddModList == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
 
-   if(BuildInitialDlBWP(srvCellCfg->initialDownlinkBWP) != ROK)
+   if(BuildPucchRsrcAddModList(rsrcCfgDb, pucchCfg->resourceToAddModList) != ROK)
    {
-      DU_LOG("\nF1AP : BuildInitialDlBWP failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
-   srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
-   srvCellCfg->downlinkBWP_ToAddModList = NULLP;
 
-   srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
-   DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
-   if(!srvCellCfg->firstActiveDownlinkBWP_Id)
+   /* PUCCH Format 1 */
+   DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
+   if(pucchCfg->format1 == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
-   *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
-
-   srvCellCfg->bwp_InactivityTimer = NULLP;
-
-   srvCellCfg->defaultDownlinkBWP_Id = NULLP;
-   DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
-   if(!srvCellCfg->defaultDownlinkBWP_Id)
+   
+   pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
+   DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
+   if(pucchCfg->format1->choice.setup == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
-   *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
 
-   srvCellCfg->uplinkConfig = NULLP;
-   DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
-   if(!srvCellCfg->uplinkConfig)
+   if(BuildPucchFormat(format1Db, pucchCfg->format1->choice.setup) != ROK)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
 
-   if(BuildUlCfg(srvCellCfg->uplinkConfig) != ROK)
+   /* PUCCH Format 2 */
+   if(format2Db)
    {
-      DU_LOG("\nF1AP : BuildUlCfg failed");
-      return RFAILED;
+      DU_ALLOC(pucchCfg->format2, sizeof(struct PUCCH_Config__format2));
+      if(pucchCfg->format2 == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      pucchCfg->format2->present = PUCCH_Config__format2_PR_setup;
+      DU_ALLOC(pucchCfg->format2->choice.setup, sizeof(PUCCH_FormatConfig_t));
+      if(pucchCfg->format2->choice.setup == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      if(BuildPucchFormat(format2Db, pucchCfg->format2->choice.setup) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
    }
-   srvCellCfg->supplementaryUplink = NULLP;
-   srvCellCfg->pdcch_ServingCellConfig = NULLP;
 
-   srvCellCfg->pdsch_ServingCellConfig = NULLP;
-   DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
-   if(!srvCellCfg->pdsch_ServingCellConfig)
+   /* PUCCH Format 3 */
+   if(format3Db)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
-      return RFAILED;
+      DU_ALLOC(pucchCfg->format3, sizeof(struct PUCCH_Config__format3));
+      if(pucchCfg->format3 == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      pucchCfg->format3->present = PUCCH_Config__format3_PR_setup;
+      DU_ALLOC(pucchCfg->format3->choice.setup, sizeof(PUCCH_FormatConfig_t));
+      if(pucchCfg->format3->choice.setup == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      if(BuildPucchFormat(format3Db, pucchCfg->format3->choice.setup) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
    }
 
-   if(BuildPdschSrvCellCfg(srvCellCfg->pdsch_ServingCellConfig) != ROK)
+   /* PUCCH Format 4 */
+   if(format4Db)
    {
-      DU_LOG("\nF1AP : BuildPdschSrvCellCfg failed");
-      return RFAILED;
+      DU_ALLOC(pucchCfg->format4, sizeof(struct PUCCH_Config__format4));
+      if(pucchCfg->format4 == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      pucchCfg->format4->present = PUCCH_Config__format4_PR_setup;
+      DU_ALLOC(pucchCfg->format4->choice.setup, sizeof(PUCCH_FormatConfig_t));
+      if(pucchCfg->format4->choice.setup == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      if(BuildPucchFormat(format4Db, pucchCfg->format4->choice.setup) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
    }
 
-   srvCellCfg->csi_MeasConfig = NULLP;
-#if 0
-   DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct  ServingCellConfig__csi_MeasConfig))
-      if(!srvCellCfg->csi_MeasConfig)
+   /* Scheduling Request */
+   if(schReqDb && (schReqDb->schedAddModListCount != 0))
+   {
+      pucchCfg->schedulingRequestResourceToAddModList = NULLP;
+      DU_ALLOC(pucchCfg->schedulingRequestResourceToAddModList, sizeof(struct PUCCH_Config__schedulingRequestResourceToAddModList));
+      if(pucchCfg->schedulingRequestResourceToAddModList == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
       }
 
-   if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
+      if(BuildPucchSchReqAddModList(schReqDb, pucchCfg->schedulingRequestResourceToAddModList) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+   }
+
+   /* Multi CSI */
+   if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
    {
-      DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
+      pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
+      DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
+      if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+
+      if(BuildPucchMultiCsiRsrcList(multiCsiDb, pucchCfg->multi_CSI_PUCCH_ResourceList) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+   }
+
+   /* DL DATA TO UL ACK */
+   DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+   if(pucchCfg->dl_DataToUL_ACK == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
       return RFAILED;
    }
-#endif
-   srvCellCfg->sCellDeactivationTimer = NULLP;
-   srvCellCfg->crossCarrierSchedulingConfig = NULLP;
-   srvCellCfg->tag_Id = TAG_ID;
-   srvCellCfg->dummy = NULLP;
-   srvCellCfg->pathlossReferenceLinking = NULLP;
-   srvCellCfg->servingCellMO = NULLP;
-   srvCellCfg->ext1 = NULLP;
+
+   if(BuildDlDataToUlAckList(dlDataToUlAckDb, pucchCfg->dl_DataToUL_ACK) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   
+   /* TODO : spatial relation info add/mod list and power control*/
 
    return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Builds Spcell config 
+ * @brief Fills SRS resource to add/modify list 
  *
  * @details
  *
- *    Function : BuildSpCellCfg 
- *
- *    Functionality: Builds sp cell config in DuToCuRrcContainer
+ *    Function : BuildSrsRsrcAddModList
  *
- * @params[in] SpCellConfig_t spCellCfg
+ *    Functionality: Fills SRS resource to add/modify list
  *
+ * @params[in] 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildSpCellCfg(SpCellConfig_t *spCellCfg)
+uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
 {
+   uint8_t   elementCnt;
+   uint8_t   rsrcIdx;
 
-   spCellCfg->servCellIndex = NULLP;
-   DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
-   if(!spCellCfg->servCellIndex)
+   elementCnt = 1;
+   resourceList->list.count = elementCnt;
+   resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
+   resourceList->list.array = NULLP;
+   DU_ALLOC(resourceList->list.array, resourceList->list.size);
+   if(!resourceList->list.array)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
       return RFAILED;
    }
-   *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
 
-   spCellCfg->reconfigurationWithSync = NULLP;
-   spCellCfg->rlf_TimersAndConstants = NULLP;
-   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
-   DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
-   if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
+   for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
-      return RFAILED;
+      DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+      if(!resourceList->list.array[rsrcIdx])
+      {
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
+        return RFAILED;
+      }
    }
-   *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
 
-   spCellCfg->spCellConfigDedicated = NULLP;
-   DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
-   if(!spCellCfg->spCellConfigDedicated)
-   {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
-      return RFAILED;
-   }
-   if(BuildSpCellCfgDed(spCellCfg->spCellConfigDedicated) != ROK)
+   rsrcIdx = 0;
+   resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
+   resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
+   resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
+
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
+   DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
+        sizeof(struct SRS_Resource__transmissionComb__n2));
+   if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
    {
-      DU_LOG("\nF1AP : BuildSpCellCfgDed failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
       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(PhysicalCellGroupConfig_t *phyCellGrpCfg)
-{
-   phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
-   phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
+      = SRS_COMB_OFFSET_N2;
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
+      = SRS_CYCLIC_SHIFT_N2;
 
-   phyCellGrpCfg->p_NR_FR1 = NULLP;
-   DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
-   if(!phyCellGrpCfg->p_NR_FR1)
+   resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
+                                                                     PUSCH_START_SYMBOL;
+   resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols =  \
+                                                                    SRS_Resource__resourceMapping__nrofSymbols_n1;
+   resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
+                                                                        SRS_Resource__resourceMapping__repetitionFactor_n1;
+
+   resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
+   resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
+   resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
+   resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
+   resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
+   resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
+                                                              SRS_Resource__groupOrSequenceHopping_neither;
+
+   /* Setting resource type to aperiodic for intergration purposes */
+   resourceList->list.array[rsrcIdx]->resourceType.present = \
+                                                            SRS_Resource__resourceType_PR_aperiodic;
+   resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
+   DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
+        sizeof(struct SRS_Resource__resourceType__aperiodic));
+   if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildPhyCellGrpCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
       return RFAILED;
    }
-   *(phyCellGrpCfg->p_NR_FR1)             = P_NR_FR1;
-   phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
-   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;
+   resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
 
    return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Builds Mac cell group config 
+ * @brief Build SRS resource set Add/mod list
  *
  * @details
  *
- *    Function : BuildMacCellGrpCfg 
- *
- *    Functionality: Builds Mac cell group config in DuToCuRrcContainer
+ *    Function : BuildSrsRsrcSetAddModList
  *
- * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
+ *    Functionality: Build SRS resource set Add/mod list
  *
+ * @params[in] 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildMacCellGrpCfg(MAC_CellGroupConfig_t *macCellGrpCfg)
+   uint8_t BuildSrsRsrcSetAddModList
+(
+ struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
+ )
 {
-   macCellGrpCfg->drx_Config = NULLP;
-   macCellGrpCfg->schedulingRequestConfig = NULLP;
-   DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
-   if(!macCellGrpCfg->schedulingRequestConfig)
-   {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
-      return RFAILED;
-   }
+   uint8_t  elementCnt;
+   uint8_t  rSetIdx;
+   uint8_t  rsrcIdx;
+   struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
 
-   if(BuildSchedulingReqConfig(macCellGrpCfg->schedulingRequestConfig) != ROK)
+   elementCnt = 1;
+   rsrcSetList->list.count = elementCnt;
+   rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
+   rsrcSetList->list.array = NULLP;
+   DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
+   if(!rsrcSetList->list.array)
    {
-      DU_LOG("\nF1AP : BuildSchedulingReqConfig failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
       return RFAILED;
    }
 
-   macCellGrpCfg->bsr_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
-   if(!macCellGrpCfg->bsr_Config)
+   for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
-      return RFAILED;
+      DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+      if(!rsrcSetList->list.array[rSetIdx])
+      {
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+        return RFAILED;
+      }
    }
 
-   if(BuildBsrConfig(macCellGrpCfg->bsr_Config) != ROK)
-   {
-      DU_LOG("\nF1AP : BuildBsrConfig failed");
-      return RFAILED;
-   }
+   rSetIdx = 0;
+   rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
 
-   macCellGrpCfg->tag_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
-   if(!macCellGrpCfg->tag_Config)
+   /* Fill Resource Id list in resource set */
+   rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
+   DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+        sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+   if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
       return RFAILED;
    }
 
-   if(BuildTagConfig(macCellGrpCfg->tag_Config) != ROK)
+   elementCnt = 1;
+   rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+   rsrcIdList->list.count = elementCnt;
+   rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
+   rsrcIdList->list.array = NULLP;
+   DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
+   if(!rsrcIdList->list.array)
    {
-      DU_LOG("\nF1AP : BuildTagConfig failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
       return RFAILED;
    }
 
-   macCellGrpCfg->phr_Config = NULLP;
-   DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
-   if(!macCellGrpCfg->phr_Config)
+   for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
-      return RFAILED;
+      DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+      if(!rsrcIdList->list.array[rsrcIdx])
+      {
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+        return RFAILED;
+      }
    }
 
-   if(BuildPhrConfig(macCellGrpCfg->phr_Config) != ROK)
-   {
-      DU_LOG("\nF1AP : BuildPhrConfig failed");
-      return RFAILED;
-   }
+   rsrcIdx = 0;
+   *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
 
-   macCellGrpCfg->skipUplinkTxDynamic = false;
-   macCellGrpCfg->ext1 = NULLP;
+   /* Fill resource type */
+   rsrcSetList->list.array[rSetIdx]->resourceType.present = \
+                                                           SRS_ResourceSet__resourceType_PR_aperiodic;
+
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
+   DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+        sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+   if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+      return RFAILED;
+   }
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
+      = APERIODIC_SRS_RESRC_TRIGGER;
+
+   /* TODO : Fill values for below IEs as expected by Viavi */
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
+
+
+   rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
+   rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
+   rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
+   rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
+   rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
 
    return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees memeory allocated for SearchSpcToAddModList
+ * @brief Builds BWP UL dedicated SRS Config
  *
  * @details
  *
- *    Function : FreeSearchSpcToAddModList
- *
- *    Functionality: Deallocating memory of SearchSpcToAddModList
+ *    Function : BuildBWPUlDedSrsCfg
  *
- * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+ *    Functionality: Builds BWP UL dedicated SRS Config
  *
- * @return void
+ * @params[in] SRS Config 
+ * @return ROK     - success
+ *         RFAILED - failure
  *
4221 * ****************************************************************/
-void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
+ * ****************************************************************/
+uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
 {
-   uint8_t idx1=0;
-   uint8_t idx2=0;
-   struct  SearchSpace *searchSpc=NULLP;
+   srsCfg->srs_ResourceSetToReleaseList = NULLP;
+   srsCfg->srs_ResourceSetToAddModList = NULLP;
+   DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
+        sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+   if(!srsCfg->srs_ResourceSetToAddModList)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
+      return RFAILED;
+   }
+   if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
+   {
+      return RFAILED;
+   }
 
-   if(searchSpcList->list.array)
+   srsCfg->srs_ResourceToReleaseList = NULLP;
+
+   /* Resource to Add/Modify list */
+   srsCfg->srs_ResourceToAddModList = NULLP;
+   DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
+        sizeof(struct SRS_Config__srs_ResourceToAddModList));
+   if(!srsCfg->srs_ResourceToAddModList)
    {
-      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  -->  F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
+      return RFAILED;
    }
+
+   if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
+   {
+      return RFAILED;
+   }
+
+   srsCfg->tpc_Accumulation = NULLP;
+
+   return ROK;
 }
+
+
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for PdschTimeDomAllocList
+ * @brief Builds Pusch Serving cell Config
  *
  * @details
  *
- *    Function : FreePdschTimeDomAllocList
+ *    Function : BuildPuschSrvCellCfg
  *
- *    Functionality: Deallocating memory of PdschTimeDomAllocList
+ *    Functionality: Builds Pusch Serving cell Config
  *
- * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+ * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
  *
- * @return void
+ * @return ROK     - success
+ *         RFAILED - failure
  *
4221 * ****************************************************************/
-void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
+ * ****************************************************************/
+uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
 {
-   uint8_t idx1=0;
+   puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
+   puschCfg->choice.setup = NULLP;
+   DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+   if(!puschCfg->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
 
-   if(timeDomAllocList->choice.setup)
+   puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+   puschCfg->choice.setup->rateMatching = NULLP;
+   puschCfg->choice.setup->xOverhead = NULLP;
+   puschCfg->choice.setup->ext1 = NULLP;
+   DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
+   if(!puschCfg->choice.setup->ext1)
    {
-      if(timeDomAllocList->choice.setup->list.array)
-      {
-        for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
-        {
-           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));
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
    }
-}
-/*******************************************************************
- *
- * @brief Frees memory allocated for PuschTimeDomAllocList
- *
- *@details
- *
- *    Function : FreePuschTimeDomAllocList
- *
- *    Functionality: Deallocating memory of PuschTimeDomAllocList
- *
- * @params[in] PUSCH_Config_t *puschCfg
- *
- * @return void
- *
- 4221 * ****************************************************************/
-void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
-{
-   uint8_t idx1=0;
-   uint8_t idx2=0;
-   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
 
-   if(puschCfg->pusch_TimeDomainAllocationList)
+   puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
+   DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
+   if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
    {
-      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
-      if(timeDomAllocList_t->choice.setup)
-      {
-        if(timeDomAllocList_t->choice.setup->list.array)
-        {
-           DU_FREE(timeDomAllocList_t->choice.setup->list.array[idx2]->k2, sizeof(long));
-           for(idx1 = 0; idx1<timeDomAllocList_t->choice.setup->list.count; idx1++)
-           {
-              DU_FREE(timeDomAllocList_t->choice.setup->list.array[idx1],\
-                    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));
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
    }
+   *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
 
+   puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
+   DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
+   if(!puschCfg->choice.setup->ext1->processingType2Enabled)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
+   *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
+   return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for InitialUlBWP
+ * @brief Builds inital UL BWP
  *
  * @details
  *
- *    Function : FreeInitialUlBWP
+ *    Function : BuildInitialUlBWP
  *
- *    Functionality: Deallocating memory of InitialUlBWP
+ *    Functionality: Builds initial UL BWP
  *
  * @params[in] BWP_UplinkDedicated_t *ulBwp
- *
- * @return void
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, 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;
+   PucchCfg *pucchCfg = NULLP;
+   PuschCfg *puschCfg = NULLP;
 
-   if(ulBwp->pusch_Config)
+   if(initUlBwp)
    {
-      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));
+      if(initUlBwp->pucchPresent)
+         pucchCfg = &initUlBwp->pucchCfg;
+      if(initUlBwp->puschPresent)
+         puschCfg = &initUlBwp->puschCfg;
+   }
 
-      /* Free SRS-Config */
-      if(ulBwp->srs_Config)
-      {
-        if(ulBwp->srs_Config->choice.setup)
-        {
-           srsCfg = ulBwp->srs_Config->choice.setup;
+   ulBwp->pucch_Config = NULLP;
+   DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   if(!ulBwp->pucch_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
 
-           /* Free Resource Set to add/mod list */
-           if(srsCfg->srs_ResourceSetToAddModList)
-           {
-              rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
-              if(rsrcSetList->list.array)
-              {
-                 rSetIdx = 0;
+   ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
+   ulBwp->pucch_Config->choice.setup = NULLP;
+   DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
+   if(!ulBwp->pucch_Config->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
 
-                 /* 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(BuildBWPUlDedPucchCfg(pucchCfg, ulBwp->pucch_Config->choice.setup) != ROK)
+   {
+      return RFAILED;
+   }
 
-                    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));
-                 }
+   /* Fill BWP UL dedicated PUSCH config */
+   ulBwp->pusch_Config = NULLP;
+   DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
+   if(!ulBwp->pusch_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
 
-                 /* Free resource type info for this SRS resource set */
-                 DU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
-                       sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+   ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
+   ulBwp->pusch_Config->choice.setup = NULLP;
+   DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+   if(!ulBwp->pusch_Config->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
 
-                 /* 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));
-           }
+   if(BuildBWPUlDedPuschCfg(puschCfg, ulBwp->pusch_Config->choice.setup) != ROK)
+   {
+      return RFAILED;
+   }
 
-           /* 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));
+   ulBwp->configuredGrantConfig = NULLP;
 
-                 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));
-           }
+   /* Fill BPW UL dedicated SRS config */
+   ulBwp->srs_Config = NULLP;
+   DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+   if(!ulBwp->srs_Config)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
 
-           DU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
-        }
-        DU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
-      }
+   ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
+   ulBwp->srs_Config->choice.setup = NULLP;
+   DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+   if(!ulBwp->srs_Config->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
    }
-}      
+
+   if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
+   {
+      return RFAILED;   
+   }
+
+   ulBwp->beamFailureRecoveryConfig = NULLP;
+
+   return ROK;
+}
+
 /*******************************************************************
  *
- * @brief Frees memory allocated for initialUplinkBWP
- *
+ * @brief Builds UL config
  * @details
  *
- *    Function : FreeinitialUplinkBWP
+ *    Function : BuildUlCfg 
  *
- *    Functionality: Deallocating memory of initialUplinkBWP
+ *    Functionality: Builds UL config in spCellCfgDed
  *
  * @params[in] UplinkConfig_t *ulCfg
  *
- * @return void
- *         
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
+uint8_t BuildUlCfg(ServCellCfgInfo *servCellCfg, UplinkConfig_t *ulCfg)
 {
-   BWP_UplinkDedicated_t *ulBwp=NULLP; 
-   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+   InitialUlBwp *initUlBwp = NULLP;
 
-   if(ulCfg->initialUplinkBWP)
+   if(servCellCfg)
    {
-      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));
+      initUlBwp = &servCellCfg->initUlBwp;
+   }
+
+   ulCfg->initialUplinkBWP = NULLP;
+   DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+   if(!ulCfg->initialUplinkBWP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failed in BuildUlCfg");
+      return RFAILED;
    }
+
+   if(BuildInitialUlBWP(initUlBwp, ulCfg->initialUplinkBWP) != ROK)
+   {
+      return RFAILED;
+   }
+
+   ulCfg->uplinkBWP_ToReleaseList = NULLP;
+   ulCfg->uplinkBWP_ToAddModList = NULLP;
+   ulCfg->firstActiveUplinkBWP_Id = NULLP;
+   DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+   if(!ulCfg->firstActiveUplinkBWP_Id)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failed in BuildUlCfg");
+      return RFAILED;
+   }
+   if(servCellCfg == NULLP)
+      *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
+   else
+      *(ulCfg->firstActiveUplinkBWP_Id) = servCellCfg->firstActvUlBwpId;
+
+   ulCfg->pusch_ServingCellConfig = NULLP;
+   DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+   if(!ulCfg->pusch_ServingCellConfig)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory Allocation failed in BuildUlCfg");
+      return RFAILED;
+   }
+
+   if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
+   {
+      return RFAILED;
+   }
+
+   ulCfg->carrierSwitching = NULLP;
+   ulCfg->ext1 = NULLP;
+   return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees emmory allocated for BWPDlDedPdschCfg
- *
+ * @brief Builds PDSCH serving cell config
  * @details
  *
- *    Function : FreeBWPDlDedPdschCfg
- *
- *    Functionality: Deallocating memory of BWPDlDedPdschCfg
+ *    Function : BuildPdschSrvCellCfg
  *
- * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *    Functionality: Builds PDSCH serving cell config in spCellCfgDed
  *
- * @return void
+ * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg 
  *
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
+uint8_t BuildPdschSrvCellCfg(PdschServCellCfg *pdschServCellDb, struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
 {
-   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;
+   pdschCfg->present =  ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
+   pdschCfg->choice.setup = NULLP;
+   DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
+   if(!pdschCfg->choice.setup)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+      return RFAILED;
+   }
 
-   if(dlBwp->pdsch_Config->choice.setup)
+   /* Code Block Group Transmission */
+   pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+   if(pdschServCellDb && (pdschServCellDb->maxCodeBlkGrpPerTb || pdschServCellDb->codeBlkGrpFlushInd))
    {
-      pdschCfg=dlBwp->pdsch_Config->choice.setup;
-      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+      DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission, sizeof(struct PDSCH_ServingCellConfig__codeBlockGroupTransmission));
+      if(pdschCfg->choice.setup->codeBlockGroupTransmission == NULLP)
       {
-        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_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+         return RFAILED;
       }
-      DU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+
+      pdschCfg->choice.setup->codeBlockGroupTransmission->present = PDSCH_ServingCellConfig__codeBlockGroupTransmission_PR_setup;
+      pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup = NULLP;
+      DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup, sizeof(struct PDSCH_CodeBlockGroupTransmission ));
+      if(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+         return RFAILED;
+      }
+
+      pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock = \
+         *(pdschServCellDb->maxCodeBlkGrpPerTb);
+      pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator = \
+         *(pdschServCellDb->codeBlkGrpFlushInd);
+   }
+
+   /* xOverhead */
+   pdschCfg->choice.setup->xOverhead = NULLP;
+   if(pdschServCellDb && pdschServCellDb->xOverhead)
+   {
+      DU_ALLOC(pdschCfg->choice.setup->xOverhead, sizeof(long));
+      if(pdschCfg->choice.setup->xOverhead == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+         return RFAILED;
+      }
+      *(pdschCfg->choice.setup->xOverhead) = *(pdschServCellDb->xOverhead);
+   }
+
+   /* Number of HARQ processes */
+   pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
+   DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
+   if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+      return RFAILED;
+   }
+
+   if(pdschServCellDb == NULLP)
+   *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = PDSCH_NUM_HARQ_PROC;
+   else
+   *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = pdschServCellDb->numHarqProcForPdsch;
+
+   pdschCfg->choice.setup->pucch_Cell = NULLP;
+
+   /* Extension */
+   pdschCfg->choice.setup->ext1 = NULLP;
+   if(pdschServCellDb && pdschServCellDb->maxMimoLayers)
+   {
+      DU_ALLOC(pdschCfg->choice.setup->ext1, sizeof(struct PDSCH_ServingCellConfig__ext1));
+      if(pdschCfg->choice.setup->ext1 == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+         return RFAILED;
+      }
+
+      DU_ALLOC(pdschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
+      if(pdschCfg->choice.setup->ext1->maxMIMO_Layers == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+         return RFAILED;
+      }
+      *(pdschCfg->choice.setup->ext1->maxMIMO_Layers) = *(pdschServCellDb->maxMimoLayers);
    }
+
+   return ROK;
 }
+
 /*******************************************************************
  *
- * @brief Frees emmory allocated for BWPDlDedPdcchCfg
- *
+ * @brief Builds CSI Meas config
  * @details
  *
- *    Function : FreeBWPDlDedPdcchCfg
- *
- *    Functionality: Deallocating memory of BWPDlDedPdcchCfg
+ *    Function : BuildCsiMeasCfg 
  *
- * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *    Functionality: Builds CSI Meas config in spCellCfgDed
  *
- * @return void
- *         
+ * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
+uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
 {
-   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)
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds DL BWP to add/modify list
+ * @details
+ *
+ *    Function : BuildDlBwpToAddModList
+ *
+ *    Functionality: Builds DL BWP to add/modify list
+ *
+ * @params[in] ServCellCfgInfo *servCellCfg, 
+ *             struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/ 
+uint8_t BuildDlBwpToAddModList(ServCellCfgInfo *servCellCfg, struct ServingCellConfig__downlinkBWP_ToAddModList *dlBwpAddModList)
+{
+   uint8_t elementCnt, idx;
+
+   elementCnt = servCellCfg->numDlBwpToAdd;
+   dlBwpAddModList->list.count = elementCnt;
+   dlBwpAddModList->list.size = elementCnt * sizeof(struct BWP_Downlink *);
+   dlBwpAddModList->list.array = NULLP;
+   DU_ALLOC(dlBwpAddModList->list.array, dlBwpAddModList->list.size);
+   if(dlBwpAddModList->list.array == NULLP)
    {
-      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
-      if(pdcchCfg->controlResourceSetToAddModList)
+      DU_LOG("\nERROR  --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
+      return RFAILED;
+   }
+
+   for(idx=0; idx<dlBwpAddModList->list.count; idx++)
+   {
+      DU_ALLOC(dlBwpAddModList->list.array[idx], sizeof(BWP_Downlink_t));
+      if(dlBwpAddModList->list.array[idx] == NULLP)
       {
-        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_LOG("\nERROR  --> DU APP: Memory allocation failure in BuildDlBwpToAddModList");
+         return RFAILED;
       }
-      DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
    }
-}      
+
+   for(idx=0; idx<dlBwpAddModList->list.count; idx++)
+   {
+      dlBwpAddModList->list.array[idx]->bwp_Id = servCellCfg->DlBwpToAddList[idx].bwpId;
+      dlBwpAddModList->list.array[idx]->bwp_Common = NULLP;
+      dlBwpAddModList->list.array[idx]->bwp_Dedicated = NULLP;
+   }
+   return ROK;
+}
 
 /*******************************************************************
  *
- * @brief Frees emmory allocated for DUToCURRCContainer 
- *
+ * @brief Builds Spcell config dedicated
  * @details
  *
- *    Function : FreeMemDuToCuRrcCont
+ *    Function : BuildSpCellCfgDed
  *
- *    Functionality: Deallocating memory of DuToCuRrcContainer
+ *    Functionality: Builds sp cell config dedicated in spCellCfg
  *
- * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
+ * @params[in] ServingCellConfig_t srvCellCfg
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
+uint8_t BuildSpCellCfgDed(DuUeCb *ueCb, ServingCellConfig_t *srvCellCfg)
 {
-   uint8_t idx=0;
-   SpCellConfig_t *spCellCfg=NULLP;
-   ServingCellConfig_t *srvCellCfg=NULLP;
-   BWP_DownlinkDedicated_t *dlBwp=NULLP;
-   MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
-   PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
-   struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
-   struct RLC_Config *rlcConfig=NULLP;
-   struct LogicalChannelConfig *macLcConfig=NULLP;
-   struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
-   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
-   struct TAG_Config *tagConfig=NULLP;
-   struct TAG_Config__tag_ToAddModList *tagList=NULLP;
-   struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
-   struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
+   ServCellCfgInfo *servCellCfg = NULLP;
+   InitialDlBwp *initDlBwp = NULLP;
+   PdschServCellCfg *pdschServCellDb = NULLP;
 
-   rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
-   if(rlcBearerList)
+   if(ueCb)
    {
-      if(rlcBearerList->list.array)
-      {
-        for(idx=0; idx<rlcBearerList->list.count; idx++)
-        {
-           if(rlcBearerList->list.array[idx])
-           {  
-              rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
-              macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
-              if(rlcConfig)
-              {
-                 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));
-                 }     
-                 DU_FREE(rlcConfig, sizeof(struct RLC_Config));
-              }
-              DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
-              if(macLcConfig)
-              {
-                 if(macLcConfig->ul_SpecificParameters)
-                 {
-                    DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,   sizeof(SchedulingRequestId_t));
-                    DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
-                    DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
-                 }
-                 DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
-              }
-              DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
-           }   
-        }
-        DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
-      }
-      DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+      servCellCfg = &ueCb->macUeCfg.spCellCfg.servCellCfg;
+      initDlBwp = &servCellCfg->initDlBwp;
+      pdschServCellDb = &servCellCfg->pdschServCellCfg;
    }
 
-   macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
-   if(macCellGrpCfg)
+   srvCellCfg->tdd_UL_DL_ConfigurationDedicated = NULLP;
+   DU_ALLOC(srvCellCfg->tdd_UL_DL_ConfigurationDedicated, sizeof(TDD_UL_DL_ConfigDedicated_t));
+   if(!srvCellCfg->tdd_UL_DL_ConfigurationDedicated)
    {
-      schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; 
-      if(schedulingRequestConfig)
-      {
-        schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
-        if(schReqList)
-        {
-           if(schReqList->list.array)
-           {
-              for(idx=0;idx<schReqList->list.count; idx++)
-              {
-                 if(schReqList->list.array[idx])
-                 {
-                    DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
-                    DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
-                 }
-              }
-              DU_FREE(schReqList->list.array, schReqList->list.size);
-           }
-           DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
-                 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));    }
-           DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
-      }
-      if(macCellGrpCfg->bsr_Config)
-      {
-        DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
-      }
-      tagConfig = macCellGrpCfg->tag_Config;
-      if(tagConfig)
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
+   }
+
+   srvCellCfg->initialDownlinkBWP = NULLP;
+   DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+   if(!srvCellCfg->initialDownlinkBWP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
+   }
+
+   if(BuildInitialDlBWP(initDlBwp, srvCellCfg->initialDownlinkBWP) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildInitialDlBWP failed");
+      return RFAILED;
+   }
+
+   srvCellCfg->downlinkBWP_ToReleaseList = NULLP;
+
+   srvCellCfg->downlinkBWP_ToAddModList = NULLP;
+   if(ueCb && ueCb->macUeCfg.spCellCfg.servCellCfg.numDlBwpToAdd)
+   {
+      DU_ALLOC(srvCellCfg->downlinkBWP_ToAddModList, sizeof(struct ServingCellConfig__downlinkBWP_ToAddModList));
+      if(srvCellCfg->downlinkBWP_ToAddModList == NULLP)
       {
-        tagList = tagConfig->tag_ToAddModList;
-        if(tagList)
-        {
-           if(tagList->list.array)
-           {
-              for(idx=0; idx<tagList->list.count; idx++)
-              {
-                 DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
-              }
-              DU_FREE(tagList->list.array, tagList->list.size);
-           }
-           DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
-        }
-        DU_FREE(tagConfig, sizeof(struct TAG_Config));
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+         return RFAILED;
       }
 
-      phrConfig = macCellGrpCfg->phr_Config;
-      if(phrConfig)
+      if(BuildDlBwpToAddModList(&ueCb->macUeCfg.spCellCfg.servCellCfg, srvCellCfg->downlinkBWP_ToAddModList) != ROK)
       {
-        DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
-        DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
+         DU_LOG("\nERROR  -->  F1AP : BuildInitialDlBWP failed");
+         return RFAILED;
       }
+   }
 
-      DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
+   srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
+   DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+   if(!srvCellCfg->firstActiveDownlinkBWP_Id)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
    }
+   if(ueCb == NULLP)
+      *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
+   else
+      *(srvCellCfg->firstActiveDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.firstActvDlBwpId;
 
-   phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
-   if(phyCellGrpCfg)
+   srvCellCfg->bwp_InactivityTimer = NULLP;
+
+   srvCellCfg->defaultDownlinkBWP_Id = NULLP;
+   DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+   if(!srvCellCfg->defaultDownlinkBWP_Id)
    {
-      DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
-      DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
    }
+   if(ueCb == NULLP)
+      *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
+   else
+      *(srvCellCfg->defaultDownlinkBWP_Id) = ueCb->macUeCfg.spCellCfg.servCellCfg.defaultDlBwpId;
 
-   spCellCfg = cellGrpCfg->spCellConfig;
-   if(spCellCfg)
+   srvCellCfg->uplinkConfig = NULLP;
+   DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
+   if(!srvCellCfg->uplinkConfig)
    {
-      if(spCellCfg->servCellIndex)
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
+   }
+
+   if(BuildUlCfg(servCellCfg, srvCellCfg->uplinkConfig) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildUlCfg failed");
+      return RFAILED;
+   }
+   srvCellCfg->supplementaryUplink = NULLP;
+   srvCellCfg->pdcch_ServingCellConfig = NULLP;
+
+   srvCellCfg->pdsch_ServingCellConfig = NULLP;
+   DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct ServingCellConfig__pdsch_ServingCellConfig));
+   if(!srvCellCfg->pdsch_ServingCellConfig)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+      return RFAILED;
+   }
+
+   if(BuildPdschSrvCellCfg(pdschServCellDb, srvCellCfg->pdsch_ServingCellConfig) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildPdschSrvCellCfg failed");
+      return RFAILED;
+   }
+
+   srvCellCfg->csi_MeasConfig = NULLP;
+#if 0
+   DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct  ServingCellConfig__csi_MeasConfig))
+      if(!srvCellCfg->csi_MeasConfig)
       {
-        if(spCellCfg->rlmInSyncOutOfSyncThreshold)
-        {
-           if(spCellCfg->spCellConfigDedicated)
-           {
-              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));
-           }
-           DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
-        }
-        DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfgDed");
+        return RFAILED;
       }
-      DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
+
+   if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
+   {
+      DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
+      return RFAILED;
    }
+#endif
+   srvCellCfg->sCellDeactivationTimer = NULLP;
+   srvCellCfg->crossCarrierSchedulingConfig = NULLP;
+   srvCellCfg->tag_Id = TAG_ID;
+   srvCellCfg->dummy = NULLP;
+   srvCellCfg->pathlossReferenceLinking = NULLP;
+   srvCellCfg->servingCellMO = NULLP;
+   srvCellCfg->ext1 = NULLP;
+
    return ROK;
 }
 /*******************************************************************
  *
- * @brief Builds DU To CU RRC Container 
+ * @brief Builds Spcell config 
  *
  * @details
  *
- *    Function : BuildDuToCuRrcContainer 
+ *    Function : BuildSpCellCfg 
  *
- *    Functionality: Builds DuToCuRrcContainer
+ *    Functionality: Builds sp cell config in DuToCuRrcContainer
  *
- * @params[in] idx, index in F1AP msg
- *             DuToCuRRCContainer, DuToCuRRCContainer
+ * @params[in] SpCellConfig_t spCellCfg
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildDuToCuRrcContainer(DUtoCURRCContainer_t *duToCuRrcContainer)
+uint8_t BuildSpCellCfg(DuUeCb *ueCb, SpCellConfig_t *spCellCfg)
 {
-   uint8_t  ret = ROK;
-   CellGroupConfigRrc_t  cellGrpCfg;
-   asn_enc_rval_t        encRetVal;
-   memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
-   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
-
-   while(true)
+   spCellCfg->servCellIndex = NULLP;
+   DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
+   if(!spCellCfg->servCellIndex)
    {
-      cellGrpCfg.cellGroupId = CELL_GRP_ID;
-
-      cellGrpCfg.rlc_BearerToAddModList = NULLP;
-      DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
-      if(!cellGrpCfg.rlc_BearerToAddModList)
-      {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
-        ret = RFAILED;
-        break;
-      }
-      if(BuildRlcBearerToAddModList(cellGrpCfg.rlc_BearerToAddModList) != ROK)
-      {
-        DU_LOG("\nF1AP : BuildRlcBearerToAddModList failed");
-        ret = RFAILED;
-        break;
-      }
-
-      cellGrpCfg.rlc_BearerToReleaseList = NULLP;
-      cellGrpCfg.mac_CellGroupConfig = NULLP;
-      DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
-      if(!cellGrpCfg.mac_CellGroupConfig)
-      {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
-        ret = RFAILED;
-        break;
-      }
-      if(BuildMacCellGrpCfg(cellGrpCfg.mac_CellGroupConfig) != ROK)
-      {
-        DU_LOG("\nF1AP : BuildMacCellGrpCfg failed");
-        ret = RFAILED;
-        break;
-      }
-
-      cellGrpCfg.physicalCellGroupConfig = NULLP;
-      DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
-      if(!cellGrpCfg.physicalCellGroupConfig)
-      {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
-        ret = RFAILED;
-        break;
-      }
-      if(BuildPhyCellGrpCfg(cellGrpCfg.physicalCellGroupConfig) != ROK)
-      {
-        DU_LOG("\nF1AP : BuildPhyCellGrpCfg failed");
-        ret = RFAILED;
-        break;
-      }
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      return RFAILED;
+   }
 
-      cellGrpCfg.spCellConfig = NULLP;
-      DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
-      if(!cellGrpCfg.spCellConfig)
-      {
-        DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
-        ret = RFAILED;
-        break;
-      }
-      if(BuildSpCellCfg(cellGrpCfg.spCellConfig) != ROK)
-      {
-        DU_LOG("\nF1AP : BuildSpCellCfg failed");
-        ret = RFAILED;
-        break;
-      }
+   if(ueCb == NULLP)
+      *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
+   else
+      *(spCellCfg->servCellIndex) = ueCb->macUeCfg.spCellCfg.servCellIdx;
 
-      cellGrpCfg.sCellToAddModList = NULLP;
-      cellGrpCfg.sCellToReleaseList = NULLP;
-      cellGrpCfg.ext1 = NULLP;
+   spCellCfg->reconfigurationWithSync = NULLP;
+   spCellCfg->rlf_TimersAndConstants = NULLP;
+   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
 
-      /* encode cellGrpCfg into duToCuRrcContainer */
-      xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
-      memset(encBuf, 0, ENC_BUF_MAX_LEN);
-      encBufSize = 0;
-      encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
-      /* Encode results */
-      if(encRetVal.encoded == ENCODE_FAIL)
-      {
-        DU_LOG( "\n F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        ret = RFAILED;
-        break;
-      }
-      else
-      {
-        DU_LOG("\n F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
-        for(int i=0; i< encBufSize; i++)
-        {
-           printf("%x",encBuf[i]);
-        }
-      }
+   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;
 
-      duToCuRrcContainer->size = encBufSize;
-      DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
-      if(!duToCuRrcContainer->buf)
-      {
-        DU_LOG("\nF1AP : Memory allocation failed in BuildDuToCuRrcContainer");
-        ret = RFAILED;
-        break;
-      }
-      if(ret == ROK)
-      {
-         memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
-      }
-      break;
+   spCellCfg->spCellConfigDedicated = NULLP;
+   DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+   if(!spCellCfg->spCellConfigDedicated)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildSpCellCfg");
+      return RFAILED;
    }
-   FreeMemDuToCuRrcCont(&cellGrpCfg);
-   return ret;
+   if(BuildSpCellCfgDed(ueCb, spCellCfg->spCellConfigDedicated) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildSpCellCfgDed failed");
+      return RFAILED;
+   }
+
+   return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Free memory allocated in InitialULRRCMessage
+ * @brief Builds Phy cell group config 
  *
  * @details
  *
- *    Function : freeInitUlRrcMsgTransfer
+ *    Function : BuildPhyCellGrpCfg 
  *
- *    Functionality: Free memory allocated in InitialULRRCMessage
+ *    Functionality: Builds Phy cell group config in DuToCuRrcContainer
  *
- * @params[in]F1AP_PDU_t  *f1apMsg)
+ * @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg 
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-
-uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t  *f1apMsg)
+uint8_t BuildPhyCellGrpCfg(DuUeCb *ueCb, PhysicalCellGroupConfig_t *phyCellGrpCfg)
 {
-   uint8_t ieIdx, arrIdx;
-   InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
+   phyCellGrpCfg->harq_ACK_SpatialBundlingPUCCH = NULLP;
+   phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
 
-   if(f1apMsg)
+   phyCellGrpCfg->p_NR_FR1 = NULLP;
+   DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+   if(!phyCellGrpCfg->p_NR_FR1)
    {
-      if(f1apMsg->choice.initiatingMessage)
-      {
-         initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
-           choice.InitialULRRCMessageTransfer;
-        if(initULRRCMsg->protocolIEs.list.array)
-        {
-           for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
-           {
-              switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
-              {
-                 case ProtocolIE_ID_id_NRCGI:
-                 {
-                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
-                    {
-                       if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
-                       {
-                          DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
-                          initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
-                       }
-                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
-                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
-                    }
-                     break;
-                 }
-                 case ProtocolIE_ID_id_RRCContainer:
-                 {
-                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
-                    {
-                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
-                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
-                    }
-                     break;
-                 }
-                 case ProtocolIE_ID_id_DUtoCURRCContainer:
-                 {
-                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
-                    {
-                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
-                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
-                    }
-                    break;
-                 }
-                 default:
-                    break;
-              }
-            }
-            for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
-            {
-               if(initULRRCMsg->protocolIEs.list.array[arrIdx])
-               {
-                  DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
-                     sizeof(InitialULRRCMessageTransferIEs_t));
-               }
-            }
-            DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
-         }
-        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-      }
-      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+      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
    {
-      DU_LOG("\nDU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
-      return RFAILED;
+      *(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 and sends the InitialULRRCMessage 
+ * @brief Builds Mac cell group config 
  *
  * @details
  *
- *    Function : BuildAndSendInitialRrcMsgTransfer 
+ *    Function : BuildMacCellGrpCfg 
  *
- *    Functionality: Constructs the Initial UL RRC Message Transfer and sends
- *                   it to the CU through SCTP.
+ *    Functionality: Builds Mac cell group config in DuToCuRrcContainer
  *
- * @params[in] 
+ * @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
-      uint16_t rrcContSize, uint8_t *rrcContainer)
+uint8_t BuildMacCellGrpCfg(DuUeCb *ueCb, MAC_CellGroupConfig_t *macCellGrpCfg)
 {
-   uint8_t   ret;
-   uint8_t   elementCnt;
-   uint8_t   ieIdx;
-   asn_enc_rval_t  encRetVal;
-   F1AP_PDU_t  *f1apMsg = NULLP;
-   InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
-   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+   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;
+   }
 
-   while(true)
+   if(BuildSchedulingReqConfig(ueCb, macCellGrpCfg->schedulingRequestConfig) != ROK)
    {
-      DU_LOG("\n F1AP : Building RRC Setup Request\n");
-      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-      if(f1apMsg == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-        break;
-      }
-      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
-      DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-      if(f1apMsg->choice.initiatingMessage == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
-        break;
-      }
-      f1apMsg->choice.initiatingMessage->procedureCode =\
-                                                       ProcedureCode_id_InitialULRRCMessageTransfer;
-      f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
-      f1apMsg->choice.initiatingMessage->value.present = \
-                                                        InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
-      initULRRCMsg =\
-                   &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
-      elementCnt = 5;
-      initULRRCMsg->protocolIEs.list.count = elementCnt;
-      initULRRCMsg->protocolIEs.list.size = \
-                                           elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
-      /* Initialize the F1Setup members */
-      DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
-      if(initULRRCMsg->protocolIEs.list.array == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for\
-              RRCSetupRequestMessageTransferIEs failed");
-        break;
-      }
-      for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
-      {
-        DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
-              sizeof(InitialULRRCMessageTransferIEs_t));
-        if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
-        {
-           break;
-        }
-      }
-      ieIdx = 0;
-      /*GNB DU UE F1AP ID*/
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
-                                                       ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality  = Criticality_reject;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
-                                                                 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
-
-
-      /*NRCGI*/
-      ieIdx++;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
-                                                       ProtocolIE_ID_id_NRCGI;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality  =Criticality_reject;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
-                                                                 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
-
-      ret =\
-          BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
-      if(ret!=ROK)
-      {
-        break;
-      }
-
-      /*CRNTI*/
-      ieIdx++;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
-                                                       ProtocolIE_ID_id_C_RNTI;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
-
-      /*RRCContainer*/
-      ieIdx++;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
-                                                       ProtocolIE_ID_id_RRCContainer;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
-
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
-      DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
-           initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
-      if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
-      {
-         DU_LOG(" F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
-         break;
-      
-      }
-      memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
-           initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
+      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;
+   }
 
-      /*DUtoCURRCContainer*/
-      ieIdx++;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
-      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
-                                                                InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
+   if(BuildBsrConfig(ueCb, macCellGrpCfg->bsr_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildBsrConfig failed");
+      return RFAILED;
+   }
 
-      ret = BuildDuToCuRrcContainer(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
-      if(ret != ROK)
-      {
-        break;
-      }
+   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;
+   }
 
-      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+   if(BuildTagConfig(ueCb, macCellGrpCfg->tag_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildTagConfig failed");
+      return RFAILED;
+   }
 
-      /* Encode the F1SetupRequest type as APER */
-      memset(encBuf, 0, ENC_BUF_MAX_LEN);
-      encBufSize = 0;
-      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
-      /* Encode results */
-      if(encRetVal.encoded == ENCODE_FAIL)
-      {
-        DU_LOG( "\n F1AP : Could not encode Initial UL RRC Message Transfer\
-              structure (at %s)\n",encRetVal.failed_type ? \
-              encRetVal.failed_type->name : "unknown");
-        ret = RFAILED;
-        break;
-      }
-      else
-      {
+   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;
+   }
 
-        DU_LOG("\n F1AP : Created APER encoded buffer for Initial UL RRC\
-              Message transfer\n");
-        for(int i=0; i< encBufSize; i++)
-        {
-           printf("%x",encBuf[i]);
-        }
-      }
-      /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
-      {
-        DU_LOG("\n F1AP : Sending Initial UL RRC Message Transfer Failed");
-        ret = RFAILED;
-        break;
-      }
-      break;
+   if(BuildPhrConfig(ueCb, macCellGrpCfg->phr_Config) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildPhrConfig failed");
+      return RFAILED;
    }
-   freeInitUlRrcMsgTransfer(f1apMsg);
-   return ret;
-}/* End of BuildAndSendInitialRrcMsgTransfer*/
 
-/*****  UE SETUP REQUEST *****/
+   macCellGrpCfg->skipUplinkTxDynamic = false;
+   macCellGrpCfg->ext1 = NULLP;
 
+   return ROK;
+}
 /*******************************************************************
  *
- * @brief Free Qos And Snssai Drb Info
+ * @brief Frees memeory allocated for SearchSpcToAddModList
  *
  * @details
  *
- *    Function : freeDrbQosAndSnssaiInfo
+ *    Function : FreeSearchSpcToAddModList
  *
- *    Functionality: Free Qos And Snssai Drb Info
+ *    Functionality: Deallocating memory of SearchSpcToAddModList
+ *
+ * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
  *
- * @params[in] LcCfg *lcCfg,
  * @return void
  *
- * ****************************************************************/
-void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg)
4221 * ****************************************************************/
+void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
 {
-   if(lcCfg->snssai)
-   {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
-   }
-   if(lcCfg->drbQos)
-   {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
-   }
-}
-
-/******************************************************************
-*
-* @brief Function to delete the RLC Lc cfg from UE APP DB
-*
-* @details
-*
-*  Function : freeRlcLcCfg
-*
-*  Functionality: Function to delete the RLC Lc cfg from UE APP DB
-*
-*
- *****************************************************************/
+   uint8_t idx1=0;
+   uint8_t idx2=0;
+   struct  SearchSpace *searchSpc=NULLP;
 
-void freeRlcLcCfg(RlcBearerCfg *lcCfg)
-{
-   switch(lcCfg->rlcMode)
+   if(searchSpcList->list.array)
    {
-      case RLC_AM :
-      {
-         if(lcCfg->u.amCfg)
-        {
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
-            lcCfg->u.amCfg = NULLP;
-        }
-         break;
-      }
-      case RLC_UM_BI_DIRECTIONAL :
-      {
-         if(lcCfg->u.umBiDirCfg)
-        {
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
-           lcCfg->u.umBiDirCfg = NULLP;
-         }
-         break;
-      }
-      case RLC_UM_UNI_DIRECTIONAL_UL :
+      if(searchSpcList->list.array[idx2])
       {
-         if(lcCfg->u.umUniDirUlCfg)
+        searchSpc = searchSpcList->list.array[idx2];
+        if(searchSpc->controlResourceSetId)
         {
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
-           lcCfg->u.umUniDirUlCfg = NULLP;
+           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));
         }
-         break;
-
       }
-      case RLC_UM_UNI_DIRECTIONAL_DL :
+      for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
       {
-         if(lcCfg->u.umUniDirDlCfg)
-        {
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
-           lcCfg->u.umUniDirDlCfg = NULLP;
-         }
-         break;
+        DU_FREE(searchSpcList->list.array[idx1],
+              sizeof(struct SearchSpace));
       }
-      default:
-         DU_LOG("\nDU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
-        break;
+      DU_FREE(searchSpcList->list.array,searchSpcList->list.size);
    }
-   memset(lcCfg, 0, sizeof(LcCfg));
 }
 /*******************************************************************
  *
- * @brief Function to free MacLcCfg
+ * @brief Frees memory allocated for PdschTimeDomAllocList
  *
  * @details
  *
- *    Function : freeMacLcCfg
+ *    Function : FreePdschTimeDomAllocList
  *
- *    Functionality: Function to free MacLcCfg
+ *    Functionality: Deallocating memory of PdschTimeDomAllocList
+ *
+ * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
  *
- * @params[in] LcCfg *lcCfg,
  * @return void
  *
  * ****************************************************************/
-
-void  freeMacLcCfg(LcCfg *lcCfg)
+void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
 {
-    /* Deleting DRBQOS */
-   if(lcCfg->drbQos)
-   {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
-      lcCfg->drbQos = NULLP;
-   }
-   /* Deleting SNSSAI */
-   if(lcCfg->snssai)
+   uint8_t idx1=0;
+
+   if(timeDomAllocList->choice.setup)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
-      lcCfg->snssai = NULLP;
+      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));
    }
-   memset(lcCfg, 0, sizeof(LcCfg));
 }
-
 /*******************************************************************
  *
- * @brief Free UE NR Capability received in UE Context setup request
+ * @brief Frees memory allocated for PuschTimeDomAllocList
  *
- * @details
+ *@details
  *
- *    Function : freeUeNrCapability
+ *    Function : FreePuschTimeDomAllocList
  *
- *    Functionality:  
- *       Free UE NR Capability received in UE Context setup request
+ *    Functionality: Deallocating memory of PuschTimeDomAllocList
  *
- * @params[in] 
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] PUSCH_Config_t *puschCfg
+ *
+ * @return void
  *
  * ****************************************************************/
-void freeUeNrCapability(void *ueNrCapability)
+void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
 {
-   uint8_t idx;
-   FeatureSets_t *featureSets;
-   UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
+   uint8_t rsrcListIdx=0;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
 
-   if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
+   if(puschCfg->pusch_TimeDomainAllocationList)
    {
-      for(idx = 0; idx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; idx++)
+      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
+      if(timeDomAllocList_t->choice.setup)
       {
-         if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx])
-            free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[idx]);
+         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));
       }
-      free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
+      DU_FREE(puschCfg->transformPrecoder, sizeof(long));
+      DU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
+            sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
    }
 
-   if(ueNrCap->featureSets)
+}
+
+/*******************************************************************
+ *
+ * @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)
    {
-      featureSets = ueNrCap->featureSets;
-      if(featureSets->featureSetsDownlinkPerCC)
+      if(ulBwpPucchCfg->choice.setup)
       {
-         if(featureSets->featureSetsDownlinkPerCC->list.array)
+         pucchCfg = ulBwpPucchCfg->choice.setup;
+
+         //Free resource set list
+         if(pucchCfg->resourceSetToAddModList)
          {
-            for(idx = 0; idx < featureSets->featureSetsDownlinkPerCC->list.count; idx++)
+            if(pucchCfg->resourceSetToAddModList->list.array)
             {
-               if(featureSets->featureSetsDownlinkPerCC->list.array[idx])
+               for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
                {
-                  if(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL)
-                     free(featureSets->featureSetsDownlinkPerCC->list.array[idx]->supportedModulationOrderDL);
-                  free(featureSets->featureSetsDownlinkPerCC->list.array[idx]);
+                  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);
             }
-            free(featureSets->featureSetsDownlinkPerCC->list.array);
+            DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
          }
-         free(featureSets->featureSetsDownlinkPerCC);
-      }
-      if(featureSets->featureSetsUplinkPerCC)
-      {
-         if(featureSets->featureSetsUplinkPerCC->list.array)
+
+         //Free resource list
+         if(pucchCfg->resourceToAddModList)
          {
-            for(idx = 0; idx < featureSets->featureSetsUplinkPerCC->list.count; idx++)
+            if(pucchCfg->resourceToAddModList->list.array)
             {
-               if(featureSets->featureSetsUplinkPerCC->list.array[idx])
+               for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
                {
-                  if(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL)
-                     free(featureSets->featureSetsUplinkPerCC->list.array[idx]->supportedModulationOrderUL);
-                  free(featureSets->featureSetsUplinkPerCC->list.array[idx]);
+                  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);
             }
-            free(featureSets->featureSetsUplinkPerCC->list.array);
+            DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
          }
-         free(featureSets->featureSetsUplinkPerCC);
+
+         //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));
       }
-      free(ueNrCap->featureSets);
-   }   
+      DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   }
 }
 
 /*******************************************************************
  *
- * @brief Function to free DuUeCfg
+ * @brief Frees memory allocated for InitialUlBWP
  *
  * @details
  *
- *    Function : freeDuUeCfg
+ *    Function : FreeInitialUlBWP
  *
- *    Functionality: Function to free DuUeCfg
+ *    Functionality: Deallocating memory of InitialUlBWP
+ *
+ * @params[in] BWP_UplinkDedicated_t *ulBwp
  *
- * @params[in] DuUeCfg *ueCfg
  * @return void
  *
  * ****************************************************************/
-void freeDuUeCfg(DuUeCfg *ueCfg)
+void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
 {
-   uint8_t lcIdx;
+   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;
 
-   if(ueCfg->ueNrCapability)
-   {
-      freeUeNrCapability(ueCfg->ueNrCapability);
-      DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
-      ueCfg->ueNrCapability = NULLP;
-   }
-   if(ueCfg->cellGrpCfg)
-   {
-      DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
-      ueCfg->cellGrpCfg = NULLP;
-   }
-   if(ueCfg->ambrCfg)
-   {
-      memset(ueCfg->ambrCfg, 0, sizeof(AmbrCfg));
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
-   }
-   for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
-   {
-      freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
-   }
-   for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
+   FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
+
+   if(ulBwp->pusch_Config)
    {
-      freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
-   }
-}
+      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 Function to free UecontextSetupDb
+ * @brief Frees memory allocated for initialUplinkBWP
  *
  * @details
  *
- *    Function : freeF1UeDb
+ *    Function : FreeinitialUplinkBWP
  *
- *    Functionality: Function to free UecontextSetupDb
+ *    Functionality: Deallocating memory of initialUplinkBWP
+ *
+ * @params[in] UplinkConfig_t *ulCfg
  *
- * @params[in] UecontextSetupDb *
  * @return void
+ *         
  *
  * ****************************************************************/
-
-void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
+void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
 {
-   
-   if(f1UeDb->dlRrcMsg)
+   BWP_UplinkDedicated_t *ulBwp=NULLP; 
+   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+
+   if(ulCfg->initialUplinkBWP)
    {
-      if(f1UeDb->dlRrcMsg->rrcMsgPdu)
+      ulBwp=ulCfg->initialUplinkBWP;
+      if(ulCfg->firstActiveUplinkBWP_Id)
       {
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
-           f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
+        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));
       }
-      memset(f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+      FreeInitialUlBWP(ulBwp);
+      DU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
    }
-   freeDuUeCfg(&f1UeDb->duUeCfg);
-   memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
-   DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
 }
-
 /*******************************************************************
  *
- * @brief Function to build Am cfg Info
+ * @brief Frees emmory allocated for BWPDlDedPdschCfg
  *
  * @details
  *
- *    Function : extractRlcAmCfg
+ *    Function : FreeBWPDlDedPdschCfg
  *
- *    Functionality: Function to build Am cfg Info
+ *    Functionality: Deallocating memory of BWPDlDedPdschCfg
  *
- * @params[in] AmBearerCfg *
- *             void *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return void
  *
- * @return ROK/RFAILED
  *
  * ****************************************************************/
-
-void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
+void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
 {
-   if(rlcAmCfg)
-   {
-      /* UL AM */
-      if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
-      {
-        amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength);
-        amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly;
-        amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit;
-      }
+   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;
 
-      /* DL AM */
-      if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
+   if(dlBwp->pdsch_Config->choice.setup)
+   {
+      pdschCfg=dlBwp->pdsch_Config->choice.setup;
+      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
       {
-        amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength);
-        amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit;
-        amCfgToSet->dlAmCfg.pollPdu   = rlcAmCfg->ul_AM_RLC.pollPDU;
-        amCfgToSet->dlAmCfg.pollByte  = rlcAmCfg->ul_AM_RLC.pollByte;
-        amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold;
-      }
-   }
-}
-
+        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 Function to build Um Bi Info
+ * @brief Frees emmory allocated for BWPDlDedPdcchCfg
  *
  * @details
  *
- *    Function : extractRlcUmBiCfg
+ *    Function : FreeBWPDlDedPdcchCfg
  *
- *    Functionality: Function to build Um Bi Info
+ *    Functionality: Deallocating memory of BWPDlDedPdcchCfg
  *
- * @params[in] UmBiDirBearerCfg *
- *             void *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
  *
- * @return ROK/RFAILED
+ * @return void
+ *         
  *
  * ****************************************************************/
-
-void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
+void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
 {
-   if(rlcBiCfg)
+   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)
    {
-      /* UL UM BI DIR Cfg */
-      if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
+      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
+      if(pdcchCfg->controlResourceSetToAddModList)
       {
-        umBiCfgToSet->ulUmCfg.snLenUlUm  = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength);
-        umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly;
+        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));
       }
-
-      /* DL UM BI DIR Cfg */
-      if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
-        umBiCfgToSet->dlUmCfg.snLenDlUm  = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength);
+      DU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
    }
-}
+}      
 
 /*******************************************************************
  *
- * @brief Function to build Um Ul Info
+ * @brief Frees emmory allocated for DUToCURRCContainer 
  *
  * @details
  *
- *    Function : extractRlcUmUlCfg
+ *    Function : FreeMemDuToCuRrcCont
  *
- *    Functionality: Function to build Um Ul Info
+ *    Functionality: Deallocating memory of DuToCuRrcContainer
  *
- * @params[in] UmUniDirUlBearerCfg *
- *             void *
+ * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
  *
- * @return ROK/RFAILED
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-
-void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
+uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
 {
-   if(umUlCfg)
+   uint8_t idx=0;
+   SpCellConfig_t *spCellCfg=NULLP;
+   ServingCellConfig_t *srvCellCfg=NULLP;
+   BWP_DownlinkDedicated_t *dlBwp=NULLP;
+   MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
+   struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
+   struct RLC_Config *rlcConfig=NULLP;
+   struct LogicalChannelConfig *macLcConfig=NULLP;
+   struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
+   struct TAG_Config *tagConfig=NULLP;
+   struct TAG_Config__tag_ToAddModList *tagList=NULLP;
+   struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
+   struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
+
+   rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
+   if(rlcBearerList)
    {
-      if(umUlCfg->dl_UM_RLC.sn_FieldLength)
+      if(rlcBearerList->list.array)
+      {
+         for(idx=0; idx<rlcBearerList->list.count; idx++)
+         {
+            if(rlcBearerList->list.array[idx])
+            {  
+               rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
+               macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
+               if(rlcConfig)
+               {
+                  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));
+                  }    
+                  DU_FREE(rlcConfig, sizeof(struct RLC_Config));
+               }
+               DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+               if(macLcConfig)
+               {
+                  if(macLcConfig->ul_SpecificParameters)
+                  {
+                     DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,  sizeof(SchedulingRequestId_t));
+                     DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,  sizeof(long));
+                     DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+                  }
+                  DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+               }
+               DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+            }  
+         }
+         DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
+      }
+      DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+   }
+
+   macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
+   if(macCellGrpCfg)
+   {
+      schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; 
+      if(schedulingRequestConfig)
+      {
+         schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+         if(schReqList)
+         {
+            if(schReqList->list.array)
+            {
+               for(idx=0;idx<schReqList->list.count; idx++)
+               {
+                  if(schReqList->list.array[idx])
+                  {
+                     DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+                     DU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
+                  }
+               }
+               DU_FREE(schReqList->list.array, schReqList->list.size);
+            }
+            DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
+                  sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));    }
+            DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+      }
+      if(macCellGrpCfg->bsr_Config)
+      {
+         DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+      }
+      tagConfig = macCellGrpCfg->tag_Config;
+      if(tagConfig)
       {
-         umUlCfgToSet->ulUmCfg.snLenUlUm  = *(umUlCfg->dl_UM_RLC.sn_FieldLength);
-         umUlCfgToSet->ulUmCfg.reAssemTmr = umUlCfg->dl_UM_RLC.t_Reassembly;
+         tagList = tagConfig->tag_ToAddModList;
+         if(tagList)
+         {
+            if(tagList->list.array)
+            {
+               for(idx=0; idx<tagList->list.count; idx++)
+               {
+                  DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
+               }
+               DU_FREE(tagList->list.array, tagList->list.size);
+            }
+            DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+         }
+         DU_FREE(tagConfig, sizeof(struct TAG_Config));
+      }
+
+      phrConfig = macCellGrpCfg->phr_Config;
+      if(phrConfig)
+      {
+         DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
+         DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
       }
+
+      DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
    }
-}
 
-/*******************************************************************
- *
- * @brief Function to build Um Uni Dl Info
- *
- * @details
- *
- *    Function : extractRlcUmDlCfg
- *
- *    Functionality: Function to build Um Uni Dl Info
- *
- * @params[in] UmUniDirDlBearerCfg *
- *             void *
- *
- * @return ROK/RFAILED
- *
- * ****************************************************************/
-void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
-{
-   if(umDlCfg)
+   phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
+   if(phyCellGrpCfg)
    {
-      if(umDlCfg->ul_UM_RLC.sn_FieldLength)
-         umDlCfgToSet->dlUmCfg.snLenDlUm  = *(umDlCfg->ul_UM_RLC.sn_FieldLength);
+      DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+      DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
+   }
+
+   spCellCfg = cellGrpCfg->spCellConfig;
+   if(spCellCfg)
+   {
+      if(spCellCfg->servCellIndex)
+      {
+         if(spCellCfg->rlmInSyncOutOfSyncThreshold)
+         {
+            if(spCellCfg->spCellConfigDedicated)
+            {
+               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));
+            }
+            DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+         }
+         DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+      }
+      DU_FREE(spCellCfg,sizeof(SpCellConfig_t));
    }
+   return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Function to extractRlcModeCfg
+ * @brief Builds CellGroupConfigRrc for DU To CU RRC Container 
  *
  * @details
  *
- *    Function : extractRlcModeCfg
+ *    Function : BuildCellGroupConfigRrc
  *
- *    Functionality: Function to extractRlcModeCfg
+ *    Functionality: Builds and copied Cell group config buffer into 
+ *       DuToCuRrcContainer
  *
- * @params[in] RLC_Config_t *
- *             RlcBearerCfg *
- *             void  *    
- * @return ROK/RFAILED
+ * @params[in] idx, index in F1AP msg
+ *             DuToCuRRCContainer, DuToCuRRCContainer
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
+uint8_t BuildCellGroupConfigRrc(DuUeCb *ueCb, OCTET_STRING_t *duToCuRrcContainer)
 {
-   if(lcCfg)
+   uint8_t  ret = ROK;
+   CellGroupConfigRrc_t  cellGrpCfg;
+   asn_enc_rval_t        encRetVal;
+   memset(&cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
+   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+
+   while(true)
    {
-      switch(rlcMode)
+      cellGrpCfg.cellGroupId = CELL_GRP_ID;
+
+      cellGrpCfg.rlc_BearerToAddModList = NULLP;
+      DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+      if(!cellGrpCfg.rlc_BearerToAddModList)
       {
-         case RLC_AM :
-            {
-               if(lcCfg->choice.am)
-              {
-                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
-                 if(rlcDbCfg->u.amCfg)
-                    extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
-              }
-               break;
-            }
-         case RLC_UM_BI_DIRECTIONAL :
-            {
-               if(lcCfg->choice.um_Bi_Directional)
-              {
-                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
-                 if(rlcDbCfg->u.umBiDirCfg)
-                     extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
-              }
-               break;
-            }
-         case RLC_UM_UNI_DIRECTIONAL_UL :
-            {
-               if(lcCfg->choice.um_Uni_Directional_DL)
-               {
-                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
-                 if(rlcDbCfg->u.umUniDirUlCfg)
-                     extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
-              }
-               break;
-            }
-         case RLC_UM_UNI_DIRECTIONAL_DL :
-            {
-               if(lcCfg->choice.um_Uni_Directional_UL)
-               {
-                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
-                 if(rlcDbCfg->u.umUniDirDlCfg)
-                     extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
-              }
-               break;
-            }
-         default:
-            DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
-            break;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+         ret = RFAILED;
+         break;
+      }
+      if(BuildRlcBearerToAddModList(ueCb, cellGrpCfg.rlc_BearerToAddModList) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildRlcBearerToAddModList failed");
+         ret = RFAILED;
+         break;
       }
-   }
-}
 
-/*******************************************************************
- *
- * @brief Function to extract extractUlLcCfg
- *
- * @details
- *
- *    Function : extractUlLcCfg
- *
- *    Functionality: Function to extract extractUlLcCfg
- *
- * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
- * @return void
- *
- * ****************************************************************/
+      cellGrpCfg.rlc_BearerToReleaseList = NULLP;
+      cellGrpCfg.mac_CellGroupConfig = NULLP;
+      DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
+      if(!cellGrpCfg.mac_CellGroupConfig)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+         ret = RFAILED;
+         break;
+      }
+      if(BuildMacCellGrpCfg(ueCb, cellGrpCfg.mac_CellGroupConfig) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildMacCellGrpCfg failed");
+         ret = RFAILED;
+         break;
+      }
 
-void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
-{
-   if(ulLcCfg)
-   {
-      if(ulLcCfg->ul_SpecificParameters)
+      cellGrpCfg.physicalCellGroupConfig = NULLP;
+      DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
+      if(!cellGrpCfg.physicalCellGroupConfig)
       {
-         f1UlLcCfg->priority = \
-            ulLcCfg->ul_SpecificParameters->priority;
-      if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+         ret = RFAILED;
+         break;
+      }
+      if(BuildPhyCellGrpCfg(ueCb, cellGrpCfg.physicalCellGroupConfig) != ROK)
       {
-         f1UlLcCfg->lcGroup = \
-           *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
+         DU_LOG("\nERROR  -->  F1AP : BuildPhyCellGrpCfg failed");
+         ret = RFAILED;
+         break;
       }
-      if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
+
+      cellGrpCfg.spCellConfig = NULLP;
+      DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
+      if(!cellGrpCfg.spCellConfig)
       {
-         f1UlLcCfg->schReqId = \
-           *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+         ret = RFAILED;
+         break;
       }
-      f1UlLcCfg->pbr = \
-         ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
-      f1UlLcCfg->bsd = \
-         ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
+      if(BuildSpCellCfg(ueCb, cellGrpCfg.spCellConfig) != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildSpCellCfg failed");
+         ret = RFAILED;
+         break;
+      }
+
+      cellGrpCfg.sCellToAddModList = NULLP;
+      cellGrpCfg.sCellToReleaseList = NULLP;
+      cellGrpCfg.ext1 = NULLP;
+
+      /* encode cellGrpCfg into duToCuRrcContainer */
+      xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
+      /* Encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+         DU_LOG( "\nERROR  --> F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         ret = RFAILED;
+         break;
+      }
+      else
+      {
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
+         for(int i=0; i< encBufSize; i++)
+         {
+            printf("%x",encBuf[i]);
+         }
+      }
+
+      duToCuRrcContainer->size = encBufSize;
+      DU_ALLOC(duToCuRrcContainer->buf, duToCuRrcContainer->size);
+      if(!duToCuRrcContainer->buf)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDuToCuRrcContainer");
+         ret = RFAILED;
+         break;
+      }
+      if(ret == ROK)
+      {
+         memcpy(duToCuRrcContainer->buf, encBuf, duToCuRrcContainer->size);
       }
+      break;
    }
+   FreeMemDuToCuRrcCont(&cellGrpCfg);
+   return ret;
 }
 
 /*******************************************************************
  *
- * @brief Function to procRlcLcCfg
+ * @brief Free memory allocated in InitialULRRCMessage
  *
  * @details
  *
- *    Function : procRlcLcCfg
+ *    Function : freeInitUlRrcMsgTransfer
  *
- *    Functionality: Function to procRlcLcCfg
+ *    Functionality: Free memory allocated in InitialULRRCMessage
  *
- * @params[in] rbId, lcId, rbType, rlcMod
- *             RLC_Config_t *, RlcBearerCfg * , 
- * @return void
+ * @params[in]F1AP_PDU_t  *f1apMsg)
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
 
-void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
-   uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg)
+uint8_t freeInitUlRrcMsgTransfer(F1AP_PDU_t  *f1apMsg)
 {
+   uint8_t ieIdx, arrIdx;
+   InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
 
-   lcCfg->rbId   = rbId;
-   lcCfg->configType = configType;
-
-   if(rbType == RB_TYPE_SRB)
-   {
-      lcCfg->rbType = RB_TYPE_SRB;
-      lcCfg->lcId   = rbId;
-      lcCfg->lcType = LCH_DCCH;
-      lcCfg->rlcMode = RLC_AM;
-   }
-   else if(rbType == RB_TYPE_DRB)
+   if(f1apMsg)
    {
-      lcCfg->rbType = RB_TYPE_DRB;
-      lcCfg->lcId   = lcId;
-      lcCfg->lcType = LCH_DTCH;
-      lcCfg->rlcMode = rlcMode;
+      if(f1apMsg->choice.initiatingMessage)
+      {
+         initULRRCMsg = &f1apMsg->choice.initiatingMessage->value.\
+           choice.InitialULRRCMessageTransfer;
+        if(initULRRCMsg->protocolIEs.list.array)
+        {
+           for(ieIdx = 0; ieIdx < initULRRCMsg->protocolIEs.list.count; ieIdx++)
+           {
+              switch(initULRRCMsg->protocolIEs.list.array[ieIdx]->id)
+              {
+                 case ProtocolIE_ID_id_NRCGI:
+                 {
+                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf)
+                    {
+                       if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf)
+                       {
+                          DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.buf,\
+                          initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity.size);
+                       }
+                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.buf,\
+                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.pLMN_Identity.size);
+                    }
+                     break;
+                 }
+                 case ProtocolIE_ID_id_RRCContainer:
+                 {
+                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+                    {
+                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
+                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
+                    }
+                     break;
+                 }
+                 case ProtocolIE_ID_id_DUtoCURRCContainer:
+                 {
+                    if(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf)
+                    {
+                       DU_FREE(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.buf,
+                       initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer.size);
+                    }
+                    break;
+                 }
+                 default:
+                    break;
+              }
+            }
+            for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
+            {
+               if(initULRRCMsg->protocolIEs.list.array[arrIdx])
+               {
+                  DU_FREE(initULRRCMsg->protocolIEs.list.array[arrIdx],\
+                     sizeof(InitialULRRCMessageTransferIEs_t));
+               }
+            }
+            DU_FREE(initULRRCMsg->protocolIEs.list.array, initULRRCMsg->protocolIEs.list.size);
+         }
+        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+      }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
    }
-   if(f1RlcCfg) /* rlc mode config recived */
+   else
    {
-      extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
+      DU_LOG("\nERROR  -->  DU_APP : Recevied F1ap Pdu is null at freeInitUlRrcMsgTransfer()");
+      return RFAILED;
    }
+   return ROK;
 }
 
-
-
 /*******************************************************************
  *
- * @brief Fills DrbQos Info received by CU
+ * @brief Builds and sends the InitialULRRCMessage 
  *
  * @details
  *
- *    Function : extractQosInfo
+ *    Function : BuildAndSendInitialRrcMsgTransfer 
  *
- *    Functionality: Fills DrbQos Info received  by CU
+ *    Functionality: Constructs the Initial UL RRC Message Transfer and sends
+ *                   it to the CU through SCTP.
  *
- * @params[in] DrbQosInfo *qosToAdd, 
- *             QoSFlowLevelQoSParameters_t *qosFlowCfg
- * @return void
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-
-void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
+uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
+      uint16_t rrcContSize, uint8_t *rrcContainer)
 {
-   qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
-   qosToAdd->u.nonDyn5Qi.fiveQi     =\
-         qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
-   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
-   {
-      qosToAdd->u.nonDyn5Qi.avgWindow = \
-        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
-   }
-   qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
-      *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
-   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
-   {
-      qosToAdd->u.nonDyn5Qi.priorLevel = \
-         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
-   }
-   qosToAdd->ngRanRetPri.priorityLevel = \
-      qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
-   qosToAdd->ngRanRetPri.preEmptionCap = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
-   qosToAdd->ngRanRetPri.preEmptionVul = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
-   if(qosFlowCfg->gBR_QoS_Flow_Information)
+   uint8_t   ret;
+   uint8_t   elementCnt;
+   uint8_t   ieIdx, cellIdx, ueIdx;
+   DuUeCb    *duUeCb = NULLP;
+   asn_enc_rval_t  encRetVal;
+   F1AP_PDU_t  *f1apMsg = NULLP;
+   InitialULRRCMessageTransfer_t *initULRRCMsg = NULLP;
+   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+
+   while(true)
    {
-      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
-      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
-      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
-      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
-         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
-   }
-   qosToAdd->pduSessionId = 0;
-   qosToAdd->ulPduSessAggMaxBitRate = 0;
-}
+      DU_LOG("\n INFO   -->  F1AP : Building RRC Setup Request\n");
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
+        break;
+      }
+      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+      DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+      if(f1apMsg->choice.initiatingMessage == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for  F1AP-PDU failed");
+        break;
+      }
+      f1apMsg->choice.initiatingMessage->procedureCode =\
+                                                       ProcedureCode_id_InitialULRRCMessageTransfer;
+      f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
+      f1apMsg->choice.initiatingMessage->value.present = \
+                                                        InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
+      initULRRCMsg =\
+                   &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
+      elementCnt = 5;
+      initULRRCMsg->protocolIEs.list.count = elementCnt;
+      initULRRCMsg->protocolIEs.list.size = \
+                                           elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
+      /* Initialize the F1Setup members */
+      DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
+      if(initULRRCMsg->protocolIEs.list.array == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for\
+              RRCSetupRequestMessageTransferIEs failed");
+        break;
+      }
+      for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
+      {
+        DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx],\
+              sizeof(InitialULRRCMessageTransferIEs_t));
+        if(initULRRCMsg->protocolIEs.list.array[ieIdx] == NULLP)
+        {
+           break;
+        }
+      }
+      ieIdx = 0;
+      /*GNB DU UE F1AP ID*/
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
+                                                       ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality  = Criticality_reject;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
+                                                                 InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
 
-uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd)
-{
-   DRB_Information_t *drbInfo = NULLP;
 
-   if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
-   {
-      if(drbItem->qoSInformation.choice.choice_extension->value.present ==
-           QoSInformation_ExtIEs__value_PR_DRB_Information)
+      /*NRCGI*/
+      ieIdx++;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
+                                                       ProtocolIE_ID_id_NRCGI;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality  =Criticality_reject;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present = \
+                                                                 InitialULRRCMessageTransferIEs__value_PR_NRCGI;
+
+      ret =\
+          BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
+      if(ret!=ROK)
       {
-        drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
+        break;
+      }
 
-        if(!macLcToAdd->drbQos)
-        {
-           DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
-           if(macLcToAdd->drbQos == NULLP)
-           {
-              DU_LOG("\n DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()");
-              return RFAILED;
-           }
+      /*CRNTI*/
+      ieIdx++;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
+                                                       ProtocolIE_ID_id_C_RNTI;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.C_RNTI = crnti;
 
-        }
-        if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
-        {
-           extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
-            macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
-        }
-        if(!macLcToAdd->snssai)
-        {
-           DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai));
-           if(macLcToAdd->snssai == NULLP)
-           {
-              DU_LOG("\n DUAPP:Memory failed at allocating SNSSAI at extractDrbCfg()");
-              return RFAILED;
-           }
-        }
-        memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \
-              drbInfo->sNSSAI.sST.size);
-        if(drbInfo->sNSSAI.sD)
-        {
-           memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \
-                 drbInfo->sNSSAI.sD->size);
-        }
-      }/*End of DRB Info*/
-   }
-   return ROK;
-}
+      /*RRCContainer*/
+      ieIdx++;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->id  = \
+                                                       ProtocolIE_ID_id_RRCContainer;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
 
-uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
-{
-   uint8_t ret = ROK;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = rrcContSize;
+      DU_ALLOC(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
+           initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size)
+      if(!initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
+         break;
+      
+      }
+      memcpy(initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, rrcContainer,
+           initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
 
-   if(drbCfg)
-   {
-      ret = extractDrbCfg(drbCfg, lcCfg);
-      if(ret == RFAILED)
+
+      /*DUtoCURRCContainer*/
+      ieIdx++;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCContainer;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      initULRRCMsg->protocolIEs.list.array[ieIdx]->value.present =\
+                                                                InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
+
+      for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
       {
-         DU_LOG("F1AP: Failed to build Drb Qos at extractMacRbCfg()");
-        return ret;
+         for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+         {
+            if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti == crnti))
+            {
+               duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+            }
+         }
       }
-   }
-   else
-   {
-      lcCfg->drbQos = NULLP;
-      lcCfg->snssai = NULLP;
-      if(lcCfg->lcId == SRB2_LCID)
-         lcCfg->dlLcCfg.lcp = LC_PRIORITY_3;
-      else
-         lcCfg->dlLcCfg.lcp = LC_PRIORITY_1;
-   }
-   if(ulLcCfg)
-   {
-      lcCfg->ulLcCfgPres = true;
-      extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg);
-   }
-   else
-      lcCfg->ulLcCfgPres = false;
-   return ret;
-}
 
-uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
-   DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
-{
-   uint8_t ret = ROK;
+      ret = BuildCellGroupConfigRrc(duUeCb, &initULRRCMsg->protocolIEs.list.array[ieIdx]->value.choice.DUtoCURRCContainer);
+      if(ret != ROK)
+      {
+        break;
+      }
 
-   lcCfg->lcId = lcId;
-   lcCfg->configType = configType;
-   if(rbType == RB_TYPE_SRB)
-   {
-      ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg);
-   }
-   else if(rbType == RB_TYPE_DRB)
-   {
-      ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg);
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the Intial UL RRC Message transfer as APER */
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
+      /* Encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+        DU_LOG( "\nERROR  --> F1AP : Could not encode Initial UL RRC Message Transfer\
+              structure (at %s)\n",encRetVal.failed_type ? \
+              encRetVal.failed_type->name : "unknown");
+        ret = RFAILED;
+        break;
+      }
+      else
+      {
+
+        DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for Initial UL RRC\
+              Message transfer\n");
+        for(int i=0; i< encBufSize; i++)
+        {
+           printf("%x",encBuf[i]);
+        }
+      }
+      /* Sending  msg  */
+      if(sendF1APMsg() != ROK)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Sending Initial UL RRC Message Transfer Failed");
+        ret = RFAILED;
+        break;
+      }
+      break;
    }
+   freeInitUlRrcMsgTransfer(f1apMsg);
    return ret;
-}
+}/* End of BuildAndSendInitialRrcMsgTransfer*/
+
+/*****  UE SETUP REQUEST *****/
 
 /*******************************************************************
  *
- * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ * @brief Free Qos And Snssai Drb Info
  *
  * @details
  *
- *    Function : extractRlcCfgToAddMod
+ *    Function : freeDrbQosAndSnssaiInfo
  *
- *    Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ *    Functionality: Free Qos And Snssai Drb Info
  *
- * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
- *             DuUeCfg Pointer
- * @return ROK/RFAILED
+ * @params[in] LcCfg *lcCfg,
+ * @return void
  *
  * ****************************************************************/
-
-uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \
-   DuUeCfg *ueCfgDb)
+void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg)
 {
-  uint8_t ret, idx, rbId, lcId, rlcMode, rbType;
-  RLC_Config_t *f1RlcCfg = NULLP;
-  LogicalChannelConfig_t *macUlLcCfg = NULLP;
+   if(lcCfg->snssai)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
+   }
+   if(lcCfg->drbQos)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
+   }
+}
 
-  for(idx = 0; idx < lcCfg->list.count; idx++)
-  {
-     lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
-     if(lcCfg->list.array[idx]->servedRadioBearer)
-     {
-        /* RadioBearer for SRB/DRB */
-        if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
-        RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
-        {
-           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
-           rbType = RB_TYPE_SRB;
-        }
-        else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
-        RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
-        {
-           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
-           rbType = RB_TYPE_DRB;
-        }
-        else
-        {
-           DU_LOG("\n No components present in Bearer config to ADD/MOD");
-           return RFAILED;
-        }
-        /* MAC UL LC Config */
-        if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
-        {
-           macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
-        }
-     }
-     else
-     {
-        DU_LOG("\nDUAPP: Received RadioBearer config is NULL");
-        return RFAILED;
-     }
-     /* RLC Mode Config */
-     if(lcCfg->list.array[idx]->rlc_Config)
-     {
-        rlcMode  = lcCfg->list.array[idx]->rlc_Config->present;
-        f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
-     }
-     
-     /* Filling RLC/MAC Config*/
-     memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
-     memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
-     procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]));
-     ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]);
-     if(ret == RFAILED)
-     {
-        DU_LOG("\nDUAPP: Failed while filling MAC LC config at extractRlcCfgToAddMod()");
-        return ret;
-     }
-     (ueCfgDb->numRlcLcs)++;
-     (ueCfgDb->numMacLcs)++;
-  }
-  //TODO: To send the failure cause in UeContextSetupRsp 
-  return ret;
+/******************************************************************
+*
+* @brief Function to delete the RLC Lc cfg from UE APP DB
+*
+* @details
+*
+*  Function : freeRlcLcCfg
+*
+*  Functionality: Function to delete the RLC Lc cfg from UE APP DB
+*
+*
+ *****************************************************************/
+
+void freeRlcLcCfg(RlcBearerCfg *lcCfg)
+{
+   switch(lcCfg->rlcMode)
+   {
+      case RLC_AM :
+         {
+            if(lcCfg->u.amCfg)
+            {
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
+            }
+            break;
+         }
+      case RLC_UM_BI_DIRECTIONAL :
+         {
+            if(lcCfg->u.umBiDirCfg)
+            {
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+            }
+            break;
+         }
+      case RLC_UM_UNI_DIRECTIONAL_UL :
+         {
+            if(lcCfg->u.umUniDirUlCfg)
+            {
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+            }
+            break;
+
+         }
+      case RLC_UM_UNI_DIRECTIONAL_DL :
+         {
+            if(lcCfg->u.umUniDirDlCfg)
+            {
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+            }
+            break;
+         }
+      default:
+         DU_LOG("\nERROR  -->  DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
+         break;
+   }
+   DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
 }
 
 /*******************************************************************
  *
- * @brief DeAlloc pdsch serv cell config info
+ * @brief Function to free MacLcCfg
  *
  * @details
  *
- *    Function : freeMacPdschServCellInfo
+ *    Function : freeMacLcCfg
  *
- *    Functionality: DeAlloc pdsch serv cell config info
+ *    Functionality: Function to free MacLcCfg
  *
- * @params[in] PdschServCellCfg pointer
+ * @params[in] LcCfg *lcCfg,
  * @return void
  *
  * ****************************************************************/
 
-void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
+void  freeMacLcCfg(LcCfg *lcCfg)
 {
-   if(pdsch->xOverhead)
-   {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t));
-   }
-   if(pdsch->codeBlkGrpFlushInd)
-   {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
-   }
-   if(pdsch->maxCodeBlkGrpPerTb)
+    /* Deleting DRBQOS */
+   if(lcCfg->drbQos)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
    }
-   if(pdsch->maxMimoLayers)
+   /* Deleting SNSSAI */
+   if(lcCfg->snssai)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
    }
 }
-
 /*******************************************************************
  *
- * @brief Free Serving cell Info
+ * @brief Free UE NR Capability received in UE Context setup request
  *
  * @details
  *
- *    Function : freeMacServingCellInfo
+ *    Function : freeAperDecodeUeNrCapability
  *
- *    Functionality: Free Serving cell Info
+ *    Functionality:  
+ *       Free UE NR Capability received in UE Context setup request
  *
- * @params[in] ServCellCfgInfo *srvCellCfg
- * @return void
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
+void freeAperDecodeUeNrCapability(void *ueNrCapability)
 {
-   freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
-   if(srvCellCfg->bwpInactivityTmr)
+   uint8_t arrIdx =0;
+   FeatureSets_t *featureSets =NULLP;
+   UE_NR_Capability_t *ueNrCap = (UE_NR_Capability_t *)ueNrCapability;
+
+   if(ueNrCap->rf_Parameters.supportedBandListNR.list.array)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
+      for(arrIdx = 0; arrIdx < ueNrCap->rf_Parameters.supportedBandListNR.list.count; arrIdx++)
+      {
+         if(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx])
+            free(ueNrCap->rf_Parameters.supportedBandListNR.list.array[arrIdx]);
+      }
+      free(ueNrCap->rf_Parameters.supportedBandListNR.list.array);
    }
+
+   if(ueNrCap->featureSets)
+   {
+      featureSets = ueNrCap->featureSets;
+      if(featureSets->featureSetsDownlinkPerCC)
+      {
+         if(featureSets->featureSetsDownlinkPerCC->list.array)
+         {
+            for(arrIdx = 0; arrIdx < featureSets->featureSetsDownlinkPerCC->list.count; arrIdx++)
+            {
+               if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx])
+               {
+                  if(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL)
+                     free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]->supportedModulationOrderDL);
+                  free(featureSets->featureSetsDownlinkPerCC->list.array[arrIdx]);
+               }
+            }
+            free(featureSets->featureSetsDownlinkPerCC->list.array);
+         }
+         free(featureSets->featureSetsDownlinkPerCC);
+      }
+      if(featureSets->featureSetsUplinkPerCC)
+      {
+         if(featureSets->featureSetsUplinkPerCC->list.array)
+         {
+            for(arrIdx = 0; arrIdx < featureSets->featureSetsUplinkPerCC->list.count; arrIdx++)
+            {
+               if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx])
+               {
+                  if(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL)
+                     free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]->supportedModulationOrderUL);
+                  free(featureSets->featureSetsUplinkPerCC->list.array[arrIdx]);
+               }
+            }
+            free(featureSets->featureSetsUplinkPerCC->list.array);
+         }
+         free(featureSets->featureSetsUplinkPerCC);
+      }
+      free(ueNrCap->featureSets);
+   }   
 }
 
 /*******************************************************************
- *
- * @brief Free cell Grp Cfg Info
- *
- * @details
- *
- *    Function : freeUeReCfgCellGrpInfo
- *
- *    Functionality: Free cell Grp Cfg Info
- *
- * @params[in] MacUeCfg*  duUeCfg
- * @return void
- *
- * ****************************************************************/
+*
+* @brief Function to free PdcchSearchSpcToAddModList
+         where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodePdcchSearchSpcToAddModList 
+*
+*    Functionality: Function to free PdcchSearchSpcToAddModList
+*
+* @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+* @return void
+*
+* ****************************************************************/
 
-void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg)
+void freeAperDecodePdcchSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
 {
-   freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
-}
+   uint8_t searchSpcArrIdx=0;
+   uint8_t searchSpcArrIdx1=0;
+   struct  SearchSpace *searchSpc=NULLP;
 
-/*******************************************************************
- *
- * @brief Fills Reconfig SchReqReConfig
- *
- * @details
- *
- *    Function : extractSchReqReConfig
- *
- *    Functionality: Fills Reconfig SchReqReConfig
- *
- * @params[in] SchedulingRequestConfig_t *cuSchedReq
- *             SchedReqCfg*  macSchedReq
- * @return void
- *
- * ****************************************************************/
-void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
-{
-   uint8_t schReqIdx = 0;
-   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
-   struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
 
-   if(cuSchedReq->schedulingRequestToAddModList)
+   if(searchSpcList->list.array)
    {
-      schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
-      if(schReqListToAdd->list.count)
+      if(searchSpcList->list.array[searchSpcArrIdx1])
       {
-        macSchedReq->addModListCount = schReqListToAdd->list.count;
-        for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
+        searchSpc = searchSpcList->list.array[searchSpcArrIdx1];
+        if(searchSpc->controlResourceSetId)
         {
-           macSchedReq->addModList[schReqIdx].schedReqId = \
-              schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
-           macSchedReq->addModList[schReqIdx].srProhibitTmr = \
-              *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
-           macSchedReq->addModList[schReqIdx].srTransMax    =\
-              schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
+           if(searchSpc->monitoringSlotPeriodicityAndOffset)
+           {
+              if(searchSpc->monitoringSymbolsWithinSlot)
+              {
+                 if(searchSpc->monitoringSymbolsWithinSlot->buf)
+                 {
+                    if(searchSpc->nrofCandidates)
+                    {
+                       if(searchSpc->searchSpaceType)
+                       {
+                          free(searchSpc->searchSpaceType->choice.ue_Specific);
+                          free(searchSpc->searchSpaceType);
+                       }
+                       free(searchSpc->nrofCandidates);
+                    }
+                    free(searchSpc->monitoringSymbolsWithinSlot->buf);
+                 }
+                 free(searchSpc->monitoringSymbolsWithinSlot);
+              }
+              free(searchSpc->monitoringSlotPeriodicityAndOffset);
+           }
+           free(searchSpc->controlResourceSetId);
         }
       }
-   }
-   /* Scheduling Req To release */
-   if(cuSchedReq->schedulingRequestToReleaseList)
-   {
-      schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
-      if(schReqListToRel->list.count)
+      for(searchSpcArrIdx = 0; searchSpcArrIdx < searchSpcList->list.count; searchSpcArrIdx++)
       {
-        macSchedReq->relListCount = schReqListToRel->list.count;
-        for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
-        {
-           macSchedReq->relList[schReqIdx] = \
-              *schReqListToRel->list.array[schReqIdx];
-        }
+        free(searchSpcList->list.array[searchSpcArrIdx]);
       }
+      free(searchSpcList->list.array);
    }
 }
-
 /*******************************************************************
- *
- * @brief Fills TagReconfig
- *
- * @details
- *
- *    Function : extractTagReconfig
- *
- *    Functionality: Fills extractTagReconfig
- *
- * @params[in] TAG_Config_t *cuTagCfg
- *             TagCfg *macTagCfg
- * @return void
- *
- * ****************************************************************/
+*
+* @brief Function for free part for the memory allocated by aper_decoder
+* 
+* @details
+*
+*    Function : freeAperDecodeBWPDlDedPdcchConfig
+*
+*    Functionality: Function to free BWPDlDedPdcchConfig
+*
+* @params[in] 
+* @return void
+*
+* ****************************************************************/
 
-void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
+
+void freeAperDecodeBWPDlDedPdcchConfig(BWP_DownlinkDedicated_t *dlBwp)
 {
-  uint8_t tagIdx = 0;
-  struct TAG_Config__tag_ToAddModList  *tagListToAddMod = NULLP;
-  struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
-
-  /* Tag config to AddMod */
-  if(cuTagCfg->tag_ToAddModList)
-  {
-     tagListToAddMod = cuTagCfg->tag_ToAddModList; 
-     if(tagListToAddMod->list.count)
-     {
-        macTagCfg->addModListCount = tagListToAddMod->list.count;
-        for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
-       {
-           macTagCfg->addModList[tagIdx].tagId =\
-              tagListToAddMod->list.array[tagIdx]->tag_Id;     
-           macTagCfg->addModList[tagIdx].timeAlignTimer = \
-
-              tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
-       }
-     }
-  }
-  /* Tag config to release */
-  if(cuTagCfg->tag_ToReleaseList)
-  {
-     tagListToRel = cuTagCfg->tag_ToReleaseList;
-     if(tagListToRel->list.count)
-     {
-        macTagCfg->relListCount = tagListToRel->list.count;
-        for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
-       {
-           macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];     
-       }
-     }
-  }
-}
-
-/*******************************************************************
- *
- * @brief Fills PdcchCfg received by CU
- *
- * @details
- *
- *    Function : extractPdcchCfg
- *
- *    Functionality: Fills PdcchCfg received  by CU
- *
- * @params[in] PDCCH_Config_t *cuPdcchCfg,
- *             PdcchConfig *duPdcchCfg
- * @return void
- *
- * ****************************************************************/
-
-void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
-{
-   uint8_t cRsetIdx = 0;
-   uint8_t srchSpcIdx = 0;
-
-   struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
-   struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
-   struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
-   struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
-
-
-   /* Control Resource Set To Add/Mod List */
-   if(cuPdcchCfg->controlResourceSetToAddModList)
+   uint8_t arrIdx1=0;
+   uint8_t arrIdx2=0;
+   struct PDCCH_Config *pdcchCfg=NULLP;
+   struct ControlResourceSet *controlRSet=NULLP;
+   struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
+   
+   if(dlBwp->pdcch_Config->choice.setup)
    {
-      cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
-      if(cRsetToAddModList->list.count)
+      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
+      if(pdcchCfg->controlResourceSetToAddModList)
       {
-         macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
-        for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
+        controlRSetList = pdcchCfg->controlResourceSetToAddModList;
+        if(controlRSetList->list.array)
         {
-           macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
-             cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
-           bitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
-              macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
-            macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
-             cRsetToAddModList->list.array[cRsetIdx]->duration;
-
-           macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
-             cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;   
-            if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
+           controlRSet = controlRSetList->list.array[arrIdx2];
+           if(controlRSet)
            {
-              //TODO: handle the case for Interleaved
-            }
-            macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
-             cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
-           if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
+              if(controlRSet->frequencyDomainResources.buf)
+              {
+                 if(controlRSet->pdcch_DMRS_ScramblingID)
+                 {
+                    if(pdcchCfg->searchSpacesToAddModList)
+                    {
+                       freeAperDecodePdcchSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
+                       free(pdcchCfg->searchSpacesToAddModList);
+                    }
+                    free(controlRSet->pdcch_DMRS_ScramblingID);
+                 }
+                 free(controlRSet->frequencyDomainResources.buf);
+              }
+           }
+           for(arrIdx1 = 0; arrIdx1 <controlRSetList->list.count; arrIdx1++)
            {
-              macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
-                 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
+              free(controlRSetList->list.array[arrIdx1]);
            }
-         }
+           free(controlRSetList->list.array);
+        }
+        free(pdcchCfg->controlResourceSetToAddModList);
       }
-
+      free(dlBwp->pdcch_Config->choice.setup);
    }
-   /* Control Resource Set To Release List */
-   if(cuPdcchCfg->controlResourceSetToReleaseList)
+}
+/*******************************************************************
+*
+* @brief Function to free PdschTimeDomAllocationList 
+*     where the memory allocated by aper_decoder
+* 
+* @details
+*
+*    Function : freeAperDecodePdschTimeDomAllocationList
+*
+*    Functionality: Function to free PdschTimeDomAllocationList
+*
+* @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList 
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodePdschTimeDomAllocationList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
+{
+   uint8_t arrIdx=0;
+
+   if(timeDomAllocList->choice.setup)
    {
-      cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
-      if(cRsetToRelList->list.count)
+      if(timeDomAllocList->choice.setup->list.array)
       {
-         macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
-        for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
+        for(arrIdx = 0; arrIdx <timeDomAllocList->choice.setup->list.count ; arrIdx++)
         {
-            macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
+           free(timeDomAllocList->choice.setup->list.array[arrIdx]);
         }
+        free(timeDomAllocList->choice.setup->list.array);
       }
+      free(timeDomAllocList->choice.setup);
    }
+}
 
-   /* Search space To Add/Mod List */
-   if(cuPdcchCfg->searchSpacesToAddModList)
+/*******************************************************************
+*
+* @brief Function to free BWPDlDedPdschConfig 
+*        where the memory allocated by aper_decoder
+*  
+* @details
+*
+*    Function : freeAperDecodeBWPDlDedPdschConfig 
+*
+*    Functionality: Function to free BWPDlDedPdschConfig 
+*
+* @params[in] BWP_DownlinkDedicated_t *dlBwp 
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeBWPDlDedPdschConfig(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)
    {
-      srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
-      if(srchSpcToAddModList->list.count)
+      pdschCfg=dlBwp->pdsch_Config->choice.setup;
+      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
       {
-         macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
-        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
+        if(pdschCfg->pdsch_TimeDomainAllocationList)
         {
-            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
-              srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
-            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
-              *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
-           if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
-           {
-               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
-                 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
-            }
-            if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
-            {
-              bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
-                 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
-            }
-           if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
-            {
-             macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
-                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
-              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
-                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
-              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
-                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
-              
-              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
-                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
-              
-              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
-                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
-           }
-            if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
+           timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
+           if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
            {
-              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
-                 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
-              if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
-              {
-                 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
-                    srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
-              }
-         
+              prbBndlType=&pdschCfg->prb_BundlingType;
+              free(prbBndlType->choice.staticBundling);
+              free(pdschCfg->maxNrofCodeWordsScheduledByDCI);
            }
+           freeAperDecodePdschTimeDomAllocationList(timeDomAllocList);
+           free(pdschCfg->pdsch_TimeDomainAllocationList);
         }
-      }
-   }
-   /* Search space To Rel List */
-   if(cuPdcchCfg->searchSpacesToReleaseList)
-   {
-      srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
-      if(srchSpcToRelList->list.count)
-      {
-         macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
-        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
+        dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
+        if(dmrsDlCfg->choice.setup)
         {
-            macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
-              *(srchSpcToRelList->list.array[srchSpcIdx]);
+           free(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition);
+           free(dmrsDlCfg->choice.setup);
         }
+        free(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA);
       }
+      free(dlBwp->pdsch_Config->choice.setup);
    }
 }
-
 /*******************************************************************
- *
- * @brief Fills PdschCfg received by CU
- *
- * @details
- *
- *    Function : extractPdschCfg
- *
- *    Functionality: Fills PdschCfg received  by CU
- *
- * @params[in] PDSCH_Config_t *cuPdschCfg,
- *             PdschConfig *macPdschCfg
- * @return void
- *
- * ****************************************************************/
+*
+* @brief Function to free PuschTimeDomAllocListCfg
+                 where the memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodePuschTimeDomAllocListCfg
+*
+*    Functionality: Function to free PuschTimeDomAllocListCfg
+*
+* @params[in] PUSCH_Config_t *puschCfg 
+* @return void
+*
+* ****************************************************************/
 
-void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg)
+
+void freeAperDecodePuschTimeDomAllocListCfg(PUSCH_Config_t *puschCfg)
 {
-   uint8_t timeDomIdx;
-   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
+   uint8_t arrIdx=0;
+   uint8_t arrIdx1=0;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
 
-   if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+   if(puschCfg->pusch_TimeDomainAllocationList)
    {
-      if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
-         PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
+      timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
+      if(timeDomAllocList_t->choice.setup)
       {
-         if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
+        if(timeDomAllocList_t->choice.setup->list.array)
         {
-            macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
-              *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
+           free(timeDomAllocList_t->choice.setup->list.array[arrIdx1]->k2);
+           for(arrIdx = 0; arrIdx<timeDomAllocList_t->choice.setup->list.count; arrIdx++)
+           {
+              free(timeDomAllocList_t->choice.setup->list.array[arrIdx]);
+           }
+           free(timeDomAllocList_t->choice.setup->list.array);
         }
+        free(timeDomAllocList_t->choice.setup);
       }
+      free(puschCfg->transformPrecoder);
+      free(puschCfg->pusch_TimeDomainAllocationList);
    }
-   macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
-   if(cuPdschCfg->pdsch_TimeDomainAllocationList)
+}
+/*******************************************************************
+*
+* @brief Function to free InitialUlBWPConfig where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodeInitialUlBWPConfig 
+*
+*    Functionality: Function to free InitialUlBWPConfig
+*
+* @params[in]  BWP_UplinkDedicated_t *ulBwp
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeInitialUlBWPConfig(BWP_UplinkDedicated_t *ulBwp)
+{
+   uint8_t  rSetIdx =0;
+   uint8_t  rsrcIdx =0;
+   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;
+
+   if(ulBwp->pusch_Config)
    {
-      timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
-      if(timeDomAlloc->present ==\
-         PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
+      if(ulBwp->pusch_Config->choice.setup)
       {
-         if(timeDomAlloc->choice.setup)
+        puschCfg=ulBwp->pusch_Config->choice.setup;
+        if(puschCfg->dataScramblingIdentityPUSCH)
         {
-           macPdschCfg->numTimeDomRsrcAlloc  = timeDomAlloc->choice.setup->list.count;
-            for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
-            {
-              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
-                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
-              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
-                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+           if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+           {
+              freeAperDecodePuschTimeDomAllocListCfg(puschCfg);
+              dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+              if(dmrsUlCfg->choice.setup)
+              {
+                 if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+                 {
+                    if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+                    {
+                       free(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0);
+                       free(dmrsUlCfg->choice.setup->transformPrecodingDisabled);
+                    }
+                    free(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition);
+                 }
+                 free(dmrsUlCfg->choice.setup);
+              }
+              free(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA);
            }
+           free(puschCfg->dataScramblingIdentityPUSCH);
         }
+        free(ulBwp->pusch_Config->choice.setup);
       }
-   }
-   macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
-   if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
-      macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
-   if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
-   {
-      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
-      if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
+      free(ulBwp->pusch_Config);
+
+      /* Free SRS-Config */
+      if(ulBwp->srs_Config)
       {
-         if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
+        if(ulBwp->srs_Config->choice.setup)
         {
-            macPdschCfg->bundlingInfo.StaticBundling.size = \
-              *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
+           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++)
+                       {
+                          free(rsrcIdList->list.array[rsrcIdx]);
+                       }
+                       free(rsrcIdList->list.array);
+                    }
+                    free(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList);
+                 }
+
+                 /* Free resource type info for this SRS resource set */
+
+                 free(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic);
+
+                 /* Free memory for each resource set */
+                 for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+                 {
+                    free(rsrcSetList->list.array[rSetIdx]);
+                 }
+                 free(rsrcSetList->list.array);
+              }
+              free(srsCfg->srs_ResourceSetToAddModList);
+           }
+
+           /* Free resource to add/modd list */
+           if(srsCfg->srs_ResourceToAddModList)
+           {
+              resourceList = srsCfg->srs_ResourceToAddModList;
+              if(resourceList->list.array)
+              {
+                 rsrcIdx = 0;
+
+                 free(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2);
+                 free(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic);
+
+                 for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+                 {
+                    free(resourceList->list.array[rsrcIdx]);
+                 }
+                 free(resourceList->list.array);
+              }
+              free(srsCfg->srs_ResourceToAddModList);
+           }
+
+           free(ulBwp->srs_Config->choice.setup);
         }
+        free(ulBwp->srs_Config);
       }
    }
-   else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
+}
+/*******************************************************************
+*
+* @brief Function to free initialUplinkBWPConfig where memory allocated by aper_decoder
+*
+* @details
+*
+*    Function : freeAperDecodeinitialUplinkBWPConfig
+*
+*    Functionality: Function to free initialUplinkBWPConfig
+*
+* @params[in] UplinkConfig_t *ulCfg 
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeinitialUplinkBWPConfig(UplinkConfig_t *ulCfg)
+{
+   BWP_UplinkDedicated_t *ulBwp=NULLP;
+   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+   
+   if(ulCfg->initialUplinkBWP)
    {
-      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
+      ulBwp=ulCfg->initialUplinkBWP;
+      if(ulCfg->firstActiveUplinkBWP_Id)
+      {
+        if(ulCfg->pusch_ServingCellConfig)
+        {
+           puschCfg=ulCfg->pusch_ServingCellConfig;
+           if(puschCfg->choice.setup)
+           {
+              if(puschCfg->choice.setup->ext1)
+              {
+                 free(puschCfg->choice.setup->ext1->processingType2Enabled);
+                 free(puschCfg->choice.setup->ext1->maxMIMO_Layers);
+                 free(puschCfg->choice.setup->ext1);
+              }
+              free(puschCfg->choice.setup);
+           }
+           free(ulCfg->pusch_ServingCellConfig);
+        }
+        free(ulCfg->firstActiveUplinkBWP_Id);
+      }
+      freeAperDecodeInitialUlBWPConfig(ulBwp);
+      free(ulCfg->initialUplinkBWP);
    }
-
 }
 
 /*******************************************************************
  *
- * @brief Fills PdschServingCellCfg received by CU
+ * @brief Function to free DuUeCfg
  *
  * @details
  *
- *    Function : extractPdschServingCellCfg
+ *    Function : freeDuUeCfg
  *
- *    Functionality: Fills PdschCfg received  by CU
+ *    Functionality: Function to free DuUeCfg
  *
- * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
- *             PdschServCellCfg *macUePdschSrvCellCfg
- * @return ROK/RFAILED
+ * @params[in] DuUeCfg *ueCfg
+ * @return void
  *
  * ****************************************************************/
-
-uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
+void freeDuUeCfg(DuUeCfg *ueCfg)
 {
-   if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
+   uint8_t lcIdx = 0;
+   uint8_t arrIdx = 0;
+   SpCellConfig_t *spCellCfg = NULLP;
+   ServingCellConfig_t *srvCellCfg = NULLP;
+   BWP_DownlinkDedicated_t *dlBwp = NULLP;
+   MAC_CellGroupConfig_t *macCellGrpCfg = NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
+   struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList = NULLP;
+   struct RLC_Config *rlcConfig = NULLP;
+   struct LogicalChannelConfig *macLcConfig = NULLP;
+   struct SchedulingRequestConfig *schedulingRequestConfig = NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList = NULLP;
+   struct TAG_Config *tagConfig = NULLP;
+   struct TAG_Config__tag_ToAddModList *tagList = NULLP;
+   struct MAC_CellGroupConfig__phr_Config *phrConfig = NULLP;
+   struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg = NULLP;
+   CellGroupConfigRrc_t *cellGrpCfg = ueCfg->cellGrpCfg;
+  
+   if(ueCfg->ueNrCapability)
    {
-      if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
+      freeAperDecodeUeNrCapability(ueCfg->ueNrCapability);
+      DU_FREE(ueCfg->ueNrCapability, sizeof(UE_NR_Capability_t));
+      ueCfg->ueNrCapability = NULLP;
+   }
+
+   if(ueCfg->cellGrpCfg)
+   {
+      
+      rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
+      if(rlcBearerList)
       {
-         if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
-         {
-            *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
-              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
-        }
-        else
+        if(rlcBearerList->list.array)
         {
-            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t));
-            if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
+           for(arrIdx=0; arrIdx<rlcBearerList->list.count; arrIdx++)
            {
-               *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
-                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
+              if(rlcBearerList->list.array[arrIdx])
+              {
+                 rlcConfig   = rlcBearerList->list.array[arrIdx]->rlc_Config;
+                 macLcConfig = rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig;
+                 
+                 if(rlcBearerList->list.array[arrIdx]->servedRadioBearer)
+                 {
+                    free(rlcBearerList->list.array[arrIdx]->servedRadioBearer);
+                 }
+                 if(rlcConfig)
+                 {
+                    if(rlcConfig->choice.am)
+                    {
+                       free(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength);
+                       free(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength);
+                       free(rlcConfig->choice.am);
+                    }
+                    free(rlcBearerList->list.array[arrIdx]->rlc_Config);
+                 }
+                 if(macLcConfig)
+                 {
+                    if(macLcConfig->ul_SpecificParameters)
+                    {
+                       free(macLcConfig->ul_SpecificParameters->schedulingRequestID);
+                       free(macLcConfig->ul_SpecificParameters->logicalChannelGroup);
+                       free(macLcConfig->ul_SpecificParameters);
+                    }
+                    free(rlcBearerList->list.array[arrIdx]->mac_LogicalChannelConfig);
+                 }
+                 free(rlcBearerList->list.array[arrIdx]); 
+              }
            }
-           else
+           free(rlcBearerList->list.array);
+        }
+        free(cellGrpCfg->rlc_BearerToAddModList);
+      }
+
+      macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
+      if(macCellGrpCfg)
+      {
+        schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig;
+        if(schedulingRequestConfig)
+        {
+           schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+           if(schReqList)
            {
-              DU_LOG("\nDUAPP: Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
-              return RFAILED;
+              if(schReqList->list.array)
+              {
+                 for(arrIdx=0;arrIdx<schReqList->list.count; arrIdx++)
+                 {
+                    if(schReqList->list.array[arrIdx])
+                    {
+                       free(schReqList->list.array[arrIdx]->sr_ProhibitTimer); 
+                       free(schReqList->list.array[arrIdx]);
+                    }
+                 }
+                 free(schReqList->list.array);
+              }
+              free(schedulingRequestConfig->schedulingRequestToAddModList);
            }
+           free(macCellGrpCfg->schedulingRequestConfig);
         }
-         if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
-         {
-            *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
-              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+        if(macCellGrpCfg->bsr_Config)
+        {
+           free(macCellGrpCfg->bsr_Config);
         }
-        else
+        tagConfig = macCellGrpCfg->tag_Config;
+        if(tagConfig)
         {
-            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool));
-            if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
+           tagList = tagConfig->tag_ToAddModList;
+           if(tagList)
            {
-               *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
-                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+              if(tagList->list.array)
+              {
+                 for(arrIdx=0; arrIdx<tagList->list.count; arrIdx++)
+                 {
+                    free(tagList->list.array[arrIdx]);
+                 }
+                 free(tagList->list.array);
+              }
+              free(tagConfig->tag_ToAddModList);
            }
-           else
+           free(tagConfig); 
+        }
+
+        phrConfig = macCellGrpCfg->phr_Config;
+        if(phrConfig)
+        {
+           free(phrConfig->choice.setup); 
+           free(phrConfig); 
+        }
+
+        free(macCellGrpCfg); 
+      }
+
+      phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
+      if(phyCellGrpCfg)
+      {
+        free(phyCellGrpCfg->p_NR_FR1);
+        free(phyCellGrpCfg); 
+      }
+
+      spCellCfg = cellGrpCfg->spCellConfig;
+      if(spCellCfg)
+      {
+        if(spCellCfg->servCellIndex)
+        {
+           if(spCellCfg->rlmInSyncOutOfSyncThreshold)
            {
-              DU_LOG("\nDUAPP: Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
-              return RFAILED;
+              if(spCellCfg->spCellConfigDedicated)
+              {
+                 srvCellCfg = spCellCfg->spCellConfigDedicated;
+                 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)
+                                {
+
+                                   free(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH);
+                                   free(pdschCfg->choice.setup);
+                                }
+
+                                free(srvCellCfg->pdsch_ServingCellConfig);
+                             }
+
+                             freeAperDecodeinitialUplinkBWPConfig(srvCellCfg->uplinkConfig);
+                             free(srvCellCfg->uplinkConfig);
+                          }
+                          free(srvCellCfg->defaultDownlinkBWP_Id);
+                       }
+
+                       free(srvCellCfg->firstActiveDownlinkBWP_Id);
+                    }
+                    if(dlBwp->pdcch_Config)
+                    {
+                       if(dlBwp->pdsch_Config)
+                       {
+                          freeAperDecodeBWPDlDedPdschConfig(dlBwp);
+                          free(dlBwp->pdsch_Config);
+                       }
+                       freeAperDecodeBWPDlDedPdcchConfig(dlBwp);
+                       free(dlBwp->pdcch_Config);
+                    }
+                    free(srvCellCfg->initialDownlinkBWP);
+                 }
+
+                 free(spCellCfg->spCellConfigDedicated);
+              }
+              free(spCellCfg->rlmInSyncOutOfSyncThreshold);
            }
+           free(spCellCfg->servCellIndex); 
         }
+        free(spCellCfg);
       }
+      DU_FREE(ueCfg->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
+      ueCfg->cellGrpCfg = NULLP;
    }
-   if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
+   if(ueCfg->ambrCfg)
    {
-      macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH); 
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->ambrCfg, sizeof(AmbrCfg));
    }
-   if(cuPdschSrvCellCfg->ext1)
+   for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
    {
-      if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
-      {
-        if(macUePdschSrvCellCfg->maxMimoLayers)
-       {
-           *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
-       }
-       else
-       {
-           DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
-           if(macUePdschSrvCellCfg->maxMimoLayers)
-          {
-              *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
-          }
-          else
-          {
-             DU_LOG("\nDUAPP: Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
-             return RFAILED;
-          }
-       }
-      }
+      freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
    }
-   if(cuPdschSrvCellCfg->xOverhead)
+   for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
    {
-      if(macUePdschSrvCellCfg->xOverhead)
-      {
-         *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
-      }
-      else
-      {
-         DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t));
-         if(macUePdschSrvCellCfg->xOverhead)
-         {
-            *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
-         }
-         else
-         {
-            DU_LOG("\nDUAPP: Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
-           return RFAILED;
-         }
-      }
+      freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
+   }
+   for(lcIdx = 0; lcIdx < ueCfg->numDrb; lcIdx++)
+   {
+      DU_FREE(ueCfg->upTnlInfo[lcIdx].tnlCfg1, sizeof(GtpTnlCfg));
    }
-   return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Fills PuschCfg received by CU
+ * @brief Function to free UecontextSetupDb
  *
  * @details
  *
- *    Function : extractPuschCfg
+ *    Function : freeF1UeDb
  *
- *    Functionality: Fills PuschCfg received  by CU
+ *    Functionality: Function to free UecontextSetupDb
  *
- * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
- *             PuschCfg *macPuschCfg
+ * @params[in] UecontextSetupDb *
  * @return void
  *
  * ****************************************************************/
 
-void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
+void freeF1UeDb(F1UeContextSetupDb *f1UeDb)
 {
-   uint8_t timeDomIdx = 0;
-   DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
-   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
-
-   if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
+   
+   if(f1UeDb->dlRrcMsg)
    {
-      if(cuPuschCfg->choice.setup)
+      if(f1UeDb->dlRrcMsg->rrcMsgPdu)
       {
-         if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
-        {
-             macPuschCfg->dataScramblingId = \
-               *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
-        }
-        if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
-        {
-           if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
-           {
-              if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
-              {
-                 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
-                 if(dmrsUlCfg->dmrs_AdditionalPosition)
-                 {
-                     macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
-                       *(dmrsUlCfg->dmrs_AdditionalPosition);
-                 }
-                  if(dmrsUlCfg->transformPrecodingDisabled)
-                 {
-                    if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
-                    {
-                       macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
-                          *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
-                     }
-                 }
-              }
-           }
-        }
-        /*Res Alloc Type for UL */
-        if(cuPuschCfg->choice.setup->resourceAllocation)
-        {
-            macPuschCfg->resourceAllocType = \
-              cuPuschCfg->choice.setup->resourceAllocation;
-        }
-        if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
-        {
-           timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
-           if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
-           {
-               if(timeDomAllocList->choice.setup)
-              {
-                 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
-                 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
-                 {
-                    macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
-                       *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
-                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
-                        timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
-                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
-                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
-                  }
-              }
-           }
-        }
-        if(cuPuschCfg->choice.setup->transformPrecoder)
-            macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
+        //DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,\
+              f1UeDb->dlRrcMsg->rrcMsgPdu, f1UeDb->dlRrcMsg->rrcMsgSize);
       }
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
    }
+   freeDuUeCfg(&f1UeDb->duUeCfg);
+   memset(f1UeDb, 0, sizeof(F1UeContextSetupDb));
+   DU_FREE(f1UeDb, sizeof(F1UeContextSetupDb));
 }
 
 /*******************************************************************
  *
- * @brief Function to fill pucch Power Control
+ * @brief Function to build Am cfg Info
  *
  * @details
  *
- *    Function : extractPucchPowerControl
+ *    Function : extractRlcAmCfg
  *
- *    Functionality: Function to fill pucch Power Control
+ *    Functionality: Function to build Am cfg Info
  *
- * @params[in] PucchPowerControl *pwrCtrl,
- *             struct PUCCH_PowerControl *cuPwrCtrlCfg
- * @return void
+ * @params[in] AmBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
  *
  * ****************************************************************/
 
-void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
+void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
 {
-   uint8_t arrIdx;
-
-   if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
-      pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
-   if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
-      pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
-   if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
-      pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
-   if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
-      pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
-   if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
-      pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
-   if(cuPwrCtrlCfg->p0_Set)
+   if(rlcAmCfg)
    {
-      pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
-      for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
+      /* UL AM */
+      if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
       {
-         pwrCtrl->p0Set[arrIdx].p0PucchId =\
-           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
-         pwrCtrl->p0Set[arrIdx].p0PucchVal =\
-           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
+        amCfgToSet->ulAmCfg.snLenUl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->dl_AM_RLC.sn_FieldLength));
+         /*TODO: Check the timer value when sent by real CU */
+        amCfgToSet->ulAmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_Reassembly); 
+        amCfgToSet->ulAmCfg.statProhTmr = convertProhibitTmrEnumToValue(rlcAmCfg->dl_AM_RLC.t_StatusProhibit);
       }
-   }
-   if(cuPwrCtrlCfg->pathlossReferenceRSs)
-   {
-      pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
-      for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
+
+      /* DL AM */
+      if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
       {
-         pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
-           cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
+        amCfgToSet->dlAmCfg.snLenDl = covertAmSnLenFromRrcEnumToIntEnum(*(rlcAmCfg->ul_AM_RLC.sn_FieldLength));
+        amCfgToSet->dlAmCfg.pollRetxTmr = covertPollRetxTmrEnumToValue(rlcAmCfg->ul_AM_RLC.t_PollRetransmit);
+        amCfgToSet->dlAmCfg.pollPdu   = covertPollPduEnumToValue(rlcAmCfg->ul_AM_RLC.pollPDU);
+        amCfgToSet->dlAmCfg.pollByte  = covertPollByteEnumToValue(rlcAmCfg->ul_AM_RLC.pollByte);
+        amCfgToSet->dlAmCfg.maxRetxTh = covertMaxRetxEnumToValue(rlcAmCfg->ul_AM_RLC.maxRetxThreshold);
       }
    }
 }
- /*******************************************************************
+
+/*******************************************************************
  *
- * @brief Function to extractResrcSetToAddModList sent by CU
+ * @brief Function to build Um Bi Info
  *
  * @details
  *
- *    Function : extractResrcSetToAddModList
+ *    Function : extractRlcUmBiCfg
  *
- *    Functionality: Fucntion to extractResrcSetToAddModList
+ *    Functionality: Function to build Um Bi Info
  *
- * @params[in] PucchResrcSetCfg pointer,
- *             struct PUCCH_Config__resourceSetToAddModList pointer
- * @return void
+ * @params[in] UmBiDirBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
  *
  * ****************************************************************/
 
-void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
+void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
 {
-   uint8_t arrIdx, rsrcListIdx;
-
-   macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count; 
-   for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
+   if(rlcBiCfg)
    {
-      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId     =\
-         cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
-      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
-         cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
-      for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
+      /* UL UM BI DIR Cfg */
+      if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
       {
-         macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
-            *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
+        umBiCfgToSet->ulUmCfg.snLenUlUm  = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->dl_UM_RLC.sn_FieldLength));
+        umBiCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(rlcBiCfg->dl_UM_RLC.t_Reassembly);
       }
-      macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
-         *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
+
+      /* DL UM BI DIR Cfg */
+      if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
+        umBiCfgToSet->dlUmCfg.snLenDlUm  = covertUmSnLenFromRrcEnumToIntEnum(*(rlcBiCfg->ul_UM_RLC.sn_FieldLength));
    }
-}/* End of extractResrcSetToAddModList */
+}
 
 /*******************************************************************
  *
- * @brief Fills extractResrcToAddModList sent by CU
+ * @brief Function to build Um Ul Info
  *
  * @details
  *
- *    Function : extractResrcToAddModList
+ *    Function : extractRlcUmUlCfg
  *
- *    Functionality: Fills extractResrcToAddModList
+ *    Functionality: Function to build Um Ul Info
  *
- * @params[in] PucchResrcCfg pointer,
- *             struct PUCCH_Config__resourceToAddModList pointer
- * @return ROk/RFAILED
+ * @params[in] UmUniDirUlBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
  *
  * ****************************************************************/
 
-uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
+void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
 {
-   uint8_t arrIdx;
-   
-   macResrcList->resrcToAddModListCount = cuResrcList->list.count;
-   for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
+   if(umUlCfg)
    {
-      macResrcList->resrcToAddModList[arrIdx].resrcId      =\
-        cuResrcList->list.array[arrIdx]->pucch_ResourceId; 
-      macResrcList->resrcToAddModList[arrIdx].startPrb     =\
-        cuResrcList->list.array[arrIdx]->startingPRB;
-      if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
-      {
-         macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
-           *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
-      }
-      if(cuResrcList->list.array[arrIdx]->secondHopPRB)
+      if(umUlCfg->dl_UM_RLC.sn_FieldLength)
       {
-         macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
-           *cuResrcList->list.array[arrIdx]->secondHopPRB;
+         umUlCfgToSet->ulUmCfg.snLenUlUm  = covertUmSnLenFromRrcEnumToIntEnum(*(umUlCfg->dl_UM_RLC.sn_FieldLength));
+         umUlCfgToSet->ulUmCfg.reAssemTmr = convertReasmblTmrEnumToValue(umUlCfg->dl_UM_RLC.t_Reassembly);
       }
-      /* PUCCH RSRC FORMAT */
-      if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to build Um Uni Dl Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmDlCfg
+ *
+ *    Functionality: Function to build Um Uni Dl Info
+ *
+ * @params[in] UmUniDirDlBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
+{
+   if(umDlCfg)
+   {
+      if(umDlCfg->ul_UM_RLC.sn_FieldLength)
+         umDlCfgToSet->dlUmCfg.snLenDlUm  = covertUmSnLenFromRrcEnumToIntEnum(*(umDlCfg->ul_UM_RLC.sn_FieldLength));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extractRlcModeCfg
+ *
+ * @details
+ *
+ *    Function : extractRlcModeCfg
+ *
+ *    Functionality: Function to extractRlcModeCfg
+ *
+ * @params[in] RLC_Config_t *
+ *             RlcBearerCfg *
+ *             void  *    
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
+{
+   if(lcCfg)
+   {
+      switch(rlcMode)
       {
-         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
-         if(cuResrcList->list.array[arrIdx]->format.choice.format0)
-        {
-           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
-           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
-           {
-               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
-              return RFAILED;
-           }
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
-               cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
-               cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
-               cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
-        }
+         case RLC_AM :
+            {
+               if(lcCfg->choice.am)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
+                  if(rlcDbCfg->u.amCfg)
+                     extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
+               }
+               break;
+            }
+         case RLC_UM_BI_DIRECTIONAL :
+            {
+               if(lcCfg->choice.um_Bi_Directional)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+                  if(rlcDbCfg->u.umBiDirCfg)
+                     extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
+               }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_UL :
+            {
+               if(lcCfg->choice.um_Uni_Directional_DL)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+                  if(rlcDbCfg->u.umUniDirUlCfg)
+                     extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
+               }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_DL :
+            {
+               if(lcCfg->choice.um_Uni_Directional_UL)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+                  if(rlcDbCfg->u.umUniDirDlCfg)
+                     extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
+               }
+               break;
+            }
+         default:
+            DU_LOG("\nERROR  -->  DUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
+            break;
       }
-      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract extractUlLcCfg
+ *
+ * @details
+ *
+ *    Function : extractUlLcCfg
+ *
+ *    Functionality: Function to extract extractUlLcCfg
+ *
+ * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
+{
+   if(ulLcCfg)
+   {
+      if(ulLcCfg->ul_SpecificParameters)
       {
-         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
-         if(cuResrcList->list.array[arrIdx]->format.choice.format1)
-        {
-            DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
-           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
-           {
-               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
-              return RFAILED;
-           }
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
-                cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
-                cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
-                cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
-                cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
-        }
+         f1UlLcCfg->priority = \
+            ulLcCfg->ul_SpecificParameters->priority;
+      if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
+      {
+         f1UlLcCfg->lcGroup = \
+           *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
       }
-      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
+      if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
       {
-         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
-         if(cuResrcList->list.array[arrIdx]->format.choice.format2)
-        {
-           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
-           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
-           {
-               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
-              return RFAILED;
-           }
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
-                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
-                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
-                cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
-         }
+         f1UlLcCfg->schReqId = \
+           *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
       }
-      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
+      f1UlLcCfg->pbr = \
+         ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
+      f1UlLcCfg->bsd = \
+         ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
+      }
+   }
+}
+
+/*******************************************************************
+*
+* @brief Function to extract Snssai Cfg Info from CU
+*
+* @details
+*
+*    Function : extractDrbSnssaiCfg
+*
+*    Functionality: Function to extract Drb Snssai Cfg Info from CU
+*
+* @params[in] DRB_Information_t *drbInfo, Snssai  *snssai
+* @return ROK/RFAILED
+*
+* ****************************************************************/
+
+uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
+{
+   if(!(*snssaiToBeShared))
+   {
+      DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
+      if(snssaiToBeShared == NULLP)
       {
-         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
-         if(cuResrcList->list.array[arrIdx]->format.choice.format3)
-        {
-           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
-           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
-           {
-               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
-              return RFAILED;
-           }
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
-                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
-                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
-                cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
-         }
+         DU_LOG("\nERROR  -->  DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
+         return RFAILED;
       }
-      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
+   }
+   if(RecvSnssai)
+   {
+      memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
+      if(RecvSnssai->sD)
       {
-         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
-         if(cuResrcList->list.array[arrIdx]->format.choice.format4)
-         {
-           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
-           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
-           {
-               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
-              return RFAILED;
-           }
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
-                cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
-           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
-                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
-                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
-            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
-                cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
-        }
+         memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf,  RecvSnssai->sD->size);
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
+         return RFAILED;
       }
    }
    return ROK;
+}
 
-}/* End of extractResrcToAddModList */
+/*******************************************************************
+ *
+ * @brief Function to procRlcLcCfg
+ *
+ * @details
+ *
+ *    Function : procRlcLcCfg
+ *
+ *    Functionality: Function to procRlcLcCfg
+ *
+ * @params[in] rbId, lcId, rbType, rlcMod
+ *             RLC_Config_t *, RlcBearerCfg * , 
+ * @return void
+ *
+ * ****************************************************************/
+
+void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
+   uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
+{
+   DRB_Information_t *drbInfo;
+
+   lcCfg->rbId   = rbId;
+   lcCfg->configType = configType;
+
+   if(rbType == RB_TYPE_SRB)
+   {
+      lcCfg->rbType = RB_TYPE_SRB;
+      lcCfg->lcId   = rbId;
+      lcCfg->lcType = LCH_DCCH;
+      lcCfg->rlcMode = RLC_AM;
+   }
+   else if(rbType == RB_TYPE_DRB)
+   {
+      lcCfg->rbType = RB_TYPE_DRB;
+      lcCfg->lcId   = lcId;
+      lcCfg->lcType = LCH_DTCH;
+      lcCfg->rlcMode = rlcMode;
+   }
+   if(f1RlcCfg) /* rlc mode config recived */
+   {
+      extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
+   }
+   if(qoSInformation != NULLP)
+   {
+      if(qoSInformation->present == QoSInformation_PR_choice_extension)
+      {
+         if(qoSInformation->choice.choice_extension->value.present ==\
+               QoSInformation_ExtIEs__value_PR_DRB_Information)
+         {
+            drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information; 
+            if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->snssai) != ROK)
+            {
+               DU_LOG("\nERROR  -->  DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
+               return;
+            }
+         }
+      }
+   }
+}
 
 /*******************************************************************
  *
- * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
+ * @brief Fills DrbQos Info received by CU
  *
  * @details
  *
- *    Function : fillPucchSchedReqPeriodAndOffset
+ *    Function : extractQosInfo
  *
- *    Functionality: To fillPucchSchedReqPeriodAndOffset
+ *    Functionality: Fills DrbQos Info received  by CU
  *
- * @params[in] macPeriodicty,
- *     SchedulingRequestResourceConfig__periodicityAndOffset pointer
+ * @params[in] DrbQosInfo *qosToAdd, 
+ *             QoSFlowLevelQoSParameters_t *qosFlowCfg
  * @return void
  *
  * ****************************************************************/
 
-void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t  macOffset,\
-   struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
+void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
 {
-   macPeriodicty = cuPeriodicty->present;
-   switch(macPeriodicty)
+   uint8_t qosCntIdx = 0;
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+
+   qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
+   qosToAdd->u.nonDyn5Qi.fiveQi     =\
+                                     qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
+   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
    {
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
-        {
-           macOffset     = cuPeriodicty->choice.sym2;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
-        {
-           macOffset     = cuPeriodicty->choice.sym6or7;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
-        {
-           macOffset     = cuPeriodicty->choice.sl1;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
-        {
-           macOffset = cuPeriodicty->choice.sl2;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
-        {
-           macOffset = cuPeriodicty->choice.sl4;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
-        {
-           macOffset = cuPeriodicty->choice.sl5;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
-        {
-           macOffset = cuPeriodicty->choice.sl8;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
-        {
-           macOffset = cuPeriodicty->choice.sl10;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
-        {
-           macOffset = cuPeriodicty->choice.sl16;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
-        {
-           macOffset = cuPeriodicty->choice.sl20;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
-        {
-           macOffset = cuPeriodicty->choice.sl40;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
-        {
-           macOffset = cuPeriodicty->choice.sl80;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
-        {
-           macOffset = cuPeriodicty->choice.sl160;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
-        {
-           macOffset = cuPeriodicty->choice.sl320;
-           break;
-        }
-      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
+      qosToAdd->u.nonDyn5Qi.avgWindow = \
+                                        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+   }
+
+   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume)
+   {
+      qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
+                                              *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+   }
+
+   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
+   {
+      qosToAdd->u.nonDyn5Qi.priorLevel = \
+                                         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
+   }
+   qosToAdd->ngRanRetPri.priorityLevel = \
+                                         qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
+   qosToAdd->ngRanRetPri.preEmptionCap = \
+                                         qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
+   qosToAdd->ngRanRetPri.preEmptionVul = \
+                                         qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
+   if(qosFlowCfg->gBR_QoS_Flow_Information)
+   {
+      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
+      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
+      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
+      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
+   }
+   /*Extracting PDU_SESSION_ID*/
+   qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
+   if(qosIeExt)
+   {
+      for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
+      {
+         if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
+               QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
+         {
+            qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
+            DU_LOG("\nDEBUG -->  DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
+         }
+      }  
+   }
+   qosToAdd->ulPduSessAggMaxBitRate = 0;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract GTP Tunnel Info from CU
+ *
+ * @details
+ *
+ *    Function : extractUpTnlInfo
+ *
+ *    Functionality: Function to extract GTP Tunnel Info from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
+   ULUPTNLInformation_ToBeSetup_List_t *tnlInfo, UpTnlCfg *upTnlInfo)
+{
+   uint8_t tnlIdx;
+   uint32_t ipv4_du = 0;
+   GTPTunnel_t *gtpTunnel = NULLP;
+
+   upTnlInfo->drbId = drbId; 
+   upTnlInfo->configType = configType;
+#ifdef O1_ENABLE
+   cmInetAddr((S8*)g_cfg.DU_IPV4_Addr, &ipv4_du);
+#else
+   cmInetAddr((char *)DU_IP_V4_ADDR, &ipv4_du);
+#endif
+
+   for(tnlIdx=0; tnlIdx < tnlInfo->list.count; tnlIdx++)
+   {
+      if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.present == UPTransportLayerInformation_PR_gTPTunnel)
+      {
+        if(tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel)
         {
-           macOffset = cuPeriodicty->choice.sl640;
-           break;
+           gtpTunnel = tnlInfo->list.array[tnlIdx]->uLUPTNLInformation.choice.gTPTunnel;
+           DU_ALLOC(upTnlInfo->tnlCfg1, sizeof(GtpTnlCfg));
+            if(upTnlInfo->tnlCfg1 == NULLP)
+           {
+               DU_LOG("\nERROR  -->  F1AP : extractUpTnlInfo: Failed to allocate mmeory for tunnel cfg 1");
+               return RFAILED;
+           }
+           bitStringToInt(&gtpTunnel->transportLayerAddress, &upTnlInfo->tnlCfg1->ulTnlAddress);
+           upTnlInfo->tnlCfg1->dlTnlAddress = ipv4_du;
+           if(gtpTunnel->gTP_TEID.size > 0)
+           {
+              teIdStringToInt(gtpTunnel->gTP_TEID.buf, &upTnlInfo->tnlCfg1->teId);
+           }
         }
-      default :
-         DU_LOG("\nERROR  --> F1AP : Invalid periodicity %d", macPeriodicty);
+        break;
+      }
    }
+   return ROK;
 }
 
+/*******************************************************************
+*
+* @brief Function to extract Drb Qos Cfg Info from CU
+*
+* @details
+*
+*    Function : extractDrbQosCfg 
+*
+*    Functionality: Function to extract Drb Qos Cfg Info from CU
+*
+* @params[in] DRB_Information_t *drbInfo, LcCfg *macLcToAdd
+* @return ROK/RFAILED
+*
+* ****************************************************************/
+
+uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd ) 
+{
+   if(!macLcToAdd->drbQos)
+   {
+      DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
+      if(macLcToAdd->drbQos == NULLP)
+      {
+         DU_LOG("\nERROR  -->  DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
+         return RFAILED;
+      }
+
+   }
+   if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
+   {
+      extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
+      macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
+   }
+   if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
+   {
+      DU_LOG("\nERROR  -->  DUAPP: Unable to extract Snssai information  at extractDrbQosCfg()");
+      return RFAILED;
+   }
+   return ROK;
+}
 /*******************************************************************
  *
- * @brief Function to extractPucchFormatCfg sent by CU
+ * @brief Function to extract DRB info received from CU
  *
  * @details
  *
- *    Function : extractPucchFormatCfg
+ *    Function : extractDrbCfg
  *
- *    Functionality: Function to extractPucchFormatCfg
+ *    Functionality: Function to extract DRB info received from CU
  *
- * @params[in] PucchFormatCfg pointer,
- *             PUCCH_FormatConfig_t pointer
+ * @params[in] F1AP message
  * @return void
  *
  * ****************************************************************/
+uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
+DRBs_ToBeModified_Item_t *drbModItem,  LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
+{
+   DRB_Information_t *drbInfo = NULLP;
 
-void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
- {
-    if(cuFormatCfg->interslotFrequencyHopping)
-       macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
-    if(cuFormatCfg->additionalDMRS)  
-       macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
-    if(cuFormatCfg->maxCodeRate)
-       macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
-    if(cuFormatCfg->nrofSlots)  
-       macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
-    if(cuFormatCfg->pi2BPSK)  
-       macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
-    if(cuFormatCfg->simultaneousHARQ_ACK_CSI)  
-       macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
- }/* End of extractPucchFormatCfg */
+   if(drbItem != NULLP)
+   {
+      if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  -->  DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
+         return RFAILED;
+      }
+      if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
+      {
+         if(drbItem->qoSInformation.choice.choice_extension->value.present == QoSInformation_ExtIEs__value_PR_DRB_Information)
+         {
+            drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
+            if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
+            {
+               DU_LOG("\nERROR  -->  DUAPP : Failed to extract qos Cfg at extractDrbCfg()");
+               return RFAILED;
+            }
+         }
+      }
+   }
+   else if(drbSetupModItem != NULLP)
+   {
+      if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
+      upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  -->  DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
+         return RFAILED;
+      }
+      if(drbSetupModItem->qoSInformation.present == QoSInformation_PR_choice_extension)
+      {
+         if(drbSetupModItem->qoSInformation.choice.choice_extension->value.present ==\
+         QoSInformation_ExtIEs__value_PR_DRB_Information)
+         {
+            drbInfo = &drbSetupModItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
+            if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
+            {
+               DU_LOG("\nERROR  -->  DUAPP : Failed to extract qos Cfg at extractDrbCfg()");  
+               return RFAILED;
+            }
+
+         }
+      }
+   }
+   else if(drbModItem != NULLP)
+   {
+      if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
+      upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  -->  DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
+         return RFAILED;
+      }
+      if(drbModItem->qoSInformation != NULLP)
+      {
+         if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
+         {
+            if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
+                  QoSInformation_ExtIEs__value_PR_DRB_Information)
+            {
+               drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
+               if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
+               {
+                  DU_LOG("\nERROR  -->  DUAPP : Failed to extract qos Cfg at extractDrbCfg()");  
+                  return RFAILED;
+               }
+
+            }
+         }
+      }
+   }
+   return ROK;
+}
 
 /*******************************************************************
  *
- * @brief Function to extractSchedReqCfgToAddMod sent by CU
+ * @brief Function to extract RB info received from CU
  *
  * @details
  *
- *    Function : extractSchedReqCfgToAddMod
+ *    Function : extractMacRbCfg
  *
- *    Functionality: Function to extractSchedReqCfgToAddMod
+ *    Functionality: Function to extract RB info received from CU
  *
- * @params[in] PucchSchedReqCfg pointer,
- *      PUCCH_Config__schedulingRequestResourceToAddModList pointer
- * @return void
+ * @params[in] F1AP message
+ * @return ROK/RFAILED
  *
  * ****************************************************************/
 
-void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
+uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
+DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
-   uint8_t arrIdx;
-
-   macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
-   for(arrIdx = 0; arrIdx <  macSchedReqCfg->schedAddModListCount; arrIdx++)
+   if(drbCfg != NULLP)
    {
-      macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
-         cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
-      macSchedReqCfg->schedAddModList[arrIdx].requestId =\
-         cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
-      if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
+      if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
       {
-         fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
-           macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
+         DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+         return RFAILED;
       }
-      if(cuSchedReqList->list.array[arrIdx]->resource)
+   }
+   else if(drbSetupModCfg != NULLP)
+   { 
+      if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
       {
-         macSchedReqCfg->schedAddModList[arrIdx].resrc =\
-           *cuSchedReqList->list.array[arrIdx]->resource;
+         DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+         return RFAILED;
       }
    }
+   else if(drbModCfg != NULLP)
+   { 
+      if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
+      {
+         DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+         return RFAILED;
+      }
+   }
+   else
+   {
+      lcCfg->drbQos = NULLP;
+      lcCfg->snssai = NULLP;
+      if(lcCfg->lcId == SRB2_LCID)
+         lcCfg->dlLcCfg.lcp = LC_PRIORITY_3;
+      else
+         lcCfg->dlLcCfg.lcp = LC_PRIORITY_1;
+   }
+   if(ulLcCfg)
+   {
+      lcCfg->ulLcCfgPres = true;
+      extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg);
+   }
+   else
+      lcCfg->ulLcCfgPres = false;
+   return ROK;
+}
 
-}/* End of extractSchedReqCfgToAddMod */
-
- /*******************************************************************
+/*******************************************************************
  *
- * @brief Fills PucchCfg received by CU
+ * @brief Function processing LC config info received from CU
  *
  * @details
  *
- *    Function : extractPucchCfg
+ *    Function : procMacLcCfg
  *
- *    Functionality: Fills PucchCfg received  by CU
+ *    Functionality: Function processing LC config info received from CU
  *
- * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg,
- *             PucchCfg *macPucchCfg
+ * @params[in] F1AP message
  * @return ROK/RFAILED
  *
  * ****************************************************************/
 
-uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg)         
+uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
+LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
-   uint8_t arrIdx;
+   uint8_t ret = ROK;
 
-   if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
+   lcCfg->lcId = lcId;
+   lcCfg->configType = configType;
+   if(rbType == RB_TYPE_SRB)
    {
-      if(cuPucchCfg->choice.setup)
+      ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
+   }
+   else if(rbType == RB_TYPE_DRB)
+   {
+      if(drbItem != NULL)
+        ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
+      else if(drbSetupModItem != NULL)
+        ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
+      else if(drbModItem != NULL)
+        ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ *
+ * @details
+ *
+ *    Function : extractRlcCfgToAddMod
+ *
+ *    Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ *
+ * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
+ *             DuUeCfg Pointer
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
+{
+  uint8_t idx, rbId, lcId, rlcMode, rbType;
+  RLC_Config_t *f1RlcCfg = NULLP;
+  LogicalChannelConfig_t *macUlLcCfg = NULLP;
+
+  for(idx = 0; idx < lcCfg->list.count; idx++)
+  {
+     lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
+     if(lcCfg->list.array[idx]->servedRadioBearer)
+     {
+        /* RadioBearer for SRB/DRB */
+        if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
+        RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
+        {
+           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
+           rbType = RB_TYPE_SRB;
+        }
+        else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
+        RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
+        {
+           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
+           rbType = RB_TYPE_DRB;
+        }
+        else
+        {
+           DU_LOG("\nERROR  -->  No components present in Bearer config to ADD/MOD");
+           return RFAILED;
+        }
+        /* MAC UL LC Config */
+        if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
+        {
+           macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
+        }
+     }
+     else
+     {
+        DU_LOG("\nERROR  -->  DUAPP: Received RadioBearer config is NULL");
+        return RFAILED;
+     }
+     /* RLC Mode Config */
+     if(lcCfg->list.array[idx]->rlc_Config)
+     {
+        rlcMode  = lcCfg->list.array[idx]->rlc_Config->present;
+        f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
+     }
+     
+     /* Filling RLC/MAC Config*/
+     memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
+     memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
+     procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
+     if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
+     {
+        DU_LOG("\nERROR  -->  DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
+        return RFAILED;
+     }
+     (ueCfgDb->numRlcLcs)++;
+     (ueCfgDb->numMacLcs)++;
+     DU_LOG("\nDEBUG  -> DUAPP: extractRlcCfgToAddMod:RBType:%d, DrbID: %d,lcId:%d, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
+        rbType, rbId, lcId, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs,  ueCfgDb->numDrb);
+  }
+  //TODO: To send the failure cause in UeContextSetupRsp 
+  return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief DeAlloc pdsch serv cell config info
+ *
+ * @details
+ *
+ *    Function : freeMacPdschServCellInfo
+ *
+ *    Functionality: DeAlloc pdsch serv cell config info
+ *
+ * @params[in] PdschServCellCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
+{
+   if(pdsch->xOverhead)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
+   }
+   if(pdsch->codeBlkGrpFlushInd)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
+   }
+   if(pdsch->maxCodeBlkGrpPerTb)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
+   }
+   if(pdsch->maxMimoLayers)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Free Serving cell Info
+ *
+ * @details
+ *
+ *    Function : freeMacServingCellInfo
+ *
+ *    Functionality: Free Serving cell Info
+ *
+ * @params[in] ServCellCfgInfo *srvCellCfg
+ * @return void
+ *
+ * ****************************************************************/
+void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
+{
+   uint8_t timeDomRsrcIdx;
+
+   if(srvCellCfg->initDlBwp.pdschPresent)
+   {
+      for(timeDomRsrcIdx = 0; timeDomRsrcIdx < srvCellCfg->initDlBwp.pdschCfg.numTimeDomRsrcAlloc; timeDomRsrcIdx++)
       {
-         /* Resource Set Cfg */ 
-        if(cuPucchCfg->choice.setup->resourceSetToAddModList)
-        {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
-           if(macPucchCfg->resrcSet == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
-            extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
-        }
-         
-        /* Resource Cfg */ 
-        if(cuPucchCfg->choice.setup->resourceToAddModList)
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, \
+            srvCellCfg->initDlBwp.pdschCfg.timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t));
+      }
+   }
+
+   freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
+   if(srvCellCfg->bwpInactivityTmr)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
+   }
+
+   if(srvCellCfg->initUlBwp.pucchPresent)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->initUlBwp.pucchCfg.dlDataToUlAck, sizeof(PucchDlDataToUlAck));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Free cell Grp Cfg Info
+ *
+ * @details
+ *
+ *    Function : freeUeReCfgCellGrpInfo
+ *
+ *    Functionality: Free cell Grp Cfg Info
+ *
+ * @params[in] MacUeCfg*  duUeCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg)
+{
+   freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Reconfig SchReqReConfig
+ *
+ * @details
+ *
+ *    Function : extractSchReqReConfig
+ *
+ *    Functionality: Fills Reconfig SchReqReConfig
+ *
+ * @params[in] SchedulingRequestConfig_t *cuSchedReq
+ *             SchedReqCfg*  macSchedReq
+ * @return void
+ *
+ * ****************************************************************/
+void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
+{
+   uint8_t schReqIdx = 0;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
+
+   if(cuSchedReq->schedulingRequestToAddModList)
+   {
+      schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
+      if(schReqListToAdd->list.count)
+      {
+        macSchedReq->addModListCount = schReqListToAdd->list.count;
+        for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
         {
-            DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
-           if(macPucchCfg->resrc == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
-            extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
+           macSchedReq->addModList[schReqIdx].schedReqId = \
+              schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
+           macSchedReq->addModList[schReqIdx].srProhibitTmr = \
+              *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
+           macSchedReq->addModList[schReqIdx].srTransMax    =\
+              schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
         }
-         
-        /* Format 1 Cfg */ 
-        if(cuPucchCfg->choice.setup->format1)
+      }
+   }
+   /* Scheduling Req To release */
+   if(cuSchedReq->schedulingRequestToReleaseList)
+   {
+      schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
+      if(schReqListToRel->list.count)
+      {
+        macSchedReq->relListCount = schReqListToRel->list.count;
+        for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
         {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
-           if(macPucchCfg->format1 == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in  extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
-            extractPucchFormatCfg(macPucchCfg->format1,\
-              cuPucchCfg->choice.setup->format1->choice.setup);
+           macSchedReq->relList[schReqIdx] = \
+              *schReqListToRel->list.array[schReqIdx];
         }
-         
-        /* Format 2 Cfg */
-         if(cuPucchCfg->choice.setup->format2)
-        {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
-           if(macPucchCfg->format2 == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in  extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
-            extractPucchFormatCfg(macPucchCfg->format2,\
-              cuPucchCfg->choice.setup->format2->choice.setup);
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills TagReconfig
+ *
+ * @details
+ *
+ *    Function : extractTagReconfig
+ *
+ *    Functionality: Fills extractTagReconfig
+ *
+ * @params[in] TAG_Config_t *cuTagCfg
+ *             TagCfg *macTagCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
+{
+  uint8_t tagIdx = 0;
+  struct TAG_Config__tag_ToAddModList  *tagListToAddMod = NULLP;
+  struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
+
+  /* Tag config to AddMod */
+  if(cuTagCfg->tag_ToAddModList)
+  {
+     tagListToAddMod = cuTagCfg->tag_ToAddModList; 
+     if(tagListToAddMod->list.count)
+     {
+        macTagCfg->addModListCount = tagListToAddMod->list.count;
+        for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
+       {
+           macTagCfg->addModList[tagIdx].tagId =\
+              tagListToAddMod->list.array[tagIdx]->tag_Id;     
+           macTagCfg->addModList[tagIdx].timeAlignTimer = \
+
+              tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
+       }
+     }
+  }
+  /* Tag config to release */
+  if(cuTagCfg->tag_ToReleaseList)
+  {
+     tagListToRel = cuTagCfg->tag_ToReleaseList;
+     if(tagListToRel->list.count)
+     {
+        macTagCfg->relListCount = tagListToRel->list.count;
+        for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
+       {
+           macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];     
+       }
+     }
+  }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdcchCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdcchCfg
+ *
+ *    Functionality: Fills PdcchCfg received  by CU
+ *
+ * @params[in] PDCCH_Config_t *cuPdcchCfg,
+ *             PdcchConfig *duPdcchCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
+{
+   uint8_t cRsetIdx = 0;
+   uint8_t srchSpcIdx = 0;
+
+   struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
+   struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
+   struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
+   struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
+
+
+   /* Control Resource Set To Add/Mod List */
+   if(cuPdcchCfg->controlResourceSetToAddModList)
+   {
+      cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
+      if(cRsetToAddModList->list.count)
+      {
+         macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
+         for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
+         {
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
+               cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
+            //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
+                  macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
+            memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
+               cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
+               cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
+
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
+                cRsetToAddModList->list.array[cRsetIdx]->duration;
+
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
+               cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;   
+            if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
+            {
+               //TODO: handle the case for Interleaved
+            }
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
+                cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
+            if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
+            {
+               macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
+                  *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
+            }
+         }
+      }
+   }
+   /* Control Resource Set To Release List */
+   if(cuPdcchCfg->controlResourceSetToReleaseList)
+   {
+      cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
+      if(cRsetToRelList->list.count)
+      {
+         macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
+         for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
+         {
+            macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
+         }
+      }
+   }
+
+   /* Search space To Add/Mod List */
+   if(cuPdcchCfg->searchSpacesToAddModList)
+   {
+      srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
+      if(srchSpcToAddModList->list.count)
+      {
+         macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
+         for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
+         {
+            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
+                                                                          srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
+            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
+                                                                    *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
+            {
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
+                                                                                         srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
+            }
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
+            {
+               bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
+                     macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
+            }
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
+            {
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
+                                                                                       srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
+                                                                                       srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
+                                                                                       srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
+
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
+                                                                                       srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
+
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
+                                                                                        srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
+            }
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
+            {
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
+                                                                               srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
+               if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
+               {
+                  macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
+                                                                                      srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
+               }
+
+            }
+         }
+      }
+   }
+   /* Search space To Rel List */
+   if(cuPdcchCfg->searchSpacesToReleaseList)
+   {
+      srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
+      if(srchSpcToRelList->list.count)
+      {
+         macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
+         for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
+         {
+            macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
+                                                         *(srchSpcToRelList->list.array[srchSpcIdx]);
+         }
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdschCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdschCfg
+ *
+ *    Functionality: Fills PdschCfg received  by CU
+ *
+ * @params[in] PDSCH_Config_t *cuPdschCfg = Information which is send by CU,
+ *                   which we have stored in F1UeContextSetupDb,
+ *             PdschConfig *macPdschCfg = Used to Store the information which
+ *                   needs to send in other layer, as well as this can be the variable
+ *                   which stores the information in DuCb,
+ *             PdschConfig *storedPdschCfg =  Null in case of sending the
+ *                   information to other layer else it will have stored pdsch 
+ *                   configuration in copyOfmacUeCfg.
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg, PdschConfig *storedPdschCfg)
+{
+   uint8_t timeDomIdx;
+   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
+
+   if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+   {
+      if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
+            PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
+      {
+         if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
+         {
+            macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
+               *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
+         }
+      }
+   }
+   macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
+   if(cuPdschCfg->pdsch_TimeDomainAllocationList)
+   {
+      timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
+      if(timeDomAlloc->present ==\
+            PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
+      {
+         if(timeDomAlloc->choice.setup)
+         {
+            macPdschCfg->numTimeDomRsrcAlloc  = timeDomAlloc->choice.setup->list.count;
+            for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
+            {
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 = NULLP;
+               if(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0)
+               {
+                  if(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 == NULL)
+                  {
+                     if(storedPdschCfg)
+                     {
+                        if(storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
+                        {
+                           macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0 =\
+                           storedPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0;
+                        }
+                        else
+                        {
+                           DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
+                        }
+                     }
+                     else
+                     {
+                        DU_ALLOC_SHRABL_BUF(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0, sizeof(uint8_t));
+                     }
+                     if(!macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0)
+                     {
+                        DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for k0 at extractPdschCfg()");
+                        return;
+                     }
+                  }
+                  *(macPdschCfg->timeDomRsrcAllociList[timeDomIdx].k0) = \
+                  *(timeDomAlloc->choice.setup->list.array[timeDomIdx]->k0);
+               }
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
+                  timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
+               macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
+                  timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+            }
+         }
+      }
+   }
+   macPdschCfg->rbgSize = cuPdschCfg->rbg_Size;
+   if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
+      macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
+   if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
+   {
+      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
+      if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
+      {
+         if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
+         {
+            macPdschCfg->bundlingInfo.StaticBundling.size = \
+               *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
+         }
+      }
+   }
+   else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
+   {
+      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
+   }
+
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdschServingCellCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdschServingCellCfg
+ *
+ *    Functionality: Fills PdschCfg received  by CU
+ *
+ * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
+ *             PdschServCellCfg *macUePdschSrvCellCfg
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
+{
+   if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
+   {
+      if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
+      {
+         if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
+         {
+            *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
+              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
+        }
+        else
+        {
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
+            if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
+           {
+               *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
+                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
+           }
+           else
+           {
+              DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
+              return RFAILED;
+           }
+        }
+         if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
+         {
+            *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
+              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+        }
+        else
+        {
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
+            if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
+           {
+               *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
+                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+           }
+           else
+           {
+              DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
+              return RFAILED;
+           }
+        }
+      }
+   }
+   if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
+   {
+      macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH); 
+   }
+   if(cuPdschSrvCellCfg->ext1)
+   {
+      if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
+      {
+        if(macUePdschSrvCellCfg->maxMimoLayers)
+       {
+           *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
+       }
+       else
+       {
+           DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
+           if(macUePdschSrvCellCfg->maxMimoLayers)
+          {
+              *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
+          }
+          else
+          {
+             DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
+             return RFAILED;
+          }
+       }
+      }
+   }
+   if(cuPdschSrvCellCfg->xOverhead)
+   {
+      if(macUePdschSrvCellCfg->xOverhead)
+      {
+         *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
+      }
+      else
+      {
+         DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
+         if(macUePdschSrvCellCfg->xOverhead)
+         {
+            *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
+           return RFAILED;
+         }
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PuschCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPuschCfg
+ *
+ *    Functionality: Fills PuschCfg received  by CU
+ *
+ * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
+ *             PuschCfg *macPuschCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
+{
+   uint8_t timeDomIdx = 0;
+   DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
+
+   if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
+   {
+      if(cuPuschCfg->choice.setup)
+      {
+         if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
+        {
+             macPuschCfg->dataScramblingId = \
+               *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
+        }
+        if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
+        {
+           if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
+           {
+              if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
+              {
+                 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
+                 if(dmrsUlCfg->dmrs_AdditionalPosition)
+                 {
+                     macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
+                       *(dmrsUlCfg->dmrs_AdditionalPosition);
+                 }
+                  if(dmrsUlCfg->transformPrecodingDisabled)
+                 {
+                    if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
+                    {
+                       macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
+                          *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
+                     }
+                 }
+              }
+           }
+        }
+        /*Res Alloc Type for UL */
+        if(cuPuschCfg->choice.setup->resourceAllocation)
+        {
+            macPuschCfg->resourceAllocType = \
+              cuPuschCfg->choice.setup->resourceAllocation;
+        }
+        if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
+        {
+           timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
+           if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
+           {
+               if(timeDomAllocList->choice.setup)
+              {
+                 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
+                 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
+                 {
+                    macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
+                       *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
+                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
+                        timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
+                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
+                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+                  }
+              }
+           }
+        }
+        if(cuPuschCfg->choice.setup->transformPrecoder)
+            macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to fill pucch Power Control
+ *
+ * @details
+ *
+ *    Function : extractPucchPowerControl
+ *
+ *    Functionality: Function to fill pucch Power Control
+ *
+ * @params[in] PucchPowerControl *pwrCtrl,
+ *             struct PUCCH_PowerControl *cuPwrCtrlCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPucchPowerControl(PucchPowerControl *pwrCtrl, struct PUCCH_PowerControl *cuPwrCtrlCfg)
+{
+   uint8_t arrIdx;
+
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f0)
+      pwrCtrl->deltaF_Format0 = *cuPwrCtrlCfg->deltaF_PUCCH_f0;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f1)
+      pwrCtrl->deltaF_Format1 = *cuPwrCtrlCfg->deltaF_PUCCH_f1;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f2)
+      pwrCtrl->deltaF_Format2 = *cuPwrCtrlCfg->deltaF_PUCCH_f2;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f3)
+      pwrCtrl->deltaF_Format3 = *cuPwrCtrlCfg->deltaF_PUCCH_f3;
+   if(cuPwrCtrlCfg->deltaF_PUCCH_f4)
+      pwrCtrl->deltaF_Format4 = *cuPwrCtrlCfg->deltaF_PUCCH_f4;
+   if(cuPwrCtrlCfg->p0_Set)
+   {
+      pwrCtrl->p0SetCount = cuPwrCtrlCfg->p0_Set->list.count;
+      for(arrIdx=0; arrIdx < pwrCtrl->p0SetCount; arrIdx++)
+      {
+         pwrCtrl->p0Set[arrIdx].p0PucchId =\
+           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Id;
+         pwrCtrl->p0Set[arrIdx].p0PucchVal =\
+           cuPwrCtrlCfg->p0_Set->list.array[arrIdx]->p0_PUCCH_Value;
+      }
+   }
+   if(cuPwrCtrlCfg->pathlossReferenceRSs)
+   {
+      pwrCtrl->pathLossRefRSListCount = cuPwrCtrlCfg->pathlossReferenceRSs->list.count;
+      for(arrIdx = 0; arrIdx < pwrCtrl->pathLossRefRSListCount; arrIdx++)
+      {
+         pwrCtrl->pathLossRefRSList[arrIdx].pathLossRefRSId =\
+           cuPwrCtrlCfg->pathlossReferenceRSs->list.array[arrIdx]->pucch_PathlossReferenceRS_Id;
+      }
+   }
+}
+ /*******************************************************************
+ *
+ * @brief Function to extractResrcSetToAddModList sent by CU
+ *
+ * @details
+ *
+ *    Function : extractResrcSetToAddModList
+ *
+ *    Functionality: Fucntion to extractResrcSetToAddModList
+ *
+ * @params[in] PucchResrcSetCfg pointer,
+ *             struct PUCCH_Config__resourceSetToAddModList pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_Config__resourceSetToAddModList *cuRsrcSetList)
+{
+   uint8_t arrIdx, rsrcListIdx;
+
+   macRsrcSetList->resrcSetToAddModListCount = cuRsrcSetList->list.count; 
+   for(arrIdx = 0; arrIdx < macRsrcSetList->resrcSetToAddModListCount; arrIdx++)
+   {
+      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcSetId     =\
+         cuRsrcSetList->list.array[arrIdx]->pucch_ResourceSetId;
+      macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount =\
+         cuRsrcSetList->list.array[arrIdx]->resourceList.list.count;
+      for(rsrcListIdx = 0; rsrcListIdx < macRsrcSetList->resrcSetToAddModList[arrIdx].resrcListCount; rsrcListIdx++)
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
+            *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
+      }
+
+      if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
+            *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
+      }
+      else
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
+      }
+   }
+}/* End of extractResrcSetToAddModList */
+
+/*******************************************************************
+ *
+ * @brief Fills extractResrcToAddModList sent by CU
+ *
+ * @details
+ *
+ *    Function : extractResrcToAddModList
+ *
+ *    Functionality: Fills extractResrcToAddModList
+ *
+ * @params[in] PucchResrcCfg pointer,
+ *             struct PUCCH_Config__resourceToAddModList pointer
+ * @return ROk/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractResrcToAddModList(PucchResrcCfg *macResrcList, struct PUCCH_Config__resourceToAddModList *cuResrcList)
+{
+   uint8_t arrIdx;
+   
+   macResrcList->resrcToAddModListCount = cuResrcList->list.count;
+   for(arrIdx = 0; arrIdx < macResrcList->resrcToAddModListCount; arrIdx++)
+   {
+      macResrcList->resrcToAddModList[arrIdx].resrcId      =\
+        cuResrcList->list.array[arrIdx]->pucch_ResourceId; 
+      macResrcList->resrcToAddModList[arrIdx].startPrb     =\
+        cuResrcList->list.array[arrIdx]->startingPRB;
+      if(cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping)
+      {
+         macResrcList->resrcToAddModList[arrIdx].intraFreqHop =\
+           *cuResrcList->list.array[arrIdx]->intraSlotFrequencyHopping;
+      }
+      if(cuResrcList->list.array[arrIdx]->secondHopPRB)
+      {
+         macResrcList->resrcToAddModList[arrIdx].secondPrbHop =\
+           *cuResrcList->list.array[arrIdx]->secondHopPRB;
+      }
+      /* PUCCH RSRC FORMAT */
+      if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format0)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_0;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format0)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0, sizeof(PucchFormat0));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format0 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->initialCyclicShift =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->initialCyclicShift;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->numSymbols =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->nrofSymbols;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format0->startSymbolIdx =\
+               cuResrcList->list.array[arrIdx]->format.choice.format0->startingSymbolIndex;
+        }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format1)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_1;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format1)
+        {
+            DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1, sizeof(PucchFormat1));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format1 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->initialCyclicShift =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->initialCyclicShift;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->startingSymbolIndex;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format1->timeDomOCC =\
+                cuResrcList->list.array[arrIdx]->format.choice.format1->timeDomainOCC;
+        }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format2)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_2;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format2)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2, sizeof(PucchFormat2_3));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format2 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numPrbs =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofPRBs;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format2->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format2->startingSymbolIndex;
+         }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format3)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_3;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format3)
+        {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3, sizeof(PucchFormat2_3));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format3 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numPrbs =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofPRBs;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->nrofSymbols;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format3->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format3->startingSymbolIndex;
+         }
+      }
+      else if(cuResrcList->list.array[arrIdx]->format.present == PUCCH_Resource__format_PR_format4)
+      {
+         macResrcList->resrcToAddModList[arrIdx].pucchFormat = PUCCH_FORMAT_4;
+         if(cuResrcList->list.array[arrIdx]->format.choice.format4)
+         {
+           DU_ALLOC_SHRABL_BUF(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4, sizeof(PucchFormat4));
+           if(macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4 == NULLP)
+           {
+               DU_LOG("\nERROR  --> F1AP : Failed to allocate memory for Format4 in extractResrcToAddModList()");
+              return RFAILED;
+           }
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->numSymbols =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->nrofSymbols;
+           macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occLen =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Length;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->occIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->occ_Index;
+            macResrcList->resrcToAddModList[arrIdx].PucchFormat.format4->startSymbolIdx =\
+                cuResrcList->list.array[arrIdx]->format.choice.format4->startingSymbolIndex;
+        }
+      }
+   }
+   return ROK;
+
+}/* End of extractResrcToAddModList */
+
+/*******************************************************************
+ *
+ * @brief Fills fillPucchSchedReqPeriodAndOffset sent by CU
+ *
+ * @details
+ *
+ *    Function : fillPucchSchedReqPeriodAndOffset
+ *
+ *    Functionality: To fillPucchSchedReqPeriodAndOffset
+ *
+ * @params[in] macPeriodicty,
+ *     SchedulingRequestResourceConfig__periodicityAndOffset pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void fillPucchSchedReqPeriodAndOffset(uint8_t macPeriodicty, uint16_t  macOffset,\
+   struct SchedulingRequestResourceConfig__periodicityAndOffset *cuPeriodicty)
+{
+   macPeriodicty = cuPeriodicty->present;
+   switch(macPeriodicty)
+   {
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
+        {
+           macOffset     = cuPeriodicty->choice.sym2;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
+        {
+           macOffset     = cuPeriodicty->choice.sym6or7;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
+        {
+           macOffset     = cuPeriodicty->choice.sl1;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
+        {
+           macOffset = cuPeriodicty->choice.sl2;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
+        {
+           macOffset = cuPeriodicty->choice.sl4;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
+        {
+           macOffset = cuPeriodicty->choice.sl5;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
+        {
+           macOffset = cuPeriodicty->choice.sl8;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
+        {
+           macOffset = cuPeriodicty->choice.sl10;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
+        {
+           macOffset = cuPeriodicty->choice.sl16;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
+        {
+           macOffset = cuPeriodicty->choice.sl20;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
+        {
+           macOffset = cuPeriodicty->choice.sl40;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
+        {
+           macOffset = cuPeriodicty->choice.sl80;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
+        {
+           macOffset = cuPeriodicty->choice.sl160;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
+        {
+           macOffset = cuPeriodicty->choice.sl320;
+           break;
+        }
+      case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
+        {
+           macOffset = cuPeriodicty->choice.sl640;
+           break;
+        }
+      default :
+         DU_LOG("\nERROR  -->  F1AP : Invalid periodicity %d", macPeriodicty);
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extractPucchFormatCfg sent by CU
+ *
+ * @details
+ *
+ *    Function : extractPucchFormatCfg
+ *
+ *    Functionality: Function to extractPucchFormatCfg
+ *
+ * @params[in] PucchFormatCfg pointer,
+ *             PUCCH_FormatConfig_t pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPucchFormatCfg(PucchFormatCfg *macFormatCfg, PUCCH_FormatConfig_t *cuFormatCfg)
+ {
+    if(cuFormatCfg->interslotFrequencyHopping)
+       macFormatCfg->interSlotFreqHop = *cuFormatCfg->interslotFrequencyHopping;
+    if(cuFormatCfg->additionalDMRS)  
+       macFormatCfg->addDmrs = *cuFormatCfg->additionalDMRS;
+    if(cuFormatCfg->maxCodeRate)
+       macFormatCfg->maxCodeRate = *cuFormatCfg->maxCodeRate;
+    if(cuFormatCfg->nrofSlots)  
+       macFormatCfg->numSlots = *cuFormatCfg->nrofSlots;
+    if(cuFormatCfg->pi2BPSK)  
+       macFormatCfg->pi2BPSK = *cuFormatCfg->pi2BPSK;
+    if(cuFormatCfg->simultaneousHARQ_ACK_CSI)  
+       macFormatCfg->harqAckCSI = *cuFormatCfg->simultaneousHARQ_ACK_CSI;
+ }/* End of extractPucchFormatCfg */
+
+/*******************************************************************
+ *
+ * @brief Function to extractSchedReqCfgToAddMod sent by CU
+ *
+ * @details
+ *
+ *    Function : extractSchedReqCfgToAddMod
+ *
+ *    Functionality: Function to extractSchedReqCfgToAddMod
+ *
+ * @params[in] PucchSchedReqCfg pointer,
+ *      PUCCH_Config__schedulingRequestResourceToAddModList pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractSchedReqCfgToAddMod(PucchSchedReqCfg *macSchedReqCfg, struct PUCCH_Config__schedulingRequestResourceToAddModList *cuSchedReqList)
+{
+   uint8_t arrIdx;
+
+   macSchedReqCfg->schedAddModListCount = cuSchedReqList->list.count;
+   for(arrIdx = 0; arrIdx <  macSchedReqCfg->schedAddModListCount; arrIdx++)
+   {
+      macSchedReqCfg->schedAddModList[arrIdx].resrcId =\
+         cuSchedReqList->list.array[arrIdx]->schedulingRequestResourceId;
+      macSchedReqCfg->schedAddModList[arrIdx].requestId =\
+         cuSchedReqList->list.array[arrIdx]->schedulingRequestID;
+      if(cuSchedReqList->list.array[arrIdx]->periodicityAndOffset)
+      {
+         fillPucchSchedReqPeriodAndOffset(macSchedReqCfg->schedAddModList[arrIdx].periodicity,\
+           macSchedReqCfg->schedAddModList[arrIdx].offset, cuSchedReqList->list.array[arrIdx]->periodicityAndOffset);
+      }
+      if(cuSchedReqList->list.array[arrIdx]->resource)
+      {
+         macSchedReqCfg->schedAddModList[arrIdx].resrc =\
+           *cuSchedReqList->list.array[arrIdx]->resource;
+      }
+   }
+
+}/* End of extractSchedReqCfgToAddMod */
+
+ /*******************************************************************
+ *
+ * @brief Fills PucchCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPucchCfg
+ *
+ *    Functionality: Fills PucchCfg received  by CU
+ *
+ * @params[in] BWP_UplinkDedicated__pucch_Config *cuPucchCfg = Information which
+ *                is send by CU, which we have stored in F1UeContextSetupDb,
+ *             PucchCfg *macPucchCfg = Used to Store the information which
+ *                needs to send in other layer, as well as this can be the variable
+ *                which stores the information in DuCb,
+ *             PucchCfg *storedPucchCfg = Null in case of sending the
+ *                information to other layer else it will have Pucch Cfg which
+ *                we have stored in copyOfmacUeCfg.
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractPucchCfg(struct BWP_UplinkDedicated__pucch_Config *cuPucchCfg, PucchCfg *macPucchCfg,\
+PucchCfg *storedPucchCfg)        
+{
+   uint8_t arrIdx;
+
+   if(cuPucchCfg->present == BWP_UplinkDedicated__pucch_Config_PR_setup)
+   {
+      if(cuPucchCfg->choice.setup)
+      {
+         /* Resource Set Cfg */ 
+        if(cuPucchCfg->choice.setup->resourceSetToAddModList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->resrcSet, sizeof(PucchResrcSetCfg));
+           if(macPucchCfg->resrcSet == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc set List in extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->resrcSet, 0, sizeof(PucchResrcSetCfg));
+            extractResrcSetToAddModList(macPucchCfg->resrcSet, cuPucchCfg->choice.setup->resourceSetToAddModList);
+        }
+         
+        /* Resource Cfg */ 
+        if(cuPucchCfg->choice.setup->resourceToAddModList)
+        {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->resrc, sizeof(PucchResrcCfg));
+           if(macPucchCfg->resrc == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract Resrc List in extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->resrc, 0, sizeof(PucchResrcCfg));
+            extractResrcToAddModList(macPucchCfg->resrc, cuPucchCfg->choice.setup->resourceToAddModList);
+        }
+         
+        /* Format 1 Cfg */ 
+        if(cuPucchCfg->choice.setup->format1)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format1, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format1 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 1 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format1, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format1,\
+              cuPucchCfg->choice.setup->format1->choice.setup);
+        }
+         
+        /* Format 2 Cfg */
+         if(cuPucchCfg->choice.setup->format2)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format2, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format2 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 2 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format2, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format2,\
+              cuPucchCfg->choice.setup->format2->choice.setup);
+        }
+         
+        /* Format 3 Cfg */
+         if(cuPucchCfg->choice.setup->format3)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format3 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format3,\
+              cuPucchCfg->choice.setup->format3->choice.setup);
+        }
+
+         /* Format 4 Cfg */
+         if(cuPucchCfg->choice.setup->format4)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
+           if(macPucchCfg->format4 == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
+            extractPucchFormatCfg(macPucchCfg->format4,\
+              cuPucchCfg->choice.setup->format4->choice.setup);
+        }
+
+         /* Sched Req List */
+         if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
+           if(macPucchCfg->schedReq == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
+            extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
+           cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
+        }
+
+         /*TODO: Add support for  Spatial Info */
+
+        /* MultiCsiCfg */
+         if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
+        {
+           DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
+           if(macPucchCfg->multiCsiCfg == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in  extractPucchCfg()");
+              return RFAILED;
+           }
+           memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
+            macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
+           for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
+           {
+              macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
+                *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
+           }
+        }
+
+         /* Dl_DataToUL_ACK */ 
+        if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
+    {
+       if(storedPucchCfg)
+       {
+          if(storedPucchCfg->dlDataToUlAck)
+          {
+             macPucchCfg->dlDataToUlAck = storedPucchCfg->dlDataToUlAck; 
+          }
+          else
+          {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
+          }
+       }
+       else
+       {
+          DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
+       }
+       if(macPucchCfg->dlDataToUlAck == NULLP)
+       {
+          DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
+          return RFAILED;
+       }
+       memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
+       macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
+       for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
+       {
+          macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
+          *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
+       }
+        }
+
+        /* Power Control */
+         if(cuPucchCfg->choice.setup->pucch_PowerControl)
+        {
+            DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
+           if(macPucchCfg->powerControl == NULLP)
+           {
+              DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
+              return RFAILED;
+           }
+            extractPucchPowerControl(macPucchCfg->powerControl,\
+              cuPucchCfg->choice.setup->pucch_PowerControl);
+        }
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills ServingCellReconfig received by CU
+ *
+ * @details
+ *
+ *    Function : extractSpCellDedicatedCfg
+ *
+ *    Functionality: Fills ServingCellReconfig received  by CU
+ *
+ * @params[in] ServingCellConfig_t *cuSrvCellCfg = Information which is send by
+ *                  CU, which we have stored in F1UeContextSetupDb,
+ *             ServCellCfgInfo *macSrvCellCfg = Used to Store the information
+ *                  which  needs to send in other layer, as well as this can be the
+ *                  variable which stores the information in DuCb, 
+ *             ServCellCfgInfo *storedSrvCellCfg = Null in case of sending the
+ *                  information to other layer else it will have ServCellCfgInfo which
+ *                  we have stored in copyOfmacUeCfg.
+ * @return ROK/RFAILD
+ *
+ * ****************************************************************/
+uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg,\
+ServCellCfgInfo *storedSrvCellCfg)
+{
+   uint8_t ret = ROK;
+   BWP_DownlinkDedicated_t *dlBwp = NULLP;
+   BWP_UplinkDedicated_t   *ulBwp = NULLP;
+
+   if(cuSrvCellCfg->initialDownlinkBWP)
+   {
+      dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
+      if(dlBwp->pdcch_Config)
+      {
+         if(dlBwp->pdcch_Config->choice.setup)
+         {
+            macSrvCellCfg->initDlBwp.pdcchPresent = true;
+            if(storedSrvCellCfg)
+            {
+               if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
+               {
+                  extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+               }
+               else
+               {
+                  extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+               }
+            }
+            else
+            {
+               extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+            }
+         }
+      }
+      if(dlBwp->pdsch_Config)
+      {
+         if(dlBwp->pdsch_Config->choice.setup)
+         {
+            macSrvCellCfg->initDlBwp.pdschPresent = true;
+            
+            if(storedSrvCellCfg)
+            {
+               if(!storedSrvCellCfg->initDlBwp.pdschPresent)
+               {
+                  extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
+               }
+               else
+               {
+                  extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg,\
+                        &storedSrvCellCfg->initDlBwp.pdschCfg);
+               }
+            }
+            else
+            {
+               extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg, NULL);
+            }
+         }
+      }
+   }
+   if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
+      macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
+   if(cuSrvCellCfg->defaultDownlinkBWP_Id)
+      macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
+   if(cuSrvCellCfg->bwp_InactivityTimer)
+   {
+      if(macSrvCellCfg->bwpInactivityTmr)
+      {
+         memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
+      }
+      else
+      {
+         macSrvCellCfg->bwpInactivityTmr = NULLP;
+         DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
+         if(macSrvCellCfg->bwpInactivityTmr)
+         {
+            memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
+         }
+         else
+         {
+            DU_LOG("\nERROR  --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
+            return RFAILED;
+         }
+      }
+   }
+   if(cuSrvCellCfg->pdsch_ServingCellConfig)
+   {
+      if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
+      {
+         ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
+            return RFAILED;
+         }
+      }
+   }
+   if(cuSrvCellCfg->uplinkConfig)
+   {
+      if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
+      {
+         ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
+         if(ulBwp->pusch_Config)
+         {
+            macSrvCellCfg->initUlBwp.puschPresent = true;
+            extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
+         }
+         if(ulBwp->pucch_Config)
+         {
+            macSrvCellCfg->initUlBwp.pucchPresent = true;
+            memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
+            if(storedSrvCellCfg)
+            {
+               if(!storedSrvCellCfg->initUlBwp.pucchPresent)
+                  extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
+               else
+                  extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg,\
+                  &storedSrvCellCfg->initUlBwp.pucchCfg);
+            }
+            else
+            {
+               extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg, NULL);
+            }
+         }
+      }
+      if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
+         macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
+   }
+   return ret;
+}
+/*******************************************************************
+ *
+ * @brief Fills Reconfig Cell group Info received by CU
+ *
+ * @details
+ *
+ *    Function : extractUeReCfgCellInfo
+ *
+ *    Functionality: Fills Reconfig Cell group Info received by CU
+ *   
+ * @params[in] CellGroupConfigRrc_t *cellGrp = CellGroupConfigRrc_t information which
+ *                       is send by CU, which we have stored in F1UeContextSetupDb
+ *             MacUeCfg *MacUeCfg = Used to Store the information,
+ *                      which needs to send in other layer, as well as this can be
+ *                      the variable which stores the information in DuCb,
+ *             MacUeCfg *storedMacUeCfg = Null in case of sending the
+ *                      information to other layer else it will have copyOfmacUeCfg
+ *                      which we have stored in F1UeContextSetupDb.
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg, MacUeCfg *storedMacUeCfg)
+{
+   uint8_t ret = ROK;
+   MAC_CellGroupConfig_t     *macCellGroup = NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
+   SpCellConfig_t            *spcellCfg = NULLP;
+   ServingCellConfig_t       *servCellCfg = NULLP;
+
+   if(cellGrp)
+   {
+      /* Fill MacCell Group Reconfig  */
+      if(cellGrp->mac_CellGroupConfig)
+      {
+         macUeCfg->macCellGrpCfgPres = true;
+         macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
+         if(macCellGroup->schedulingRequestConfig)
+         {
+            extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
+         }
+         if(macCellGroup->tag_Config)
+         {
+            extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
+         }
+         if(macCellGroup->bsr_Config)
+         {
+            macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
+            macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer     = macCellGroup->bsr_Config->retxBSR_Timer;
+            if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
+            {
+               macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer  =\
+               *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
+            }
+         }
+         if(macCellGroup->phr_Config)
+         {
+            if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
+            {
+               macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
+               if(macCellGroup->phr_Config->choice.setup)
+               {
+                  macUeCfg->macCellGrpCfg.phrCfg.periodicTimer     = \
+                  macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
+                  macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer     = \
+                  macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
+                  macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor     = \
+                  macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
+                  macUeCfg->macCellGrpCfg.phrCfg.multiplePHR       = \
+                  macCellGroup->phr_Config->choice.setup->multiplePHR;
+                  macUeCfg->macCellGrpCfg.phrCfg.dummy             = \
+                  macCellGroup->phr_Config->choice.setup->dummy;
+                  macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
+                  macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
+                  macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG        = \
+                  macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
+               }
+            }
+         }
+      }
+      /* Fill Physical Cell Group Reconfig */
+      if(cellGrp->physicalCellGroupConfig)
+      {
+         macUeCfg->phyCellGrpCfgPres = true;
+         phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
+         if(phyCellGrpCfg->p_NR_FR1)
+         {
+            if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
+               macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
+         }
+         macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
+      }
+      /* Fill SpCell Reconfig */
+      if(cellGrp->spCellConfig)
+      {
+         macUeCfg->spCellCfgPres = true;
+         spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
+         if(spcellCfg->servCellIndex)
+         {
+            macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
+         }
+         /* Fill Serving cell Reconfig info */
+         if(cellGrp->spCellConfig->spCellConfigDedicated)
+         {
+            servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
+            if(storedMacUeCfg)
+            {
+               if(!storedMacUeCfg->spCellCfgPres)
+                  ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
+               else
+                  ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg,\
+                        &storedMacUeCfg->spCellCfg.servCellCfg);
+            }
+            else
+            {
+               ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg, NULL);
+            }
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
+            }
+         }
+      }
+   }
+   return ret;
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeNrcgi 
+*
+*    Functionality: Free Nrcgi values
+*
+* @params[in] NRCGI_t *nrcgi
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeNrcgi(NRCGI_t *nrcgi)
+{
+    if(nrcgi->pLMN_Identity.buf != NULLP)
+    {
+       free(nrcgi->pLMN_Identity.buf);
+    }
+    if(nrcgi->nRCellIdentity.buf != NULLP)
+    {
+       free(nrcgi->nRCellIdentity.buf);
+    }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeCuToDuInfo 
+*
+*    Functionality:  Free Cu To Du Information
+*
+* @params[in] CUtoDURRCInformation_t *rrcMsg
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
+{
+   uint8_t ieIdx =0;
+   uint8_t arrIdx =0;
+
+   if(rrcMsg->uE_CapabilityRAT_ContainerList)
+   {
+      if(rrcMsg->uE_CapabilityRAT_ContainerList->buf)
+         free(rrcMsg->uE_CapabilityRAT_ContainerList->buf);
+      free(rrcMsg->uE_CapabilityRAT_ContainerList);
+   }
+
+   if(rrcMsg->iE_Extensions)
+   {
+      if(rrcMsg->iE_Extensions->list.array)
+      {
+        for(ieIdx= 0; ieIdx < rrcMsg->iE_Extensions->list.count; ieIdx++)
+        {
+           if(rrcMsg->iE_Extensions->list.array[ieIdx])
+           {
+              switch(rrcMsg->iE_Extensions->list.array[ieIdx]->id)
+              {
+                 case ProtocolIE_ID_id_CellGroupConfig:
+                    if(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
+                    {
+                       free(rrcMsg->iE_Extensions->list.array[ieIdx]->extensionValue.choice.CellGroupConfig.buf);
+                    }
+                    break;
+                 default:
+                    DU_LOG("\nERROR  -->  F1AP : Invalid Event type %ld at FreeCuToDuInfo()", \
+                          rrcMsg->iE_Extensions->list.array[ieIdx]->id);
+                    break;
+              }
+           }
+        }
+        for(arrIdx = 0; arrIdx < ieIdx; arrIdx++)
+        {
+           free(rrcMsg->iE_Extensions->list.array[arrIdx]);
+        }
+        free(rrcMsg->iE_Extensions->list.array);
+
+      }
+
+      free(rrcMsg->iE_Extensions);
+   }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details 
+*
+*    Function : freeAperDecodeSplCellList
+*
+*    Functionality: Free Spl Cell List 
+                    where memory allocated by aper_decoder
+*
+* @params[in]  SCell_ToBeSetup_List_t *spCellLst
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+{
+    uint8_t  cellIdx =0;
+
+    if(spCellLst->list.array != NULLP)
+    {
+       for(cellIdx=0; cellIdx<spCellLst->list.count; cellIdx++)
+       {
+          if(cellIdx==0&&spCellLst->list.array[cellIdx]!=NULLP)
+          {
+             freeAperDecodeNrcgi(&spCellLst->list.array[cellIdx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+          }
+          if(spCellLst->list.array[cellIdx]!=NULLP)
+          {
+             free(spCellLst->list.array[cellIdx]);
+          }
+       }
+       free(spCellLst->list.array);
+    }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeSRBSetup 
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] SRBs_ToBeSetup_List_t *srbSet
+* @return void
+*
+****************************************************************/
+
+
+void freeAperDecodeSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
+{
+    uint8_t srbIdx =0;
+    if(srbSet->list.array != NULLP)
+    {
+       for(srbIdx=0; srbIdx<srbSet->list.count; srbIdx++)
+       {
+          if(srbSet->list.array[srbIdx]!=NULLP)
+          {
+             free(srbSet->list.array[srbIdx]);
+          }
+       }
+       free(srbSet->list.array);
+    }
+}
+
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeULTnlInfo
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+* @return void
+*
+* ****************************************************************/
+
+
+void freeAperDecodeULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+   uint8_t ulIdx=0;
+   if(ulInfo->list.array != NULLP)
+   {
+      for(ulIdx=0; ulIdx<ulInfo->list.count; ulIdx++)
+      {
+        if(ulIdx==0&&ulInfo->list.array[ulIdx]!=NULLP)
+        {
+           if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel!=NULLP)
+           {
+              if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                    transportLayerAddress.buf != NULLP)
+              {
+                 if(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
+                       !=NULLP)
+                 {
+                    free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf);
+                 }
+                 free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                       transportLayerAddress.buf);
+              }
+              free(ulInfo->list.array[ulIdx]->uLUPTNLInformation.choice.gTPTunnel);
+           }
+        }
+        if(ulInfo->list.array[ulIdx]!=NULLP)
+        {
+           free(ulInfo->list.array[ulIdx]);
+        }
+      }
+      free(ulInfo->list.array);
+   }
+}
+/*******************************************************************
+*
+* @brief free the memory allocated by decoder
+*
+* @details
+*
+*    Function : freeAperDecodeDRBSetup  
+*
+*    Functionality: free DRBSetup which is allocated by decoder
+*
+* @params[in]  DRBs_ToBeSetup_List_t *drbSet
+* @return void
+*
+* ****************************************************************/
+
+void freeAperDecodeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
+{
+   DRBs_ToBeSetup_Item_t *drbSetItem = NULLP;
+   uint8_t  flowIdx =0;
+   uint8_t  drbIdx =0;
+
+   if(drbSet->list.array != NULLP)
+   {
+      for(drbIdx=0; drbIdx<drbSet->list.count; drbIdx++)
+      {
+         if(drbIdx==0&&drbSet->list.array[drbIdx] != NULLP)
+         {
+            drbSetItem =&drbSet->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+            if(drbSetItem->qoSInformation.choice.choice_extension != NULLP)
+            {
+               if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                     qoS_Characteristics.choice.non_Dynamic_5QI !=NULLP)
+               {
+                  if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                        qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+                  {
+                     if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                           qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+                     {
+
+                        if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf!=NULLP)
+                        {
+
+                           if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD!=NULLP)
+                           {
+
+                              if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD->\
+                                    buf!=NULLP)
+                              {
+
+                                 if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.\
+                                       flows_Mapped_To_DRB_List.list.array != NULLP)
+                                 {
+
+                                    for(flowIdx=0;flowIdx<drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                          DRB_Information.flows_Mapped_To_DRB_List.list.count; flowIdx++)
+                                    {
+
+                                       if(flowIdx==0&&drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                             DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
+                                       {
+                                          if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                qoSFlowLevelQoSParameters.\
+                                                qoS_Characteristics.choice.non_Dynamic_5QI!=NULLP)
+                                          {
+                                             if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                   DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                   qoSFlowLevelQoSParameters.\
+                                                   qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+                                             {
+
+                                                if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                      DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                      qoSFlowLevelQoSParameters.\
+                                                      qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+                                                {
+
+
+                                                   free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                         DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                         qoSFlowLevelQoSParameters.\
+                                                         qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                                                }
+
+                                                free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                      DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                      qoSFlowLevelQoSParameters.\
+                                                      qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+                                             }
+
+                                             free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+
+                                                   DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]->\
+                                                   qoSFlowLevelQoSParameters.\
+                                                   qoS_Characteristics.choice.non_Dynamic_5QI);
+                                          }
+                                       }
+                                       if(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                             DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]!=NULLP)
+                                       {
+
+                                          free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                                DRB_Information.flows_Mapped_To_DRB_List.list.array[flowIdx]);
+                                       }
+                                    }
+
+                                    free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                          DRB_Information.flows_Mapped_To_DRB_List.list.array);
+                                 }
+
+                                 free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.\
+                                       DRB_Information.sNSSAI.sD->buf);
+                              }
+
+                              free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sD);
+                           }
+
+                           free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI.sST.buf);
+
+                        }
+
+                        free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+
+                              qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                     }
+
+                     free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                           qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+                  }
+
+                  free(drbSetItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS.\
+                        qoS_Characteristics.choice.non_Dynamic_5QI);
+               }
+               free(drbSetItem->qoSInformation.choice.choice_extension);
+            }
+            freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
+            if(drbSetItem->uLConfiguration)
+            {
+               free(drbSetItem->uLConfiguration);
+            }
+         }
+         if(drbSet->list.array[drbIdx]!=NULLP)
+         {
+            free(drbSet->list.array[drbIdx]);
+         }
+      }
+      free(drbSet->list.array);
+   }
+}
+
+
+/*******************************************************************
+ *
+ * @brief builds Mac Cell Cfg
+ *
+ * @details
+ *
+ *    Function : procUeReCfgCellInfo
+ *
+ *    Functionality: builds Mac Cell Cfg
+ *
+ * @params[in] MacUeCfg *macUeCfgToSend = Used to Store the information which
+ *                       needs to send in other layer, as well as this can be
+ *                       the variable which stores the information in DuCb.
+ *             MacUeCfg *storedMacUeCfg = Null in case of sending the
+ *                       information to other layer else it will have copyOfmacUeCfg  
+ *                       which we have stored in F1UeContextSetupDb
+ *             void *cellInfo = CellGroupConfigRrc_t information which is send
+ *                        by CU, which we have stored in F1UeContextSetupDb 
+ *
+ * @return void 
+ *
+ * ****************************************************************/
+uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfgToSend, MacUeCfg *storedMacUeCfg, void *cellInfo)
+{
+   uint8_t ret = ROK;
+   CellGroupConfigRrc_t *cellGrp = NULLP;
+
+   if(cellInfo)
+   {
+      cellGrp = (CellGroupConfigRrc_t *)cellInfo;
+      ret = extractUeReCfgCellInfo(cellGrp, macUeCfgToSend, storedMacUeCfg);
+      if(ret == RFAILED)
+         DU_LOG("\nERROR  -->  F1AP : Failed at procUeReCfgCellInfo()");
+   }
+   if(ret == RFAILED)
+   {
+      freeUeReCfgCellGrpInfo(macUeCfgToSend);
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Filling modulation info in mac ue cfg
+ *
+ * @details
+ *
+ *    Function : duFillModulationDetails
+ *
+ *    Functionality: Filling modulation info in mac ue cfg
+ *
+ * @params[in] MAC UE Config to be updated
+ *             Current UE configuration
+ *             UE NR capability from CU
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
+{
+   UE_NR_Capability_t *ueNrCap=NULLP;
+
+   if(!ueCap && oldUeCfg)
+   {
+      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));     
+      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+   }
+   else
+   {
+      ueNrCap = (UE_NR_Capability_t *)ueCap;
+
+      /* Filling DL modulation info */
+      if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
+         ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
+         ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
+      {
+         switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
+         {
+            case ModulationOrder_qpsk:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
+                  break;
+               }
+            case ModulationOrder_qam16:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
+                  break;
+               }
+            case ModulationOrder_qam64:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
+                  ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
+                  ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam256:
+               {
+                  ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
+                  break;
+               }
+            default:
+               {
+                  DU_LOG("\nERROR  -->  DU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
+                  if(oldUeCfg)
+                     memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         if(oldUeCfg)
+            memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+      }
+
+      /* Filling UL modulation info */
+      if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
+         ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
+         ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
+      {
+         switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
+         {
+            case ModulationOrder_qpsk:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
+                  break;
+               }
+            case ModulationOrder_qam16:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
+                  ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
+                  ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam64:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
+                  break;
+               }
+            case ModulationOrder_qam256:
+               {
+                  ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
+                  break;
+               }
+            default:
+               {
+                  DU_LOG("\nERROR  -->  DU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
+                  if(oldUeCfg)
+                     memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         if(oldUeCfg)
+            memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract info from CU to DU RRC container extension
+ *
+ * @details
+ *
+ *    Function : extractCuToDuRrcInfoExt
+ *
+ *    Functionality: Function to extract info from CU to DU RRC container
+ *    extension
+ *
+ * @params[in] ProtocolExtensionContainer_4624P16_t pointer
+ *
+ * @return ROK
+ *         RFAILED
+ *
+ * ****************************************************************/
+uint8_t extractCuToDuRrcInfoExt(ProtocolExtensionContainer_4624P16_t *protocolIeExtn, DuUeCfg *ueCfgDb)
+{
+   uint8_t ieIdx =0;
+   uint16_t recvBufLen =0;
+   CellGroupConfigRrc_t *cellGrpCfg = NULLP;
+   CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
+   asn_dec_rval_t rval; /* Decoder return value */
+   memset(&rval, 0, sizeof(asn_dec_rval_t));
+
+   if(protocolIeExtn)
+   {
+      for(ieIdx = 0; ieIdx < protocolIeExtn->list.count; ieIdx++)
+      {
+         extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[ieIdx]));
+         switch(extIeInfo->id)
+         {
+            case ProtocolIE_ID_id_CellGroupConfig:
+               {
+                  /* decoding the CellGroup Buf received */
+                  recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
+                  DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
+                  if(cellGrpCfg)
+                  {
+                     memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
+                     rval = aper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
+                           extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
+                     if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+                     {
+                        DU_LOG("\nERROR  -->  F1AP : ASN decode failed at decodeCellGrpCfg()");
+                        return RFAILED;
+                     }
+                     xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
+
+                     if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
+                        return NULLP;
+                     ueCfgDb->cellGrpCfg = cellGrpCfg;
+                  }
+                  break;
+               }
+
+            case ProtocolIE_ID_id_HandoverPreparationInformation:
+               {
+                  DU_LOG("\nINFO -->  F1AP : Received HANDOVER PREPARATION INFO in UE CONTEXT SETUP REQUEST");
+                  break;
+               }
+
+            default:
+               DU_LOG("\nERROR  -->  F1AP : Invalid IE received CUtoDURRCInformation: %ld at decodeCellGrpCfg()", extIeInfo->id);
+               break;
+         }
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Srb List received by CU
+ *
+ * @details
+ *
+ *    Function : procSrbListToSetup
+ *
+ *    Functionality: Fills Srb List received  by CU
+ *
+ * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
+ *             LcCfg pointer
+ *             RlcBearerCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+{
+
+   /* Filling RLC INFO */
+   procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
+
+   /* Filling MAC INFO */
+   if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL)  != ROK)
+   { 
+      DU_LOG("\nERROR  -->  F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+
+
+/*******************************************************************
+ *
+ * @brief extract Srb List received by CU
+ *
+ * @details
+ *
+ *    Function : extractSrbListToSetup
+ *
+ *    Functionality: extract Srb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] SRBs_ToBeSetup_Item_t pointer
+ *             DuUeCfg pointer
+ * @return ROK/RFAIED
+ *
+ * ****************************************************************/
+
+uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
+{
+   uint8_t ret = ROK, srbIdx = 0, rlcLcIdx = 0;
+   SRBs_ToBeSetup_Item_t *srbItem = NULLP;
+   LcCfg *macLcCtxt = NULLP;
+   RlcBearerCfg *rlcLcCtxt = NULLP;
+
+   if(srbCfg)
+   {
+      for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
+      {
+         macLcCtxt = NULL;
+         rlcLcCtxt = NULL;
+
+         srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
+         if(ueCfgDb->numMacLcs > MAX_NUM_LC)
+         { 
+            DU_LOG("\nERROR   -->  F1AP:  MAX LC Reached in MAC");
+            ret = RFAILED;
+            break;
+         }
+         if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+         {
+            DU_LOG("\nERROR   -->  F1AP:  MAX LC Reached in RLC");
+            ret = RFAILED;
+            break;
+         }
+
+         for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numMacLcs; rlcLcIdx++)
+         {
+            if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == srbItem->sRBID && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_SRB)
+            {
+               macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
+               rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
+               break;
+            }
+         }
+         if(!macLcCtxt)
+         {
+            memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+            macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
+            ueCfgDb->numMacLcs++;
+         }
+         if(!rlcLcCtxt)
+         {
+            memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+            rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
+            ueCfgDb->numRlcLcs++;
+         }
+
+         ret = procSrbListToSetup(srbItem, macLcCtxt, rlcLcCtxt);
+
+         DU_LOG("\nDEBUG --> DUAPP: extractSrbListToSetup: SRBID: %ld [RLC,MAC,NumDrb]:[%x,%x,%x]",\
+               srbItem->sRBID, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs,  ueCfgDb->numDrb);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  -->  F1AP:  Failed at extractSrbListToSetup()");
+            break;
+         }
+      }
+   }
+   else
+      ret = RFAILED;
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Drb List received by CU
+ *
+ * @details
+ *
+ *    Function : procDrbListToSetupMod
+ *
+ *    Functionality: Fills Drb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
+ *             DRBs_ToBeModified_Item_t , lcId, LcCfg pointer,
+ *             RlcBearerCfg , UpTnlCfg, RlcUeCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg)
+{
+   uint8_t cfgIdx = 0;
+   RlcMode rlcModeInfo;
+
+   if(drbItem != NULLP)
+   {
+      /* Filling RLC INFO */
+      procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
+      qoSInformation);
+
+      /* Filling MAC INFO */
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
+      { 
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
+         return RFAILED;
+      }
+   }
+   else if(drbSetupModItem != NULLP)
+   {
+      procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, 
+      &drbSetupModItem->qoSInformation);
+
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
+         return RFAILED;
+      }
+   }
+   else if(drbModItem != NULLP)
+   {
+      /* Drb to Mod IEs doesnot have rlcMode to be modified
+       * in ASN. Hence no change in RLC configurations */
+      if(storedRlcUeCfg != NULLP)
+      {
+         for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
+         {
+            if(storedRlcUeCfg->rlcLcCfg[cfgIdx].lcId == lcId)
+            {
+               rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcMode;
+               break;
+            }
+         }
+      }
+
+      procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
+         return RFAILED;
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief extract Drb List received by CU
+ *
+ * @details
+ *
+ *    Function : extractDrbListToSetupMod
+ *
+ *    Functionality: extract Drb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] DRBs_ToBeSetup_Item_t pointer
+ *             DuUeCfg pointer
+ * @return ROK/RFAIED
+ *
+ * ****************************************************************/
+
+uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
+ DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg)
+{
+   uint8_t ret = ROK;
+   uint8_t drbIdx = 0, rlcLcIdx = 0;
+   uint8_t drbId = 0, lcId = 0;
+   DRBs_ToBeSetup_Item_t *drbItem = NULLP;
+   DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
+   DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
+   LcCfg *macLcCtxt = NULLP;
+   RlcBearerCfg *rlcLcCtxt = NULLP;
+
+   ret = ROK;
+   if(drbCount > 0)
+   {
+      for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
+      {
+         macLcCtxt = NULL;
+         rlcLcCtxt = NULL;
+
+         if(ueCfgDb->numMacLcs > MAX_NUM_LC)
+         { 
+            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in MAC at extractDrbListToSetupMod()");
+            ret = RFAILED;
+            break;
+         }
+         if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+         {
+            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in RLC at extractDrbListToSetupMod()");
+            ret = RFAILED;
+            break;
+         }
+
+         if(drbModCfg != NULLP)
+         {
+            drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
+            drbId = drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID;
+         }
+         else if(drbCfg != NULLP)
+            drbId = drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item.dRBID;
+         else if(drbSetupModCfg != NULL)
+         {
+            drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
+            drbId = drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item.dRBID;
+         }
+
+         for(rlcLcIdx = 0; rlcLcIdx < ueCfgDb->numRlcLcs; rlcLcIdx++)
+         {
+            if(ueCfgDb->rlcLcCfg[rlcLcIdx].rbId == drbId && ueCfgDb->rlcLcCfg[rlcLcIdx].rbType == RB_TYPE_DRB)
+            {
+               macLcCtxt = &ueCfgDb->macLcCfg[rlcLcIdx];
+               rlcLcCtxt = &ueCfgDb->rlcLcCfg[rlcLcIdx];
+               break;
+            }
+         }
+         if(!macLcCtxt)
+         {
+            memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+            macLcCtxt = &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs];
+            ueCfgDb->numMacLcs++;
+         }
+         if(!rlcLcCtxt)
+         {
+            memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+            rlcLcCtxt = &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs];
+            ueCfgDb->numRlcLcs++;
+         }
+
+         if(drbModCfg != NULLP)
+         {
+            lcId = fetchLcId(drbId);
+            if(lcId < MIN_DRB_LCID)
+            {
+               DU_LOG("\nERROR  --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
+               break;
+            } 
+            ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
+            macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
+               break;
+            }
+         }
+         else
+         {
+            lcId = getDrbLcId(drbBitMap);
+            if(lcId == RFAILED)
+            {
+               DU_LOG("\nERROR  -->  F1AP :  InCorrect LCID extractDrbListToSetupMod()");
+               ret = RFAILED;
+               break;
+            }
+            if(drbCfg != NULL)
+            {
+               drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+               ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
+                  break;
+               }
+            }
+            else if(drbSetupModCfg != NULL)
+            {
+               ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
+                     macLcCtxt, rlcLcCtxt, &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
+                  break;
+               }
+               ueCfgDb->numDrbSetupMod++;
+            }
+         }
+         ueCfgDb->numDrb++;
+         DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
+                            lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs,  ueCfgDb->numDrb);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod()");
+            break;
+         }
+      }
+   }
+   else
+      ret = RFAILED;
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract Dl RRC Msg received from CU
+ *
+ * @details
+ *
+ *    Function : extractDlRrcMsg
+ *
+ *    Functionality: Function to extract Dl RRC Msg received from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
+   F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
+{
+   uint8_t ret = ROK;
+   dlRrcMsg->rrcMsgSize = rrcContainer->size;
+   if(dlRrcMsg->rrcMsgSize > 0)
+   {
+      DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
+      if(!dlRrcMsg->rrcMsgPdu)
+      {
+         DU_LOG("\nERROR  --> DU APP : Memory allocation failed for RRC Msg in extractDlRrcMsg()");
+         ret = RFAILED;
+      }
+      else
+      {
+         dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
+         dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
+         dlRrcMsg->srbId = SRB1_LCID;
+         memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
+      }
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Extract UE capability info 
+ *
+ * @details
+ *
+ *    Function : extractUeCapability
+ *
+ *    Functionality: Extract UE capability info and stores in ue Cb
+ *
+ * @params[in] Octet string of UE capability RAT container list
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
+{
+   uint8_t  idx;
+   uint16_t recvBufLen;
+   asn_dec_rval_t rval;
+   UE_NR_Capability_t  *ueNrCap = NULLP;
+   UE_CapabilityRAT_ContainerListRRC_t  *ueCapRatContList = NULLP;
+
+   /* Decoding UE Capability RAT Container List */
+   recvBufLen = ueCapablityListBuf->size;
+   DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
+   if(!ueCapRatContList)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in extractUeCapability");
+      return NULLP;
+   }
+   memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
+   memset(&rval, 0, sizeof(asn_dec_rval_t));
+   rval = aper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
+          ueCapablityListBuf->buf, recvBufLen, 0, 0);
+   if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+   {
+      DU_LOG("\nERROR  -->  F1AP : ASN decode failed at decodeCellGrpCfg()");
+      return NULLP;
+   }
+   xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
+
+   /* Free encoded buffer after decoding */
+
+   for(idx = 0; idx < ueCapRatContList->list.count; idx++)
+   {
+      if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
+      {
+         /* Decoding UE NR Capability */
+          recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
+          DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
+          if(!ueNrCap)
+          {
+             DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in extractUeCapability");
+             DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
+             return NULLP;
+          } 
+          memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
+          memset(&rval, 0, sizeof(asn_dec_rval_t));
+          rval = aper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
+                 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
+          if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+          {
+             DU_LOG("\nERROR  -->  F1AP : ASN decode failed at decodeCellGrpCfg()");
+             return NULLP;
+          }
+          xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
+          
+          /* Free encoded buffer after decoding */
+          free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
+      }
+      free(ueCapRatContList->list.array[idx]);
+   }
+
+   /* Free Memory*/
+   free(ueCapRatContList->list.array);
+   DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
+   return ueNrCap;
+}
+/*******************************************************************
+*
+* @brief free UE context setup request from CU
+*
+* @details
+*
+*    Function : freeAperDecodeF1UeContextSetupReq
+*
+*    Functionality: freeing part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP message
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t   *ueSetReq)
+{
+   uint8_t ieIdx = 0;
+
+   if(ueSetReq->protocolIEs.list.array != NULLP)
+   {
+      for(ieIdx = 0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
+      {
+        if(ueSetReq->protocolIEs.list.array[ieIdx])
+        {
+           switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_SpCell_ID:
+                 freeAperDecodeNrcgi(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI);
+                 break;
+              case ProtocolIE_ID_id_ServCellIndex:
+                 break;
+              case ProtocolIE_ID_id_SpCellULConfigured:
+                 break;
+              case ProtocolIE_ID_id_CUtoDURRCInformation:
+
+                 freeAperDecodeCuToDuInfo(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation);
+                 break;
+              case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+
+                 freeAperDecodeSplCellList(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SCell_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+
+                 freeAperDecodeSRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
+
+                 freeAperDecodeDRBSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List);
+                 break;
+              case ProtocolIE_ID_id_RRCContainer:
+                 {
+
+                    if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf != NULLP)
+                    {
+
+                       free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
+                    }
+                    break;
+                 }
+              case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+                 break;
+              case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
+                 {
+                    if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf)
+                    {
+                       free(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf);
+                    }
+                    break;
+                 }
+              default:
+                 DU_LOG("\nERROR  -->  F1AP: Invalid event type %ld " ,ueSetReq->protocolIEs.list.array[ieIdx]->id);
+           } 
+           free(ueSetReq->protocolIEs.list.array[ieIdx]);
         }
-         
-        /* Format 3 Cfg */
-         if(cuPucchCfg->choice.setup->format3)
+      }
+      free(ueSetReq->protocolIEs.list.array);
+   }
+}
+/*******************************************************************
+ *
+ * @brief Process UE context setup request from CU
+ *
+ * @details
+ *
+ *    Function : procF1UeContextSetupReq
+ *
+ *    Functionality: Process UE context setup request from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
+{
+   int8_t ueIdx = -1;
+   uint8_t  ret=0, ieIdx=0, ieExtIdx = 0, servCellIdx = 0;
+   bool ueCbFound = false, hoInProgress = false;
+   uint16_t nrCellId = 0,  cellIdx=0;
+   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
+   DuUeCb   *duUeCb = NULL;
+   UEContextSetupRequest_t   *ueSetReq = NULL;
+   DRBs_ToBeSetup_List_t *drbCfg = NULL;
+   CUtoDURRCInformation_t *rrcInfo = NULL;
+
+   ret = ROK;
+
+   ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+   for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
+   {
+      switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+      {
+         case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+            {
+               gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
+               break;
+            }
+
+         case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+            {
+               gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
+               break;
+            }
+
+         case ProtocolIE_ID_id_SpCell_ID:
+            {
+               bitStringToInt(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.NRCGI.nRCellIdentity, &nrCellId);
+
+               GET_CELL_IDX(nrCellId, cellIdx);
+               if(!duCb.actvCellLst[cellIdx])
+               {
+                  DU_LOG("\nERROR  -->  F1AP : Cell Id [%d] not found", nrCellId);
+                  ret = RFAILED;
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_ServCellIndex:
+            {
+               servCellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
+               break;
+            }
+
+         case ProtocolIE_ID_id_SpCellULConfigured:
+            {
+               /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL, 
+                  UL, SUL or UL+SUL for the indicated cell for the UE */
+               break;
+            }
+
+         case ProtocolIE_ID_id_CUtoDURRCInformation:
+            {
+               rrcInfo = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation;
+
+               /* Search if UE context is present */
+               for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+               {
+                  if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId)
+                  {
+                     ueCbFound = true;
+                     duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                     break;
+                  }
+               }
+
+               /* Check if UE Handover scenario */
+               if(rrcInfo->iE_Extensions)
+               {
+                  for(ieExtIdx = 0; ieExtIdx < rrcInfo->iE_Extensions->list.count; ieExtIdx++)
+                  {
+                     if(rrcInfo->iE_Extensions->list.array[ieExtIdx]->id == ProtocolIE_ID_id_HandoverPreparationInformation)
+                     {
+                        hoInProgress = true;
+                        break;
+                     }
+                  }
+               }
+               
+               /* If UE context is not present, but UE is in handover */
+               if(!ueCbFound && hoInProgress)
+               {
+                  ueIdx = getFreeBitFromUeBitMap(nrCellId);
+                  if(ueIdx != -1)
+                     gnbDuUeF1apId = ueIdx +1;
+                  else
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : No free UE IDX found in UE bit map of cell Id [%d]", nrCellId);
+                     ret = RFAILED;
+                     break;
+                  }
+                  duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                  duUeCb->f1UeDb = NULL;
+                  duUeCb->gnbCuUeF1apId = gnbCuUeF1apId;
+                  duUeCb->gnbDuUeF1apId = gnbDuUeF1apId;
+                  duUeCb->ueState = UE_HANDIN_IN_PROGRESS;
+               }
+
+               if(duUeCb)
+               {
+                  DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                  if(duUeCb->f1UeDb)
+                  {
+                     memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+                     duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
+                     duUeCb->f1UeDb->cellIdx = cellIdx;
+                  }
+                  else
+                  {
+                     DU_LOG("\nERROR  -->  F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
+                     ret = RFAILED;
+                     break;
+                  }
+               }
+               else
+               {
+                  DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                  ret = RFAILED;
+                  break;
+               }
+                 
+               /* Extract UE capability info */
+               if(rrcInfo->uE_CapabilityRAT_ContainerList)
+               {
+                  duUeCb->f1UeDb->duUeCfg.ueNrCapability = extractUeCapability(rrcInfo->uE_CapabilityRAT_ContainerList, duUeCb);
+               }
+
+               /* Extract IE extension */
+               if(rrcInfo->iE_Extensions)
+               {
+                  if(extractCuToDuRrcInfoExt(rrcInfo->iE_Extensions, &duUeCb->f1UeDb->duUeCfg) != ROK)
+                  {
+                     DU_LOG("\nERROR  -->  F1AP: Failed to extract CU to DU RRC information extension IE");
+                     //TODO: Update the failure cause in ue context Setup Response
+                     ret = RFAILED;
+                  }
+               }
+               break;
+            } 
+
+         case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+            {
+               DU_LOG("\nINFO   -->  DU_APP: Received SCell_ToBeSetup_List but  Not processing the list");
+               break;
+            }
+
+         case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+            {
+               if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
+                        &duUeCb->f1UeDb->duUeCfg))
+               {
+                  DU_LOG("\nERROR  -->  DU APP : Failed at extractSrbListToSetup()");
+                  //TODO: Update the failure cause in ue context Setup Response
+                  ret = RFAILED;
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
+            {
+               drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
+
+               if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
+               {
+                  DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod()");
+                  //TODO: Update the failure cause in ue context Setup Response
+                  ret = RFAILED;
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCContainer:
+            {
+               /* Filling Dl RRC Msg Info */
+               DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+               if(!duUeCb->f1UeDb->dlRrcMsg)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
+                  ret = RFAILED;
+               }
+               else
+               {
+                  duUeCb->f1UeDb->dlRrcMsgPres = true;
+                  memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                  ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                        &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
+               }         
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+            {
+               if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+               {
+                  duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
+               }
+               else
+               {
+                  DU_LOG("\nERROR  -->  Ignoring delivery report, since rrcContainer is not present");
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
+            {
+               /* MaximumBitRate Uplink */
+               bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
+               if(bitRateSize > 0)
+               {
+                  DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
+                  if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
+                  {
+                     DU_LOG("\nERROR  -->  DU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
+                     ret = RFAILED;
+                  }
+                  else
+                  {
+                     memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg)); 
+                     memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
+                           ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
+                  }
+               }
+               else
+                  ret = RFAILED;
+               break;
+            }
+
+         default:
+            {
+               break;
+            }
+      } /* End of switch */
+
+      /* In case of any failure in any IE */
+      if(ret == RFAILED)
+      {
+         // BuildAndSendUeContextSetupRsp(cellId,ueId);
+         DU_LOG("\nERROR  -->  F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); 
+         break;
+      }
+   } /* End of for loop of IEs */
+
+   if(ret == ROK)
+      ret = duProcUeContextSetupRequest(duUeCb);
+
+   freeAperDecodeF1UeContextSetupReq(ueSetReq); 
+   return ret;
+
+}
+/*******************************************************************
+ * @brief Free the memory allocated for Dl Tunnel Info
+ *
+ * @details
+ *
+ *    Function : freeDlTnlInfo
+ *
+ *    Functionality:
+ *       Free the memory allocated for Dl Tunnel Info
+ *
+ * @params[in] DLUPTNLInformation_ToBeSetup_List_t *
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeDlTnlInfo(DLUPTNLInformation_ToBeSetup_List_t *tnlInfo)
+{
+   uint8_t arrIdx = 0;
+
+   if(tnlInfo)
+   {
+      for(arrIdx=0; arrIdx < tnlInfo->list.count; arrIdx++)
+      {
+         DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf,\
+               tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.size);
+         DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf,\
+               tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel->gTP_TEID.size);
+         DU_FREE(tnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
+         DU_FREE(tnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
+      }
+      DU_FREE(tnlInfo->list.array, tnlInfo->list.size);
+   }
+}
+
+/*******************************************************************
+ * @brief Free the memory allocated for DRB setup List
+ *
+ * @details
+ *
+ *    Function : freeDrbSetupList
+ *
+ *    Functionality:
+ *       Free the memory allocated for DRB setup list
+ *
+ * @params[in] DRBs_Setup_List_t *
+ * @return void
+ *
+ * ****************************************************************/
+void freeDrbSetupList(DRBs_Setup_List_t *drbSetupList)
+{
+   uint8_t arrIdx = 0;
+   DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
+
+   for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
+   {
+      drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+      freeDlTnlInfo(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List);
+      DU_FREE(drbSetupList->list.array[arrIdx],  sizeof(DRBs_Setup_Item_t));
+   }
+   DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
+}
+
+/*******************************************************************
+ * @brief Free the memory allocated for UE Setup response
+ *
+ * @details
+ *
+ *    Function : FreeUeContextSetupRsp
+ *
+ *    Functionality:
+ *       Free the memory allocated for UE Setup response
+ *
+ * @params[in] F1AP PDU for UE setup response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t idx;
+   UEContextSetupResponse_t *ueSetRsp = NULLP;
+
+   if(f1apMsg)
+   {
+      if(f1apMsg->choice.successfulOutcome)
+      {
+        ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
+                   UEContextSetupResponse;
+        if(ueSetRsp->protocolIEs.list.array)
         {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->format3, sizeof(PucchFormatCfg));
-           if(macPucchCfg->format3 == NULLP)
+           for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
            {
-              DU_LOG("\nERROR --> F1AP : Failed to extract format 3 Cfg in  extractPucchCfg()");
-              return RFAILED;
+              if(ueSetRsp->protocolIEs.list.array[idx])
+              {
+                 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
+                 {
+                    case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                       break;
+                    case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                       break;
+                    case ProtocolIE_ID_id_DUtoCURRCInformation:
+                       {
+                          CellGroupConfig_t *cellGrpCfg = NULLP;
+                          cellGrpCfg  = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
+                                        DUtoCURRCInformation.cellGroupConfig;
+                          if(cellGrpCfg->buf != NULLP)
+                          {
+                             DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
+                             cellGrpCfg = NULLP;
+                          }
+                          break;
+                       }
+                    case ProtocolIE_ID_id_DRBs_Setup_List:
+                       {
+                           freeDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List); 
+                           break;
+                       }
+                    default:
+                       DU_LOG("\nERROR  -->  DUAPP: Invalid Id %ld at FreeUeContextSetupRsp()",\
+                       ueSetRsp->protocolIEs.list.array[idx]->id);
+                       break;
+                 }
+                 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
+                       sizeof(UEContextSetupResponseIEs_t));
+              }
            }
-           memset(macPucchCfg->format3, 0, sizeof(PucchFormatCfg));
-            extractPucchFormatCfg(macPucchCfg->format3,\
-              cuPucchCfg->choice.setup->format3->choice.setup);
+           DU_FREE(ueSetRsp->protocolIEs.list.array, \
+                 ueSetRsp->protocolIEs.list.size);
         }
+        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Ue context Setup Rsp DU To CU Info
+ *
+ * @details
+ *
+ *    Function : EncodeUeCntxtDuToCuInfo
+ *
+ *    Functionality: Builds Ue context Setup Rsp DU To CU Info
+ *
+ * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t * 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
+{
+   asn_enc_rval_t        encRetVal;
+
+   xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
+   memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
+   encBufSize = 0;
+   encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
+   /* Encode results */
+   if(encRetVal.encoded == ENCODE_FAIL)
+   {
+      DU_LOG( "\nERROR  -->  F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
+           encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+      return RFAILED;
+   }
+   else
+   {
+      DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
+      for(int i=0; i< encBufSize; i++)
+      {
+        printf("%x",encBuf[i]);
+      }
+   }
+   duToCuCellGrp->size = encBufSize;
+   DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
+   if(!duToCuCellGrp->buf)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in UeCntxtDuToCuInfo");
+   }
+   memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
+   return ROK;
+}
 
-         /* Format 4 Cfg */
-         if(cuPucchCfg->choice.setup->format4)
-        {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->format4, sizeof(PucchFormatCfg));
-           if(macPucchCfg->format4 == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract format 4 Cfg in  extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->format4, 0, sizeof(PucchFormatCfg));
-            extractPucchFormatCfg(macPucchCfg->format4,\
-              cuPucchCfg->choice.setup->format4->choice.setup);
-        }
+/*******************************************************************
+ *
+ * @brief Fills Dl Gtp tunnel Info
+ *
+ * @details
+ *
+ *    Function : fillGtpTunnelforDl
+ *
+ *    Functionality: Fills Dl Gtp tunnel Info
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 
-         /* Sched Req List */
-         if(cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList)
-        {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->schedReq, sizeof(PucchSchedReqCfg));
-           if(macPucchCfg->schedReq == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract schedReqCfg in  extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->schedReq, 0, sizeof(PucchSchedReqCfg));
-            extractSchedReqCfgToAddMod(macPucchCfg->schedReq,\
-           cuPucchCfg->choice.setup->schedulingRequestResourceToAddModList);
-        }
+uint8_t fillGtpTunnelforDl(GTPTunnel_t *gtpDl, GtpTnlCfg *gtpUeCfg)
+{
+   uint8_t bufSize = 0;
+
+   gtpDl->transportLayerAddress.size   = 4*sizeof(uint8_t);
+   DU_ALLOC(gtpDl->transportLayerAddress.buf, gtpDl->transportLayerAddress.size);
+   if(gtpDl->transportLayerAddress.buf == NULLP)
+   {
+      return RFAILED;
+   }
+   memcpy(gtpDl->transportLayerAddress.buf, &gtpUeCfg->dlTnlAddress, gtpDl->transportLayerAddress.size);
+
+   /*GTP TEID*/
+   gtpDl->gTP_TEID.size = 4 * sizeof(uint8_t);
+   DU_ALLOC(gtpDl->gTP_TEID.buf, gtpDl->gTP_TEID.size);
+   if(gtpDl->gTP_TEID.buf == NULLP)
+   {
+      return RFAILED;
+   }
+   bufSize = 3; /*forming an Octect String*/
+   fillTeIdString(bufSize, gtpUeCfg->teId, gtpDl->gTP_TEID.buf);
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills DL Tunnel Setup List
+ *
+ * @details
+ *
+ *    Function : fillDlTnlSetupList
+ *
+ *    Functionality: Fills the DL Tunnel Setup List
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t fillDlTnlSetupList(DLUPTNLInformation_ToBeSetup_List_t *dlTnlInfo, UpTnlCfg *tnlCfg)
+{
+   uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
+
+   eleCount = 1;
+   dlTnlInfo->list.count = eleCount; 
+   dlTnlInfo->list.size = (eleCount * sizeof(DLUPTNLInformation_ToBeSetup_Item_t *));
+
+   /* Initialize the DL Tnl Setup List Members */
+   DU_ALLOC(dlTnlInfo->list.array, dlTnlInfo->list.size);
+   if(dlTnlInfo->list.array == NULLP)
+   {
+      DU_LOG(" ERROR  -->  F1AP : Memory allocation for DL Tnl Setup List in fillDlTnlSetupList()");
+      ret = RFAILED;
+   }
+   for(arrIdx=0; arrIdx < eleCount; arrIdx++)
+   {
+      DU_ALLOC(dlTnlInfo->list.array[arrIdx], sizeof(DLUPTNLInformation_ToBeSetup_Item_t));
+      if(dlTnlInfo->list.array[arrIdx] == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for arrIdx [%d] failed in fillDlTnlSetupList()", arrIdx);
+         return RFAILED;
+      }
+      dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.present = UPTransportLayerInformation_PR_gTPTunnel;
+      DU_ALLOC(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel, sizeof(GTPTunnel_t));
+      if(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for DL tunnel info in fillDlTnlSetupList()");
+         return RFAILED;
+      }
+      ret = fillGtpTunnelforDl(dlTnlInfo->list.array[arrIdx]->dLUPTNLInformation.choice.gTPTunnel,\
+               tnlCfg->tnlCfg1);
+      if(ret != ROK)
+         break;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills the Drb Setup List for Ue Context Setup Response
+ *
+ * @details
+ *
+ *    Function : fillDrbSetupList
+ *
+ *    Functionality: Fills the Drb Setup List for Ue Context Setup Response
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
+{
+   uint8_t ret = ROK, arrIdx = 0, eleCount = 0;
+   DRBs_Setup_ItemIEs_t *drbItemIe = NULLP;
+
+   eleCount = ueCfg->numDrb;
+   drbSetupList->list.count = eleCount;
+   drbSetupList->list.size = \
+       (eleCount * sizeof(DRBs_Setup_Item_t *));
+
+   /* Initialize the Drb Setup List Members */
+   DU_ALLOC(drbSetupList->list.array, drbSetupList->list.size);
+   if(drbSetupList->list.array == NULLP)
+   {
+      DU_LOG(" ERROR  -->  F1AP : Memory allocation for DRB Setup List in fillDrbSetupList()");
+      ret = RFAILED;
+   }
+
+   for(arrIdx=0; arrIdx < eleCount; arrIdx++)
+   {
+      DU_ALLOC(drbSetupList->list.array[arrIdx], sizeof(DRBs_Setup_Item_t));
+      if(drbSetupList->list.array[arrIdx] == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for arrIdx [%d] failed in fillDrbSetupList()", arrIdx);
+         return RFAILED;
+      }
+      drbItemIe = ((DRBs_Setup_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+      drbItemIe->id = ProtocolIE_ID_id_DRBs_Setup_Item;
+      drbItemIe->criticality = Criticality_reject;
+      drbItemIe->value.present = DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item;
+      drbItemIe->value.choice.DRBs_Setup_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
+      ret = fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_Setup_Item.dLUPTNLInformation_ToBeSetup_List,\
+          &ueCfg->upTnlInfo[arrIdx]);
+      if(ret != ROK)
+         break;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends the UE Setup Response
+ *
+ * @details
+ *
+ *    Function : BuildAndSendUeContextSetupRsp
+ *
+ *    Functionality: Constructs the UE Setup Response and sends
+ *                   it to the DU through SCTP.
+ *
+ * @params[in] uint8_t cellId,uint8_t ueId
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueId)
+{
+   uint8_t   idx, ret, cellIdx, elementCnt;
+   uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
+   uint32_t  gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
+   asn_enc_rval_t  encRetVal;        /* Encoder return value */
+   F1AP_PDU_t               *f1apMsg = NULLP;
+   UEContextSetupResponse_t *ueSetRsp = NULLP;
+   DuUeCb                   *ueCb = NULLP;
+
+   DU_LOG("\n INFO   -->  F1AP : Building UE Context Setup Response for cellId %d, ueId %d\n", cellId, ueId);
+
+   while(true)
+   {
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
+         ret = RFAILED;
+         break;
+      }
+
+      f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
+      DU_ALLOC(f1apMsg->choice.successfulOutcome,
+            sizeof(SuccessfulOutcome_t));
+      if(f1apMsg->choice.successfulOutcome == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for     F1AP-PDU failed");
+         ret = RFAILED;
+         break;
+      }
+
+      f1apMsg->choice.successfulOutcome->procedureCode = \
+                                                         ProcedureCode_id_UEContextSetup;
+      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = \
+                                                         SuccessfulOutcome__value_PR_UEContextSetupResponse;
+
+      ueSetRsp =
+         &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
+      elementCnt = 4;
+      ueSetRsp->protocolIEs.list.count = elementCnt;
+      ueSetRsp->protocolIEs.list.size = \
+                                        elementCnt * sizeof(UEContextSetupResponse_t *);
+
+      /* Initialize the UESetup members */
+      DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
+            ueSetRsp->protocolIEs.list.size);
+      if(ueSetRsp->protocolIEs.list.array == NULLP)
+      {
+         DU_LOG(" ERROR  -->  F1AP : Memory allocation for UE Setup Response failed");
+         ret = RFAILED;
+         break;
+      }
+
+      for(idx=0; idx<elementCnt; idx++)
+      {
+         DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
+               sizeof(UEContextSetupResponseIEs_t));
+         if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
+         {
+            DU_LOG(" ERROR  -->  F1AP : Memory allocation for UE Setup Response failed");
+            ret = RFAILED;
+            break;
+         }
+      }
+      /* Fetching Ue Cb Info*/
+      GET_CELL_IDX(cellId, cellIdx);
+      gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+      gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
+      ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueId-1];
+
+      idx = 0;
+      /*GNB CU UE F1AP ID*/
+      ueSetRsp->protocolIEs.list.array[idx]->id        = \
+                                                  ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+                                                             UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
+
+      /*GNB DU UE F1AP ID*/
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id        = \
+                                                  ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+                                                             UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
+
+
+      /*DUtoCURRC Information */
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id  = \
+                                                   ProtocolIE_ID_id_DUtoCURRCInformation;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present =\
+                                                            UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
+      BuildCellGroupConfigRrc(ueCb, &ueSetRsp->protocolIEs.list.array[idx]->value.choice.DUtoCURRCInformation.cellGroupConfig);
+
+      /* Drb Setup List */
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id  = \
+                                                   ProtocolIE_ID_id_DRBs_Setup_List;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present =\
+                                                            UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
+      ret = fillDrbSetupList(&ueSetRsp->protocolIEs.list.array[idx]->value.choice.DRBs_Setup_List,\
+            &ueCb->f1UeDb->duUeCfg);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Failed to fillDrbSetupList in BuildAndSendUeContextSetupRsp()");
+         freeF1UeDb(ueCb->f1UeDb);
+         ueCb->f1UeDb = NULLP;
+         break;
+      }
+
+      /* Free UeContext Db created during Ue context Req */
+      freeF1UeDb(ueCb->f1UeDb);
+      ueCb->f1UeDb = NULLP;
+
+      /* TODO: To send Drb list */
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the UE context setup response type as APER */
+      memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
+            encBuf);
+      /* Encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+         DU_LOG( "\nERROR  -->  F1AP : Could not encode UE Context Setup Response structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         ret = RFAILED;
+         break;
+      }
+      else
+      {
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for UE Context Setup Response\n");
+         for(int i=0; i< encBufSize; i++)
+         {
+            printf("%x",encBuf[i]);
+         }
+      }
+
+      /* Sending  msg  */
+      if(sendF1APMsg() != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Setup Response failed");
+         ret = RFAILED;
+         break;
+      }
+      break;
+   }
+   FreeUeContextSetupRsp(f1apMsg);
+   return ret;
+}/* End of BuildAndSendUeContextSetupRsp */
+/*******************************************************************
+*
+* @brief  Build And Send Ue Context Rsp 
+*
+* @details
+*
+*    Function : BuildAndSendUeCtxtRsp 
+*
+*    Functionality : Build And Send Ue Context Rsp
 
-         /*TODO: Add support for  Spatial Info */
+* @params[in]
+* @return sucess = ROK
+*         failure = RFAILED
+*
+* ****************************************************************/
+uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueId)
+{
+   uint8_t cellIdx = 0, actionType = 0; 
 
-        /* MultiCsiCfg */
-         if(cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList)
-        {
-           DU_ALLOC_SHRABL_BUF(macPucchCfg->multiCsiCfg, sizeof(PucchMultiCsiCfg));
-           if(macPucchCfg->multiCsiCfg == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract multiCsiCfg in  extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->multiCsiCfg, 0, sizeof(PucchMultiCsiCfg));
-            macPucchCfg->multiCsiCfg->multiCsiResrcListCount = cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.count;
-           for(arrIdx =0; arrIdx < macPucchCfg->multiCsiCfg->multiCsiResrcListCount; arrIdx++)
-           {
-              macPucchCfg->multiCsiCfg->multiCsiResrcList[arrIdx] =\
-                *cuPucchCfg->choice.setup->multi_CSI_PUCCH_ResourceList->list.array[arrIdx];
-           }
-        }
+   GET_CELL_IDX(cellId, cellIdx);
+   actionType = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].f1UeDb->actionType;
 
-         /* Dl_DataToUL_ACK */ 
-        if(cuPucchCfg->choice.setup->dl_DataToUL_ACK)
-        {
-            DU_ALLOC_SHRABL_BUF(macPucchCfg->dlDataToUlAck, sizeof(PucchDlDataToUlAck));
-           if(macPucchCfg->dlDataToUlAck == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract Dl_DataToUL_ACK in extractPucchCfg()");
-              return RFAILED;
-           }
-           memset(macPucchCfg->dlDataToUlAck, 0, sizeof(PucchDlDataToUlAck));
-            macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount = cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.count;
-           for(arrIdx = 0; arrIdx < macPucchCfg->dlDataToUlAck->dlDataToUlAckListCount; arrIdx++)
-            {
-               macPucchCfg->dlDataToUlAck->dlDataToUlAckList[arrIdx] =\
-                  *cuPucchCfg->choice.setup->dl_DataToUL_ACK->list.array[arrIdx];
-           }
-        }
+   switch(actionType)
+   {
+      case UE_CTXT_SETUP:
+         {
+            BuildAndSendUeContextSetupRsp(cellId,ueId);
+            break;
+         }
+      case UE_CTXT_MOD:
+         {
+            BuildAndSendUeContextModRsp(&duCb.actvCellLst[cellIdx]->ueCb[ueId-1]);
+            break;
+         }
+      default:
+         DU_LOG("ERROR  -->  F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
+         break;
 
-        /* Power Control */
-         if(cuPucchCfg->choice.setup->pucch_PowerControl)
-        {
-            DU_ALLOC_SHRABL_BUF(macPucchCfg->powerControl, sizeof(PucchPowerControl));
-           if(macPucchCfg->powerControl == NULLP)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed to extract power control in extractPucchCfg()");
-              return RFAILED;
-           }
-            extractPucchPowerControl(macPucchCfg->powerControl,\
-              cuPucchCfg->choice.setup->pucch_PowerControl);
-        }
-      }
    }
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Fills ServingCellReconfig received by CU
+ * @brief deallocating the memory of  F1reset msg
  *
  * @details
  *
- *    Function : extractSpCellDedicatedCfg
+ *    Function : FreeF1ResetReq
  *
- *    Functionality: Fills ServingCellReconfig received  by CU
+ *    Functionality :
+ *         - freeing memory of F1reset request msg
+ *
+ * @params[in]
+ * @return void
  *
- * @params[in] ServingCellConfig_t *cuSrvCellCfg
- *             ServCellCfgInfo *macSrvCellCfg
- * @return ROK/RFAILD
  *
  * ****************************************************************/
-uint8_t extractSpCellDedicatedCfg(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg)
+void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t ret = ROK;
-   BWP_DownlinkDedicated_t *dlBwp = NULLP;
-   BWP_UplinkDedicated_t   *ulBwp = NULLP;
+   uint8_t idx =0 ;
+   Reset_t *f1ResetMsg;
 
-   if(cuSrvCellCfg->initialDownlinkBWP)
+   if(f1apMsg)
    {
-      dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
-      if(dlBwp->pdcch_Config)
+      if(f1apMsg->choice.initiatingMessage)
       {
-         if(dlBwp->pdcch_Config->choice.setup)
+        f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
+
+        if(f1ResetMsg->protocolIEs.list.array)
         {
-           macSrvCellCfg->initDlBwp.pdcchPresent = true;
-           extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+           for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
+           {
+              if(f1ResetMsg->protocolIEs.list.array[idx])
+              {
+                 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
+              }
+           }
+           DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
         }
+        DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
       }
-      if(dlBwp->pdsch_Config)
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   }
+}
+/*******************************************************************
+ *
+ * @brief Build and Send F1reset request 
+ *
+ * @details
+ *
+ *    Function : BuildAndSendF1ResetReq
+ *
+ *    Functionality:
+ *         - Build and Send F1reset request msg
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendF1ResetReq()
+{
+   uint8_t          elementCnt=0;
+   uint8_t          idx=0;
+   uint8_t          ret= RFAILED;
+   Reset_t          *f1ResetMsg = NULLP;
+   F1AP_PDU_t       *f1apMsg = NULLP;
+   asn_enc_rval_t   encRetVal;
+   DU_LOG("\nINFO   -->  F1AP : Building F1 Reset request \n");
+   do
+   {
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
       {
-         if(dlBwp->pdsch_Config->choice.setup)
+        break;
+      }
+      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+      DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+      if(f1apMsg->choice.initiatingMessage == NULLP)
+      {
+        break;
+      }
+      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
+      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+      f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
+
+      f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
+
+      elementCnt = 3;
+      f1ResetMsg->protocolIEs.list.count = elementCnt;
+      f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
+
+      /* Initialize the F1Setup members */
+      DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
+      if(f1ResetMsg->protocolIEs.list.array == NULLP)
+      {
+        break;
+      }
+      for(idx=0; idx<elementCnt; idx++)
+      {
+        DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
+        if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
         {
-           macSrvCellCfg->initDlBwp.pdschPresent = true;
-           extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg);
+           break;
         }
       }
-   }
-   if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
-      macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
-   if(cuSrvCellCfg->defaultDownlinkBWP_Id)
-      macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
-   if(cuSrvCellCfg->bwp_InactivityTimer)
-   {
-      if(macSrvCellCfg->bwpInactivityTmr)
+
+      /*TransactionID*/
+      idx=0;
+      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
+      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
+
+      /*Cause*/
+      idx++;
+      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
+      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
+
+      /*Reset Type*/
+      idx++;
+      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
+      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
+      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
+
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the F1SetupRequest type as APER */
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
+           encBuf);
+
+      /* Encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
       {
-         memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
+        DU_LOG("\nERROR  -->  F1AP : Could not encode F1Reset structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
       }
       else
       {
-         macSrvCellCfg->bwpInactivityTmr = NULLP;
-         DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
-        if(macSrvCellCfg->bwpInactivityTmr)
-        {
-            memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
-        }
-        else
+        DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for F1Reset\n");
+        for(idx=0; idx< encBufSize; idx++)
         {
-           DU_LOG("\nERROR  --> F1AP : Memory Alloc failed for bwpInactivityTmr at extractSpCellDedicatedCfg()");
-           return RFAILED;
+           printf("%x",encBuf[idx]);
         }
       }
-   }
-   if(cuSrvCellCfg->pdsch_ServingCellConfig)
+
+      if(sendF1APMsg() != ROK)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Sending F1 Reset request failed");
+        break;
+      }
+
+      ret = ROK;
+      break;
+   }while(true);
+
+   FreeF1ResetReq(f1apMsg);
+   return ret;
+}
+/*******************************************************************
+ *
+ * @brief Build And Send F1ResetAck
+ *
+ * @details
+ *
+ *    Function : BuildAndSendF1ResetAck
+ *
+ *    Functionality:
+ *         - Build And Send  F1ResetRSP
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t idx;
+   ResetAcknowledge_t *f1ResetAck;
+
+   if(f1apMsg)
    {
-      if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
+      if(f1apMsg->choice.successfulOutcome)
       {
-         ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
-         if(ret == RFAILED)
+        f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
+
+        if(f1ResetAck->protocolIEs.list.array)
         {
-           DU_LOG("\nERROR --> F1AP : Failed at extractPdschServingCellCfg()");
-           return RFAILED;
+           for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
+           {
+              if(f1ResetAck->protocolIEs.list.array[idx])
+              {
+                 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
+              }
+           }
+           DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
         }
+        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
       }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
    }
-   if(cuSrvCellCfg->uplinkConfig)
-   {
-     if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
-     {
-        ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
-       if(ulBwp->pusch_Config)
-       {
-          macSrvCellCfg->initUlBwp.puschPresent = true;
-           extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
-       }
-       if(ulBwp->pucch_Config)
-       {
-          macSrvCellCfg->initUlBwp.pucchPresent = true;
-          memset(&macSrvCellCfg->initUlBwp.pucchCfg, 0, sizeof(PucchCfg));
-           extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); 
-       }
-     }
-     if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
-        macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
-   }
-   return ret;
 }
+
 /*******************************************************************
  *
- * @brief Fills Reconfig Cell group Info received by CU
+ * @brief Build And Send F1ResetAck
  *
  * @details
  *
- *    Function : extractUeReCfgCellInfo
+ *    Function : BuildAndSendF1ResetAck
  *
- *    Functionality: Fills Reconfig Cell group Info received by CU
+ *    Functionality:
+ *         - Build And Send  F1ResetRSP
  *
- * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
- *             MacUeCfg*  macUeCfg
- * @return ROK/RFAILED
+ *  @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg)
+uint8_t BuildAndSendF1ResetAck()
 {
-   uint8_t ret = ROK;
-   MAC_CellGroupConfig_t     *macCellGroup = NULLP;
-   PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
-   SpCellConfig_t            *spcellCfg = NULLP;
-   ServingCellConfig_t       *servCellCfg = NULLP;
+   uint8_t                idx = 0;
+   uint8_t                elementCnt = 0;
+   uint8_t                ret = RFAILED;
+   F1AP_PDU_t             *f1apMsg = NULL;
+   ResetAcknowledge_t     *f1ResetAck = NULLP;
+   asn_enc_rval_t         encRetVal;
+   DU_LOG("\nINFO   -->  F1AP : Building F1 Reset Acknowledgment \n");
 
-   if(cellGrp)
-   {
-      /* Fill MacCell Group Reconfig  */
-      if(cellGrp->mac_CellGroupConfig)
+   do{
+      /* Allocate the memory for F1ResetRequest_t */
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
       {
-         macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
-         if(macCellGroup->schedulingRequestConfig)
-        {
-            extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
-        }
-         if(macCellGroup->tag_Config)
-        {
-            extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
-        }
-        if(macCellGroup->bsr_Config)
-        {
-            macUeCfg->macCellGrpCfg.bsrTmrCfg.periodicTimer = macCellGroup->bsr_Config->periodicBSR_Timer;
-            macUeCfg->macCellGrpCfg.bsrTmrCfg.retxTimer     = macCellGroup->bsr_Config->retxBSR_Timer;
-           if(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer)
-           {
-               macUeCfg->macCellGrpCfg.bsrTmrCfg.srDelayTimer  =\
-                 *(macCellGroup->bsr_Config->logicalChannelSR_DelayTimer);
-           }
-        }
-        if(macCellGroup->phr_Config)
-        {
-           if(macCellGroup->phr_Config->present == MAC_CellGroupConfig__phr_Config_PR_setup)
-           {
-               macUeCfg->macCellGrpCfg.phrCfgSetupPres = true;
-               if(macCellGroup->phr_Config->choice.setup)
-              {
-                macUeCfg->macCellGrpCfg.phrCfg.periodicTimer     = \
-                  macCellGroup->phr_Config->choice.setup->phr_PeriodicTimer;
-                macUeCfg->macCellGrpCfg.phrCfg.prohibitTimer     = \
-                  macCellGroup->phr_Config->choice.setup->phr_ProhibitTimer;
-                macUeCfg->macCellGrpCfg.phrCfg.txPowerFactor     = \
-                  macCellGroup->phr_Config->choice.setup->phr_Tx_PowerFactorChange;
-                macUeCfg->macCellGrpCfg.phrCfg.multiplePHR       = \
-                  macCellGroup->phr_Config->choice.setup->multiplePHR;
-                macUeCfg->macCellGrpCfg.phrCfg.dummy             = \
-                  macCellGroup->phr_Config->choice.setup->dummy;
-                macUeCfg->macCellGrpCfg.phrCfg.phrType2OtherCell = \
-                  macCellGroup->phr_Config->choice.setup->phr_Type2OtherCell;
-                macUeCfg->macCellGrpCfg.phrCfg.phrOtherCG        = \
-                  macCellGroup->phr_Config->choice.setup->phr_ModeOtherCG;
-              }
-           }
-        }
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
+        break;
       }
-      /* Fill Physical Cell Group Reconfig */
-      if(cellGrp->physicalCellGroupConfig)
+
+      f1apMsg->present =  F1AP_PDU_PR_successfulOutcome;
+
+      DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      if(f1apMsg->choice.successfulOutcome == NULLP)
       {
-         phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
-         if(phyCellGrpCfg->p_NR_FR1)
-        {
-           if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
-               macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
-        }
-         macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
+        break;
       }
-      /* Fill SpCell Reconfig */
-      if(cellGrp->spCellConfig)
+      f1apMsg->choice.successfulOutcome->criticality   = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
+      f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
+
+      elementCnt = 1;
+
+      f1ResetAck->protocolIEs.list.count = elementCnt;
+      f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
+
+      DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
+      if(f1ResetAck->protocolIEs.list.array == NULLP)
       {
-         spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
-         if(spcellCfg->servCellIndex)
+        DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1ResetAckIEs failed");
+        break;
+      }
+
+      for(idx=0; idx<elementCnt; idx++)
+      {
+        DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
+        if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
         {
-            macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
+           break;
         }
-         /* Fill Serving cell Reconfig info */
-        if(cellGrp->spCellConfig->spCellConfigDedicated)
+      }
+      /*TransactionID*/
+      idx = 0;
+      f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
+      f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
+      f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
+
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the F1SetupRequest type as UPER */
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
+
+      /* Check encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Could not encode F1ResetAck structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
+      }
+      else
+      {
+        DU_LOG("\nDUBUG   -->  F1AP : Created APER encoded buffer for F1ResetAck\n");
+        for(int i=0; i< encBufSize; i++)
         {
-           servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
-            ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
-           if(ret == RFAILED)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
-           }
+           printf("%x",encBuf[i]);
         }
       }
-   }
+      /* Sending msg */
+      if(sendF1APMsg() != ROK)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Sending F1 Reset Acknowledgement failed");
+        break;
+      }
+
+      ret = ROK;
+      break;
+   }while(true);
+
+   FreeF1ResetAck(f1apMsg);
    return ret;
 }
+/******************************************************************
+*
+* @brief free F1 reset msg allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeAperDecodeF1ResetMsg 
+*
+*    Functionality: free F1 reset msg allocated by aper_decoder 
+*
+* @params[in] Reset_t *f1ResetMsg 
+* @return void 
+*
+* ****************************************************************/
 
-/*******************************************************************
- *
- * @brief builds Mac Cell Cfg
- *
- * @details
- *
- *    Function : procUeReCfgCellInfo
- *
- *    Functionality: builds Mac Cell Cfg
- *
- * @params[in] MacUeCfg pointer
- *             void pointer
- *
- * @return void 
- *
- * ****************************************************************/
-uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo)
+void freeAperDecodeF1ResetMsg(Reset_t *f1ResetMsg)
 {
-   uint8_t ret = ROK;
-   CellGroupConfigRrc_t *cellGrp = NULLP;
-
-   if(cellInfo)
-   {
-      cellGrp = (CellGroupConfigRrc_t *)cellInfo;
-      ret = extractUeReCfgCellInfo(cellGrp, macUeCfg);
-      if(ret == RFAILED)
-         DU_LOG("\nF1AP: Failed at procUeReCfgCellInfo()");
-   }
-   if(ret == RFAILED)
+   uint8_t ieIdx =0;
+   if(f1ResetMsg->protocolIEs.list.array)
    {
-      freeUeReCfgCellGrpInfo(macUeCfg);
+      for(ieIdx=0 ;ieIdx < f1ResetMsg->protocolIEs.list.count ; ieIdx++)
+      {
+        if(f1ResetMsg->protocolIEs.list.array[ieIdx])
+        {
+           free(f1ResetMsg->protocolIEs.list.array[ieIdx]);
+        }
+      }
+      free(f1ResetMsg->protocolIEs.list.array);
    }
-   return ret;
 }
 
-/*******************************************************************
+/******************************************************************
  *
- * @brief Filling modulation info in mac ue cfg
+ * @brief Processes DL RRC Message Transfer  sent by CU
  *
  * @details
  *
- *    Function : duFillModulationDetails
+ *    Function : procF1ResetReq
  *
- *    Functionality: Filling modulation info in mac ue cfg
+ *    Functionality: Processes DL RRC Message Transfer sent by CU
  *
- * @params[in] MAC UE Config to be updated
- *             Current UE configuration
- *             UE NR capability from CU
+ * @params[in] F1AP_PDU_t ASN decoded F1AP message
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
+uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
 {
-   UE_NR_Capability_t *ueNrCap;
+   /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
+   uint8_t       ieIdx = 0;
+   uint8_t        ret = ROK;
+   Reset_t       *f1ResetMsg = NULLP;
 
-   if(ueCap)
-      ueNrCap = (UE_NR_Capability_t *)ueCap;
+   DU_LOG("\nINFO   -->  Processing F1 reset request");
+   f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
 
-   /* Filling DL modulation info */
-   if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
-        ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
-        ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
+   for(ieIdx=0; ieIdx<f1ResetMsg->protocolIEs.list.count; ieIdx++)
    {
-      switch(*(ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL))
+      switch(f1ResetMsg->protocolIEs.list.array[ieIdx]->id)
       {
-        case ModulationOrder_qpsk:
-           {
-              ueCfg->dlModInfo.modOrder = MOD_ORDER_QPSK;
-              break;
-           }
-        case ModulationOrder_qam16:
-           {
-              ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM16;
-              break;
-           }
-        case ModulationOrder_qam64:
-           {
-              ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM64;
-              ueCfg->dlModInfo.mcsIndex = PDSCH_MCS_INDEX;
-              ueCfg->dlModInfo.mcsTable = MCS_TABLE_QAM64;
-              break;
-           }
-        case ModulationOrder_qam256:
-           {
-              ueCfg->dlModInfo.modOrder = MOD_ORDER_QAM256;
-              break;
-           }
-        default:
-           {
-              DU_LOG("\nDU APP: Incorrect downlink modulation order received. Reatining old modulation configuration");
-              memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-              break;
-           }
-      }
-   }
-   else
-   {
-      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-   }
+        case ProtocolIE_ID_id_TransactionID:
+           break;
 
-   /* Filling UL modulation info */
-   if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsUplinkPerCC && \
-        ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0] && \
-        ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL)
-   {
-      switch(*(ueNrCap->featureSets->featureSetsUplinkPerCC->list.array[0]->supportedModulationOrderUL))
-      {
-        case ModulationOrder_qpsk:
-           {
-              ueCfg->ulModInfo.modOrder = MOD_ORDER_QPSK;
-              break;
-           }
-        case ModulationOrder_qam16:
-           {
-              ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM16;
-              ueCfg->ulModInfo.mcsIndex = PUSCH_MCS_INDEX;
-              ueCfg->ulModInfo.mcsTable = MCS_TABLE_QAM64;
-              break;
-           }
-        case ModulationOrder_qam64:
-           {
-              ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM64;
-              break;
-           }
-        case ModulationOrder_qam256:
+        case ProtocolIE_ID_id_Cause:
+           break;
+
+        case ProtocolIE_ID_id_ResetType:
            {
-              ueCfg->ulModInfo.modOrder = MOD_ORDER_QAM256;
               break;
            }
+
         default:
-           {
-              DU_LOG("\nDU APP: Incorrect uplink modulation order received. Reatining old modulation configuration");
-              memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
-              break;
-           }
-      }
-   }
-   else
-   {
-      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+           break;
+      }
    }
+   ret = BuildAndSendF1ResetAck();
+   DU_LOG("\nINFO   -->  UE release is not supported for now");
+
+   freeAperDecodeF1ResetMsg(f1ResetMsg);
+
+   return ret;
 }
 
 /*******************************************************************
  *
- * @brief Function to extract cellGrp Info present in cutoDu cont
+ * @brief free the RRC delivery report
  *
  * @details
  *
- *    Function : extractCellGrpInfo
- *
- *    Functionality: Function to extract cellGrp Info present
- *                   in cutoDu cont
+ *    Function : freeRrcDeliveryReport
  *
- * @params[in] ProtocolExtensionContainer_4624P16_t pointer
+ *    Functionality: free the RRC delivery report
  *
- * @return CellGroupConfigRrc_t *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-
-CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\
-   DuUeCfg *ueCfgDb)
+void freeRrcDeliveryReport(F1AP_PDU_t  *f1apMsg )
 {
-   uint8_t idx2;
-   uint16_t id;
-   uint16_t recvBufLen;
-   CellGroupConfigRrc_t *cellGrpCfg = NULLP;
-   CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
-   asn_dec_rval_t rval; /* Decoder return value */
-   memset(&rval, 0, sizeof(asn_dec_rval_t));
+   uint8_t idx=0;
+   RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
 
-   if(protocolIeExtn)
+   if(f1apMsg)
    {
-      for(idx2 = 0; idx2 < protocolIeExtn->list.count; idx2++)
+      if(f1apMsg->choice.initiatingMessage)
       {
-         extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[idx2]));
-        id = extIeInfo->id;
-         switch(id)
-         {
-            case ProtocolIE_ID_id_CellGroupConfig:
-            {
-              recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
-              /* decoding the CellGroup Buf received */
-              DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
-              if(cellGrpCfg)
+        rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
+        if(rrcDeliveryReport->protocolIEs.list.array)
+        {
+           for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
+                 idx++)
+           {
+              if(rrcDeliveryReport->protocolIEs.list.array[idx])
               {
-                  memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
-                  rval = aper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
-                    extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
-                  if(rval.code == RC_FAIL || rval.code == RC_WMORE)
-                  {
-                     DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()");
-                     return NULLP;
-                  }
-                  xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
-                 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
-                    return NULLP;
-              }
-              break;
-            }
-            default:
-               DU_LOG("\nF1AP : Invalid IE received CUtoDURRCInformation:%d at decodeCellGrpCfg()", id);
-              break;
-         }
+                 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
+                       sizeof(RRCDeliveryReportIEs_t));
+              }   
+           }
+           DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
+                 rrcDeliveryReport->protocolIEs.list.size);
+        }
+        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
       }
+      DU_FREE(f1apMsg,
+           sizeof(F1AP_PDU_t));
    }
-   return cellGrpCfg;
 }
 
 /*******************************************************************
- *
- * @brief Fills Srb List received by CU
- *
- * @details
- *
- *    Function : procSrbListToSetup
- *
- *    Functionality: Fills Srb List received  by CU
- *
- * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
- *             LcCfg pointer
- *             RlcBearerCfg pointer
- * @return void
- *
- * ****************************************************************/
-uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+*
+* @brief Builds and sends the RRC delivery report
+*
+* @details
+*
+*    Function : BuildAndSendRrcDeliveryReport
+*
+*    Functionality: Builds and sends the RRC delivery report
+*
+* @params[in]
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
+   uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
 {
-   uint8_t ret = ROK;
+   uint8_t             ret = RFAILED;
+   uint8_t             idx    = 0;
+   uint8_t             idx1   = 0;
+   uint8_t             elementCnt = 0;
+   F1AP_PDU_t          *f1apMsg = NULLP;
+   asn_enc_rval_t      encRetVal;  
+   RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
 
-   /* Filling RLC INFO */
-   procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd);
+   do{
 
-   /* Filling MAC INFO */
-   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL, NULL, macLcToAdd);
-   if(ret == RFAILED)
-   { 
-      DU_LOG("\nF1AP:Failed at MAC LC Cfg in procSrbListToSetup()");
-      return ret;
-   }
-   return ret;
-}
+      DU_LOG("\nINFO   -->  F1AP : Building RRC delivery Message Transfer Message\n");
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for F1AP-PDU failed");
+        break;
+      }
+      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+      DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+      if(f1apMsg->choice.initiatingMessage == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for  F1AP-PDU  failed");
+        break;
+      }
+      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
+      f1apMsg->choice.initiatingMessage->criticality   = Criticality_ignore;
+      f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
+
+      rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
+      elementCnt = 4;
+      rrcDeliveryReport->protocolIEs.list.count = elementCnt;
+      rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
+
+      /* Initialize the F1Setup members */
+      DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
+      if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
+      {
+        DU_LOG(" ERROR  -->  F1AP : Memory allocation for RRC Delivery  failed");
+        break;
+      }
+      for(idx =0 ;idx <elementCnt; idx++)
+      {
+        DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
+        if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
+        {
+           break;
+        }
+      }
+
+      idx1 = 0;
+
+      /*GNB CU UE F1AP ID*/
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
+
+      /*GNB DU UE F1AP ID*/
+      idx1++;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
+
+      /*RRC delivery status*/
+      idx1++;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
+      rrcDelivery->rrcDeliveryStatus.deliveryStatus;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
+      rrcDelivery->rrcDeliveryStatus.triggeringMessage;
+
+      /* SRB ID */ 
+      idx1++;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
+      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID =  rrcDelivery->srbId;
+
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the RRC DELIVERY REPORT type as APER */
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
+      encBufSize = 0;
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
+           encBuf);
+
+      /* Encode results */
+      if(encRetVal.encoded == ENCODE_FAIL)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        break;
+      }
+      else
+      {
+        DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for RRC Delivery Msg \n");
+        for(idx=0; idx< encBufSize; idx++)
+        {
+           printf("%x",encBuf[idx]);
+        }
+      }
+
+      /* Sending msg */
+      if(sendF1APMsg() != ROK)
+      {
+        DU_LOG("\nERROR  -->  F1AP : Sending RRC delivery  msg request failed");
+        break;
+      }
+      ret = ROK;
+      break;
 
+   }while(true);
 
+   freeRrcDeliveryReport(f1apMsg);
+   return ret;
+}
 
 /*******************************************************************
  *
- * @brief extract Srb List received by CU
+ * @brief Processes cells to be activated
  *
  * @details
  *
- *    Function : extractSrbListToSetup
+ *    Function : extractCellsToBeActivated
  *
- *    Functionality: extract Srb List received by CU
- *                   for both MAC and RLC
+ *    Functionality:
+ *      - Processes cells to be activated list received in F1SetupRsp
  *
- * @params[in] SRBs_ToBeSetup_Item_t pointer
- *             DuUeCfg pointer
- * @return ROK/RFAIED
+ * @params[in] void
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
 
-uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
+uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
 {
-   uint8_t ret, srbIdx;
-   SRBs_ToBeSetup_Item_t *srbItem = NULLP;
+   uint8_t  ret = ROK;
+   uint16_t idx, nci, pci = 0;
+   Cells_to_be_Activated_List_Item_t cell;
 
-   if(srbCfg)
+   for(idx=0; idx<cellsToActivate.list.count; idx++)
    {
-      for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
+      nci = 0;
+      cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
+      bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
+
+      if(cell.nRPCI)
       {
-         srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
-         if(ueCfgDb->numMacLcs > MAX_NUM_LC)
-        { 
-            DU_LOG("\nF1AP:  MAX LC Reached in MAC");
-           ret = RFAILED;
-           break;
-        }
-         if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
-        {
-            DU_LOG("\nF1AP:  MAX LC Reached in RLC");
-           ret = RFAILED;
-           break;
-        }
-        memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
-        memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
-         ret = procSrbListToSetup(srbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
-           &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
-        ueCfgDb->numRlcLcs++;
-        ueCfgDb->numMacLcs++;
-        if(ret == RFAILED)
+        pci = *cell.nRPCI;
+      }
+      ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
+   }
+   return ret;
+}
+/******************************************************************
+*
+* @brief Processes F1 Setup Response allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeF1SetupRsp 
+*
+*    Functionality: free F1 Setup Response allocated by aper_decoder 
+*
+* @params[in] F1SetupResponse_t *f1SetRspMsg 
+* @return void 
+*
+* ****************************************************************/
+
+void freeAperDecodeF1SetupRsp(F1SetupResponse_t *f1SetRspMsg)
+{
+   uint8_t ieIdx =0;
+   uint8_t arrIdx =0;
+   Cells_to_be_Activated_List_t *cellToActivate =NULLP;
+   RRC_Version_t      *rrcVer =NULLP;
+
+   if(f1SetRspMsg->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx<f1SetRspMsg->protocolIEs.list.count; ieIdx++)
+      {
+        if(f1SetRspMsg->protocolIEs.list.array[ieIdx])
         {
-            DU_LOG("\nF1AP:  Failed at extractSrbListToSetup()");
-           break;
+           switch(f1SetRspMsg->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_Cells_to_be_Activated_List:
+                 {
+                    cellToActivate =
+                       &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.Cells_to_be_Activated_List;
+                    if(cellToActivate->list.array)
+                    {
+                       for(arrIdx=0; arrIdx<cellToActivate->list.count ; arrIdx++)
+                       {
+                          if(cellToActivate->list.array[arrIdx])
+                          {
+
+                             if(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.nRCGI.\
+                             pLMN_Identity.buf)
+                             {
+                                if(cellToActivate->list.array[0]->value.choice.\
+                                      Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf)
+                                {
+                                   free(cellToActivate->list.array[0]->value.choice.\
+                                         Cells_to_be_Activated_List_Item.nRCGI.nRCellIdentity.buf);
+                                }
+
+                                free(cellToActivate->list.array[0]->value.choice.Cells_to_be_Activated_List_Item.\
+                                      nRCGI.pLMN_Identity.buf);
+                             }
+                             free(cellToActivate->list.array[arrIdx]);
+                          }
+                       }
+                       free(cellToActivate->list.array);
+                    }
+                    break;
+                 }
+              case ProtocolIE_ID_id_TransactionID:
+                 {
+                    break;
+                 }
+              case ProtocolIE_ID_id_gNB_CU_Name:
+                 {
+                    free(f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_Name.buf);
+                    break;
+                 }
+              case ProtocolIE_ID_id_GNB_CU_RRC_Version:
+                 {
+                    rrcVer = &f1SetRspMsg->protocolIEs.list.array[ieIdx]->value.choice.RRC_Version;
+                    if(rrcVer->latest_RRC_Version.buf)
+                    {
+                       if(rrcVer->iE_Extensions)
+                       {
+                          if(rrcVer->iE_Extensions->list.array)
+                          {
+                             if(rrcVer->iE_Extensions->list.array[0])
+                             {
+                                if(rrcVer->iE_Extensions->list.\
+                                      array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf)
+                                {
+                                   free(rrcVer->iE_Extensions->list.\
+                                         array[0]->extensionValue.choice.Latest_RRC_Version_Enhanced.buf);
+                                }
+                                free(rrcVer->iE_Extensions->list.array[0]);
+                             }
+                             free(rrcVer->iE_Extensions->list.array);
+                          }
+                          free(rrcVer->iE_Extensions);
+                       }
+                       free(rrcVer->latest_RRC_Version.buf);
+                    }
+                    break;
+
+                 }
+              default:
+                 {
+                    DU_LOG("\nERROR  -->  DU_APP : Invalid IE received in F1SetupRsp:%ld",
+                          f1SetRspMsg->protocolIEs.list.array[ieIdx]->id);
+                 }
+           }
+           free(f1SetRspMsg->protocolIEs.list.array[ieIdx]);
         }
       }
+      free(f1SetRspMsg->protocolIEs.list.array);
    }
-   else
-      ret = RFAILED;
-
-   return ret;
 }
-
-/*******************************************************************
+/******************************************************************
  *
- * @brief Fills Drb List received by CU
+ * @brief Processes F1 Setup Response sent by CU
  *
  * @details
  *
- *    Function : procDrbListToSetup
+ *    Function : procF1SetupRsp
  *
- *    Functionality: Fills Drb List received by CU
- *                   for both MAC and RLC
+ *    Functionality: Processes F1 Setup Response sent by CU
  *
- * @params[in] SRBs_ToBeSetup_Item_t pointer
- *             LcCfg pointer,
- *             RlcBearerCfg pointer
- * @return void
+ * @params[in] F1AP_PDU_t ASN decoded F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
  *
  * ****************************************************************/
-
-uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
 {
    uint8_t ret = ROK;
+   uint16_t idx =0;
+   F1SetupResponse_t *f1SetRspMsg = NULLP;
+   GNB_CU_Name_t     *cuName = NULLP;
+   F1SetupRsp  f1SetRspDb;
+   RRC_Version_t      *rrcVer =NULLP;
+   
+   memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
 
-   /* Filling RLC INFO */
-   procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
+   DU_LOG("\nINFO   -->  F1AP : F1 Setup Response received");
+   f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
 
-   /* Filling MAC INFO */
-   ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd);
-   if(ret == RFAILED)
-   { 
-      DU_LOG("\nF1AP:Failed at RLC LC Cfg in extractDrbListToSetup()");
-      return ret;
+   for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
+   {
+      switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
+      {
+        case ProtocolIE_ID_id_Cells_to_be_Activated_List:
+           {
+              extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
+                    value.choice.Cells_to_be_Activated_List);
+              break;
+           }
+        case ProtocolIE_ID_id_TransactionID:
+           {
+              f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
+                                   value.choice.TransactionID;
+              break;
+           }
+        case ProtocolIE_ID_id_gNB_CU_Name:
+           {
+              cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
+                       value.choice.GNB_CU_Name;
+              strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
+              break;
+           }
+        case ProtocolIE_ID_id_GNB_CU_RRC_Version:
+           {
+              rrcVer = &f1SetRspMsg->protocolIEs.list.array[idx]->value.choice.RRC_Version;
+              strcpy(f1SetRspDb.rrcVersion.rrcVer,
+                    (const char*)rrcVer->latest_RRC_Version.buf);
+              break;
+           }
+        default:
+           DU_LOG("\nERROR  -->  DU_APP : Invalid IE received in F1SetupRsp:%ld",
+                 f1SetRspMsg->protocolIEs.list.array[idx]->id);
+      }
+      duProcF1SetupRsp();
    }
+   
+   freeAperDecodeF1SetupRsp(f1SetRspMsg);
 
+   duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen;
+   DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize);
+   if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed to store the buf of F1setup response");
+      return RFAILED;
+   }
+   memcpy(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, recvBuf, recvBufLen);
+   
+   if(BuildAndSendE2SetupReq() != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Failed to build and send E2 setup request ");
+      return RFAILED;
+   }
    return ret;
 }
-
 /*******************************************************************
- *
- * @brief extract Drb List received by CU
- *
- * @details
- *
- *    Function : extractDrbListToSetup
- *
- *    Functionality: extract Drb List received by CU
- *                   for both MAC and RLC
- *
- * @params[in] DRBs_ToBeSetup_Item_t pointer
- *             DuUeCfg pointer
- * @return ROK/RFAIED
- *
- * ****************************************************************/
+*
+* @brief free GNB DU config update ack
+*
+* @details
+*
+*    Function : freeAperDecodeGnbDuAck 
+*
+*    Functionality: Processes GNB DU config update ack And
+*                     added free part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP_PDU_t ASN decoded F1AP message
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
 
-uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg, DuUeCfg *ueCfgDb)
+void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 {
-   uint8_t ret, drbIdx;
-   DRBs_ToBeSetup_Item_t *drbItem = NULLP;
+   uint8_t ieIdx = 0;
 
-   ret = ROK;
-   if(drbCfg)
+   if(gnbDuAck->protocolIEs.list.array)
    {
-      for(drbIdx = 0; drbIdx < drbCfg->list.count; drbIdx++)
+      for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
       {
-         drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
-        if(ueCfgDb->numMacLcs > MAX_NUM_LC)
-        { 
-            DU_LOG("\nF1AP:  MAX LC Reached in MAC ");
-           ret = RFAILED;
-           break;
-        }
-        if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+        if(gnbDuAck->protocolIEs.list.array[ieIdx])
         {
-            DU_LOG("\nF1AP:  MAX LC Reached in RLC");
-           ret = RFAILED;
-           break;
-        }
-        memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
-        memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
-         ret = procDrbListToSetup(lcId, drbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
-           &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
-        ueCfgDb->numRlcLcs++;
-        ueCfgDb->numMacLcs++;
-        if(ret == RFAILED)
-        {
-            DU_LOG("\nF1AP:  Failed at extractDrbListToSetup()");
-           break;
+           free(gnbDuAck->protocolIEs.list.array[ieIdx]);
         }
       }
+      free(gnbDuAck->protocolIEs.list.array);
    }
-   else
-      ret = RFAILED;
-
-   return ret;
 }
 
 /*******************************************************************
- *
- * @brief Function to extract Dl RRC Msg received from CU
- *
- * @details
- *
- *    Function : extractDlRrcMsg
- *
- *    Functionality: Function to extract Dl RRC Msg received from CU
- *
- * @params[in] F1AP message
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
+*
+* @brief Building  result of gnb-du config update ack output
+*
+* @details
+*
+*    Function : duProcGnbDuCfgUpdAckMsg 
+*
+*    Functionality: 
+*        Building output of gnb-du config update ack 
+*
+* @params[in] transId
+* @return void
+*
+* ****************************************************************/
 
-uint8_t extractDlRrcMsg(uint32_t gnbDuUeF1apId, uint32_t gnbCuUeF1apId, \
-   F1DlRrcMsg *dlRrcMsg, RRCContainer_t *rrcContainer)
+uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 {
-   uint8_t ret = ROK;
-   dlRrcMsg->rrcMsgSize = rrcContainer->size;
-   if(dlRrcMsg->rrcMsgSize > 0)
-   {
-      DU_ALLOC_SHRABL_BUF(dlRrcMsg->rrcMsgPdu, dlRrcMsg->rrcMsgSize);
-      if(!dlRrcMsg->rrcMsgPdu)
-      {
-         DU_LOG("\nDU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq");
-         ret = RFAILED;
-      }
-      else
-      {
-         dlRrcMsg->gnbDuUeF1apId = gnbDuUeF1apId;
-         dlRrcMsg->gnbCuUeF1apId = gnbCuUeF1apId;
-         dlRrcMsg->srbId = SRB1_LCID;
-         memcpy(dlRrcMsg->rrcMsgPdu, rrcContainer->buf, dlRrcMsg->rrcMsgSize);
+   uint8_t  ieIdx=0, arrIdx=0,ret=ROK;
+   uint8_t  ueId =0 , ueIdx =0, totalActiveUe = 0;
+   uint16_t cellId =0, cellIdx =0, crnti=0;
+   CmLList *f1apPduNode = NULLP;
+   ReservedF1apPduInfo *f1apPduInfo =NULLP;
+   F1AP_PDU_t *f1apMsgPdu = NULLP;
+   GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
+   BIT_STRING_t *cellIdentity=NULLP;
+   struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
+   Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
+   Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
+
+   DU_LOG("\nINFO   -->  DU APP: GNB-DU config update Ack received ");
+   f1apPduNode = searchFromReservedF1apPduList(transId);
+   f1apPduInfo = (ReservedF1apPduInfo *)f1apPduNode->node;
+   f1apMsgPdu = (F1AP_PDU_t *)f1apPduInfo->f1apMsg;
+
+   if(f1apMsgPdu)
+   {
+      if(f1apMsgPdu->choice.initiatingMessage)
+      {
+         gnbDuConfigUpdate = &f1apMsgPdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate;
+         for(ieIdx=0; ieIdx < gnbDuConfigUpdate->protocolIEs.list.count; ieIdx++)
+         {
+            switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
+            {
+               case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
+                  {
+                     cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
+                                     Served_Cells_To_Delete_List;
+                     if(cellsToDelete->list.array)
+                     {
+                        if(cellsToDelete->list.array[arrIdx])
+                        {
+                           deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
+                           deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
+                           if(deleteItem->oldNRCGI.nRCellIdentity.buf)
+                           {
+                              cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
+                              bitStringToInt(cellIdentity, &cellId);
+
+                              GET_CELL_IDX(cellId, cellIdx);
+                              if(duCb.actvCellLst[cellIdx] != NULLP)
+                              {
+                                 duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+                              }
+                           }
+                        }
+                     }
+
+                     if(duCb.actvCellLst[cellIdx] != NULLP)
+                     {
+                        if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
+                        {
+                           ret = duSendCellDeletReq(cellId);
+                           if(ret == RFAILED)
+                           {
+                              DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
+                              request for cellId[%d]", cellId);
+                           }
+                        }
+                        else
+                        {
+                           totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
+                           while(totalActiveUe)
+                           {
+                              if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
+                              {
+                                 ueIdx++;
+                                 continue;
+                              }
+
+                              crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
+                              GET_UE_ID(crnti,ueId);
+                              /* Sending Ue Context release request only for maximum supporting UEs */
+                              ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
+                              if(ret == RFAILED)
+                              {
+                                 DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
+                                 request for cellId[%d]", cellId);
+                              }
+                              ueIdx++;
+                              totalActiveUe--;
+                           }
+                        }
+                     }
+                     else
+                     {
+                        DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
+                        ret = RFAILED;
+                     }
+                     break;
+                  }
+
+               default:
+                  break;
+            }
+         }
       }
    }
+   
+   FreeDUConfigUpdate(f1apMsgPdu);
+   deleteFromReservedF1apPduList(f1apPduNode);
    return ret;
 }
 
 /*******************************************************************
- *
- * @brief Extract UE capability info 
- *
- * @details
- *
- *    Function : extractUeCapability
- *
- *    Functionality: Extract UE capability info and stores in ue Cb
- *
- * @params[in] Octet string of UE capability RAT container list
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapablityListBuf, DuUeCb *ueCb)
+*
+* @brief Processes GNB DU config update ack
+*
+* @details
+*
+*    Function : procF1GNBDUCfgUpdAck
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP_PDU_t *f1apMsg 
+* @return void 
+*
+* ****************************************************************/
+uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t  idx;
-   uint16_t recvBufLen;
-   asn_dec_rval_t rval;
-   UE_NR_Capability_t  *ueNrCap = NULLP;
-   UE_CapabilityRAT_ContainerListRRC_t  *ueCapRatContList = NULLP;
+   uint8_t ieIdx=0,transId=0;
+   GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
 
-   /* Decoding UE Capability RAT Container List */
-   recvBufLen = ueCapablityListBuf->size;
-   DU_ALLOC(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
-   if(!ueCapRatContList)
+   DU_LOG("\nINFO   -->  F1AP : GNB-DU config update acknowledgment");
+   gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
+
+   for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability");
-      return NULLP;
+      switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
+      {
+         case ProtocolIE_ID_id_TransactionID:
+            {
+               transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+               break;
+            }
+         case ProtocolIE_ID_id_Cells_to_be_Activated_List:
+            {
+               break;
+            }
+         default :
+            {
+               DU_LOG("\nERROR  -->  F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
+                     gnbDuAck->protocolIEs.list.array[ieIdx]->id);
+               break;
+            }
+      }
    }
-   memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
-   memset(&rval, 0, sizeof(asn_dec_rval_t));
-   rval = aper_decode(0, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, (void **)&ueCapRatContList,
-          ueCapablityListBuf->buf, recvBufLen, 0, 0);
-   if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+   
+   duProcGnbDuCfgUpdAckMsg(transId);
+    
+#if 0
+   /* presently we are not supporting F1 Reset from DU to CU , we are only
+    * supporting F1 Reset from CU to DU */
+
+   if(BuildAndSendF1ResetReq() != ROK)
    {
-      DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()");
-      return NULLP;
+      return RFAILED;
    }
-   xer_fprint(stdout, &asn_DEF_UE_CapabilityRAT_ContainerListRRC, ueCapRatContList);
+#endif
 
-   /* Free encoded buffer after decoding */
-   free(ueCapablityListBuf->buf);
+   freeAperDecodeGnbDuAck(gnbDuAck);
+   return ROK;
+}
+/******************************************************************
+*
+* @brief free DL RRC Message Transfer allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeAperDecodef1DlRrcMsg 
+*
+*    Functionality: free DL RRC Message Transfer allocated by aper_decoder 
+*
+* @params[in] DLRRCMessageTransfer_t *f1DlRrcMsg 
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
 
-   for(idx = 0; idx < ueCapRatContList->list.count; idx++)
+void freeAperDecodef1DlRrcMsg(DLRRCMessageTransfer_t *f1DlRrcMsg)
+{
+   uint8_t ieIdx =0;
+   RRCContainer_t *rrcContainer = NULLP;
+
+   if(f1DlRrcMsg->protocolIEs.list.array)
    {
-      if(ueCapRatContList->list.array[idx]->rat_Type == RAT_Type_nr)
+      for(ieIdx=0; ieIdx<f1DlRrcMsg->protocolIEs.list.count; ieIdx++)
       {
-         /* Decoding UE NR Capability */
-          recvBufLen = ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.size;
-          DU_ALLOC(ueNrCap, sizeof(UE_NR_Capability_t));
-          if(!ueNrCap)
-          {
-             DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability");
-             DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
-             return NULLP;
-          } 
-          memset(ueNrCap, 0, sizeof(UE_NR_Capability_t));
-          memset(&rval, 0, sizeof(asn_dec_rval_t));
-          rval = aper_decode(0, &asn_DEF_UE_NR_Capability, (void **)&ueNrCap,
-                 ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf, recvBufLen, 0, 0);
-          if(rval.code == RC_FAIL || rval.code == RC_WMORE)
-          {
-             DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()");
-             return NULLP;
-          }
-          xer_fprint(stdout, &asn_DEF_UE_NR_Capability, ueNrCap);
-          
-          /* Free encoded buffer after decoding */
-          free(ueCapRatContList->list.array[idx]->ue_CapabilityRAT_Container.buf);
+        if(f1DlRrcMsg->protocolIEs.list.array[ieIdx])
+        {
+           switch(f1DlRrcMsg->protocolIEs.list.array[ieIdx]->id)
+           {
+              case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                 break;
+              case ProtocolIE_ID_id_SRBID:
+                 break;
+              case ProtocolIE_ID_id_RRCContainer:
+                 {
+                    rrcContainer =&f1DlRrcMsg->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer;
+                    free(rrcContainer->buf);
+                 }
+              case ProtocolIE_ID_id_ExecuteDuplication:
+                 break;
+              case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+                 break;
+                 break;
+           }
+           free(f1DlRrcMsg->protocolIEs.list.array[ieIdx]);
+        }
       }
-      free(ueCapRatContList->list.array[idx]);
+      free(f1DlRrcMsg->protocolIEs.list.array);
    }
-
-   /* Free Memory*/
-   free(ueCapRatContList->list.array);
-   DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t));
-   return ueNrCap;
 }
-
-/*******************************************************************
+/******************************************************************
  *
- * @brief Process UE context setup request from CU
+ * @brief Processes DL RRC Message Transfer  sent by CU
  *
  * @details
  *
- *    Function : procF1UeContextSetupReq
+ *    Function : procF1DlRrcMsgTrans
  *
- *    Functionality: Process UE context setup request from CU
+ *    Functionality: Processes DL RRC Message Transfer sent by CU
  *
- * @params[in] F1AP message
+ * @params[in] F1AP_PDU_t ASN decoded F1AP message
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
+uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t    ret, ieIdx, ueIdx, lcId, cellIdx;
-   bool ueCbFound = false;
-   uint32_t gnbCuUeF1apId, gnbDuUeF1apId, bitRateSize;
-   DuUeCb   *duUeCb = NULLP;
-   UEContextSetupRequest_t   *ueSetReq = NULLP;
-    
+   uint8_t  idx, ret;
+   DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
+   F1DlRrcMsg dlMsg;
+   memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
+
+   DU_LOG("\nINFO   -->  DU_APP : DL RRC message transfer Recevied");
+   f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
+
    ret = ROK;
-   
-   ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
-   for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
+
+   for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
    {
-      switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+      switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
       {
         case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
            {
-              gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
+              dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
               break;
            }
         case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
            {
-              gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
+              dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
               break;
            }
-        case ProtocolIE_ID_id_ServCellIndex:
+        case ProtocolIE_ID_id_SRBID:
            {
-              cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
-               for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
-              {
-                 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
-                    (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
-                 {
-                    ueCbFound = true;
-                     duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
-                     DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
-                     if(duUeCb->f1UeDb)
-                     {
-                        memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
-                       duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
-                       duUeCb->f1UeDb->cellIdx = cellIdx;
-                    }
-                    else
-                    {
-                        DU_LOG("\nF1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
-                        ret = RFAILED;
-                    }
-                 }
-                 else
-                    ueCbFound = false;
-                 
-              }
-              if(!ueCbFound)
-              {
-                  DU_LOG("\nF1AP: DuUeCb is not found at procF1UeContextSetupReq()");
-                  ret = RFAILED;
-              }
+              dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
               break;
            }
-         case ProtocolIE_ID_id_SpCellULConfigured:
-           /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL, 
-           UL, SUL or UL+SUL for the indicated cell for the UE */
-           break;
-         case ProtocolIE_ID_id_CUtoDURRCInformation:
-           {
-               if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList)
-               {
-                  duUeCb->f1UeDb->duUeCfg.ueNrCapability = \
-                     extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\
-                        uE_CapabilityRAT_ContainerList, duUeCb);
-               }
-              if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions)
-              {
-                  duUeCb->f1UeDb->duUeCfg.cellGrpCfg = extractCellGrpInfo(ueSetReq->protocolIEs.list.array[ieIdx]->\
-                    value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg);
-                 if(!duUeCb->f1UeDb->duUeCfg.cellGrpCfg)
-                 {
-                    DU_LOG("\n F1AP: Failed to extract cell Grp Info");
-                    //TODO: Update the failure cause in ue context Setup Response
-                    ret = RFAILED;
-                 }
-              }
-               break;
-            } 
-         case ProtocolIE_ID_id_SCell_ToBeSetup_List:
-           {
-              DU_LOG("\nDU_APP: Received SCell to be added");
-              DU_LOG("\nDU_APP: Not processing the SCell_ToBeSetup_List");
+        case ProtocolIE_ID_id_ExecuteDuplication:
+           dlMsg.execDup = true;
            break;
-           }
-         case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
-           {
-              if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
-                 &duUeCb->f1UeDb->duUeCfg))
-              {
-                 DU_LOG("\nDU_APP: Failed at extractSrbListToSetup()");
-                 //TODO: Update the failure cause in ue context Setup Response
-                 ret = RFAILED;
-              }
-              break;
-           }
-         case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
-           {
-              lcId = getDrbLcId(&duUeCb->drbBitMap);
-              if(lcId != RFAILED)
-              {
-                  if(extractDrbListToSetup(lcId, &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List,\
-                    &duUeCb->f1UeDb->duUeCfg))
-                 {
-                    DU_LOG("\nDU_APP: Failed at extractDrbListToSetup()");
-                    //TODO: Update the failure cause in ue context Setup Response
-                    ret = RFAILED;
-                 }
-              }
-              else 
-                 ret = RFAILED;
-               break;
-           }
+
         case ProtocolIE_ID_id_RRCContainer:
            {
-              /* Filling Dl RRC Msg Info */
-              DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
-              if(!duUeCb->f1UeDb->dlRrcMsg)
-              {
-                 DU_LOG("\nDU APP : Memory allocation failed for DL RRC Msg in procUeCtxtSetupReq()");
-                 ret = RFAILED;
-              }
-              else
-              {
-                 memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
-                 ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
-                    &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer);
-              }          
-              break;
-           }
-        case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
-           {
-              if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
-              {
-                 duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
-              }
-              else
-              {
-                 DU_LOG("\nIgnoring delivery report, since rrcContainer is not present");
-              }
-              break;
-           }
-        case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
-            {
-               /* MaximumBitRate Uplink */
-              bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
-              if(bitRateSize > 0)
+              if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
               {
-                  DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.ambrCfg, bitRateSize);
-                 if(!duUeCb->f1UeDb->duUeCfg.ambrCfg)
+                 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
+                 DU_ALLOC_SHRABL_BUF(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
+                 if(dlMsg.rrcMsgPdu)
                  {
-                    DU_LOG("\nDU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
-                    ret = RFAILED;
-                 }
+                    memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
+                       dlMsg.rrcMsgSize);
+                 }
                  else
                  {
-                    memset(duUeCb->f1UeDb->duUeCfg.ambrCfg, 0, sizeof(AmbrCfg)); 
-                     memcpy(&duUeCb->f1UeDb->duUeCfg.ambrCfg->ulBr,
-                    ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
-                     duUeCb->f1UeDb->duUeCfg.ambrCfg->dlBr = 0;
+                    DU_LOG("\nERROR  -->  DU APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
+                     return RFAILED;
                  }
               }
               else
-                 ret = RFAILED;
+              {
+                 DU_LOG("\nERROR  -->  DU_APP : RRC Container Size is invalid:%ld",\
+                 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+                 return RFAILED;
+              }
               break;
            }
-        default:
+         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
            {
+              dlMsg.deliveryStatRpt = true;
               break;
            }
+        default:
+           DU_LOG("\nERROR  -->  DU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
+                 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
       }
    }
-   if(ret == RFAILED)
-   {
-      /*TODO : Negative case*/
-      // BuildAndSendUeContextSetupRsp(ueIdx, cellId);
-      DU_LOG("F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); 
-   }
-   else
-      ret = duProcUeContextSetupRequest(duUeCb);
 
-   return ret;
+   ret = duProcDlRrcMsg(&dlMsg);
 
+   freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
+   return ret;
 }
-
 /*******************************************************************
- * @brief Free the memory allocated for UE Setup response
- *
- * @details
- *
- *    Function : FreeUeContextSetupRsp
- *
- *    Functionality:
- *       Free the memory allocated for UE Setup response
- *
- * @params[in] F1AP PDU for UE setup response
- * @return ROK     - success
- *         RFAILED - failure
  *
- * ****************************************************************/
-void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
-{
-   uint8_t idx;
-   UEContextSetupResponse_t *ueSetRsp = NULLP;
-
-   if(f1apMsg)
-   {
-      if(f1apMsg->choice.successfulOutcome)
-      {
-        ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
-                   UEContextSetupResponse;
-        if(ueSetRsp->protocolIEs.list.array)
-        {
-           for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
-           {
-              if(ueSetRsp->protocolIEs.list.array[idx])
-              {
-                 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
-                 {
-                    case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_DUtoCURRCInformation:
-                       {
-                          CellGroupConfig_t *cellGrpCfg = NULLP;
-                          cellGrpCfg  = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
-                                        DUtoCURRCInformation.cellGroupConfig;
-                          if(cellGrpCfg->buf != NULLP)
-                          {
-                             DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
-                             cellGrpCfg = NULLP;
-                          }
-                          break;
-                       }
-                    default:
-                       DU_LOG("\nDUAPP: Invalid Id %ld at FreeUeContextSetupRsp()", ueSetRsp->protocolIEs.list.array[idx]->id);
-                       break;
-                 }
-                 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
-                       sizeof(UEContextSetupResponseIEs_t));
-              }
-           }
-           DU_FREE(ueSetRsp->protocolIEs.list.array, \
-                 ueSetRsp->protocolIEs.list.size);
-        }
-        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+* @brief Builds the DRB to be Setup Mod list
+*
+* @details
+*
+*    Function : 
+*
+*    Functionality: Constructs the DRB to be Setup Mod list
+*
+* @params[in] DRBs_SetupMod_List_t *drbSet
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildSrbSetupModList(SRBs_SetupMod_List_t *srbList, DuUeCfg *ueCfg)
+{
+   uint8_t srbIdx = 0;
+   struct SRBs_SetupMod_ItemIEs *srbItemIe;
+
+   srbList->list.count = ueCfg->numRlcLcs;
+   srbList->list.size = srbList->list.count * sizeof(SRBs_SetupMod_ItemIEs_t *);
+
+   DU_ALLOC(srbList->list.array, srbList->list.size);
+   if(srbList->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  DU APP : Memory allocation failed in BuildSrbSetupModList");
+      return RFAILED;
+   }
+
+   for(srbIdx = 0; srbIdx < srbList->list.count; srbIdx++)
+   {
+      DU_ALLOC(srbList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
+      if(srbList->list.array[srbIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  DU APP : Memory allocation failed in BuildSrbSetupModList");
+         return RFAILED;
       }
-      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   } 
+
+   for(srbIdx=0; srbIdx < srbList->list.count; srbIdx++)
+   {
+      srbItemIe = (struct SRBs_SetupMod_ItemIEs *)srbList->list.array[srbIdx];
+      srbItemIe->id = ProtocolIE_ID_id_SRBs_SetupMod_Item;
+      srbItemIe->criticality = Criticality_reject;
+      srbItemIe->value.present = SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item;
+      srbItemIe->value.choice.SRBs_SetupMod_Item.sRBID = ueCfg->rlcLcCfg[srbIdx].rbId;
+      srbItemIe->value.choice.SRBs_SetupMod_Item.lCID = ueCfg->rlcLcCfg[srbIdx].lcId;
    }
+   return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Builds Ue context Setup Rsp DU To CU Info
- *
- * @details
- *
- *    Function : EncodeUeCntxtDuToCuInfo
- *
- *    Functionality: Builds Ue context Setup Rsp DU To CU Info
- *
- * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t * 
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- ******************************************************************/
+* @brief Builds the DRB to be Setup Mod list
+*
+* @details
+*
+*    Function : 
+*
+*    Functionality: Constructs the DRB to be Setup Mod list
+*
+* @params[in] DRBs_SetupMod_List_t *drbSet
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+****************************************************************/
 
-uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
+uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
 {
-   asn_enc_rval_t        encRetVal;
+   uint8_t arrIdx =0;
+   uint8_t drbCnt =0;
+   struct DRBs_SetupMod_ItemIEs *drbItemIe;
 
-   xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
-   memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
-   encBufSize = 0;
-   encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
-   /* Encode results */
-   if(encRetVal.encoded == ENCODE_FAIL)
+   drbCnt = ueCfg->numDrbSetupMod;
+
+   if(!drbCnt)
    {
-      DU_LOG( "\n F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
-           encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-      return RFAILED;
+      DU_LOG("\nINFO  -->  F1AP : BuildDrbToBeSetupModList(): No DRB information to avaialble to add");
+      return ROK;
    }
-   else
+
+   drbSet->list.count = drbCnt;
+   drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
+   DU_ALLOC(drbSet->list.array, drbSet->list.size);
+   if(drbSet->list.array == NULLP)
    {
-      DU_LOG("\n F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
-      for(int i=0; i< encBufSize; i++)
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+      return  RFAILED;
+   }
+   for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
+   {
+      DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
+      if(drbSet->list.array[arrIdx] == NULLP)
       {
-        printf("%x",encBuf[i]);
+             DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+             return  RFAILED;
+      }
+
+      drbItemIe = (struct DRBs_SetupMod_ItemIEs *)drbSet->list.array[arrIdx];
+      drbItemIe->id = ProtocolIE_ID_id_DRBs_SetupMod_Item;
+      drbItemIe->criticality = Criticality_reject;
+      drbItemIe->value.present = DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item;
+      drbItemIe->value.choice.DRBs_SetupMod_Item.dRBID = ueCfg->upTnlInfo[arrIdx].drbId;
+      if(fillDlTnlSetupList(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List,\
+      &ueCfg->upTnlInfo[arrIdx])!= ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Failed to fill DlTnl SetupList in BuildDrbToBeSetupModList");
+         return RFAILED;
       }
+      
    }
-   duToCuCellGrp->size = encBufSize;
-   DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
-   if(!duToCuCellGrp->buf)
+
+   return ROK;
+}
+/*******************************************************************
+* @brief Free the memory allocated for DRB setup List
+*
+* @details
+*
+*    Function : FreeDrbSetupModList 
+*
+*    Functionality:
+*       Free the memory allocated for DRB setup list
+*
+* @params[in] DRBs_Setup_List_t *
+* @return void
+*
+* ****************************************************************/
+void FreeDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
+{
+   uint8_t arrIdx = 0;
+   DRBs_SetupMod_ItemIEs_t *drbItemIe = NULLP;
+
+   for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
    {
-      DU_LOG("\nF1AP : Memory allocation failed in UeCntxtDuToCuInfo");
+      drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+      freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
+      DU_FREE(drbSetupList->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
    }
-   memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
-   return ROK;
+   DU_FREE(drbSetupList->list.array, drbSetupList->list.size);
 }
 
 /*******************************************************************
- *
- * @brief Builds and sends the UE Setup Response
- *
- * @details
- *
- *    Function : BuildAndSendUeContextSetupRsp
- *
- *    Functionality: Constructs the UE Setup Response and sends
- *                   it to the DU through SCTP.
- *
- * @params[in] 
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
+* @brief Free the memory allocated for SRB setup List
+*
+* @details
+*
+*    Function : FreeSrbSetupModList 
+*
+*    Functionality:
+*       Free the memory allocated for SRB setup list
+*
+* @params[in] SRBs_Setup_List_t *
+* @return void
+*
+* ****************************************************************/
+void FreeSrbSetupModList(SRBs_SetupMod_List_t *srbSetupList)
 {
-   uint8_t   idx, ret, cellIdx, elementCnt;
-   uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
-   uint32_t  gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
-   asn_enc_rval_t  encRetVal;        /* Encoder return value */
-   F1AP_PDU_t               *f1apMsg = NULLP;
-   UEContextSetupResponse_t *ueSetRsp = NULLP;
-   CellGroupConfigRrc_t     *cellGrpCfg = NULLP;
-   DuUeCb                   *ueCb = NULLP;
+   uint8_t srbIdx = 0;
+   
+   for(srbIdx = 0; srbIdx < srbSetupList->list.count; srbIdx++)
+      DU_FREE(srbSetupList->list.array[srbIdx], sizeof(SRBs_SetupMod_ItemIEs_t));
+   DU_FREE(srbSetupList->list.array, srbSetupList->list.size);
+}
 
-   DU_LOG("\n F1AP : Building UE Context Setup Response for cellId %d, ueIdx %d\n", cellId, ueIdx);
+/*******************************************************************
+* @brief Free the memory allocated for UE Context Mod Response
+*
+* @details
+*
+*    Function : FreeUeContextModResp 
+*
+*    Functionality:
+*       Free the memory allocated for UE Context Mod Response
+*
+* @params[in] F1AP_PDU_t *f1apMsg
+* @return void
+*
+* ****************************************************************/
 
-   while(true)
+void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t ieIdx;
+   UEContextModificationResponse_t *ueContextModifyRes = NULLP;
+   if(f1apMsg)
+   {
+      if(f1apMsg->choice.successfulOutcome)
+      {
+         ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
+         if(ueContextModifyRes->protocolIEs.list.array)
+         {
+            for(ieIdx=0 ; ieIdx<ueContextModifyRes->protocolIEs.list.count; ieIdx++)
+            {
+               if(ueContextModifyRes->protocolIEs.list.array[ieIdx])
+               {
+                  switch(ueContextModifyRes->protocolIEs.list.array[ieIdx]->id)
+                  {
+                     case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_DRBs_SetupMod_List:
+                        {
+                            FreeDrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->\
+                            value.choice.DRBs_SetupMod_List));
+                            break;
+                        }
+                     case ProtocolIE_ID_id_SRBs_SetupMod_List:
+                        {
+                           FreeSrbSetupModList(&(ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.\
+                              SRBs_SetupMod_List));
+                           break; 
+                        }
+                  }
+                  DU_FREE(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
+               }
+
+            }
+            DU_FREE(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
+         }
+         DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   }
+}
+
+/*****************************************************************i
+*
+* @brief Creating the ue context modifcation response and sending
+*
+* @details
+*
+*    Function : BuildAndSendUeContextModRsp 
+*
+*    Functionality:
+*         - Creating the ue context modifcation response 
+*
+* @params[in] uint8_t cellId,uint8_t ueId
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildAndSendUeContextModRsp(DuUeCb *ueCb)
+{
+   uint8_t   ieIdx = 0, tnlIdx = 0, rbIdx = 0;
+   uint8_t   elementCnt = 0;
+   uint8_t   ret = RFAILED;
+   F1AP_PDU_t *f1apMsg = NULLP;
+   asn_enc_rval_t  encRetVal;
+   UEContextModificationResponse_t *ueContextModifyRes = NULLP;
+
+   DU_LOG("\nINFO  -->  F1AP : Building UE context modification response\n");
+
+   while(1)
    {
       DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
       if(f1apMsg == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-        ret = RFAILED;
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+         break;
       }
 
-      f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
-      DU_ALLOC(f1apMsg->choice.successfulOutcome,
-           sizeof(SuccessfulOutcome_t));
+      f1apMsg->present =  F1AP_PDU_PR_successfulOutcome;
+
+      DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
       if(f1apMsg->choice.successfulOutcome == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
-        ret = RFAILED;
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+         break;
       }
-
-      f1apMsg->choice.successfulOutcome->procedureCode = \
-                                                        ProcedureCode_id_UEContextSetup;
+      f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
       f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
-      f1apMsg->choice.successfulOutcome->value.present = \
-                                                        SuccessfulOutcome__value_PR_UEContextSetupResponse;
-
-      ueSetRsp =
-        &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
-      elementCnt = 3;
-      ueSetRsp->protocolIEs.list.count = elementCnt;
-      ueSetRsp->protocolIEs.list.size = \
-                                       elementCnt * sizeof(UEContextSetupResponse_t *);
+      f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
 
-      /* Initialize the UESetup members */
-      DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
-           ueSetRsp->protocolIEs.list.size);
-      if(ueSetRsp->protocolIEs.list.array == NULLP)
+      ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
+  
+      if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
       {
-        DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
-        ret = RFAILED;
-        break;
+         if(ueCb->f1UeDb->duUeCfg.numDrbSetupMod)
+            elementCnt =3;
+         else
+            elementCnt =2;
       }
+      if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
+         elementCnt = 5;
+      if(ueCb->f1UeDb->actionType == UE_CTXT_RRC_RECFG_COMPLETE)
+         elementCnt = 2;
+      ueContextModifyRes->protocolIEs.list.count = elementCnt;
+      ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
 
-      for(idx=0; idx<elementCnt; idx++)
+      /* Initialize the UE context modification members */
+      DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
+      if(ueContextModifyRes->protocolIEs.list.array == NULLP)
       {
-        DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
-              sizeof(UEContextSetupResponseIEs_t));
-        if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
-        {
-           DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
-           ret = RFAILED;
-           break;
-        }
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for UE context modifcation Request failed");
+         break;
       }
-      /* Fetching Ue Cb Info*/
-      GET_CELL_IDX(cellId, cellIdx);
-      gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
-      gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
-      ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
 
-      idx = 0;
-      /*GNB CU UE F1AP ID*/
-      ueSetRsp->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
+      for(ieIdx=0 ; ieIdx<elementCnt; ieIdx++)
+      {
+         DU_ALLOC(ueContextModifyRes->protocolIEs.list.array[ieIdx], sizeof(UEContextModificationResponse_t));
+         if(ueContextModifyRes->protocolIEs.list.array[ieIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : Memory allocation for UE context modifcation Request failed");
+            break;
+         }
+      }
 
-      /*GNB DU UE F1AP ID*/
-      idx++;
-      ueSetRsp->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
+      ieIdx=0;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present =\
+      UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID = ueCb->gnbCuUeF1apId;
 
+      ieIdx++;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present=\
+      UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueCb->gnbDuUeF1apId;
 
-      /*DUtoCURRC Information */
-      idx++;
-      ueSetRsp->protocolIEs.list.array[idx]->id  = \
-                                                  ProtocolIE_ID_id_DUtoCURRCInformation;
-      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      ueSetRsp->protocolIEs.list.array[idx]->value.present =\
-                                                           UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
-      if(ueCb->f1UeDb)
+      if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
       {
-         if(ueCb->f1UeDb->duUeCfg.cellGrpCfg)
-        {
-           cellGrpCfg = (CellGroupConfigRrc_t*)ueCb->f1UeDb->duUeCfg.cellGrpCfg;
-           ret = EncodeUeCntxtDuToCuInfo(&ueSetRsp->protocolIEs.list.array[idx]->value.\
-                    choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg);
-           /* Free UeContext Db created during Ue context Req */
-           freeF1UeDb(ueCb->f1UeDb);
-           ueCb->f1UeDb = NULLP;
+         ieIdx++;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DUtoCURRCInformation;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
+         UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation;
+         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->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)
+            {
+               for(tnlIdx = 0; tnlIdx < duCb.numTeId; tnlIdx++)
+               {
+                  if(duCb.upTnlCfg[tnlIdx]->ueId == ueCb->gnbDuUeF1apId)
+                  {
+                     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;
+            }
          }
       }
-      else
+
+      if(ueCb->f1UeDb->actionType == UE_CTXT_CFG_QUERY)
       {
-         DU_LOG("\nF1AP: Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()");
-         ret = RFAILED;
+         ieIdx++;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_SRBs_SetupMod_List;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+         ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.present = \
+                                                                            UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List;
+         for(rbIdx = 0; rbIdx < ueCb->rlcUeCfg.numLcs; rbIdx++)
+         {
+            if(ueCb->rlcUeCfg.rlcLcCfg[rbIdx].rbType == RB_TYPE_SRB)
+            {
+               memcpy(&ueCb->f1UeDb->duUeCfg.rlcLcCfg[ueCb->f1UeDb->duUeCfg.numRlcLcs++], &ueCb->rlcUeCfg.rlcLcCfg[rbIdx],\
+                     sizeof(RlcBearerCfg));
+            }
+         }
+         ret = BuildSrbSetupModList(&ueContextModifyRes->protocolIEs.list.array[ieIdx]->value.choice.SRBs_SetupMod_List, \
+               &ueCb->f1UeDb->duUeCfg);
+         if(ret != ROK)
+         {
+            DU_LOG( "\nERROR  -->  F1AP : Failed to build SRB setupmod List ");
+            break;
+         }
       }
-      if(ret == RFAILED)
-         break;
+
+      freeF1UeDb(ueCb->f1UeDb);
+      ueCb->f1UeDb = NULLP;
 
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
-      /* Encode the UE context setup response type as APER */
-      memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
+      /* Encode the F1SetupRequest type as APER */
+      memset(encBuf, 0, ENC_BUF_MAX_LEN);
       encBufSize = 0;
-      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
-           encBuf);
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,encBuf);
+
       /* Encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG( "\n F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        ret = RFAILED;
-        break;
-      }
-      else
-      {
-        DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n");
-        for(int i=0; i< encBufSize; i++)
-        {
-           printf("%x",encBuf[i]);
-        }
+         DU_LOG( "\nERROR  -->  F1AP : Could not encode UE Context Setup Request structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         ret = RFAILED;
+         break;
+      }
+      else
+      {
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for UE Context Modification Response\n");
+         for(int i=0; i< encBufSize; i++)
+         {
+            printf("%x",encBuf[i]);
+         }
       }
 
       /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL)        != ROK)
+      if(sendF1APMsg() != ROK)
       {
-        DU_LOG("\n F1AP : Sending UE Context Setup Request Failed");
-        ret = RFAILED;
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Setup Res Failed");
+         ret = RFAILED;
+         break;
       }
+
+      ret = ROK;
       break;
    }
-   FreeUeContextSetupRsp(f1apMsg);
+   FreeUeContextModResp(f1apMsg);
    return ret;
-}/* End of BuildAndSendUeContextSetupRsp */
-
+}
+/*******************************************************************
+ *
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for QOSInfo
+ *
+ * @details
+ *
+ *    Function : freeAperDecodeQosInfo
+ *
+ *    Functionality:  Deallocating the memory allocated for QOSInfo
+ *
+ * @params[in] QoSFlowLevelQoSParameters_t *drbQos
+ *
+ * @return void
+ *
+ * ****************************************************************/
 
-uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
+void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
 {
-   uint8_t cellIdx = 0, actionType = 0; 
-
-   GET_CELL_IDX(cellId, cellIdx);
-   actionType = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb->actionType;
-
-   switch(actionType)
+   if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
    {
-      case UE_CTXT_SETUP:
-         BuildAndSendUeContextSetupRsp(ueIdx, cellId);
-         break;
-      case UE_CTXT_MOD:
-         //TODO: Build Ue context Modification Rsp
-         break;
-      default:
-         DU_LOG("F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
-         break;
-
+      if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow!=NULLP)
+      {
+         if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume!=NULLP)
+         {
+            free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+         }
+         free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+      }
+      free(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI);
    }
-   return ROK;
 }
-
 /*******************************************************************
  *
- * @brief deallocating the memory of  F1reset msg
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for UlTnlInfoforDrb
  *
  * @details
  *
- *    Function : FreeF1ResetReq
+ *    Function : freeAperDecodeUlTnlInfoforDrbSetupMod 
  *
- *    Functionality :
- *         - freeing memory of F1reset request msg
+ *    Functionality:  Deallocating memory allocated for UlTnlInfoforDrb
  *
- * @params[in]
- * @return void
+ * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
  *
+ * @return void
  *
  * ****************************************************************/
-void FreeF1ResetReq(F1AP_PDU_t *f1apMsg)
+void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
 {
-   uint8_t idx =0 ;
-   Reset_t *f1ResetMsg;
+   uint8_t arrIdx =0;
 
-   if(f1apMsg)
+   if(ulInfo->list.array)
    {
-      if(f1apMsg->choice.initiatingMessage)
+      for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
       {
-        f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
-
-        if(f1ResetMsg->protocolIEs.list.array)
-        {
-           for(idx=0 ;idx < f1ResetMsg->protocolIEs.list.count ; idx++)
-           {
-              if(f1ResetMsg->protocolIEs.list.array[idx])
-              {
-                 DU_FREE(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
-              }
-           }
-           DU_FREE(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
-        }
-        DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+         if(ulInfo->list.array[arrIdx])
+         {
+            if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel )
+            {
+               if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->transportLayerAddress.buf)
+               {
+                  if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf)
+                  {
+                     free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                           gTP_TEID.buf);
+                  }
+                  free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+                        transportLayerAddress.buf);
+               }
+               free(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel);
+            }
+            free(ulInfo->list.array[arrIdx]);
+         }
       }
-      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+      free(ulInfo->list.array);
    }
 }
 /*******************************************************************
  *
- * @brief Build and Send F1reset request 
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for DrbSetupModItem  
  *
  * @details
  *
- *    Function : BuildAndSendF1ResetReq
+ *    Function : freeAperDecodeDrbSetupModItem 
  *
- *    Functionality:
- *         - Build and Send F1reset request msg
+ *    Functionality:  Deallocating memory allocated for DrbSetupModItem
  *
- * @params[in]
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
+ *
+ * @return void
  *
  * ****************************************************************/
-uint8_t BuildAndSendF1ResetReq()
-{
-   uint8_t          elementCnt=0;
-   uint8_t          idx=0;
-   uint8_t          ret= RFAILED;
-   Reset_t          *f1ResetMsg = NULLP;
-   F1AP_PDU_t       *f1apMsg = NULLP;
-   asn_enc_rval_t   encRetVal;
-   DU_LOG("\nF1AP : Building F1 Reset request \n");
-   do
-   {
-      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-      if(f1apMsg == NULLP)
-      {
-        break;
-      }
-      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
-      DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
-      if(f1apMsg->choice.initiatingMessage == NULLP)
-      {
-        break;
-      }
-      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_Reset;
-      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
-      f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_Reset;
 
-      f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
-
-      elementCnt = 3;
-      f1ResetMsg->protocolIEs.list.count = elementCnt;
-      f1ResetMsg->protocolIEs.list.size = elementCnt * sizeof(ResetIEs_t *);
-
-      /* Initialize the F1Setup members */
-      DU_ALLOC(f1ResetMsg->protocolIEs.list.array,f1ResetMsg->protocolIEs.list.size);
-      if(f1ResetMsg->protocolIEs.list.array == NULLP)
-      {
-        break;
-      }
-      for(idx=0; idx<elementCnt; idx++)
-      {
-        DU_ALLOC(f1ResetMsg->protocolIEs.list.array[idx],sizeof(ResetIEs_t));
-        if(f1ResetMsg->protocolIEs.list.array[idx] == NULLP)
-        {
-           break;
-        }
-      }
+void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
+{
+   uint8_t arrIdx =0;
+   SNSSAI_t *snssai =NULLP;
+   Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
 
-      /*TransactionID*/
-      idx=0;
-      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
-      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_TransactionID;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.TransactionID = 1;
+   drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
+   switch(drbItem->qoSInformation.present)
+   {
+      case QoSInformation_PR_NOTHING:
+         break;
+      case QoSInformation_PR_eUTRANQoS:
+         {
+            if(drbItem->qoSInformation.choice.eUTRANQoS)
+            {
+               free(drbItem->qoSInformation.choice.eUTRANQoS);
+            }
+            break;
+         }
+      case QoSInformation_PR_choice_extension:
+         {
+            if(drbItem->qoSInformation.choice.choice_extension)
+            {
+               freeAperDecodeQosInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.\
+                     DRB_Information.dRB_QoS);
+               snssai = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.sNSSAI;
+               if(snssai->sST.buf)
+               {
+                  free(snssai->sST.buf);
+               }
+               if(snssai->sD)
+               {
+                  if(snssai->sD->buf)
+                  {
+                     free(snssai->sD->buf);
+                  }
+                  free(snssai->sD);
+               }
 
-      /*Cause*/
-      idx++;
-      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_Cause;
-      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_ignore;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_Cause;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.present = Cause_PR_radioNetwork;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.Cause.choice.radioNetwork = CauseRadioNetwork_action_desirable_for_radio_reasons;
+               flowMap = &drbItem->qoSInformation.choice.choice_extension->value.choice.\
+                         DRB_Information.flows_Mapped_To_DRB_List;
+               if(flowMap->list.array)
+               {
+                  for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
+                  {
+                     if(flowMap->list.array[arrIdx] )
+                     {
+                        freeAperDecodeQosInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
+                        free(flowMap->list.array[arrIdx]);
+                     }
+                  }
+                  free(flowMap->list.array);
+               }
 
-      /*Reset Type*/
-      idx++;
-      f1ResetMsg->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_ResetType;
-      f1ResetMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.present = ResetIEs__value_PR_ResetType;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.present = ResetType_PR_f1_Interface;
-      f1ResetMsg->protocolIEs.list.array[idx]->value.choice.ResetType.choice.f1_Interface = ResetAll_reset_all;
+               free(drbItem->qoSInformation.choice.choice_extension);
+            }
+            break;
+         }
 
-      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+   }
+   freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+   if(drbItem->uLConfiguration)
+   {
+      free(drbItem->uLConfiguration);
+   }
+}
 
-      /* Encode the F1SetupRequest type as APER */
-      memset(encBuf, 0, ENC_BUF_MAX_LEN);
-      encBufSize = 0;
-      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
-           encBuf);
+/*******************************************************************
+ *
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for DrbToBeSetupModList
+ *
+ * @details
+ *
+ *    Function : freeAperDecodeDrbToBeSetupModList
+ *
+ *    Functionality:  Deallocating memory allocated for DrbToBeSetupModList
+ *
+ * @params[in] DRBs_ToBeSetupMod_List_t *drbSet
+ *
+ * @return void
+ *
+ * ****************************************************************/
 
-      /* Encode results */
-      if(encRetVal.encoded == ENCODE_FAIL)
-      {
-        DU_LOG("\nF1AP : Could not encode F1Reset structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
-      }
-      else
-      {
-        DU_LOG("\nF1AP : Created APER encoded buffer for F1Reset\n");
-        for(idx=0; idx< encBufSize; idx++)
-        {
-           printf("%x",encBuf[idx]);
-        }
-      }
+void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
+{
+   uint8_t arrIdx =0;
+   struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
 
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+   if(drbSet->list.array)
+   {
+      for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
       {
-        DU_LOG("\nF1AP : Sending F1 Reset request failed");
-        break;
+         if(drbSet->list.array[arrIdx] != NULLP)
+         {
+            if(arrIdx == 0)
+            {
+               drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
+               freeAperDecodeDrbSetupModItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
+            }
+            free(drbSet->list.array[arrIdx]);
+         }
       }
+      free(drbSet->list.array);
+   }
 
-      ret = ROK;
-      break;
-   }while(true);
-
-   FreeF1ResetReq(f1apMsg);
-   return ret;
 }
 /*******************************************************************
  *
- * @brief Build And Send F1ResetAck
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for UeContextModificationReqMsg
  *
  * @details
  *
- *    Function : BuildAndSendF1ResetAck
+ *    Function : freeAperDecodeUeContextModificationReqMsg
  *
- *    Functionality:
- *         - Build And Send  F1ResetRSP
+ *    Functionality:  Deallocating memory allocated for
+ *                  UeContextModificationReqMsg
  *
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] UEContextModificationRequest_t *UeContextModifyReq
+ *
+ * @return void
  *
  * ****************************************************************/
-void FreeF1ResetAck(F1AP_PDU_t *f1apMsg)
+void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *ueContextModifyReq )
 {
-   uint8_t idx;
-   ResetAcknowledge_t *f1ResetAck;
+   uint8_t arrIdx, ieId;
 
-   if(f1apMsg)
+   if(ueContextModifyReq->protocolIEs.list.array)
    {
-      if(f1apMsg->choice.successfulOutcome)
+      for( arrIdx = 0 ; arrIdx<ueContextModifyReq->protocolIEs.list.count ; arrIdx++)
       {
-        f1ResetAck= &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
-
-        if(f1ResetAck->protocolIEs.list.array)
-        {
-           for(idx=0; idx<f1ResetAck->protocolIEs.list.count ; idx++)
-           {
-              if(f1ResetAck->protocolIEs.list.array[idx])
-              {
-                 DU_FREE(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
-              }
-           }
-           DU_FREE(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
-        }
-        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+         if(ueContextModifyReq->protocolIEs.list.array[arrIdx])
+         {
+            ieId = ueContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+            switch(ieId)
+            {
+               case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                  break;
+               case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                  break;
+               case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
+                  {
+                     freeAperDecodeDrbToBeSetupModList(&ueContextModifyReq->protocolIEs.list.array[arrIdx]->\
+                           value.choice.DRBs_ToBeSetupMod_List);
+                     break;
+                  }
+               case ProtocolIE_ID_id_TransmissionActionIndicator:
+                  break;
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     free(ueContextModifyReq->protocolIEs.list.array[arrIdx]->value.choice.RRCContainer.buf);
+                  }
+            }
+            free(ueContextModifyReq->protocolIEs.list.array[arrIdx]);
+         }
       }
-      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+      free(ueContextModifyReq->protocolIEs.list.array);
    }
 }
-
 /*******************************************************************
  *
- * @brief Build And Send F1ResetAck
+ * @brief processing the F1 UeContextModificationReq
  *
  * @details
  *
- *    Function : BuildAndSendF1ResetAck
+ *    Function : procF1UeContextModificationReq
  *
- *    Functionality:
- *         - Build And Send  F1ResetRSP
+ *    Functionality:  processing the F1 UeContextModificationReq
  *
- *  @params[in]
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] F1AP_PDU_t *f1apMsg
  *
+ * @return
  * ****************************************************************/
-uint8_t BuildAndSendF1ResetAck()
+uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t                idx = 0;
-   uint8_t                elementCnt = 0;
-   uint8_t                ret = RFAILED;
-   F1AP_PDU_t             *f1apMsg = NULL;
-   ResetAcknowledge_t     *f1ResetAck = NULLP;
-   asn_enc_rval_t         encRetVal;
-   DU_LOG("\nF1AP : Building F1 Reset Acknowledgment \n");
+   UEContextModificationRequest_t *ueContextModifyReq = NULLP;
+   uint8_t  ret = ROK, ieIdx = 0, cellIdx=0;
+   DuUeCb   *duUeCb = NULLP;
+   DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
+   DRBs_ToBeModified_List_t *drbModifiedCfg;
+   uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
 
-   do{
-      /* Allocate the memory for F1ResetRequest_t */
+   ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
+   for(ieIdx=0; (ieIdx < ueContextModifyReq->protocolIEs.list.count && ret == ROK); ieIdx++)
+   {
+      switch(ueContextModifyReq->protocolIEs.list.array[ieIdx]->id)
+      {
+         case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+            {
+               gnbCuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
+               break;
+            }
+         case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+            {
+               gnbDuUeF1apId = ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
+               for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+               {
+                  if(duCb.actvCellLst[cellIdx])
+                  {
+                     if((duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                           (duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1].gnbCuUeF1apId == gnbCuUeF1apId))
+                     {
+                        duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[gnbDuUeF1apId-1];
+                        if(duUeCb->f1UeDb == NULLP)
+                        {
+                           DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                           duUeCb->f1UeDb->cellIdx = cellIdx;
+                           duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
+                        }
+                        break;
+                     }
+                  }
+               }
+               if(duUeCb == NULLP)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
+                  ret = RFAILED;
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCContainer:
+            {
+               /* Filling Dl RRC Msg Info */
+               DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+               if(!duUeCb->f1UeDb->dlRrcMsg)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                        Memory allocation failed ");
+                  ret = RFAILED;
+               }
+               else
+               {
+                  duUeCb->f1UeDb->dlRrcMsgPres = true;
+                  memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                  ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                        &ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+                        value.choice.RRCContainer);
+               }
+
+               break;
+            }
+
+         case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
+         case ProtocolIE_ID_id_DRBs_ToBeModified_List:
+            {
+               if(duUeCb->f1UeDb)
+               {
+                  if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
+                        UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
+                  {
+                     drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
+                                      choice.DRBs_ToBeSetupMod_List;
+
+                     if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
+                              &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
+                     {
+                        DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
+                        ret = RFAILED;
+                     }
+                  }
+
+                  if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
+                        UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
+
+                  {
+                     drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
+                                      choice.DRBs_ToBeModified_List;
+                     if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
+                              &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->rlcUeCfg))
+                     {
+                        DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
+                        ret = RFAILED;
+                     }
+                  }
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_GNB_DUConfigurationQuery:
+            {
+               DU_LOG("\nINFO  -->  DU APP : Received GNB DU Configuration Query in UE Context Modification Request from CU");
+               if(duUeCb->f1UeDb)
+               {
+                  duUeCb->f1UeDb->actionType = UE_CTXT_CFG_QUERY;
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator:
+            {
+               if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.RRCReconfigurationCompleteIndicator == \
+                  RRCReconfigurationCompleteIndicator_true)
+               {
+                  duUeCb->f1UeDb->actionType = UE_CTXT_RRC_RECFG_COMPLETE;
+               }
+               break;
+            }
+         case ProtocolIE_ID_id_TransmissionActionIndicator:
+            {
+               if(duUeCb->f1UeDb)
+               {
+                  if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.TransmissionActionIndicator  == TransmissionActionIndicator_stop)
+                  {
+                     duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = STOP_TRANSMISSION; 
+                  }
+                  else 
+                  {
+                     duUeCb->f1UeDb->duUeCfg.dataTransmissionAction = RESTART_TRANSMISSION; 
+                  }
+               }
+               break;
+            }
+
+         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+            {
+               if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu)
+               {
+                  duUeCb->f1UeDb->dlRrcMsg->deliveryStatRpt = true;
+               }
+               break;
+            }
+              
+      }
+   }
+
+   if(ret != RFAILED) 
+   {
+      ret = duProcUeContextModReq(duUeCb);
+   }
+   freeAperDecodeUeContextModificationReqMsg(ueContextModifyReq);
+   return ret; 
+}
+
+/*****************************************************************i
+*
+* @brief Free memory allocated for UE Context Release Request
+*
+* @details
+*
+*    Function : FreeUeContextReleaseReq
+*
+*    Functionality:
+*         - Free memory allocated for UE Context Release Request
+*
+* @params[in] F1AP_PDU_t *f1apMsg
+* @return void 
+*
+* *************************************************************/
+void FreeUeContextReleaseReq(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t ieIdx;
+   UEContextReleaseRequest_t *ueReleaseReq = NULLP;
+   
+   if(f1apMsg)
+   {
+      if(f1apMsg->choice.initiatingMessage)
+      {
+         ueReleaseReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
+         if(ueReleaseReq->protocolIEs.list.array)
+         {
+            for(ieIdx=0 ; ieIdx<ueReleaseReq->protocolIEs.list.count; ieIdx++)
+            {
+               DU_FREE(ueReleaseReq->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseRequest_t));
+            }
+            DU_FREE(ueReleaseReq->protocolIEs.list.array, ueReleaseReq->protocolIEs.list.size);
+         }
+         DU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+      }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   }
+
+}
+/*****************************************************************i
+*
+* @brief Build and Send UE Context Release Request  
+*
+* @details
+*
+*    Function : BuildAndSendUeContextReleaseReq
+*
+*    Functionality:
+*         - Build and Send UE Context Release Request 
+*
+* @params[in]
+* @return ROK     - success
+*         RFAILED - failure
+*
+* *************************************************************/
+uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueId)
+{
+   bool memAllocFail = false;
+   uint8_t ieIdx =0;
+   uint8_t ret = RFAILED;
+   uint16_t cellIdx =0;
+   uint16_t crnti = 0;
+   uint8_t  elementCnt = 0;
+   uint32_t  gnbCuUeF1apId =0;   /* gNB-CU UE F1AP Id */
+   uint32_t  gnbDuUeF1apId =0;   /* gNB-DU UE F1AP Id */
+   asn_enc_rval_t encRetVal; 
+   F1AP_PDU_t *f1apMsg = NULLP;
+   UEContextReleaseRequest_t *ueReleaseReq = NULLP;
+
+   DU_LOG("\nINFO  --> Building the UE Context Release Request");
+   do
+   {
       DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
       if(f1apMsg == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for f1apMsg");
+         break;
       }
 
-      f1apMsg->present =  F1AP_PDU_PR_successfulOutcome;
-
-      DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
-      if(f1apMsg->choice.successfulOutcome == NULLP)
+      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+      DU_ALLOC(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+      if(f1apMsg->choice.initiatingMessage == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
+         initiatingMessage");   
+         break;
       }
-      f1apMsg->choice.successfulOutcome->criticality   = Criticality_reject;
-      f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_ResetAcknowledge;
-      f1ResetAck = &f1apMsg->choice.successfulOutcome->value.choice.ResetAcknowledge;
+      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
+      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+      f1apMsg->choice.initiatingMessage->value.present = \
+      InitiatingMessage__value_PR_UEContextReleaseRequest;
 
-      elementCnt = 1;
+      ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
 
-      f1ResetAck->protocolIEs.list.count = elementCnt;
-      f1ResetAck->protocolIEs.list.size = elementCnt*sizeof(ResetAcknowledgeIEs_t *);
+      elementCnt = 2;
 
-      DU_ALLOC(f1ResetAck->protocolIEs.list.array, f1ResetAck->protocolIEs.list.size );
-      if(f1ResetAck->protocolIEs.list.array == NULLP)
+      ueReleaseReq->protocolIEs.list.count = elementCnt;
+      ueReleaseReq->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseRequest_t *);
+
+      /* Initialize the F1Setup members */
+      DU_ALLOC(ueReleaseReq->protocolIEs.list.array,ueReleaseReq->protocolIEs.list.size);
+      if(ueReleaseReq->protocolIEs.list.array == NULLP)
       {
-        DU_LOG("\nF1AP : Memory allocation for F1ResetAckIEs failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE array");
+         break;
+      }
+      for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
+      {
+         DU_ALLOC(ueReleaseReq->protocolIEs.list.array[ieIdx],\
+               sizeof(UEContextReleaseRequest_t));
+         if(ueReleaseReq->protocolIEs.list.array[ieIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for IE elements");
+            memAllocFail = true;  
+            break;
+         }
       }
+      if(memAllocFail == true)
+         break;
 
-      for(idx=0; idx<elementCnt; idx++)
+      /* Fetching Ue Cb Info*/
+      GET_CELL_IDX(cellId, cellIdx);
+      if(duCb.actvCellLst[cellIdx] == NULLP)
       {
-        DU_ALLOC(f1ResetAck->protocolIEs.list.array[idx], sizeof(ResetAcknowledgeIEs_t));
-        if(f1ResetAck->protocolIEs.list.array[idx] == NULLP)
-        {
-           break;
-        }
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
+         break;
+      }
+      else
+      {
+         GET_CRNTI(crnti, ueId);
+         if(duCb.actvCellLst[cellIdx]->ueCb[ueId-1].crnti != crnti)
+         {
+            DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
+            break;
+         }
+         gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+         gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
       }
-      /*TransactionID*/
-      idx = 0;
-      f1ResetAck->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_TransactionID;
-      f1ResetAck->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      f1ResetAck->protocolIEs.list.array[idx]->value.present = ResetAcknowledgeIEs__value_PR_TransactionID;
-      f1ResetAck->protocolIEs.list.array[idx]->value.choice.TransactionID = TRANS_ID;
 
+      ieIdx=0; 
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; 
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present = \
+      UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
+      
+      ieIdx++;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->value.present =\
+      UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueReleaseReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
+      
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
-      /* Encode the F1SetupRequest type as UPER */
+      /* Encode the F1SetupRequest type as APER */
       memset(encBuf, 0, ENC_BUF_MAX_LEN);
       encBufSize = 0;
       encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
-
-      /* Check encode results */
+      /* Encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG("\nF1AP : Could not encode F1ResetAck structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Could not encode UEContextReleaseRequest structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
       }
       else
       {
-        DU_LOG("\nF1AP : Created APER encoded buffer for F1ResetAck\n");
-        for(int i=0; i< encBufSize; i++)
-        {
-           printf("%x",encBuf[i]);
-        }
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for UEContextReleaseRequest\n");
+         for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+         {
+            printf("%x",encBuf[ieIdx]);
+         }
       }
+
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
-        DU_LOG("\nF1AP : Sending F1 Reset Acknowledgement failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Release Request failed");
+         break;
       }
-
       ret = ROK;
       break;
    }while(true);
 
-   FreeF1ResetAck(f1apMsg);
+   FreeUeContextReleaseReq(f1apMsg);
    return ret;
 }
-
-/******************************************************************
+/*****************************************************************i
  *
- * @brief Processes DL RRC Message Transfer  sent by CU
+ * @brief Free memory allocated for UE Context Release Complete
  *
  * @details
  *
- *    Function : procF1ResetReq
+ *    Function : FreeUeContextReleaseComplete
  *
- *    Functionality: Processes DL RRC Message Transfer sent by CU
+ *    Functionality:
+ *         - Free memory allocated for UE Context Release Complete
  *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] F1AP_PDU_t *f1apMsg
+ * @return void
  *
- * ****************************************************************/
-uint8_t procF1ResetReq(F1AP_PDU_t *f1apMsg)
+ * *************************************************************/
+void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
 {
-   /* we are currently not supporting Ue release. right now we are supporting only init case of fireset */
-   uint8_t       idx = 0;
-   uint8_t        ret = ROK;
-   Reset_t       *f1ResetMsg = NULLP;
-
-   DU_LOG("\nProcessing F1 reset request");
-   f1ResetMsg = &f1apMsg->choice.initiatingMessage->value.choice.Reset;
+   uint8_t ieIdx;
+   UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
 
-   for(idx=0; idx<f1ResetMsg->protocolIEs.list.count; idx++)
+   if(f1apMsg)
    {
-      switch(f1ResetMsg->protocolIEs.list.array[idx]->id)
+      if(f1apMsg->choice.successfulOutcome)
       {
-        case ProtocolIE_ID_id_TransactionID:
-           break;
-
-        case ProtocolIE_ID_id_Cause:
-           break;
-
-        case ProtocolIE_ID_id_ResetType:
-           {
-              DU_LOG("\nReceived F1 Reset request");
-              break;
-           }
-
-        default:
-           break;
+         ueReleaseComplete =&f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
+         if(ueReleaseComplete->protocolIEs.list.array)
+         {
+            for(ieIdx=0 ; ieIdx<ueReleaseComplete->protocolIEs.list.count; ieIdx++)
+            {
+               DU_FREE(ueReleaseComplete->protocolIEs.list.array[ieIdx], sizeof(UEContextReleaseComplete_t));
+            }
+            DU_FREE(ueReleaseComplete->protocolIEs.list.array, ueReleaseComplete->protocolIEs.list.size);
+         }
+         DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
       }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
    }
-   ret = BuildAndSendF1ResetAck();
-   DU_LOG("\nUE release is not supported for now");
-   return ret;
-}
 
-/*******************************************************************
+}
+/*****************************************************************i
  *
- * @brief free the RRC delivery report
+ * @brief Build and Send UE Context Release Complete
  *
  * @details
  *
- *    Function : freeRrcDeliveryReport
+ *    Function : BuildAndSendUeContextReleaseComplete
  *
- *    Functionality: free the RRC delivery report
+ *    Functionality:
+ *         - Build and Send UE Context Release Complete
  *
- * @params[in]
+ * @params[in]  cellId,  gnbCuUeF1apId, gnbDuUeF1apId
  * @return ROK     - success
  *         RFAILED - failure
  *
- * ****************************************************************/
-void freeRrcDeliveryReport(F1AP_PDU_t  *f1apMsg )
+ * *************************************************************/
+uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
 {
-   uint8_t idx=0;
-   RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
+   bool memAllocFail = false;
+   uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
+   asn_enc_rval_t encRetVal;
+   F1AP_PDU_t *f1apMsg = NULLP;
+   UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
 
-   if(f1apMsg)
+   DU_LOG("\nINFO  --> Building the UE Context Release Complete");
+   do
    {
-      if(f1apMsg->choice.initiatingMessage)
-      {
-        rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
-        if(rrcDeliveryReport->protocolIEs.list.array)
-        {
-           for(idx =0 ;idx <rrcDeliveryReport->protocolIEs.list.count ;
-                 idx++)
-           {
-              if(rrcDeliveryReport->protocolIEs.list.array[idx])
-              {
-                 DU_FREE(rrcDeliveryReport->protocolIEs.list.array[idx],
-                       sizeof(RRCDeliveryReportIEs_t));
-              }   
-           }
-           DU_FREE(rrcDeliveryReport->protocolIEs.list.array,
-                 rrcDeliveryReport->protocolIEs.list.size);
-        }
-        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-      }
-      DU_FREE(f1apMsg,
-           sizeof(F1AP_PDU_t));
-   }
-}
-
-/*******************************************************************
-*
-* @brief Builds and sends the RRC delivery report
-*
-* @details
-*
-*    Function : BuildAndSendRrcDeliveryReport
-*
-*    Functionality: Builds and sends the RRC delivery report
-*
-* @params[in]
-*
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
-uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
-   uint32_t gnbDuUeF1apId, RrcDeliveryReport *rrcDelivery)
-{
-   uint8_t             ret = RFAILED;
-   uint8_t             idx    = 0;
-   uint8_t             idx1   = 0;
-   uint8_t             elementCnt = 0;
-   F1AP_PDU_t          *f1apMsg = NULLP;
-   asn_enc_rval_t      encRetVal;  
-   RRCDeliveryReport_t *rrcDeliveryReport= NULLP;
-
-   do{
-
-      DU_LOG("\nF1AP : Building RRC delivery Message Transfer Message\n");
       DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
       if(f1apMsg == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for f1apMsg");
+         break;
       }
-      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
-      DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-      if(f1apMsg->choice.initiatingMessage == NULLP)
+
+      f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
+      DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      if(f1apMsg->choice.successfulOutcome == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU  failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
+               successfulOutcome");
+         break;
       }
-      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_RRCDeliveryReport;
-      f1apMsg->choice.initiatingMessage->criticality   = Criticality_ignore;
-      f1apMsg->choice.initiatingMessage->value.present = InitiatingMessage__value_PR_RRCDeliveryReport;
+      f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
+      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = \
+      SuccessfulOutcome__value_PR_UEContextReleaseComplete;
 
-      rrcDeliveryReport = &f1apMsg->choice.initiatingMessage->value.choice.RRCDeliveryReport;
-      elementCnt = 4;
-      rrcDeliveryReport->protocolIEs.list.count = elementCnt;
-      rrcDeliveryReport->protocolIEs.list.size = elementCnt * sizeof(RRCDeliveryReportIEs_t *);
+      ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
 
-      /* Initialize the F1Setup members */
-      DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array, rrcDeliveryReport->protocolIEs.list.size);
-      if(rrcDeliveryReport->protocolIEs.list.array == NULLP)
+      elementCnt = 2;
+      ueReleaseComplete->protocolIEs.list.count = elementCnt;
+      ueReleaseComplete->protocolIEs.list.size = elementCnt * sizeof(UEContextReleaseComplete_t *);
+
+      /* Initialize the UE Release Complete members */
+      DU_ALLOC(ueReleaseComplete->protocolIEs.list.array,ueReleaseComplete->protocolIEs.list.size);
+      if(ueReleaseComplete->protocolIEs.list.array == NULLP)
       {
-        DU_LOG(" F1AP : Memory allocation for RRC Delivery  failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
+         break;
       }
-      for(idx =0 ;idx <elementCnt; idx++)
+      for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
       {
-        DU_ALLOC(rrcDeliveryReport->protocolIEs.list.array[idx], sizeof(RRCDeliveryReportIEs_t));
-        if(rrcDeliveryReport->protocolIEs.list.array[idx] == NULLP)
-        {
-           break;
-        }
+         DU_ALLOC(ueReleaseComplete->protocolIEs.list.array[ieIdx],\
+               sizeof(UEContextReleaseComplete_t));
+         if(ueReleaseComplete->protocolIEs.list.array[ieIdx] == NULLP)
+         {
+            DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE\
+            elements");
+            memAllocFail = true;
+            break;
+         }
       }
+      if(memAllocFail == true)
+         break;
 
-      idx1 = 0;
-
-      /*GNB CU UE F1AP ID*/
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_CU_UE_F1AP_ID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
-
-      /*GNB DU UE F1AP ID*/
-      idx1++;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_GNB_DU_UE_F1AP_ID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
 
-      /*RRC delivery status*/
-      idx1++;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_RRCDeliveryStatus;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_RRCDeliveryStatus;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.delivery_status =\
-      rrcDelivery->rrcDeliveryStatus.deliveryStatus;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.RRCDeliveryStatus.triggering_message =\
-      rrcDelivery->rrcDeliveryStatus.triggeringMessage;
+      ieIdx=0;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present = \
+      UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID =gnbCuUeF1apId;
 
-      /* SRB ID */ 
-      idx1++;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->id = ProtocolIE_ID_id_SRBID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->criticality = Criticality_ignore;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.present = RRCDeliveryReportIEs__value_PR_SRBID;
-      rrcDeliveryReport->protocolIEs.list.array[idx1]->value.choice.SRBID =  rrcDelivery->srbId;
+      ieIdx++;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->criticality= Criticality_reject;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.present =\
+      UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueReleaseComplete->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =gnbDuUeF1apId;
 
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
-      /* Encode the RRC DELIVERY REPORT type as APER */
+      /* Encode the F1SetupComplete type as APER */
       memset(encBuf, 0, ENC_BUF_MAX_LEN);
       encBufSize = 0;
-      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf,\
-           encBuf);
-
+      encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
       /* Encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG("\nF1AP : Could not encode RRC Delivery Msg structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Could not encode UEContextReleaseComplete structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
       }
       else
       {
-        DU_LOG("\nF1AP : Created APER encoded buffer for RRC Delivery Msg \n");
-        for(idx=0; idx< encBufSize; idx++)
-        {
-           printf("%x",encBuf[idx]);
-        }
+         DU_LOG("\nDEBUG   -->  F1AP : Created APER encoded buffer for UEContextReleaseComplete\n");
+         for(ieIdx=0; ieIdx< encBufSize; ieIdx++)
+         {
+            printf("%x",encBuf[ieIdx]);
+         }
       }
 
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
-        DU_LOG("\nF1AP : Sending RRC delivery  msg request failed");
-        break;
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Release Complete failed");
+         break;
       }
       ret = ROK;
       break;
-
    }while(true);
-
-   freeRrcDeliveryReport(f1apMsg);
+   
+   if((ret == ROK) && (duCb.actvCellLst[cellId-1]) && (duCb.actvCellLst[cellId-1]->cellStatus == DELETION_IN_PROGRESS) 
+         && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
+   {
+      ret = duSendCellDeletReq(cellId);
+      if(ret != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
+               Delete req for CellId");
+      }
+   }
+   FreeUeContextReleaseComplete(f1apMsg);
    return ret;
+
 }
 
 /*******************************************************************
- *
- * @brief Processes cells to be activated
- *
- * @details
- *
- *    Function : extractCellsToBeActivated
- *
- *    Functionality:
- *      - Processes cells to be activated list received in F1SetupRsp
- *
- * @params[in] void
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-uint8_t extractCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
+*
+* @brief added free part for the memory allocated by aper_decoder 
+*
+* @details
+*
+*    Function : freeAperDecodeUeContextReleaseCommand 
+*
+*    Functionality: added free part for the memory allocated by aper_decoder
+*
+* @params[in] F1AP_PDU_t *f1apMsg
+* @return void
+*
+* ****************************************************************/
+void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t  ret = ROK;
-   uint16_t idx, nci, pci = 0;
-   Cells_to_be_Activated_List_Item_t cell;
+   uint8_t ieIdx=0;
+   UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
 
-   for(idx=0; idx<cellsToActivate.list.count; idx++)
+   ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
+   
+   if(ueContextReleaseCommand->protocolIEs.list.array)
    {
-      nci = 0;
-      cell = cellsToActivate.list.array[idx]->value.choice.Cells_to_be_Activated_List_Item;
-      bitStringToInt(&cell.nRCGI.nRCellIdentity, &nci);
-
-      if(cell.nRPCI)
+      for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
       {
-        pci = *cell.nRPCI;
+         if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
+         {
+            switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
+            {
+               case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                  break;
+               case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                  break;
+               case ProtocolIE_ID_id_Cause:
+                  break;
+               case ProtocolIE_ID_id_RRCContainer:
+               {
+                  if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+                  {
+                     free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf);
+                  }
+                  break;
+               }
+               default :
+                  DU_LOG("\nERROR  -->  F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
+                       ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
+                  break;
+            }
+         }
+         free(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]);
       }
-      ret = duProcCellsToBeActivated(cell.nRCGI.pLMN_Identity.buf, nci, pci);
+      free(ueContextReleaseCommand->protocolIEs.list.array);
    }
-   return ret;
 }
-
-/******************************************************************
- *
- * @brief Processes F1 Setup Response sent by CU
- *
- * @details
- *
- *    Function : procF1SetupRsp
- *
- *    Functionality: Processes F1 Setup Response sent by CU
- *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg)
+/*******************************************************************
+*
+* @brief processing of UE Context Release Command
+*
+* @details
+*
+*    Function : procF1UeContextReleaseCommand 
+*
+*    Functionality: processing of UE Context Release Command
+*
+* @params[in] F1AP_PDU_t *f1apMsg
+* @return void
+*
+* ****************************************************************/
+uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t ret = ROK;
-   uint16_t idx;
-   F1SetupResponse_t *f1SetRspMsg = NULLP;
-   GNB_CU_Name_t     *cuName = NULLP;
-   RRC_Version_t     *rrc_Ver = NULLP;
-   F1SetupRsp  f1SetRspDb;
-   memset(&f1SetRspDb, 0, sizeof(F1SetupRsp));
+   uint8_t  ieIdx=0, ret=ROK, ueIdx=0;
+   uint16_t cellIdx =0, cellId = 0;
+   bool ueIdxFound = false;
+   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
+   DuUeCb   *duUeCb = NULLP;
+   UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
+
+   ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
+
+   if(ueContextReleaseCommand->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
+      {
+         if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
+         {
+            switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
+            {
+               case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                  {
+                     gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                    value.choice.GNB_CU_UE_F1AP_ID;
+                     break;
+                  }
+
+               case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                  {
+                     gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                     value.choice.GNB_DU_UE_F1AP_ID;
+                     break;
+                  }
 
-   DU_LOG("\nF1AP : F1 Setup Response received");
-   f1SetRspMsg = &f1apMsg->choice.successfulOutcome->value.choice.F1SetupResponse;
+               case ProtocolIE_ID_id_Cause:
+                  {
+                     for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+                     {
+                        for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+                        {
+                           if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                                 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+                           {
+                              cellId = duCb.actvCellLst[cellIdx]->cellId;
+                              duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                              ueIdxFound = true;
+                              break;
+                           }
+                        }
+                        if(ueIdxFound == true)
+                        {
+                           break;
+                        }
+                     }
+                     
+                     if(!ueIdxFound)
+                     {
+                        DU_LOG("\nERROR  -->  F1AP: procF1UeContextReleaseCommand(): Ue Information is not available");
+                        ret = RFAILED;
+                     }
+                     break;
+                  }
 
-   for(idx=0; idx<f1SetRspMsg->protocolIEs.list.count; idx++)
-   {
-      switch(f1SetRspMsg->protocolIEs.list.array[idx]->id)
-      {
-        case ProtocolIE_ID_id_Cells_to_be_Activated_List:
-           {
-              extractCellsToBeActivated(f1SetRspMsg->protocolIEs.list.array[idx]->\
-                    value.choice.Cells_to_be_Activated_List);
-              break;
-           }
-        case ProtocolIE_ID_id_TransactionID:
-           {
-              f1SetRspDb.transId = f1SetRspMsg->protocolIEs.list.array[idx]->\
-                                   value.choice.TransactionID;
-              break;
-           }
-        case ProtocolIE_ID_id_gNB_CU_Name:
-           {
-              cuName = &f1SetRspMsg->protocolIEs.list.array[idx]->\
-                       value.choice.GNB_CU_Name;
-              strcpy(f1SetRspDb.cuName, (const char*)cuName->buf);
-              break;
-           }
-        case ProtocolIE_ID_id_GNB_CU_RRC_Version:
-           {
-              rrc_Ver = &f1SetRspMsg->protocolIEs.list.array[idx]->\
-                        value.choice.RRC_Version;
-              strcpy(f1SetRspDb.rrcVersion.rrcVer,
-                    (const char*)rrc_Ver->latest_RRC_Version.buf);
-              break;
-           }
-        default:
-           DU_LOG("\nDU_APP : Invalid IE received in F1SetupRsp:%ld",
-                 f1SetRspMsg->protocolIEs.list.array[idx]->id);
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     if(ueIdxFound == true)  
+                     {
+                        DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                        if(duUeCb->f1UeDb)
+                        {
+                           memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+                           duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
+                           duUeCb->f1UeDb->cellIdx = cellIdx;
+                           /* Filling Dl RRC Msg Info */
+                           DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+                           if(!duUeCb->f1UeDb->dlRrcMsg)
+                           {
+                              DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                    Memory allocation failed ");
+                              ret = RFAILED;
+                           }
+                           else
+                           {
+                              duUeCb->f1UeDb->dlRrcMsgPres = true;
+                              memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                              ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                                    &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                    value.choice.RRCContainer);
+                           }
+
+                        }
+                        else
+                        {
+                           DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                 Memory allocation failed ");
+                           ret = RFAILED;
+
+                        }
+                     }
+                     break;
+                  }
+               default :
+                  DU_LOG("\nERROR  -->  F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
+                        ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
+                  break;
+            }
+         }
       }
-      duProcF1SetupRsp();
    }
+   if(ret != RFAILED)
+   {
+      duProcUeContextReleaseCommand(cellId, duUeCb);
+   }
+   freeAperDecodeUeContextReleaseCommand(f1apMsg);
    return ret;
 }
 
-/*******************************************************************
+/**************************************************************
  *
- * @brief Processes GNB DU config update ack
+ * @brief free the memory allocated by aper decoder for paging
  *
  * @details
  *
- *    Function : procF1GNBDUCfgUpdAck
+ *    Function : freeAperDecodePagingMsg
  *
- *    Functionality: Processes GNB DU config update ack
+ *    Functionality:
+ *         - free the memory allocated by aper decoder for
+ *         the paging f1ap msg
  *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
+ * @params[in] Paging_t   *paging
  * @return ROK     - success
  *         RFAILED - failure
  *
- * ****************************************************************/
-uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
+ ****************************************************************/
+void freeAperDecodePagingMsg(Paging_t   *paging)
 {
-   uint8_t ieIdx, transId;
-   GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
+   uint8_t ieIdx, cellIdx;
+   PagingCell_ItemIEs_t *pagingCellItemIes;
+   PagingCell_Item_t *pagingCellItem;
+   PagingCell_list_t  *pagingCelllist;
 
-   gnbDuAck = &f1apMsg->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge;
-   
-   for(ieIdx=0; ieIdx < gnbDuAck->protocolIEs.list.count; ieIdx++)
+   if(paging)
    {
-      switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
+      if(paging->protocolIEs.list.array)
       {
-         case ProtocolIE_ID_id_TransactionID:
-           transId = gnbDuAck->protocolIEs.list.array[ieIdx]->\
-              value.choice.TransactionID;
-            DU_LOG("\nF1AP : GNB-DU config update acknowledgment received for transId %d", transId);
-           break;
-         case ProtocolIE_ID_id_Cells_to_be_Activated_List:
-           break;
-         default :
-            DU_LOG("\nF1AP: Invalid IE Received: %ld, at procF1GNBDUCfgUpdAck()", \
-           gnbDuAck->protocolIEs.list.array[ieIdx]->id);
-           break;
+         for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
+         {
+            if(paging->protocolIEs.list.array[ieIdx])
+            {
+               switch(paging->protocolIEs.list.array[ieIdx]->id)
+               {
+                  case ProtocolIE_ID_id_UEIdentityIndexValue:
+                     {
+                        free(paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10.buf);
+                        break;
+                     }
+                  case ProtocolIE_ID_id_PagingIdentity:
+                     {
+                        if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present == PagingIdentity_PR_cNUEPagingIdentity)
+                        {
+                           if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)
+                           {
+                              if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->present == \
+                                    CNUEPagingIdentity_PR_fiveG_S_TMSI)
+                              {
+                                 free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf);
+                              }
+                              free(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity);
+                           }
+                        }
+                        break;
+                     }
+                  case ProtocolIE_ID_id_PagingCell_List:
+                     {
+                        pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list;
+                        if(pagingCelllist->list.array)
+                        {
+                           for(cellIdx = 0; cellIdx < pagingCelllist->list.count; cellIdx++)
+                           {
+                              if(pagingCelllist->list.array[cellIdx])
+                              {
+                                 pagingCellItemIes = (PagingCell_ItemIEs_t *)pagingCelllist->list.array[cellIdx];
+                                 if(pagingCellItemIes->id == ProtocolIE_ID_id_PagingCell_Item)
+                                 {
+                                    pagingCellItem = &pagingCellItemIes->value.choice.PagingCell_Item;
+                                    free(pagingCellItem->nRCGI.pLMN_Identity.buf);
+                                    free(pagingCellItem->nRCGI.nRCellIdentity.buf);
+                                 }
+                                 free(pagingCelllist->list.array[cellIdx]);
+                              }
+                           }
+                           free(pagingCelllist->list.array);
+                        }
+                        break;
+                     }
+               }
+               free(paging->protocolIEs.list.array[ieIdx]);
+            }
+         }
+         free(paging->protocolIEs.list.array);
+
       }
    }
-   duProcGnbDuCfgUpdAckMsg();
-#if 0
-   if(BuildAndSendF1ResetReq() != ROK)
-   {
-      return RFAILED;
-   }
-#endif
-   return ROK;
 }
 
-/******************************************************************
+/**************************************************************
  *
- * @brief Processes DL RRC Message Transfer  sent by CU
+ * @brief processing the paging f1ap msg received from CU 
  *
  * @details
  *
- *    Function : procF1DlRrcMsgTrans
+ *    Function : procPagingMsg
  *
- *    Functionality: Processes DL RRC Message Transfer sent by CU
+ *    Functionality:
+ *         - processing the paging f1ap msg received from CU
  *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
+ * @params[in] F1AP_PDU_t *f1apMsg
  * @return ROK     - success
  *         RFAILED - failure
  *
- * ****************************************************************/
-uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
+ *
+ ****************************************************************/
+uint8_t procPagingMsg(F1AP_PDU_t *f1apMsg) 
 {
-   uint8_t  idx, ret;
-   DLRRCMessageTransfer_t *f1DlRrcMsg = NULLP;
-   F1DlRrcMsg dlMsg;
-   memset(&dlMsg, 0, sizeof(F1DlRrcMsg));
+   uint8_t ieIdx = 0, cellListIdx = 0;
+   uint16_t cellId = 0, cellIdx = 0;
+   Paging_t   *paging = NULLP;
+   PagingCell_list_t  *pagingCelllist = NULLP;
+   PagingCell_ItemIEs_t *pagingCellItemIes = NULLP;
+   PagingCell_Item_t *pagingCellItem = NULLP;
+   DuPagingMsg *tmpPagingParam = NULLP;
+
+   DU_LOG("\nINFO  --> DU APP : Processing the Paging Message");
+   paging = &f1apMsg->choice.initiatingMessage->value.choice.Paging;
+   if(paging)
+   {
+      if(paging->protocolIEs.list.array)
+      {
+         DU_ALLOC(tmpPagingParam, sizeof(DuPagingMsg));
+         if(tmpPagingParam == NULLP)
+         {
+            DU_LOG("\nERROR  --> DU APP : Memory Allocation Failure in procPagingMsg");
+            freeAperDecodePagingMsg(paging);
+            return RFAILED;
+         }
+         for(ieIdx=0 ; ieIdx<paging->protocolIEs.list.count; ieIdx++)
+         {
+            if(paging->protocolIEs.list.array[ieIdx])
+            {
+               switch(paging->protocolIEs.list.array[ieIdx]->id)
+               {
+                  case ProtocolIE_ID_id_UEIdentityIndexValue:
+                     {
+                        bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.UEIdentityIndexValue.choice.indexLength10,\
+                                         &tmpPagingParam->ueId);
+                        break;
+                     }
 
-   DU_LOG("\nDU_APP : DL RRC message transfer Recevied");
-   f1DlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
+                  case ProtocolIE_ID_id_PagingIdentity:
+                     {
+                        switch(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.present)
+                        {
+                           case PagingIdentity_PR_cNUEPagingIdentity: 
+                              {
+                                 if(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.cNUEPagingIdentity)  
+                                 {
+                                    bitStringToInt(&paging->protocolIEs.list.array[ieIdx]->value.choice.PagingIdentity.choice.\
+                                          cNUEPagingIdentity->choice.fiveG_S_TMSI, &tmpPagingParam->sTmsi);
+
+                                 }
+                                 break;
+                              }
+                            case PagingIdentity_PR_rANUEPagingIdentity:
+                               {
+                                  /*TODO: This Identifier is specific to RAN Initiated Paging – Connected Mode Paging*/
+                                  break;
+                               }
+                            default:
+                               {
+                                  DU_LOG("ERROR  -->  DU APP: Invalid UE Paging Identity, Skipping this Paging Message:");
+                                  continue;
+                               }
+                        }
+                     }
 
-   ret = ROK;
+                  case ProtocolIE_ID_id_PagingDRX:
+                     {
+                        tmpPagingParam->pagingDrxPres = TRUE;
+                        tmpPagingParam->pagingDrx = convertPagingCycleEnumToValue(paging->protocolIEs.list.array[ieIdx]->value.choice.PagingDRX);
+                        break;
+                     }
 
-   for(idx=0; idx<f1DlRrcMsg->protocolIEs.list.count; idx++)
-   {
-      switch(f1DlRrcMsg->protocolIEs.list.array[idx]->id)
-      {
-        case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-           {
-              dlMsg.gnbCuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
-              break;
-           }
-        case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-           {
-              dlMsg.gnbDuUeF1apId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
-              break;
-           }
-        case ProtocolIE_ID_id_SRBID:
-           {
-              dlMsg.srbId = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
-              break;
-           }
-        case ProtocolIE_ID_id_ExecuteDuplication:
-           dlMsg.execDup = true;
-           break;
+                  case ProtocolIE_ID_id_PagingPriority:
+                     {
+                        tmpPagingParam->pagPriority = paging->protocolIEs.list.array[ieIdx]->value.choice.PagingPriority;
+                        break;
+                     }
 
-        case ProtocolIE_ID_id_RRCContainer:
-           {
-              if(f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size > 0)
-              {
-                 dlMsg.rrcMsgSize = f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size;
-                 DU_ALLOC(dlMsg.rrcMsgPdu, dlMsg.rrcMsgSize);
-                 if(dlMsg.rrcMsgPdu)
-                 {
-                    memcpy(dlMsg.rrcMsgPdu, f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,\
-                       dlMsg.rrcMsgSize);
-                 }
-                 else
-                 {
-                    DU_LOG("\nDU_APP : Memory alloc Failed at RRC Container at procF1DlRrcMsgTrans()");
-                     return RFAILED;
-                 }
-              }
-              else
-              {
-                 DU_LOG("\nDU_APP : RRC Container Size is invalid:%ld",\
-                 f1DlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
-                 return RFAILED;
-              }
-              break;
-           }
-         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
-           {
-              dlMsg.deliveryStatRpt = true;
-              break;
-           }
-        default:
-           DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
-                 f1DlRrcMsg->protocolIEs.list.array[idx]->id);
+                  case ProtocolIE_ID_id_PagingCell_List:
+                     {
+                        pagingCelllist = &paging->protocolIEs.list.array[ieIdx]->value.choice.PagingCell_list; 
+                        if(pagingCelllist->list.array)
+                        {
+                           for(cellListIdx = 0; cellListIdx < pagingCelllist->list.count; cellListIdx++)
+                           {
+                              if(pagingCelllist->list.array[cellListIdx])
+                              {
+                                 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
+                                 {
+                                    DU_LOG("\nERROR  --> F1AP : CellId:%d Not in Activelist",cellId);
+                                    continue;
+                                 }
+                              }
+                           }
+                        }
+                        break;
+                     }
+                   default:
+                     {
+                         DU_LOG("\nERROR  --> F1AP : Incorrect Paging IE option");
+                         break;
+                     }
+               }
+            }
+         }
       }
    }
-
-   ret = duProcDlRrcMsg(&dlMsg);
-   return ret;
+   DU_FREE(tmpPagingParam, sizeof(DuPagingMsg));
+   freeAperDecodePagingMsg(paging);
+  
+   return ROK;
 }
 
-/*****************************************************************i
+/**************************************************************
  *
  * @brief Handles received F1AP message and sends back response  
  *
@@ -9442,15 +15559,14 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
  * ****************************************************************/
 void F1APMsgHdlr(Buffer *mBuf)
 {
-   int i;
-   char *recvBuf;
-   MsgLen copyCnt;
-   MsgLen recvBufLen;
-   F1AP_PDU_t *f1apMsg;
+   int i =0;
+   char *recvBuf =NULLP;
+   MsgLen copyCnt =0;
+   MsgLen recvBufLen =0;
+   F1AP_PDU_t *f1apMsg =NULLP;
    asn_dec_rval_t rval; /* Decoder return value */
    F1AP_PDU_t f1apasnmsg ;
-
-   DU_LOG("\nF1AP : Received F1AP message buffer");
+   DU_LOG("\nINFO  -->  F1AP : Received F1AP message buffer");
    ODU_PRINT_MSG(mBuf, 0,0);
 
    /* Copy mBuf into char array to decode it */
@@ -9459,16 +15575,16 @@ void F1APMsgHdlr(Buffer *mBuf)
 
    if(recvBuf == NULLP)
    {
-      DU_LOG("\nF1AP : Memory allocation failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed");
       return;
    }
    if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, &copyCnt) != ROK)
    {
-      DU_LOG("\nF1AP : Failed while copying %d", copyCnt);
+      DU_LOG("\nERROR   -->  F1AP : Failed while copying %d", copyCnt);
       return;
    }
 
-   printf("\nF1AP : Received flat buffer to be decoded : ");
+   printf("\nDEBUG   -->  F1AP : Received flat buffer to be decoded : ");
    for(i=0; i< recvBufLen; i++)
    {
       printf("%x",recvBuf[i]);
@@ -9479,11 +15595,10 @@ void F1APMsgHdlr(Buffer *mBuf)
    memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
 
    rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
-   DU_FREE(recvBuf, (Size)recvBufLen);
 
    if(rval.code == RC_FAIL || rval.code == RC_WMORE)
    {
-      DU_LOG("\nF1AP : ASN decode failed");
+      DU_LOG("\nERROR  -->  F1AP : ASN decode failed");
       return;
    }
    printf("\n");
@@ -9492,75 +15607,93 @@ void F1APMsgHdlr(Buffer *mBuf)
    switch(f1apMsg->present)
    {
       case F1AP_PDU_PR_successfulOutcome:
-        {
-           switch(f1apMsg->choice.successfulOutcome->value.present)
-           {
-              case SuccessfulOutcome__value_PR_ResetAcknowledge:
-                 {
-                    DU_LOG("\nF1AP : F1ResetAcknowledge is received successfully ");
-                    break;
-                 }
-              case SuccessfulOutcome__value_PR_F1SetupResponse:
-                 {                             
+         {
+            switch(f1apMsg->choice.successfulOutcome->value.present)
+            {
+               case SuccessfulOutcome__value_PR_ResetAcknowledge:
+                  {
+                     DU_LOG("\nINFO   -->  F1AP : F1ResetAcknowledge is received successfully ");
+                     break;
+                  }
+               case SuccessfulOutcome__value_PR_F1SetupResponse:
+                  {                            
 #ifndef ODU_TEST_STUB
-                    procF1SetupRsp(f1apMsg);
+                     procF1SetupRsp(f1apMsg, recvBufLen, recvBuf);
 #endif
-                    break;
-                 }
+                     break;
+                  }
 
-              case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
-                 {
-                    procF1GNBDUCfgUpdAck(f1apMsg);
-                    break;
-                 }
+               case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
+                  {
+                     procF1GNBDUCfgUpdAck(f1apMsg);
+                     break;
+                  }
 
-              default:
-                 {
-                    DU_LOG("\nF1AP : Invalid type of successful outcome [%d]", f1apMsg->choice.successfulOutcome->value.present);
-                    return;
-                 }
-           }/* End of switch(successfulOutcome) */
-           break;
-        }
+               default:
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Invalid type of SuccessfulOutcome__value_PR_ResetAcknowledge [%d]",\
+                           f1apMsg->choice.successfulOutcome->value.present);
+                     return;
+                  }
+            }/* End of switch(successfulOutcome) */
+            free(f1apMsg->choice.successfulOutcome);
+            break;
+         }
       case F1AP_PDU_PR_initiatingMessage:
-        {
-           switch(f1apMsg->choice.initiatingMessage->value.present)
-           {
-              case InitiatingMessage__value_PR_Reset:
-                 {
-                    DU_LOG("\nF1AP : F1 reset request received");
-                    procF1ResetReq(f1apMsg);
-                    break;
-                 }
-              case InitiatingMessage__value_PR_DLRRCMessageTransfer:
-                 {
-                    procF1DlRrcMsgTrans(f1apMsg);
-                    break;
-                 }
-              case InitiatingMessage__value_PR_UEContextSetupRequest:
-                 {
-                    procF1UeContextSetupReq(f1apMsg);
-                    break;
-                 }
-
-              default:
-                 {
-                    DU_LOG("\nF1AP : Invalid type of initiating message[%d]",
-                          f1apMsg->choice.initiatingMessage->value.present);
-                    return;
-                 }
-           }/* End of switch(initiatingMessage) */
-           break;
-        }
+         {
+            switch(f1apMsg->choice.initiatingMessage->value.present)
+            {
+               case InitiatingMessage__value_PR_Reset:
+                  {
+                     procF1ResetReq(f1apMsg);
+                     break;
+                  }
+               case InitiatingMessage__value_PR_DLRRCMessageTransfer:
+                  {
+                     procF1DlRrcMsgTrans(f1apMsg);
+                     break;
+                  }
+               case InitiatingMessage__value_PR_UEContextSetupRequest:
+                  {
+                     procF1UeContextSetupReq(f1apMsg);
+                     break;
+                  }
+               case InitiatingMessage__value_PR_UEContextModificationRequest:
+                  {
+                     procF1UeContextModificationReq(f1apMsg);
+                     break;
+                  }
+               case InitiatingMessage__value_PR_UEContextReleaseCommand:
+                  {
+                      procF1UeContextReleaseCommand(f1apMsg);
+                      break;
+                  }
+               case InitiatingMessage__value_PR_Paging:
+                  {
+                     procPagingMsg(f1apMsg);
+                     break;
+                  }
+               default:
+                  {
+                     DU_LOG("\nERROR  -->  F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
+                           f1apMsg->choice.initiatingMessage->value.present);
+                     return;
+                  }
+            }/* End of switch(initiatingMessage) */
+            free(f1apMsg->choice.initiatingMessage);
+            break;
+         }
 
       default:
-        {
-           DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
-           return;
-        }
+         {
+            DU_LOG("\nERROR  -->  F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
+            return;
+         }
+         free(f1apMsg);
 
    }/* End of switch(f1apMsg->present) */
-
+   
+   DU_FREE(recvBuf, (Size)recvBufLen);
 } /* End of F1APMsgHdlr */
 
 /**********************************************************************