[Epic-ID: ODUHIGH-516][Task-ID: 527] Implementation of E2 Node Configuration Update...
[o-du/l2.git] / src / du_app / du_f1ap_msg_hdl.c
index b30f89d..c263e52 100644 (file)
@@ -1588,91 +1588,6 @@ void FreeF1SetupReq(F1AP_PDU_t *f1apMsg)
    }
 }
 
-/*******************************************************************
- *
- * @brief add or modify E2NodeComponent list
- *
- * @details
- *
- *    Function : addOrModifyE2NodeComponent 
- *
- * Functionality: add or modify E2NodeComponent list 
- *
- * @parameter uint8_t componentactiontype, bool reqPart, uint8_t bufSize, char *bufString
- * @return ROK     - success
- *         RFAILED - failure
- *
- ******************************************************************/
-uint8_t addOrModifyE2NodeComponent(uint8_t action, bool reqPart, uint8_t bufSize, char *bufString)
-{
-   E2NodeComponent *e2NodeComponentInfo;
-   CmLList  *node = NULLP;
-   
-   if(action == E2_NODE_COMPONENT_ADD)
-   {
-      if(reqPart == true)
-      {
-         DU_ALLOC(e2NodeComponentInfo, sizeof(E2NodeComponent));
-         if(!e2NodeComponentInfo)
-         {
-            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for e2NodeComponentInfo in %s",__func__);
-            return RFAILED;
-         }
-         e2NodeComponentInfo->interfaceType =F1;
-         e2NodeComponentInfo->componentId=duCfgParam.duId;
-         e2NodeComponentInfo->componentActionType = action;
-         e2NodeComponentInfo->reqBufSize = bufSize;
-
-         DU_ALLOC(e2NodeComponentInfo->componentRequestPart, bufSize);
-         if(e2NodeComponentInfo->componentRequestPart == NULLP)
-         {
-            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for componentRequestPart");
-            DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
-            return RFAILED;
-         }
-         memcpy(e2NodeComponentInfo->componentRequestPart, bufString, e2NodeComponentInfo->reqBufSize);
-         DU_ALLOC(node, sizeof(CmLList));
-         if(node)
-         {
-            node->node = (PTR) e2NodeComponentInfo;
-            cmLListAdd2Tail(&duCb.e2apDb.e2NodeComponentList, node);
-         }
-         else
-         {
-            DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for e2NodeComponentList node");
-            DU_FREE(e2NodeComponentInfo->componentRequestPart, bufSize);
-            DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
-            return RFAILED;
-         }
-      }
-      else
-      {
-         if(duCb.e2apDb.e2NodeComponentList.count)
-         {
-            CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
-            while(node)
-            {
-               e2NodeComponentInfo = (E2NodeComponent*)node->node;
-               if((e2NodeComponentInfo->interfaceType == F1) && (e2NodeComponentInfo->componentActionType == action))
-               {
-                  e2NodeComponentInfo->rspBufSize = bufSize;
-
-                  DU_ALLOC(e2NodeComponentInfo->componentResponsePart, bufSize);
-                  if(e2NodeComponentInfo->componentResponsePart == NULLP)
-                  {
-                     DU_LOG("\nERROR  -->  F1AP : Memory allocation failed to store the encoding of f1setup rsp");
-                     return RFAILED;
-                  }
-                  memcpy(e2NodeComponentInfo->componentResponsePart, bufString, e2NodeComponentInfo->rspBufSize);
-                  break;
-               }
-               node = node->next;
-            }
-         } 
-      }
-   }
-   return ROK;
-}
 /*******************************************************************
  *
  * @brief Builds and Send the F1SetupRequest
@@ -1844,7 +1759,11 @@ uint8_t BuildAndSendF1SetupReq()
          
 
       }
-      addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, true, encBufSize, encBuf);
+      if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_ADD, true, encBufSize, encBuf) !=ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Failed to add the e2 node in the list");
+         break;
+      }
       /* Sending msg */
       if(sendF1APMsg() != ROK)
       {
@@ -2843,6 +2762,11 @@ uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction)
          }
 #endif
       }
+      if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_UPDATE, true, encBufSize, encBuf)!=ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Failed to update the e2 node in the list");
+         break;
+      }
       /* Sending msg */
       if(sendF1APMsg() != ROK)
       {
@@ -15628,7 +15552,11 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
    duProcF1SetupRsp();
    freeAperDecodeF1SetupRsp(f1SetRspMsg);
    
-   addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, false, recvBufLen, recvBuf);
+   if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_ADD, false, recvBufLen, recvBuf) !=ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Failed to add the e2 node in the list");
+      return RFAILED;
+   }
 
    if(BuildAndSendE2SetupReq() != ROK)
    {
@@ -15806,11 +15734,12 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 *
 *    Functionality: added free part for the memory allocated by aper_decoder
 *
-* @params[in] F1AP_PDU_t *f1apMsg 
+* @params[in] F1AP_PDU_t *f1apMsg,  MsgLen recvBufLen, char *recvBuf 
 * @return void 
 *
 * ****************************************************************/
-uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
+
+uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf)
 {
    uint8_t ieIdx=0,transId=0;
    GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck = NULLP;
@@ -15852,6 +15781,12 @@ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
    }
 #endif
 
+   if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_UPDATE, false, recvBufLen, recvBuf) !=ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Failed to update the e2 node in the list");
+      return RFAILED;
+   }
+
    freeAperDecodeGnbDuAck(gnbDuAck);
    return ROK;
 }
@@ -18035,7 +17970,7 @@ void F1APMsgHdlr(Buffer *mBuf)
 
                case SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge:
                   {
-                     procF1GNBDUCfgUpdAck(f1apMsg);
+                     procF1GNBDUCfgUpdAck(f1apMsg, recvBufLen, recvBuf);
                      break;
                   }