Merge "Restructure O1 module to run as a thread in O-DU High binary [Issue-Id: ODUHIG...
authorVidhu Shekhar Pandey <vidhu.pandey@hcl.com>
Fri, 7 May 2021 11:29:30 +0000 (11:29 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Fri, 7 May 2021 11:29:30 +0000 (11:29 +0000)
1  2 
build/odu/makefile
src/du_app/du_cfg.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_mgr_main.c

diff --combined build/odu/makefile
@@@ -138,6 -138,12 +138,12 @@@ ifeq ($(PHY), INTEL_L1
          -lrte_gro -lrte_pmd_ark -lrte_pmd_i40e -lrte_pmd_sw_event
  endif
  
+ ifeq ($(O1_ENABLE),YES)
+   L_OPTS+=-lsysrepo -lyang
+   L_OPTS+=-lsysrepo-cpp -lyang-cpp
+   L_OPTS+=-lstdc++
+ endif
  # Export some of the flags expected from the command line.
  # # These macros are made available for the makefiles called from this makefile
  export BOARD
@@@ -202,9 -208,10 +208,9 @@@ du
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
 -              $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
  endif
  
  link_du: du
@@@ -222,9 -229,10 +228,9 @@@ clean_odu
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mac.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/sch.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
 -              $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
  endif
                $(Q)rm -rf $(OBJ_ROOT)/odu/*
                $(Q)rm -rf $(LIB_ROOT)/odu/*
@@@ -248,7 -256,7 +254,7 @@@ cu
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CCPP1)'
  endif
  
  clean_cu:
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak clean OBJ_DIR=$(OBJ_ROOT)/cu_stub LIB_DIR=$(LIB_ROOT)/cu_stub LOG_DIR=$(LOG_ROOT)/cu_stub CC='$(CCPP1)'
  endif
         $(Q)rm -rf $(OBJ_ROOT)/cu_stub/*
         $(Q)rm -rf $(LIB_ROOT)/cu_stub/*
@@@ -282,7 -290,7 +288,7 @@@ ric
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CCPP1)'
  endif
  
  clean_ric:
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/cm.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
         $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
  ifeq ($(O1_ENABLE),YES)
-               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak clean OBJ_DIR=$(OBJ_ROOT)/ric_stub LIB_DIR=$(LIB_ROOT)/ric_stub LOG_DIR=$(LOG_ROOT)/ric_stub CC='$(CCPP1)'
  endif
         $(Q)rm -rf $(OBJ_ROOT)/ric_stub/*
         $(Q)rm -rf $(LIB_ROOT)/ric_stub/*
diff --combined src/du_app/du_cfg.c
  #include "BWP-UplinkCommon.h"
  
  #ifdef O1_ENABLE
- #include "Config.h"
+ #include "ConfigInterface.h"
  extern StartupConfig g_cfg;
  #endif
  
  DuCfgParams duCfgParam;
@@@ -619,12 -617,8 +617,12 @@@ uint8_t readCfg(
  
     /* Mib Params */
     mib.sysFrmNum = SYS_FRAME_NUM;
 +#ifdef NR_TDD
 +   mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120;
 +#else
     mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60;
 -   mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; 
 +#endif
 +   mib.ssb_SubcarrierOffset = SSB_SC_OFFSET; //Kssb
     mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2;
     mib.controlResourceSetZero = CORESET_0_INDEX;
     mib.searchSpaceZero = SEARCHSPACE_0_INDEX;
  #include "GTPTunnel.h"
  
  #ifdef O1_ENABLE
- #include "Config.h"
+ #include "ConfigInterface.h"
  extern StartupConfig g_cfg;
  #endif
  
  DuCfgParams duCfgParam;
 -
  /************************************************************************
   *
   * @brief Converts enum values into actual value of Poll retransmit timer
@@@ -1202,7 -1201,7 +1200,7 @@@ uint8_t BuildRrcVer(RRC_Version_t *rrcV
   *
   * @details
   *
 - *    Function : SendF1APMsg
 + *    Function : sendF1APMsg
   *
   *    Functionality: Sends F1 msg over SCTP
   *
   *         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)
        {
        return RFAILED;
     }
     return ROK; 
 -} /* SendF1APMsg */
 +} /* sendF1APMsg */
  
  /*******************************************************************
   *
@@@ -1695,7 -1694,7 +1693,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;
@@@ -2498,7 -2497,7 +2496,7 @@@ uint8_t BuildAndSendDUConfigUpdate(
         }
        }
        /* 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;
@@@ -2702,7 -2701,7 +2700,7 @@@ uint8_t BuildAndSendULRRCMessageTransfe
        }
  
        /* 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;
@@@ -5899,7 -5898,7 +5897,7 @@@ uint8_t BuildAndSendInitialRrcMsgTransf
         }
        }
        /* 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;
@@@ -9291,7 -9290,7 +9289,7 @@@ uint8_t procUeReCfgCellInfo(MacUeCfg *m
   * ****************************************************************/
  void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap)
  {
 -   UE_NR_Capability_t *ueNrCap;
 +   UE_NR_Capability_t *ueNrCap=NULLP;
  
     if(ueCap)
        ueNrCap = (UE_NR_Capability_t *)ueCap;
@@@ -10590,7 -10589,7 +10588,7 @@@ uint8_t BuildAndSendUeContextSetupRsp(u
        }
  
        /* 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;
@@@ -10792,7 -10791,7 +10790,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;
@@@ -10945,7 -10944,7 +10943,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;
@@@ -11212,7 -11211,7 +11210,7 @@@ uint8_t BuildAndSendRrcDeliveryReport(u
        }
  
        /* 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;
@@@ -11940,7 -11939,7 +11938,7 @@@ uint8_t BuildAndSendUeContextModResp(ui
        }
  
        /* Sending  msg  */
 -      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
 +      if(sendF1APMsg() != ROK)
        {
           DU_LOG("\nERROR  -->  F1AP : Sending UE Context Setup Res Failed");
           ret = RFAILED;
     }
     FreeUeContextModResp(f1apMsg);
     return ret;
 -
  }
  /*******************************************************************
   *
@@@ -12285,436 -12285,6 +12283,436 @@@ uint8_t procF1UeContextModificationReq(
     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]
 + * @return ROK     - success
 + *         RFAILED - failure
 + *
 + * *************************************************************/
 +uint8_t BuildAndSendUeContextReleaseComplete(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);
 +
 +   FreeUeContextReleaseComplete(f1apMsg);
 +   return ret;
 +
 +   /*TODO: To add trigger for UE context release complete, once the operations of UE context
 +    * release command are done*/
 +}
 +/*******************************************************************
 +*
 +* @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)
 +{
 +   /*TODO: processing of DL RRC Msg Transfer to RLC->SCH->MAC-LOWER-MAC->PHY, if RRC container is received */
 +   
 +   freeAperDecodeUeContextReleaseCommand(f1apMsg);
 +   return ROK;
 +}
 +/**************************************************************
   *
   * @brief Handles received F1AP message and sends back response  
   *
@@@ -12838,11 -12408,6 +12836,11 @@@ void F1APMsgHdlr(Buffer *mBuf
                       procF1UeContextModificationReq(f1apMsg);
                       break;
                    }
 +               case InitiatingMessage__value_PR_UEContextReleaseCommand:
 +                  {
 +                      procF1UeContextReleaseCommand(f1apMsg);
 +                      break;
 +                  }
                 default:
                    {
                       DU_LOG("\nERROR  -->  F1AP : Invalid type of F1AP_PDU_PR_initiatingMessage [%d]",
diff --combined src/du_app/du_mgr_main.c
  #include "du_sctp.h"
  #include "du_egtp.h"
  
+ #ifdef O1_ENABLE
+ #include "O1Interface.h"
+ #endif
  uint8_t rlcUlActvTsk (Pst *, Buffer *);
  uint8_t rlcUlActvInit (Ent, Inst, Region, Reason);
  uint8_t rlcDlActvTsk (Pst *, Buffer *);
@@@ -290,14 -296,13 +296,14 @@@ uint8_t commonInit(
  
     ODU_SET_PROC_ID(DU_PROC);
  
 +   /* Intel L1 using core 0-15. ODU-High using 16-21 */
     /* system task for DU APP */
     if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
     {
        DU_LOG("\nERROR  -->  DU_APP : System Task creation for DU APP failed");
        return RFAILED;
     }
 -   ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 15, 0);
 +   ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
  
     /* system task for EGTP */
     if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
        DU_LOG("\nERROR  -->  DU_APP : System Task creation for EGTP failed");
        return RFAILED;
     }
 -   ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
 +   ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
  
     /* system task for RLC_DL and MAC */
     if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
     }
     pthread_attr_init(&attr);
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 -   ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
 +   ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
  
     /* system task for RLC UL */
     if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
        DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC UL failed");
        return RFAILED;
     }
 -   ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
 +   ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
  
     /* system task for SCTP receiver thread */
     if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
        DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCTP failed");
        return RFAILED;
     }
 -   ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
 +   ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
  
     /* system task for lower-mac receiver thread */
     if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
        DU_LOG("\nERROR  -->  DU_APP : System Task creation for Lower MAC failed");
        return RFAILED;
     }
 -   ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
 +   ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
  
     /* Create TAPA tasks */
     if(duAppInit(du_app_stsk) != ROK)
@@@ -434,6 -439,11 +440,11 @@@ uint8_t tst(void
  {
     init_log();
  
+ #ifdef O1_ENABLE
+    if(start_O1_module() != ROK)
+       return RFAILED;
+ #endif
     //Initialize TAPA layers
     if(duInit() != ROK)
     {