[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-523] Statistics Indication between DU APP...
[o-du/l2.git] / src / du_app / du_msg_hdl.c
index e29aa3b..ca5c9e5 100644 (file)
@@ -2217,6 +2217,87 @@ uint8_t BuildAndSendStatsReq(ActionDefinition subscribedAction)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Process statistics response from MAC
+ *
+ * @details
+ *
+ *    Function : DuProcMacStatsRsp
+ *
+ *    Functionality: Processes statistics configuration response
+ *       from MAC. If configuration is succsessful, DUAPP starts
+ *       reporting period timer for this subscription request 
+ *       from RIC
+ *
+ * @params[in]
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
+{
+   if(statsRsp)
+   {
+      if(statsRsp->rsp == MAC_DU_APP_RSP_OK)
+      {
+         DU_LOG("\nINFO  -->  DU_APP : Statistics configured successfully");
+         /* TODO : Start Reporting period timer for this subscription request
+          * To be handled in next gerrit */
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU_APP : Statistics configuration failed with cause [%d]", statsRsp->cause);
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsRsp, sizeof(MacStatsRsp));
+      return ROK;
+   }
+
+   DU_LOG("\nINFO  -->  DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
+   return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Process statistics indication from MAC
+ *
+ * @details
+ *
+ *    Function : DuProcMacStatsInd
+ *
+ *    Functionality: Processes statistics indication from MAC.
+ *
+ * @params[in]
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsInd)
+{
+   if(statsInd)
+   {
+#ifdef DEBUG_PRINT   
+      DU_LOG("\nDEBUG  -->  DU_APP : DuProcMacStatsInd: Received Statistics Indication");
+      DU_LOG("\nMeasurement type [%d]  Measurement Value [%lf]", statsInd->type, statsInd->value);
+#endif      
+
+      /* TODO : When stats indication is received
+       * DU APP searches for the message type in E2AP RIC subscription database
+       * and stores in the value in the list of subscribed measurements
+       *
+       * This will be implemented in next gerrit.
+       */
+
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsInd, sizeof(MacStatsInd));
+      return ROK;
+   }
+   
+   DU_LOG("\nINFO  -->  DU_APP : DuProcMacStatsInd: Received NULL Pointer");
+   return RFAILED;
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/