+ if(BuildAndSendRicSubscriptionDeleteResponse(ranFuncId, requestId) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: failed to build and send ric subs delete rsp");
+ return RFAILED;
+ }
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Extract statistics received from DU layers and delete
+ * Ric subscription's action info
+ *
+ * @details
+ *
+ * Function : e2ProcActionDeleteRsp
+ *
+ * Functionality:
+ * [Step-1] Fetch RAN Function and Subscription DB using
+ * subscription Id received in statistics delete response.
+ * [Step-2] Fetch pending ric subs modification rsp info
+ * from ran func db based on ric request information.
+ * [Step 3] - Traverse each index of stats group delete list
+ * received in stats delete response.
+ * [Step 3.1] - If action deleted successfully, delete the
+ * node from DB and fill the action info in the pending ric
+ * subs modification rsp's accepted list.
+ * [Step 3.1] - Else fill the action info in the pending ric
+ * subs modification rsp's rejected list.
+ * [Step 4] - Set removeActionCompleted true and process the
+ * Pending Subscription modification rsp list.
+ *
+ *
+ * @params[in] Statistics delete rsp
+ * @return ROK-success
+ * RFAILED-failure
+ *
+ * ****************************************************************/
+uint8_t e2ProcActionDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp)
+{
+ uint8_t idx = 0;
+ uint8_t actionId = 0;
+ uint8_t tmpIndex = 0;
+ CmLList *actionNode = NULLP;
+ ActionInfo *actionInfoDb = NULLP;
+ PendingSubsModRspInfo *pendingSubsModRsp = NULLP;
+ RanFunction *ranFuncDb = NULLP;
+ CmLList *ricSubscriptionNode = NULLP;
+ RicSubscription *ricSubscriptionInfo = NULLP;
+
+ /* [Step-1] */
+ if(fetchSubsInfoFromSubsId(statsDeleteRsp->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+
+ /* [Step-2] */
+ for(idx=0; idx<ranFuncDb->numPendingSubsModRsp; idx++)
+ {
+ if((ranFuncDb->pendingSubsModRspInfo[idx].requestId.requestorId == ricSubscriptionInfo->requestId.requestorId) &&
+ (ricSubscriptionInfo->requestId.instanceId == ricSubscriptionInfo->requestId.instanceId))
+ {
+ pendingSubsModRsp = &ranFuncDb->pendingSubsModRspInfo[idx];
+ break;
+ }
+ }
+
+ if(pendingSubsModRsp == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+
+ /* [Step-3] */
+ for(idx=0; idx<statsDeleteRsp->numStatsGroupDeleted; idx++)
+ {
+ actionInfoDb = NULLP;
+ actionId = statsDeleteRsp->statsGrpDelInfo[idx].groupId;
+ actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_DEL);
+ if(actionInfoDb)
+ {
+ if(statsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelRsp == MAC_DU_APP_RSP_OK)
+ {
+ /* [Step-3.1] */
+ tmpIndex = pendingSubsModRsp->removeActionStatus.numOfAcceptedActions;
+ actionInfoDb->action = CONFIG_UNKNOWN;
+ cmLListDelFrm(&ricSubscriptionInfo->actionSequence, actionNode);
+ deleteActionSequence(actionNode);
+ pendingSubsModRsp->removeActionStatus.acceptedActionList[tmpIndex] = actionId;
+ pendingSubsModRsp->removeActionStatus.numOfAcceptedActions++;
+ }
+ else
+ {
+ /* [Step-3.2] */
+ tmpIndex = pendingSubsModRsp->removeActionStatus.numOfRejectedActions;
+ pendingSubsModRsp->removeActionStatus.rejectedActionList[tmpIndex].id = actionId;
+ convertDuCauseToE2Cause(statsDeleteRsp->statsGrpDelInfo[idx].statsGrpDelCause,\
+ &pendingSubsModRsp->removeActionStatus.rejectedActionList[tmpIndex].failureCause);
+ pendingSubsModRsp->removeActionStatus.numOfRejectedActions++;
+ }
+ }
+ }
+
+ /* [Step-4] */
+ pendingSubsModRsp->removeActionCompleted = true;
+ if(duProcPendingSubsModRsp(ricSubscriptionInfo, pendingSubsModRsp) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : failed to process subscription modification rsp");
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief du process pending ric subscription modification rsp
+ * recieved from the layers
+ *
+ * @details
+ *
+ * Function : duProcPendingSubsModRsp
+ *
+ * Functionality: Process pending subscription modification response
+ * If processing of add, mod and remove action completes
+ * then send the ric sub modification rsp
+ *
+ * @params[in]
+ * Ric subscription info
+ * Pending Subs modification rsp
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duProcPendingSubsModRsp(RicSubscription *ricSubscriptionInfo, PendingSubsModRspInfo *pendingSubsModRsp)
+{
+ uint8_t ret = RFAILED;
+ uint32_t reportingPeriod = 0;
+
+ while(true)
+ {
+ if(pendingSubsModRsp->addActionCompleted && pendingSubsModRsp->removeActionCompleted && pendingSubsModRsp->modActionCompleted)
+ {
+ switch(ricSubscriptionInfo->eventTriggerDefinition.formatType)
+ {
+ case 1:
+ {
+ reportingPeriod = ricSubscriptionInfo->eventTriggerDefinition.choice.format1.reportingPeriod;
+ storeReportStartTime(&ricSubscriptionInfo->eventTriggerDefinition.choice.format1.startTime);
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid event trigger format of RIC subscription");
+ break;
+ }
+ }
+ if(reportingPeriod == 0)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ break;
+ }
+
+ if(duChkTmr((PTR)ricSubscriptionInfo, EVENT_RIC_SUBSCRIPTION_REPORTING_TMR) != true)
+ {
+ duStartTmr((PTR)ricSubscriptionInfo, EVENT_RIC_SUBSCRIPTION_REPORTING_TMR, reportingPeriod);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : RIC Subscription reporting timer already running for RIC Subscription");
+ break;
+ }
+
+ if(BuildAndSendRicSubscriptionModificationResponse(pendingSubsModRsp) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ break;
+ }
+
+ memset(pendingSubsModRsp, 0, sizeof(PendingSubsModRspInfo));
+ DU_LOG("\nProcessing of RIC subscription modification completed");
+ ret = ROK;
+ break;
+ }
+ else
+ {
+ ret = ROK;
+ break;
+ }
+ }
+
+ if(ret == RFAILED)
+ {
+ memset(pendingSubsModRsp, 0, sizeof(PendingSubsModRspInfo));
+ }
+ return ret;
+}
+/*******************************************************************
+ *
+ * @brief Process statistics modification response from MAC
+ *
+ * @details
+ *
+ * Function : e2ProcStatsModificationRsp
+ *
+ * Functionality: Processes statistics modification configuration
+ * response from MAC.
+ * [Step-1] Fetch RAN Function and Subscription DB using subs Id
+ * received in statistics modification response.
+ * [Step-2] Fetch pre-stored statistics mod response info by DUAPP.
+ * [Step 3] - Traverse each index of accepted list received in
+ * stats modification response.
+ * [Step 3.1] - fetch action info from databse which is set
+ * as CONFIG_UNKNOWN and then delete the node.
+ * [Step 3.1] - Again fetch action info from databse which is
+ * set as CONFIG_MOD. Change the action status as CONFIG_UNKNOWN.
+ * fill the action in pending subscription modification rsp's
+ * accepted list.
+ * [Step 4] - Traverse each index of rejected list received in
+ * stats modification response.
+ * [Step 4.1] - fetch action info from databse and delete
+ * the action node which is set as CONFIG_MOD. and then
+ * fill the action in pending subscription modification rsp's
+ * rejected list.
+ * [Step 5] - Send subscription response with accepted and rejected
+ * @params[in] Statistics modification response received from MAC
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t e2ProcStatsModificationRsp(MacStatsModificationRsp *statsModificationRsp)
+{
+ uint8_t idx = 0;
+ uint8_t actionId = 0;
+ uint8_t tempCount = 0;
+ RanFunction *ranFuncDb = NULLP;
+ CmLList *actionNode = NULLP;
+ ActionInfo *actionInfoDb = NULLP;
+ CmLList *ricSubscriptionNode = NULLP;
+ RicSubscription *ricSubscriptionInfo = NULLP;
+ PendingSubsModRspInfo *pendingSubsModRsp = NULLP;
+
+
+ /* [Step-1] */
+ if(fetchSubsInfoFromSubsId(statsModificationRsp->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+
+ /* [Step-2] */
+ for(idx=0; idx<ranFuncDb->numPendingSubsModRsp; idx++)
+ {
+ if((ranFuncDb->pendingSubsModRspInfo[idx].requestId.requestorId == ricSubscriptionInfo->requestId.requestorId) &&
+ (ricSubscriptionInfo->requestId.instanceId == ricSubscriptionInfo->requestId.instanceId))
+ {
+ pendingSubsModRsp = &ranFuncDb->pendingSubsModRspInfo[idx];
+ break;
+ }
+ }
+ if(pendingSubsModRsp == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+
+ /* [Step-3] */
+ for(idx=0; idx<statsModificationRsp->numGrpAccepted; idx++)
+ {
+ actionInfoDb = NULLP;
+ actionId = statsModificationRsp->statsGrpAcceptedList[idx];
+
+ /* [Step-3.1] */
+ actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode,CONFIG_UNKNOWN);
+ if(actionInfoDb)
+ {
+ cmLListDelFrm(&ricSubscriptionInfo->actionSequence, actionNode);
+ deleteActionSequence(actionNode);
+ }
+
+ /* [Step-3.2] */
+ actionNode=NULLP;
+ actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode,CONFIG_MOD);
+ if(actionInfoDb)
+ {
+ actionInfoDb->action = CONFIG_UNKNOWN;
+ }
+ pendingSubsModRsp->modActionStatus.acceptedActionList[pendingSubsModRsp->modActionStatus.numOfAcceptedActions++] = actionId;
+ }
+
+ /* [Step-4] */
+ for(idx=0; idx<statsModificationRsp->numGrpRejected; idx++)
+ {
+ actionInfoDb = NULLP;
+ actionId = statsModificationRsp->statsGrpRejectedList[idx].groupId;
+
+ /* [Step-4.1] */
+ actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_MOD);
+ if(actionInfoDb)
+ {
+ cmLListDelFrm(&ricSubscriptionInfo->actionSequence, actionNode);
+ deleteActionSequence(actionNode);
+ tempCount = pendingSubsModRsp->modActionStatus.numOfRejectedActions;
+ pendingSubsModRsp->modActionStatus.rejectedActionList[tempCount].id = actionId;
+ convertDuCauseToE2Cause(statsModificationRsp->statsGrpRejectedList[idx].cause, \
+ &pendingSubsModRsp->modActionStatus.rejectedActionList[tempCount].failureCause);
+ pendingSubsModRsp->modActionStatus.numOfRejectedActions++;
+ }
+ }
+
+ /* [Step-5] */
+ pendingSubsModRsp->modActionCompleted = true;
+ if(duProcPendingSubsModRsp(ricSubscriptionInfo, pendingSubsModRsp) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : failed to process subscription modification rsp");
+ return RFAILED;