[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-523] KPI reporting per statistics group
[o-du/l2.git] / src / du_app / du_msg_hdl.c
index ca5c9e5..6444943 100644 (file)
@@ -2150,11 +2150,13 @@ Statistics FetchStatsFromActionDefFormat1(ActionDefFormat1 format1)
 
    /* Hardcoding values for now for testing purpose 
     * Will be removed in next gerrit */
-   stats.macStatsReq.numStats = 2;
-   stats.macStatsReq.statsList[0].type = MAC_DL_TOTAL_PRB_USAGE;
-   stats.macStatsReq.statsList[0].periodicity = 100;
-   stats.macStatsReq.statsList[1].type = MAC_UL_TOTAL_PRB_USAGE;
-   stats.macStatsReq.statsList[1].periodicity = 100;
+   stats.macStatsReq.subscriptionId = 1;
+   stats.macStatsReq.numStatsGroup = 1;
+   stats.macStatsReq.statsGrpList[0].groupId = 1;
+   stats.macStatsReq.statsGrpList[0].periodicity = 100;
+   stats.macStatsReq.statsGrpList[0].numStats = 2;
+   stats.macStatsReq.statsGrpList[0].statsList[0] = MAC_DL_TOTAL_PRB_USAGE;
+   stats.macStatsReq.statsGrpList[0].statsList[1] = MAC_UL_TOTAL_PRB_USAGE;
 
    return stats;
 }
@@ -2238,23 +2240,33 @@ uint8_t BuildAndSendStatsReq(ActionDefinition subscribedAction)
  * ****************************************************************/
 uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
 {
+   uint8_t idx = 0;
+
+   DU_LOG("\nINFO  -->  DU_APP : DuProcMacStatsRsp: Received Statistics Response from MAC");
+
    if(statsRsp)
    {
-      if(statsRsp->rsp == MAC_DU_APP_RSP_OK)
+#ifdef DEBUG_PRINT   
+      DU_LOG("\n  Subscription Id [%ld]", statsRsp->subscriptionId);
+
+      DU_LOG("\n  Number of Accepted Groups [%d]", statsRsp->numGrpAccepted);
+      for(idx=0; idx<statsRsp->numGrpAccepted; idx++)
       {
-         DU_LOG("\nINFO  -->  DU_APP : Statistics configured successfully");
-         /* TODO : Start Reporting period timer for this subscription request
-          * To be handled in next gerrit */
+         DU_LOG("\n    Group Id [%d]", statsRsp->statsGrpAcceptedList[idx]);
       }
-      else
+
+      DU_LOG("\n  Number of Rejected Groups [%d]", statsRsp->numGrpRejected);
+      for(idx=0; idx<statsRsp->numGrpRejected; idx++)
       {
-         DU_LOG("\nERROR  -->  DU_APP : Statistics configuration failed with cause [%d]", statsRsp->cause);
+         DU_LOG("\n    Group Id [%d]", statsRsp->statsGrpRejectedList[idx]);
       }
+#endif      
+
       DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsRsp, sizeof(MacStatsRsp));
       return ROK;
    }
 
-   DU_LOG("\nINFO  -->  DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
+   DU_LOG("\nERROR  -->  DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
    return RFAILED;
 }
 
@@ -2280,7 +2292,13 @@ uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *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);
+      DU_LOG("\n  Subscription Id [%ld]", statsInd->subscriptionId);
+      DU_LOG("\n  Group Id [%d]", statsInd->groupId);
+      for(int idx = 0; idx < statsInd->numStats; idx++)
+      {
+         DU_LOG("\n  Meas type [%d] Meas Value [%lf]", statsInd->measuredStatsList[idx].type,\
+            statsInd->measuredStatsList[idx].value);
+      }
 #endif      
 
       /* TODO : When stats indication is received