code changes in Gnb-DU config update for CLA [Issue Id - ODUHIGH-335]
[o-du/l2.git] / src / du_app / du_f1ap_msg_hdl.c
index e860d41..31b432b 100644 (file)
@@ -22,6 +22,7 @@
 #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"
@@ -91,7 +92,6 @@
 #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 "UPTransportLayerInformation.h"
 #include "GTPTunnel.h"
 
+#ifdef O1_ENABLE
+#include "ConfigInterface.h"
+extern StartupConfig g_cfg;
+#endif
+
 DuCfgParams duCfgParam;
 
 /************************************************************************
@@ -174,9 +179,9 @@ uint16_t getPollRetxTmr(uint8_t pollRetxTmrCfg)
  * @return Actual value of pollPdu
  *
  * ****************************************************************/
-int16_t getPollPdu(uint8_t pollPduCfg)
+int32_t getPollPdu(uint8_t pollPduCfg)
 {
-   int16_t pollPdu;
+   int32_t pollPdu;
    switch(pollPduCfg)
    {
       case PollPDU_p4:
@@ -593,6 +598,109 @@ int16_t getStatProhTmr(uint8_t statProhTmrCfg)
    return statProhTmr; 
 }
 
+/*******************************************************************
+*
+* @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 
@@ -1091,16 +1199,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 =\
@@ -1197,7 +1304,7 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
  *
  * @details
  *
- *    Function : SendF1APMsg
+ *    Function : sendF1APMsg
  *
  *    Functionality: Sends F1 msg over SCTP
  *
@@ -1207,11 +1314,11 @@ uint8_t BuildRrcVer(RRC_Version_t *rrcVer)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t SendF1APMsg(Region region, Pool pool)
+uint8_t sendF1APMsg()
 {
    Buffer *mBuf = NULLP;
   
-   if(ODU_GET_MSG_BUF(region, pool, &mBuf) == ROK)
+   if(ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) == ROK)
    {
       if(ODU_ADD_POST_MSG_MULT((Data *)encBuf, encBufSize, mBuf) == ROK)
       {
@@ -1238,7 +1345,7 @@ uint8_t SendF1APMsg(Region region, Pool pool)
       return RFAILED;
    }
    return ROK; 
-} /* SendF1APMsg */
+} /* sendF1APMsg */
 
 /*******************************************************************
  *
@@ -1690,7 +1797,7 @@ uint8_t BuildAndSendF1SetupReq()
       }
 
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending F1 Setup request failed");
         break;
@@ -1705,6 +1812,203 @@ 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,i=0;
+   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[arrIdx])
+                  {
+                     if(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                           array[arrIdx]->pLMN_Identity.buf != NULLP)
+                     {
+                        if(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                              array[arrIdx]->iE_Extensions!= NULLP)
+                        {
+                           if(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                 array[arrIdx]->iE_Extensions->list.array != NULLP)
+                           {
+                              if(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                    array[arrIdx]->iE_Extensions->list.array[arrIdx])
+                              {
+                                 if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                       iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                                       list.array !=NULLP)
+                                 {
+                                    if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                          iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                                          list.array[arrIdx]!=NULLP)
+                                    {
+                                       if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                             iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                                             list.array[arrIdx]->sNSSAI.sST.buf!=NULLP)
+                                       {
+                                          if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                                iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                                SliceSupportList.\
+                                                list.array[arrIdx]->sNSSAI.sD != NULLP)
+                                          {
+                                             if(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                                   iE_Extensions->list.array[arrIdx]->extensionValue.\
+                                                   choice.SliceSupportList.\
+                                                   list.array[arrIdx]->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[arrIdx]!=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[arrIdx]!= NULLP)
+                                                            {
+                                                               if(modifyItem->served_Cell_Information.\
+                                                                     measurementTimingConfiguration.buf !=NULLP)
+                                                               {
+                                                                  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[arrIdx],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[arrIdx],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[arrIdx]->iE_Extensions->list.array[arrIdx]->extensionValue.\
+                                                      choice.SliceSupportList.\
+                                                      list.array[arrIdx]->sNSSAI.sD->buf,modifyItem->\
+                                                      served_Cell_Information.\
+                                                      servedPLMNs.list.array[arrIdx]->iE_Extensions->list.\
+                                                      array[arrIdx]->\
+                                                      extensionValue.choice.SliceSupportList.list.array[arrIdx]->\
+                                                      sNSSAI.sD->size);
+
+                                             }
+                                             DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                                   array[arrIdx]->\
+                                                   iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                                   SliceSupportList.\
+                                                   list.array[arrIdx]->sNSSAI.sD,sizeof(OCTET_STRING_t));
+                                          }
+                                          DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                                iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                                SliceSupportList.\
+                                                list.array[arrIdx]->sNSSAI.sST.buf,modifyItem->served_Cell_Information.\
+                                                servedPLMNs.\
+                                                list.array[arrIdx]->iE_Extensions->list.array[arrIdx]->\
+                                                extensionValue.choice.\
+                                                SliceSupportList.list.array[arrIdx]->sNSSAI.sST.size);
+                                       }
+                                       DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                             iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                                             list.array[arrIdx],sizeof(SliceSupportItem_t));
+                                    }
+                                    DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                          iE_Extensions->list.array[arrIdx]->extensionValue.choice.SliceSupportList.\
+                                          list.array,\
+                                          modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->\
+                                          iE_Extensions->list.array[arrIdx]->extensionValue.choice.\
+                                          SliceSupportList.list.size);
+                                 }
+                              }
+                              for(i=0;i<modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                    array[arrIdx]->iE_Extensions->list.count;i++)
+                              {
+                                 DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                       array[arrIdx]->iE_Extensions->list.array[i],\
+                                       sizeof(ServedPLMNs_ItemExtIEs_t ));
+                              }
+                              DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                    array[arrIdx]->iE_Extensions->list.array,modifyItem->served_Cell_Information.\
+                                    servedPLMNs.list.array[arrIdx]->iE_Extensions->list.size);
+                           }
+                           DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                                 array[arrIdx]->iE_Extensions,sizeof(ProtocolExtensionContainer_4624P3_t));
+                        }
+                        DU_FREE(modifyItem->served_Cell_Information.servedPLMNs.list.\
+                              array[arrIdx]->pLMN_Identity.buf,
+                              modifyItem->served_Cell_Information.servedPLMNs.list.array[arrIdx]->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);  
+   }
+}
 /*******************************************************************
  *
  * @brief Deallocating memory of BuildAndSendDUConfigUpdate
@@ -1723,231 +2027,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);
+         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);
+                           }
 
-                                                              }
-                                                              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));
+                           break;
+                        }
+                     case GNBDUConfigurationUpdateIEs__value_PR_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));
    }
@@ -2360,6 +2520,111 @@ 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)
+{
+   uint8_t arrIdx;
+   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;
+   }
+   for(arrIdx = 0; arrIdx < deleteItem->oldNRCGI.nRCellIdentity.size-1; arrIdx++)
+   {
+      deleteItem->oldNRCGI.nRCellIdentity.buf[arrIdx] = 0;
+   }
+   deleteItem->oldNRCGI.nRCellIdentity.buf[4] = 16;
+   deleteItem->oldNRCGI.nRCellIdentity.bits_unused = 4;
+   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;
+}
 
 /*******************************************************************
  *
@@ -2379,12 +2644,14 @@ 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;
 
@@ -2395,78 +2662,106 @@ uint8_t BuildAndSendDUConfigUpdate()
       DU_ALLOC(f1apDuCfg, sizeof(F1AP_PDU_t));
       if(f1apDuCfg == NULLP)
       {
-        DU_LOG("\nERROR  -->  F1AP : 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("\nERROR  -->  F1AP : 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("ERROR  -->  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;
-
-      // NOTE :GNB DU SYS INFO:MIB AND SIB1 INFORMATION TO BE BUILT AND FILLED HERE
-      /*GNB DU ID */
+      
+      ieIdx++;
+      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;
 
@@ -2480,30 +2775,30 @@ uint8_t BuildAndSendDUConfigUpdate()
       /* Checking encode results */
       if(encRetVal.encoded == ENCODE_FAIL)
       {
-        DU_LOG("ERROR  -->  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("\nDEBUG   -->  F1AP : 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("\nERROR  -->  F1AP : Sending GNB-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;
 }
 
@@ -2697,7 +2992,7 @@ uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId, \
       }
 
       /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL)        !=      ROK)
+      if(sendF1APMsg() !=      ROK)
       {
         DU_LOG("\nERROR  -->   F1AP : Sending  UL RRC Message Transfer Failed");
         break;
@@ -5894,7 +6189,7 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti
         }
       }
       /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending Initial UL RRC Message Transfer Failed");
         ret = RFAILED;
@@ -6955,21 +7250,21 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc
          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);
-              }
+                  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)
+                  if(rlcDbCfg->u.umBiDirCfg)
                      extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
-              }
+               }
                break;
             }
          case RLC_UM_UNI_DIRECTIONAL_UL :
@@ -6977,9 +7272,9 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc
                if(lcCfg->choice.um_Uni_Directional_DL)
                {
                   DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
-                 if(rlcDbCfg->u.umUniDirUlCfg)
+                  if(rlcDbCfg->u.umUniDirUlCfg)
                      extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
-              }
+               }
                break;
             }
          case RLC_UM_UNI_DIRECTIONAL_DL :
@@ -6987,9 +7282,9 @@ void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lc
                if(lcCfg->choice.um_Uni_Directional_UL)
                {
                   DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
-                 if(rlcDbCfg->u.umUniDirDlCfg)
+                  if(rlcDbCfg->u.umUniDirDlCfg)
                      extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
-              }
+               }
                break;
             }
          default:
@@ -7167,7 +7462,11 @@ uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
 
    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++)
    {
@@ -7194,7 +7493,56 @@ uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
    }
    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 extractDrbCfg()");
+         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(!macLcToAdd->snssai)
+   {
+      DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai));
+      if(macLcToAdd->snssai == NULLP)
+      {
+         DU_LOG("\nERROR  -->  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);
+   }
+   return ROK;
+}
 /*******************************************************************
  *
  * @brief Function to extract DRB info received from CU
@@ -7209,55 +7557,55 @@ uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
  * @return void
  *
  * ****************************************************************/
-uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
+uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem,DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
+LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
 {
    DRB_Information_t *drbInfo = NULLP;
 
-   if(extractUpTnlInfo(drbItem->dRBID, CONFIG_ADD, &drbItem->uLUPTNLInformation_ToBeSetup_List, upTnlInfo) != ROK)
+   if(drbItem != NULLP)
    {
-      DU_LOG("\nERROR  -->  DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
-      return RFAILED;
+      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;
+            }
+         }
+      }
    }
-   if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
+   else if(drbSetupModItem != NULLP)
    {
-      if(drbItem->qoSInformation.choice.choice_extension->value.present ==
-           QoSInformation_ExtIEs__value_PR_DRB_Information)
+      if(extractUpTnlInfo(drbSetupModItem->dRBID, CONFIG_ADD, &drbSetupModItem->uLUPTNLInformation_ToBeSetup_List,\
+      upTnlInfo) != ROK)
       {
-        drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
-
-        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 extractDrbCfg()");
-              return RFAILED;
-           }
+         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;
+            }
 
-        }
-        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("\nERROR  -->  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;
 }
 
@@ -7277,11 +7625,19 @@ uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, UpTnlCf
  * ****************************************************************/
 
 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
-  LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
+DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
    if(drbCfg != NULLP)
    {
-      if(extractDrbCfg(drbCfg, lcCfg, upTnlInfo) != ROK)
+      if(extractDrbCfg(drbCfg, NULL, lcCfg, upTnlInfo) != ROK)
+      {
+         DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+         return RFAILED;
+      }
+   }
+   else if(drbSetupModCfg != NULLP)
+   { 
+      if(extractDrbCfg(NULL, drbSetupModCfg, lcCfg, upTnlInfo) != ROK)
       {
          DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
          return RFAILED;
@@ -7322,7 +7678,8 @@ uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
  * ****************************************************************/
 
 uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
-   DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
+DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LogicalChannelConfig_t *ulLcCfg,\
+LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
    uint8_t ret = ROK;
 
@@ -7330,11 +7687,14 @@ uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
    lcCfg->configType = configType;
    if(rbType == RB_TYPE_SRB)
    {
-      ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg, NULL);
+      ret = extractMacRbCfg(lcId, NULL,NULL, ulLcCfg, lcCfg, NULL);
    }
    else if(rbType == RB_TYPE_DRB)
    {
-      ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg, upTnlInfo);
+      if(drbItem != NULL)
+        ret = extractMacRbCfg(lcId, drbItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
+      else if(drbSetupModItem != NULL)
+        ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, ulLcCfg, lcCfg, upTnlInfo);
    }
    return ret;
 }
@@ -7355,10 +7715,9 @@ uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
  *
  * ****************************************************************/
 
-uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \
-   DuUeCfg *ueCfgDb)
+uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, DuUeCfg *ueCfgDb)
 {
-  uint8_t ret, idx, rbId, lcId, rlcMode, rbType;
+  uint8_t idx, rbId, lcId, rlcMode, rbType;
   RLC_Config_t *f1RlcCfg = NULLP;
   LogicalChannelConfig_t *macUlLcCfg = NULLP;
 
@@ -7407,17 +7766,16 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList
      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], NULL);
-     if(ret == RFAILED)
+     if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
      {
         DU_LOG("\nERROR  -->  DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
-        return ret;
+        return RFAILED;
      }
      (ueCfgDb->numRlcLcs)++;
      (ueCfgDb->numMacLcs)++;
   }
   //TODO: To send the failure cause in UeContextSetupRsp 
-  return ret;
+  return ROK;
 }
 
 /*******************************************************************
@@ -8730,79 +9088,82 @@ uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg
       /* 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)
-        {
+         }
+         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)
-           {
+            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)
-           {
+               *(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;
-              }
-           }
-        }
+               {
+                  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)
+         {
+            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(cellGrp->spCellConfig->spCellConfigDedicated)
+         {
+            servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
             ret = extractSpCellDedicatedCfg(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
-           if(ret == RFAILED)
-           {
-              DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
-           }
-        }
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR --> F1AP : Failed at extractSpCellDedicatedCfg()");
+            }
+         }
       }
    }
    return ret;
@@ -9034,129 +9395,132 @@ 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)
-                                               {
-                                                  freeAperDecodeULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
-                                                  free(drbSetItem->uLConfiguration);
-
-
-                                                  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.\
+         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)
+                     {
 
-                             qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
-                    }
+                        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->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);
-           }
-        }
-        if(drbSet->list.array[drbIdx]!=NULLP)
-        {
-           free(drbSet->list.array[drbIdx]);
-        }
+                  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);
    }
@@ -9217,93 +9581,100 @@ uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo)
  * ****************************************************************/
 void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
 {
-   UE_NR_Capability_t *ueNrCap;
-
-   if(ueCap)
-      ueNrCap = (UE_NR_Capability_t *)ueCap;
+   UE_NR_Capability_t *ueNrCap=NULLP;
 
-   /* Filling DL modulation info */
-   if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
-        ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
-        ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
+   if(!ueCap)
    {
-      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");
-              memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-              break;
-           }
-      }
+      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));     
+      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
    }
    else
    {
-      memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
-   }
+      ueNrCap = (UE_NR_Capability_t *)ueCap;
 
-   /* 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))
+      /* Filling DL modulation info */
+      if(ueNrCap->featureSets && ueNrCap->featureSets->featureSetsDownlinkPerCC && \
+         ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0] && \
+         ueNrCap->featureSets->featureSetsDownlinkPerCC->list.array[0]->supportedModulationOrderDL)
       {
-        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");
-              memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
-              break;
-           }
+         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");
+                  memcpy(&ueCfg->dlModInfo, &oldUeCfg->dlModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         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");
+                  memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
+                  break;
+               }
+         }
+      }
+      else
+      {
+         memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
       }
-   }
-   else
-   {
-      memcpy(&ueCfg->ulModInfo, &oldUeCfg->ulModInfo, sizeof(ModulationInfo));
    }
 }
 
@@ -9325,7 +9696,7 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
  * ****************************************************************/
 
 CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\
-   DuUeCfg *ueCfgDb)
+      DuUeCfg *ueCfgDb)
 {
    uint8_t idx2 =0;
    uint16_t id =0;
@@ -9397,7 +9768,7 @@ uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, R
    procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd);
 
    /* Filling MAC INFO */
-   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL, NULL, macLcToAdd, NULL);
+   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, macLcToAdd, NULL);
    if(ret == RFAILED)
    { 
       DU_LOG("\nERROR  -->  F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
@@ -9485,22 +9856,32 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
  * ****************************************************************/
 
 uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
-   LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
 {
-   uint8_t ret = ROK;
 
-   /* Filling RLC INFO */
-   procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
+   if(drbItem != NULLP)
+   {
+      /* Filling RLC INFO */
+      procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
 
-   /* Filling MAC INFO */
-   ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd, upTnlInfo);
-   if(ret == RFAILED)
-   { 
-      DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
-      return ret;
+      /* Filling MAC INFO */
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
+      { 
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
+         return RFAILED;
+      }
    }
+   else if(drbSetupModItem != NULLP)
+   {
+      procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
 
-   return ret;
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
+         return RFAILED;
+      }
+   }
+   return ROK;
 }
 
 /*******************************************************************
@@ -9520,43 +9901,64 @@ uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
  *
  * ****************************************************************/
 
-uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg, DuUeCfg *ueCfgDb)
+uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg,DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
+uint8_t drbCount, DuUeCfg *ueCfgDb)
 {
    uint8_t ret, drbIdx;
    DRBs_ToBeSetup_Item_t *drbItem = NULLP;
-   
+   DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
+
    ret = ROK;
-   if(drbCfg)
+   if(drbCount > 0)
    {
-      for(drbIdx = 0; drbIdx < drbCfg->list.count; drbIdx++)
+      for(drbIdx = 0; drbIdx < drbCount; drbIdx++)
       {
-         drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
-        if(ueCfgDb->numMacLcs > MAX_NUM_LC)
-        { 
+         if(ueCfgDb->numMacLcs > MAX_NUM_LC)
+         { 
             DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in MAC at extractDrbListToSetup()");
-           ret = RFAILED;
-           break;
-        }
-        if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
-        {
+            ret = RFAILED;
+            break;
+         }
+         if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+         {
             DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in RLC at extractDrbListToSetup()");
-           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->upTnlInfo[ueCfgDb->numDrb]);
-
-        ueCfgDb->numRlcLcs++;
-        ueCfgDb->numMacLcs++;
-        ueCfgDb->numDrb++;
-        if(ret == RFAILED)
-        {
+            ret = RFAILED;
+            break;
+         }
+         memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+         memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+   
+         if(drbCfg != NULL)
+         {
+            drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+            ret = procDrbListToSetup(lcId, drbItem, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
+               &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
+               break;
+            }
+         }
+         else if(drbSetupModCfg != NULL)
+         {
+            drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
+            ret = procDrbListToSetup(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item) ,\
+            &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
+            &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
+               break;
+            }
+         }
+         ueCfgDb->numRlcLcs++;
+         ueCfgDb->numMacLcs++;
+         ueCfgDb->numDrb++;
+         if(ret == RFAILED)
+         {
             DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
-           break;
-        }
+            break;
+         }
       }
    }
    else
@@ -9785,193 +10187,194 @@ void freeAperDecodeF1UeContextSetupReq(UEContextSetupRequest_t   *ueSetReq)
  * ****************************************************************/
 uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t  ret, ieIdx, ueIdx, lcId, cellIdx;
+   uint8_t  ret=0, ieIdx=0, ueIdx=0, lcId=0, cellIdx=0;
    bool ueCbFound = false;
-   uint32_t gnbCuUeF1apId, gnbDuUeF1apId, bitRateSize;
-   DuUeCb   *duUeCb = NULLP;
-   UEContextSetupRequest_t   *ueSetReq = NULLP;
-    
+   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0, bitRateSize=0;
+   DuUeCb   *duUeCb = NULL;
+   UEContextSetupRequest_t   *ueSetReq = NULL;
+   DRBs_ToBeSetup_List_t *drbCfg = 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_ServCellIndex:
-           {
-              cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
+         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_ServCellIndex:
+            {
+               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;
+               {
+                  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
-                    {
+                        duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
+                        duUeCb->f1UeDb->cellIdx = cellIdx;
+                     }
+                     else
+                     {
                         DU_LOG("\nERROR  -->  F1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
                         ret = RFAILED;
-                    }
-                 }
-                 else
-                    ueCbFound = false;
-                 
-              }
-              if(!ueCbFound)
-              {
+                     }
+                  }
+                  else
+                     ueCbFound = false;
+
+               }
+               if(!ueCbFound)
+               {
                   DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
                   ret = RFAILED;
-              }
-              break;
-           }
+               }
+               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;
+            /* 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);
+                  extractUeCapability(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.\
+                  uE_CapabilityRAT_ContainerList, duUeCb);
                }
-              if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions)
-              {
+               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("\nERROR  -->  F1AP: Failed to extract cell Grp Info");
-                    //TODO: Update the failure cause in ue context Setup Response
-                    ret = RFAILED;
-                 }
-              }
+                        value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg);
+                  if(!duUeCb->f1UeDb->duUeCfg.cellGrpCfg)
+                  {
+                     DU_LOG("\nERROR  -->  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("\nINFO   -->  DU_APP: Received SCell_ToBeSetup_List but  Not processing the list");
-           break;
-           }
+            {
+               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;
-           }
+            {
+               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:
-           {
-              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("\nERROR  -->  DU APP : Failed at extractDrbListToSetup()");
-                    //TODO: Update the failure cause in ue context Setup Response
-                    ret = RFAILED;
-                 }
-              }
-              else 
-                 ret = RFAILED;
+            {
+               lcId = getDrbLcId(&duUeCb->drbBitMap);
+               if(lcId != RFAILED)
+               {
+                  drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
+                  if(extractDrbListToSetup(lcId, drbCfg, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg))
+                  {
+                     DU_LOG("\nERROR  -->  DU 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("\nERROR  -->  DU 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("\nERROR  -->  Ignoring delivery report, since rrcContainer is not present");
-              }
-              break;
-           }
-        case ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL:
-            {
+            }
+         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)
-              {
+               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)); 
+                  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;
-           }
+                           ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf, bitRateSize);
+                  }
+               }
+               else
+                  ret = RFAILED;
+               break;
+            }
+         default:
+            {
+               break;
+            }
       }
    }
    if(ret == RFAILED)
    {
       /*TODO : Negative case*/
-      // BuildAndSendUeContextSetupRsp(ueIdx, cellId);
+      // BuildAndSendUeContextSetupRsp(cellId,ueIdx);
       DU_LOG("\nERROR  -->  F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); 
    }
    else
       ret = duProcUeContextSetupRequest(duUeCb);
-   
+
    freeAperDecodeF1UeContextSetupReq(ueSetReq); 
    return ret;
 
 }
-
 /*******************************************************************
  * @brief Free the memory allocated for Dl Tunnel Info
  *
@@ -10309,13 +10712,13 @@ uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
  *    Functionality: Constructs the UE Setup Response and sends
  *                   it to the DU through SCTP.
  *
- * @params[in] 
+ * @params[in] uint8_t cellId,uint8_t ueIdx
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
+uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx)
 {
    uint8_t   idx, ret, cellIdx, elementCnt;
    uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
@@ -10484,7 +10887,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
       }
 
       /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL)        != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Setup Response failed");
         ret = RFAILED;
@@ -10510,7 +10913,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
 *         failure = RFAILED
 *
 * ****************************************************************/
-uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
+uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx)
 {
    uint8_t cellIdx = 0, actionType = 0; 
 
@@ -10520,11 +10923,15 @@ uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
    switch(actionType)
    {
       case UE_CTXT_SETUP:
-         BuildAndSendUeContextSetupRsp(ueIdx, cellId);
-         break;
+         {
+            BuildAndSendUeContextSetupRsp(cellId,ueIdx);
+            break;
+         }
       case UE_CTXT_MOD:
-         //TODO: Build Ue context Modification Rsp
-         break;
+         {
+            BuildAndSendUeContextModRsp(cellId, ueIdx);
+            break;
+         }
       default:
          DU_LOG("ERROR  -->  F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
          break;
@@ -10686,7 +11093,7 @@ uint8_t BuildAndSendF1ResetReq()
         }
       }
 
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending F1 Reset request failed");
         break;
@@ -10839,7 +11246,7 @@ uint8_t BuildAndSendF1ResetAck()
         }
       }
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending F1 Reset Acknowledgement failed");
         break;
@@ -11106,7 +11513,7 @@ uint8_t BuildAndSendRrcDeliveryReport(uint32_t gnbCuUeF1apId, \
       }
 
       /* Sending msg */
-      if(SendF1APMsg(DU_APP_MEM_REGION, DU_POOL) != ROK)
+      if(sendF1APMsg() != ROK)
       {
         DU_LOG("\nERROR  -->  F1AP : Sending RRC delivery  msg request failed");
         break;
@@ -11369,6 +11776,99 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
       free(gnbDuAck->protocolIEs.list.array);
    }
 }
+
+/*******************************************************************
+*
+* @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 duProcGnbDuCfgUpdAckMsg(uint8_t transId)
+{
+   uint8_t ueId =0 , ueIdx =0, ieIdx=0,arrIdx=0;
+   uint8_t cellId =0, cellIdx =0, crnti=0;
+   CmLList *f1apPduNode;
+   ReservedF1apPduInfo *f1apPduInfo;
+   F1AP_PDU_t *f1apMsgPdu = NULLP;
+   GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
+   BIT_STRING_t *cellIdentity;
+   struct Served_Cells_To_Delete_ItemIEs *deleteItemIe;
+   Served_Cells_To_Delete_List_t *cellsToDelete;
+   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)
+                  {
+                     for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                     {
+                        crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
+                        GET_UE_IDX(crnti,ueId);
+                        BuildAndSendUeContextReleaseReq(cellId, ueId);
+                     }
+                  }
+                  else
+                  {
+                     DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
+                     return RFAILED;
+                  }
+
+                  break;
+               }
+
+               default:
+                  break;
+            }
+         }
+      }
+   }
+   
+   FreeDUConfigUpdate(f1apMsgPdu);
+   deleteFromReservedF1apPduList(f1apPduNode);
+   return ROK;
+}
+
 /*******************************************************************
 *
 * @brief Processes GNB DU config update ack
@@ -11385,28 +11885,40 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 * ****************************************************************/
 uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
 {
-   uint8_t ieIdx;
+   uint8_t ieIdx=0,transId=0;
    GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
-   
+
    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++)
    {
       switch(gnbDuAck->protocolIEs.list.array[ieIdx]->id)
       {
          case ProtocolIE_ID_id_TransactionID:
-           break;
+            {
+               transId = gnbDuAck->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+               break;
+            }
          case ProtocolIE_ID_id_Cells_to_be_Activated_List:
-           break;
+            {
+               break;
+            }
          default :
-            DU_LOG("\nERROR  -->  F1AP: Invalid IE Received: %ld, at procF1GNBDUCfgUpdAck()", \
-           gnbDuAck->protocolIEs.list.array[ieIdx]->id);
-           break;
+            {
+               DU_LOG("\nERROR  -->  F1AP: procF1GNBDUCfgUpdAck(): Invalid IE Received: %ld", \
+                     gnbDuAck->protocolIEs.list.array[ieIdx]->id);
+               break;
+            }
       }
    }
-   duProcGnbDuCfgUpdAckMsg();
+   
+   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)
    {
       return RFAILED;
@@ -11559,143 +12071,1316 @@ uint8_t procF1DlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
    freeAperDecodef1DlRrcMsg(f1DlRrcMsg);
    return ret;
 }
-
-/*****************************************************************i
- *
- * @brief Handles received F1AP message and sends back response  
- *
- * @details
- *
- *    Function : F1APMsgHdlr
- *
- *    Functionality:
- *         - Decodes received F1AP control message
- *         - Prepares response message, encodes and sends to SCTP
- *
- * @params[in] 
- * @return ROK     - success
- *         RFAILED - failure
+/*******************************************************************
  *
- * ****************************************************************/
-void F1APMsgHdlr(Buffer *mBuf)
-{
-   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("\nINFO  -->  F1AP : Received F1AP message buffer");
-   ODU_PRINT_MSG(mBuf, 0,0);
+* @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
+*
+* ****************************************************************/
 
-   /* Copy mBuf into char array to decode it */
-   ODU_GET_MSG_LEN(mBuf, &recvBufLen);
-   DU_ALLOC(recvBuf, (Size)recvBufLen);
+uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
+{
+   uint8_t arrIdx =0;
+   uint8_t drbCnt =0;
+   struct DRBs_SetupMod_ItemIEs *drbItemIe;
 
-   if(recvBuf == NULLP)
+   drbCnt = 1;
+   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("\nERROR  -->  F1AP : Memory allocation failed");
-      return;
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+      return  RFAILED;
    }
-   if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, &copyCnt) != ROK)
+   for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
    {
-      DU_LOG("\nERROR   -->  F1AP : Failed while copying %d", copyCnt);
-      return;
-   }
+      DU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_SetupMod_ItemIEs_t));
+      if(drbSet->list.array[arrIdx] == NULLP)
+      {
+             DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+             return  RFAILED;
+      }
 
-   printf("\nDEBUG   -->  F1AP : Received flat buffer to be decoded : ");
-   for(i=0; i< recvBufLen; i++)
-   {
-      printf("%x",recvBuf[i]);
+      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;
+      }
+      
    }
 
-   /* Decoding flat buffer into F1AP messsage */
-   f1apMsg = &f1apasnmsg;
-   memset(f1apMsg, 0, sizeof(F1AP_PDU_t));
+   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;
 
-   rval = aper_decode(0, &asn_DEF_F1AP_PDU, (void **)&f1apMsg, recvBuf, recvBufLen, 0, 0);
-   DU_FREE(recvBuf, (Size)recvBufLen);
+   for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
+   {
+      drbItemIe = ((DRBs_SetupMod_ItemIEs_t *)drbSetupList->list.array[arrIdx]);
+      freeDlTnlInfo(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
+   }
+}
+/*******************************************************************
+* @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
+*
+* ****************************************************************/
 
-   if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t ieIdx;
+   UEContextModificationResponse_t *ueContextModifyRes = NULLP;
+   if(f1apMsg)
    {
-      DU_LOG("\nERROR  -->  F1AP : ASN decode failed");
-      return;
+      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; 
+                        }
+                  }
+                  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));
    }
-   printf("\n");
-   xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+}
 
-   switch(f1apMsg->present)
+/*****************************************************************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 ueIdx
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx)
+{
+   uint8_t   ieIdx = 0;
+   uint8_t   cellIdx =0;
+   uint8_t   elementCnt = 0;
+   uint8_t   ret = RFAILED;
+   uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
+   uint32_t  gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
+   F1AP_PDU_t *f1apMsg = NULLP;
+   asn_enc_rval_t         encRetVal;
+   UEContextModificationResponse_t *ueContextModifyRes = NULLP;
+   DuUeCb                   *ueCb = NULLP;
+
+   DU_LOG("\nINFO  -->  F1AP : Building Ue context modification response\n");
+
+   while(1)
    {
-      case F1AP_PDU_PR_successfulOutcome:
-        {
-           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);
-#endif
-                    break;
-                 }
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+         break;
+      }
 
-              case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
-                 {
-                    procF1GNBDUCfgUpdAck(f1apMsg);
-                    break;
-                 }
+      f1apMsg->present =  F1AP_PDU_PR_successfulOutcome;
 
-              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:
-                 {
-                    procF1ResetReq(f1apMsg);
-                    break;
-                 }
-              case InitiatingMessage__value_PR_DLRRCMessageTransfer:
-                 {
-                    procF1DlRrcMsgTrans(f1apMsg);
-                    break;
-                 }
-              case InitiatingMessage__value_PR_UEContextSetupRequest:
-                 {
-                    procF1UeContextSetupReq(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;
-        }
+      DU_ALLOC(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      if(f1apMsg->choice.successfulOutcome == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for F1AP-PDU failed Ue context modification");
+         break;
+      }
+      f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextModification;
+      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = SuccessfulOutcome__value_PR_UEContextModificationResponse;
 
-      default:
-        {
-           DU_LOG("\nERROR  -->  F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
-           return;
-        }
-        free(f1apMsg);
+      ueContextModifyRes =&f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
+
+      elementCnt = 3;
+      ueContextModifyRes->protocolIEs.list.count = elementCnt;
+      ueContextModifyRes->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationResponse_t*);
+
+      /* Initialize the UE context modification members */
+      DU_ALLOC(ueContextModifyRes->protocolIEs.list.array, ueContextModifyRes->protocolIEs.list.size);
+      if(ueContextModifyRes->protocolIEs.list.array == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation for UE context modifcation Request failed");
+         break;
+      }
+
+      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;
+         }
+      }
+
+      /* 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];
+
+      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 = 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 = gnbDuUeF1apId;
+
+      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)
+      {
+         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;
+         }
+         freeF1UeDb(ueCb->f1UeDb);
+         ueCb->f1UeDb = NULLP;
+      }
+      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)
+      {
+         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() != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Setup Res Failed");
+         ret = RFAILED;
+         break;
+      }
+      break;
+   }
+   FreeUeContextModResp(f1apMsg);
+   return ret;
+}
+/*******************************************************************
+ *
+ * @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
+ *
+ * ****************************************************************/
+
+void freeAperDecodeQosInfo(QoSFlowLevelQoSParameters_t *drbQos)
+{
+   if(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI != NULLP)
+   {
+      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);
+   }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for UlTnlInfoforDrb
+ *
+ * @details
+ *
+ *    Function : freeAperDecodeUlTnlInfoforDrbSetupMod 
+ *
+ *    Functionality:  Deallocating memory allocated for UlTnlInfoforDrb
+ *
+ * @params[in] ULUPTNLInformation_ToBeSetup_List_t *ulInfo
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodeUlTnlInfoforDrbSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+{
+   uint8_t arrIdx =0;
+
+   if(ulInfo->list.array)
+   {
+      for(arrIdx=0; arrIdx<ulInfo->list.count ; arrIdx++)
+      {
+         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]);
+         }
+      }
+      free(ulInfo->list.array);
+   }
+}
+/*******************************************************************
+ *
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for DrbSetupModItem  
+ *
+ * @details
+ *
+ *    Function : freeAperDecodeDrbSetupModItem 
+ *
+ *    Functionality:  Deallocating memory allocated for DrbSetupModItem
+ *
+ * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
+ *
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeAperDecodeDrbSetupModItem(DRBs_ToBeSetupMod_Item_t *drbItem)
+{
+   uint8_t arrIdx =0;
+   SNSSAI_t *snssai =NULLP;
+   Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
+
+   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);
+               }
+
+               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);
+               }
+
+               free(drbItem->qoSInformation.choice.choice_extension);
+            }
+            break;
+         }
+
+   }
+   freeAperDecodeUlTnlInfoforDrbSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+   if(drbItem->uLConfiguration)
+   {
+      free(drbItem->uLConfiguration);
+   }
+}
+
+/*******************************************************************
+ *
+ * @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
+ *
+ * ****************************************************************/
+
+void freeAperDecodeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
+{
+   uint8_t arrIdx =0;
+   struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe;
+
+   if(drbSet->list.array)
+   {
+      for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
+      {
+         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);
+   }
+
+}
+/*******************************************************************
+ *
+ * @brief Deallocating the memory allocated by the aper decoder
+ *          for UeContextModificationReqMsg
+ *
+ * @details
+ *
+ *    Function : freeAperDecodeUeContextModificationReqMsg
+ *
+ *    Functionality:  Deallocating memory allocated for
+ *                  UeContextModificationReqMsg
+ *
+ * @params[in] UEContextModificationRequest_t *UeContextModifyReq
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodeUeContextModificationReqMsg(UEContextModificationRequest_t *UeContextModifyReq )
+{
+   uint8_t arrIdx, ieId;
+
+   if(UeContextModifyReq->protocolIEs.list.array)
+   {
+      for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+      {
+         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;
+                  }
+            }
+            free(UeContextModifyReq->protocolIEs.list.array[arrIdx]);
+         }
+      }
+      free(UeContextModifyReq->protocolIEs.list.array);
+   }
+}
+/*******************************************************************
+ *
+ * @brief processing the F1 UeContextModificationReq
+ *
+ * @details
+ *
+ *    Function : procF1UeContextModificationReq
+ *
+ *    Functionality:  processing the F1 UeContextModificationReq
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ *
+ * @return
+ * ****************************************************************/
+uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
+{
+   UEContextModificationRequest_t *ueContextModifyReq = NULLP;
+   uint8_t  ret = ROK, ieIdx = 0, lcId =0,cellIdx=0, ueIdx=0;
+   DuUeCb   *duUeCb = NULLP;
+   DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
+   uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
+
+   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;
+               break;
+            }
+         case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
+            {
+               for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
+               {
+                  for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                  {
+                     if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                           (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+                     {
+
+                        duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                        lcId = getDrbLcId(&duUeCb->drbBitMap);
+                        if(lcId != RFAILED)
+                        {
+                           DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                           if(duUeCb->f1UeDb)
+                           {
+                              duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
+                              drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
+                              choice.DRBs_ToBeSetupMod_List;
+                              if(extractDrbListToSetup(lcId, NULL, drbSetupModCfg ,drbSetupModCfg->list.count, \
+                              &duUeCb->f1UeDb->duUeCfg))
+                              {
+                                 DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetup()");
+                                 ret = RFAILED;
+                              }
+                           }
+                        }
+                     }
+                     else
+                     {
+                        DU_LOG("\nERROR  -->  DU APP : wrong values of gnbCuUeF1apId and gnbDuUeF1apId ");
+                        ret = RFAILED;
+                     }
+                  }
+               }
+               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 ueIdx)
+{
+   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("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): 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)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): Memory allocation failed for\
+         initiatingMessage");   
+         break;
+      }
+      f1apMsg->choice.initiatingMessage->procedureCode = ProcedureCode_id_UEContextReleaseRequest;
+      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+      f1apMsg->choice.initiatingMessage->value.present = \
+      InitiatingMessage__value_PR_UEContextReleaseRequest;
+
+      ueReleaseReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
+
+      elementCnt = 2;
+
+      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("\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;
+
+      /* Fetching Ue Cb Info*/
+      GET_CELL_IDX(cellId, cellIdx);
+      if(duCb.actvCellLst[cellIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): CellId[%d] does not exist", cellId);
+         break;
+      }
+      else
+      {
+         GET_CRNTI(crnti, ueIdx);
+         if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti != crnti)
+         {
+            DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseReq(): crnti[%d] does not exist", crnti);
+            break;
+         }
+         gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
+         gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
+      }
+
+      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 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 UEContextReleaseRequest structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
+      }
+      else
+      {
+         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() != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Release Request failed");
+         break;
+      }
+      ret = ROK;
+      break;
+   }while(true);
+
+   FreeUeContextReleaseReq(f1apMsg);
+   return ret;
+}
+/*****************************************************************i
+ *
+ * @brief Free memory allocated for UE Context Release Complete
+ *
+ * @details
+ *
+ *    Function : FreeUeContextReleaseComplete
+ *
+ *    Functionality:
+ *         - Free memory allocated for UE Context Release Complete
+ *
+ * @params[in] F1AP_PDU_t *f1apMsg
+ * @return void
+ *
+ * *************************************************************/
+void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t ieIdx;
+   UEContextReleaseComplete_t *ueReleaseComplete = NULLP;
+
+   if(f1apMsg)
+   {
+      if(f1apMsg->choice.successfulOutcome)
+      {
+         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));
+   }
+
+}
+/*****************************************************************i
+ *
+ * @brief Build and Send UE Context Release Complete
+ *
+ * @details
+ *
+ *    Function : BuildAndSendUeContextReleaseComplete
+ *
+ *    Functionality:
+ *         - Build and Send UE Context Release Complete
+ *
+ * @params[in]  cellId,  gnbCuUeF1apId, gnbDuUeF1apId
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * *************************************************************/
+uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
+{
+   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;
+
+   DU_LOG("\nINFO  --> Building the UE Context Release Complete");
+   do
+   {
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): 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)
+      {
+         DU_LOG("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for\
+               successfulOutcome");
+         break;
+      }
+      f1apMsg->choice.successfulOutcome->procedureCode = ProcedureCode_id_UEContextRelease;
+      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = \
+      SuccessfulOutcome__value_PR_UEContextReleaseComplete;
+
+      ueReleaseComplete = &f1apMsg->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
+
+      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("\nERROR  -->  F1AP : BuildAndSendUeContextReleaseComplete(): Memory allocation failed for IE array");
+         break;
+      }
+      for(ieIdx=0; ieIdx<elementCnt; ieIdx++)
+      {
+         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;
+
+
+      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;
+
+      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 F1SetupComplete 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 UEContextReleaseComplete structure (at %s)\n",\
+               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+         break;
+      }
+      else
+      {
+         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() != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Sending UE Context Release Complete failed");
+         break;
+      }
+      ret = ROK;
+      break;
+   }while(true);
+   
+   if(ret == ROK)
+   {
+      duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+      ret = duSendCellDeletReq(cellId);
+      if(ret != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
+               Delete req for CellId");
+      }
+   }
+   FreeUeContextReleaseComplete(f1apMsg);
+   return ret;
+
+}
+
+/*******************************************************************
+*
+* @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 ieIdx=0;
+   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:
+                  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]);
+      }
+      free(ueContextReleaseCommand->protocolIEs.list.array);
+   }
+}
+/*******************************************************************
+*
+* @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  ieIdx=0, ret=ROK, ueIdx=0;
+   uint16_t cellIdx =0;
+   bool ueIdxFound;
+   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;
+                  }
+
+               case ProtocolIE_ID_id_Cause:
+                  {
+                     break;
+                  }
+
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
+                     {
+                        for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                        {
+                           if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                                 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+                           {
+                              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_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;
+
+                              }
+
+                              ueIdxFound = true;
+                              break;
+                           }
+                        }
+                        if(ueIdxFound == true)
+                        {
+                           break;
+                        }
+                     }
+                     if(!ueIdxFound)
+                     {
+                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                        ret = RFAILED;
+                     }
+
+
+                     break;
+                  }
+               default :
+                  DU_LOG("\nERROR  -->  F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
+                        ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
+                  break;
+            }
+         }
+      }
+   }
+   if(ret != RFAILED)
+   {
+      duProcUeContextReleaseCommand(duUeCb);
+   }
+   freeAperDecodeUeContextReleaseCommand(f1apMsg);
+   return ret;
+}
+/**************************************************************
+ *
+ * @brief Handles received F1AP message and sends back response  
+ *
+ * @details
+ *
+ *    Function : F1APMsgHdlr
+ *
+ *    Functionality:
+ *         - Decodes received F1AP control message
+ *         - Prepares response message, encodes and sends to SCTP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void F1APMsgHdlr(Buffer *mBuf)
+{
+   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("\nINFO  -->  F1AP : Received F1AP message buffer");
+   ODU_PRINT_MSG(mBuf, 0,0);
+
+   /* Copy mBuf into char array to decode it */
+   ODU_GET_MSG_LEN(mBuf, &recvBufLen);
+   DU_ALLOC(recvBuf, (Size)recvBufLen);
+
+   if(recvBuf == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed");
+      return;
+   }
+   if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, &copyCnt) != ROK)
+   {
+      DU_LOG("\nERROR   -->  F1AP : Failed while copying %d", copyCnt);
+      return;
+   }
+
+   printf("\nDEBUG   -->  F1AP : Received flat buffer to be decoded : ");
+   for(i=0; i< recvBufLen; i++)
+   {
+      printf("%x",recvBuf[i]);
+   }
+
+   /* Decoding flat buffer into F1AP messsage */
+   f1apMsg = &f1apasnmsg;
+   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("\nERROR  -->  F1AP : ASN decode failed");
+      return;
+   }
+   printf("\n");
+   xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+   switch(f1apMsg->present)
+   {
+      case F1AP_PDU_PR_successfulOutcome:
+         {
+            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);
+#endif
+                     break;
+                  }
+
+               case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
+                  {
+                     procF1GNBDUCfgUpdAck(f1apMsg);
+                     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:
+                  {
+                     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;
+                  }
+               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("\nERROR  -->  F1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
+            return;
+         }
+         free(f1apMsg);
 
    }/* End of switch(f1apMsg->present) */