From: pborla Date: Fri, 1 Dec 2023 19:08:40 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-530] Processing of RIC Subscription Modificat... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=ed9dfc3330362096a4c6d27c1b14c172a69a428a;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-530] Processing of RIC Subscription Modification request Change-Id: Ia550ffcea4683f939dfd2b9a70044e5110e58e8a Signed-off-by: pborla --- diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index d3fbcecb6..5e09bb362 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -3272,7 +3272,7 @@ uint8_t deleteStatsInfo(Inst inst, SchStatsDeleteReq *statsDeleteReq, SchStatsDe { /* [Step-2] */ if(deleteFromStatsGrpList(inst, statsGrpList, statsDeleteReq->subscriptionId,\ - statsDeleteReq->statsGrpIdToBeDelList[statsGrpIdx], false) != ROK) + statsDeleteReq->statsGrpIdToBeDelList[statsGrpIdx], false) == ROK) { /* [Step-3]*/ schStatsDeleteRsp->statsGrpDelInfo[statsGrpIdx].statsGrpDelRsp = RSP_OK; diff --git a/src/du_app/du_e2_conversions.c b/src/du_app/du_e2_conversions.c index 098223dad..2ea388e78 100644 --- a/src/du_app/du_e2_conversions.c +++ b/src/du_app/du_e2_conversions.c @@ -90,6 +90,7 @@ void convertDuCauseToE2Cause(CauseOfResult l2Cause, E2FailureCause *failureCause { switch(l2Cause) { + case STATS_ID_NOT_FOUND: case PARAM_INVALID: { failureCause->causeType = E2_RIC_REQUEST; diff --git a/src/du_app/du_e2ap_mgr.c b/src/du_app/du_e2ap_mgr.c index b1b350ad3..dad3428b9 100644 --- a/src/du_app/du_e2ap_mgr.c +++ b/src/du_app/du_e2ap_mgr.c @@ -202,11 +202,12 @@ MeasurementInfo *fetchMeasInfoFromMeasTypeName(char *e2MeasTypeName, CmLListCp * * @params[in] Action ID * RIC Subscription DB * Ric Action Node + * Config Type * @return Action Info DB * NULL, in case of failure * * ****************************************************************/ -ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSubscriptionInfo, CmLList ** actionNode) +ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSubscriptionInfo, CmLList ** actionNode, ConfigType cfgType) { ActionInfo *actionInfoDb = NULLP; @@ -214,7 +215,7 @@ ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSu while(*actionNode) { actionInfoDb = (ActionInfo*)((*actionNode)->node); - if(actionInfoDb && actionInfoDb->actionId == actionId) + if(actionInfoDb && (actionInfoDb->actionId == actionId) && (actionInfoDb->action == cfgType)) { break; } @@ -481,7 +482,7 @@ uint8_t ResetE2Request(E2ProcedureDirection dir, E2FailureCause resetCause) * ****************************************************************/ uint8_t fillRicSubsInMacStatsReq(MacStatsReq *macStatsReq, RicSubscription* ricSubscriptionInfo) { - uint8_t actionIdx = 0, grpIdx = 0, statsIdx = 0; + uint8_t grpIdx = 0, statsIdx = 0; uint64_t subscriptionId = 0; ActionInfo *actionDb = NULLP; CmLList *actionNode = NULLP; @@ -598,43 +599,153 @@ uint8_t rejectAllStatsGroup(RanFunction *ranFuncDb, CmLList *ricSubscriptionNode /******************************************************************* * - * @brief Process statistics response from MAC + * @brief Process statistics response received for subscription + * modification req and send the ric subscription response msg * * @details * - * Function : e2ProcStatsRsp + * Function : procStatsRspForSubsModReq * * Functionality: Processes statistics configuration response - * from MAC. If configuration is succsessful, DUAPP starts - * reporting period timer for this subscription request - * from RIC + * received for subscription modification req. + * [Step 1] - Fetch pendingSubsModRsp list from ran func db + * based on RIC request info. + * [Step 2] - Traverse each index of accepted list received in + * stats response. + * [Step 2.1] - Added each action related info in pending + * rsp's accepted list and mark action status CONFIG_UNKNOWN. + * [Step 3] - Traverse each index of rejected list received in + * stats response. + * [Step 3.1] - Added each action related info in pending + * rsp's rejected list and delete the action info from Db. + * [Step 4] - Set addActionCompleted true, and process the Pending + * Subscription modification rsp list. * - * @params[in] Statistics response received from MAC + * @params[in] + * Mac Stats Rsp + * Ran Function info + * Ric subscription info * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp) +uint8_t procStatsRspForSubsModReq(MacStatsRsp *statsRsp, RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo) { uint8_t idx = 0; uint8_t actionId = 0; - uint32_t reportingPeriod = 0; - RanFunction *ranFuncDb = NULLP; - CmLList *ricSubscriptionNode = NULLP; CmLList *actionNode = NULLP; - RicSubscription *ricSubscriptionInfo = NULLP; ActionInfo *actionInfoDb = NULLP; - PendingSubsRspInfo *pendingSubsRsp = NULLP; + PendingSubsModRspInfo *pendingSubsModRsp = NULLP; + + /* Step - 1 */ + for(idx=0; idxnumPendingSubsModRsp; 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; + } - /* Fetch RAN Function and Subscription DB using subscription Id received in statistics response */ - if(fetchSubsInfoFromSubsId(statsRsp->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK) + /* Step - 2 */ + for(idx=0; idxnumGrpAccepted; idx++) + { + actionInfoDb = NULLP; + + actionId = statsRsp->statsGrpAcceptedList[idx]; + actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_ADD); + if(actionInfoDb) + { + /* Step - 2.1 */ + actionInfoDb->action = CONFIG_UNKNOWN; + pendingSubsModRsp->addActionStatus.acceptedActionList[pendingSubsModRsp->addActionStatus.numOfAcceptedActions++] = actionId; + } + } + + /* Step - 3 */ + for(idx=0; idxnumGrpRejected; idx++) + { + actionInfoDb = NULLP; + actionId = statsRsp->statsGrpRejectedList[idx].groupId; + actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_ADD); + if(actionInfoDb) + { + /* Step - 3.1 */ + cmLListDelFrm(&ricSubscriptionInfo->actionSequence, actionNode); + deleteActionSequence(actionNode); + pendingSubsModRsp->addActionStatus.rejectedActionList[pendingSubsModRsp->addActionStatus.numOfRejectedActions].id = actionId; + convertDuCauseToE2Cause(statsRsp->statsGrpRejectedList[idx].cause, \ + &pendingSubsModRsp->addActionStatus.rejectedActionList[pendingSubsModRsp->addActionStatus.numOfRejectedActions].failureCause); + pendingSubsModRsp->addActionStatus.numOfRejectedActions++; + } + } + + /* Step - 4 */ + pendingSubsModRsp->addActionCompleted =true; + if(duProcPendingSubsModRsp(pendingSubsModRsp) != ROK) { - DU_LOG("\nERROR --> E2AP : DuProcMacStatsRsp: Failed to fetch subscriprtion details"); + DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__); return RFAILED; } + return ROK; +} - /* Fetch pre-stored statistics response info by DU APP */ +/******************************************************************* + * + * @brief Process statistics response for subscription req and + * send the ric subscription response msg + * + * @details + * + * Function : procStatsRspForSubsReq + * + * Functionality: Processes statistics configuration response + * received for subscription req. + * [Step 1] - Fetch PendingSubsRspInfo list from ran func db + * based on RIC request info. + * [Step 2] - If all stats group got rejected then send delete + * ric subs action info from db and send ric subscription delete + * message to ric + * [Step 3] - Store and start RIC Subscription reporting timer. + * [Step 4] - Traverse each index of accepted list received in + * stats response. + * [Step 4.1] - Added each action related info in pending + * rsp's accepted list and mark action status CONFIG_UNKNOWN. + * [Step 5] - Traverse each index of rejected list received in + * stats response. + * [Step 5.1] - Added each action related info in pending + * rsp's rejected list and delete the action info from Db. + * [Step 6] - Send subscription response with accepted and rejected + * action lists to RIC. + * + * @params[in] + * Mac Stats Rsp + * Ran Function info + * Ric subscription node + * Ric subscription info + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t procStatsRspForSubsReq(MacStatsRsp *statsRsp, RanFunction *ranFuncDb, CmLList *ricSubscriptionNode, RicSubscription *ricSubscriptionInfo) +{ + uint8_t idx = 0; + uint8_t actionId = 0; + uint32_t reportingPeriod = 0; + CmLList *actionNode = NULLP; + ActionInfo *actionInfoDb = NULLP; + PendingSubsRspInfo *pendingSubsRsp = NULLP; + + /* [Step 1] */ for(idx=0; idxnumPendingSubsRsp; idx++) { if((ranFuncDb->pendingSubsRspInfo[idx].requestId.requestorId == ricSubscriptionInfo->requestId.requestorId) && @@ -644,35 +755,34 @@ uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp) break; } } - - /* If no action is accepted - * a. Remove subcription entry from RAN Function - * b. Send RIC subscription failure */ + + if(pendingSubsRsp == NULLP) + { + DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__); + return RFAILED; + } + if(statsRsp->numGrpAccepted == 0) { + /* [Step 2 ] */ rejectAllStatsGroup(ranFuncDb, ricSubscriptionNode, statsRsp); } else { - /* Once RIC subscription is successful, mark the config action as unknown */ - ricSubscriptionInfo->action = CONFIG_UNKNOWN; - - /* Start RIC Subscription reporting timer */ + /* [Step 3 ] */ switch(ricSubscriptionInfo->eventTriggerDefinition.formatType) { case 1: { reportingPeriod = ricSubscriptionInfo->eventTriggerDefinition.choice.format1.reportingPeriod; - - /* Save the start time of reporting period */ storeReportStartTime(&ricSubscriptionInfo->eventTriggerDefinition.choice.format1.startTime); break; } default: - { - DU_LOG("\nERROR --> E2AP : Invalid event trigger format of RIC subscription"); - return RFAILED; - } + { + DU_LOG("\nERROR --> E2AP : Invalid event trigger format of RIC subscription"); + return RFAILED; + } } if(duChkTmr((PTR)ricSubscriptionInfo, EVENT_RIC_SUBSCRIPTION_REPORTING_TMR) != true) { @@ -680,41 +790,36 @@ uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp) } else { - DU_LOG("\nERROR --> E2AP : RIC Subscription reporting timer already running for RIC Subscription"); + DU_LOG("\nERROR --> E2AP : RIC Subscription reporting timer already running for RIC Subscription"); return RFAILED; } - /* If even 1 action is accepted : - * - * For accepted groups: - * Mark subscribed-action's -> action = CONFIG_UNKNOWN - * Add to accepted-action-list of subscription response - */ + /* [ Step 4 ] */ for(idx=0; idxnumGrpAccepted; idx++) { actionInfoDb = NULLP; actionId = statsRsp->statsGrpAcceptedList[idx]; - actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode); - if(actionInfoDb && (actionInfoDb->action == CONFIG_ADD)) + actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_ADD); + if(actionInfoDb) { + /* [ Step 4.1 ] */ actionInfoDb->action = CONFIG_UNKNOWN; pendingSubsRsp->acceptedActionList[pendingSubsRsp->numOfAcceptedActions++] = actionId; } } - /* For rejected groups: - * Remove entry from DU's RAN Function->subscription->actionList - * Add to rejected-action-list in subscription response - */ + /* [ Step 5 ] */ for(idx=0; idxnumGrpRejected; idx++) { actionInfoDb = NULLP; actionId = statsRsp->statsGrpRejectedList[idx].groupId; - actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode); - if(actionInfoDb->actionId == actionId) + actionInfoDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_ADD); + if(actionInfoDb) { + /* [ Step 5.1 ] */ + cmLListDelFrm(&ricSubscriptionInfo->actionSequence, actionNode); deleteActionSequence(actionNode); pendingSubsRsp->rejectedActionList[pendingSubsRsp->numOfRejectedActions].id = actionId; convertDuCauseToE2Cause(statsRsp->statsGrpRejectedList[idx].cause, \ @@ -723,10 +828,77 @@ uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp) } } - /* Send subscription response with accepted and rejected action lists to RIC */ - BuildAndSendRicSubscriptionRsp(pendingSubsRsp); + /* [ Step 6] */ + if(BuildAndSendRicSubscriptionRsp(pendingSubsRsp) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to build and send RIC Subscription rsp"); + return RFAILED; + } } memset(pendingSubsRsp, 0, sizeof(PendingSubsRspInfo)); + ricSubscriptionInfo->action = CONFIG_UNKNOWN; + return ROK; +} + +/******************************************************************* + * + * @brief Process statistics response from MAC + * + * @details + * + * Function : e2ProcStatsRsp + * + * Functionality: Processes statistics configuration response + * from MAC. + * [Step -1]Fetch RAN Function and Subscription DB using + * subscription Id received in statistics response + * [Step -2]check ricSubscriptionInfo's action + * [Step 2.1]if action == CONFIG_ADD, if no group + * accepted then reject all stats group and send ric + * subscription failure. Else process stats rsp for + * RIC subscription response. + * [Step 2.1]if action == CONFIG_MOD, process stats rsp + * for RIC subscription modification response. + * + * @params[in] Statistics response received from MAC + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp) +{ + RanFunction *ranFuncDb = NULLP; + CmLList *ricSubscriptionNode = NULLP; + RicSubscription *ricSubscriptionInfo = NULLP; + + /* [Step -1] */ + if(fetchSubsInfoFromSubsId(statsRsp->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK) + { + DU_LOG("\nERROR --> E2AP : failed in function %s at line %d",__func__,__LINE__); + return RFAILED; + } + + /* [Step -2] */ + if(ricSubscriptionInfo->action == CONFIG_ADD) + { + /* [Step -2.1] */ + if(procStatsRspForSubsReq(statsRsp, ranFuncDb, ricSubscriptionNode, ricSubscriptionInfo) != ROK) + { + rejectAllStatsGroup(ranFuncDb, ricSubscriptionNode, statsRsp); + DU_LOG("\nERROR --> E2AP : Failed to build and send RIC Subscription rsp"); + return RFAILED; + } + } + else if(ricSubscriptionInfo->action == CONFIG_MOD) + { + /* [Step -2.2] */ + if(procStatsRspForSubsModReq(statsRsp, ranFuncDb, ricSubscriptionInfo) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to build and send RIC Subscription rsp"); + return RFAILED; + } + } return ROK; } @@ -773,15 +945,15 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) * in statistics response */ if(fetchSubsInfoFromSubsId(statsInd->subscriptionId, &ranFuncDb, &ricSubscriptionNode, &ricSubscriptionInfo) != ROK) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Failed to fetch subscriprtion details"); + DU_LOG("\nERROR --> E2AP : %s : Failed to fetch subscriprtion details",__func__); return RFAILED; } /* Fetch RIC subscription's action DB */ - actionInfo = fetchActionInfoFromActionId(statsInd->groupId, ricSubscriptionInfo, &actionNode); + actionInfo = fetchActionInfoFromActionId(statsInd->groupId, ricSubscriptionInfo, &actionNode, CONFIG_UNKNOWN); if(actionInfo == NULLP) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Failed to fetch action ID [%d]", statsInd->groupId); + DU_LOG("\nERROR --> E2AP : %s: Failed to fetch action ID [%d]",__func__, statsInd->groupId); return RFAILED; } @@ -795,7 +967,7 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) } default: { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Action Format [%d] is not supported", \ + DU_LOG("\nERROR --> E2AP : %s: Action Format [%d] is not supported", __func__,\ actionInfo->definition.formatType); return RFAILED; } @@ -811,8 +983,8 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) /* Convert Measurement type from MAC-supported format to E2-supported format */ if(convertMacMeasTypeToE2MeasType(statsInd->measuredStatsList[statsIdx].type, e2MeasTypeName) != ROK) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Failed to convert measurement type from MAC-supported\ - MAC-supported format to E2-supported format"); + DU_LOG("\nERROR --> E2AP : %s: Failed to convert measurement type from MAC-supported\ + MAC-supported format to E2-supported format",__func__); continue; } @@ -820,7 +992,7 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) measInfo = fetchMeasInfoFromMeasTypeName(e2MeasTypeName, &actionFormat->measurementInfoList, &measInfoNode); if(measInfo == NULLP) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Measurement Type Name [%s] not found", e2MeasTypeName); + DU_LOG("\nERROR --> E2AP : %s: Measurement Type Name [%s] not found", __func__,e2MeasTypeName); continue; } @@ -828,7 +1000,7 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) DU_ALLOC(measValue, sizeof(double)); if(!measValue) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Memory allocation failed at line [%d]", __LINE__); + DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line [%d]",__func__, __LINE__); return RFAILED; } *measValue = statsInd->measuredStatsList[statsIdx].value; @@ -836,7 +1008,7 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) DU_ALLOC(measValueNode, sizeof(CmLList)); if(!measValueNode) { - DU_LOG("\nERROR --> E2AP : extractStatsMeasurement: Memory allocation failed at line [%d]", __LINE__); + DU_LOG("\nERROR --> E2AP : %s : Memory allocation failed at line [%d]",__func__, __LINE__); DU_FREE(measValue, sizeof(double)); return RFAILED; } @@ -864,7 +1036,6 @@ uint8_t e2ProcStatsInd(MacStatsInd *statsInd) * ****************************************************************/ void E2apHdlRicSubsReportTmrExp(RicSubscription *ricSubscription) { - uint8_t actionIdx = 0; uint32_t reportingPeriod = 0; ActionInfo *action=NULLP; CmLList *actionNode=NULLP; @@ -1579,6 +1750,267 @@ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) 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; idxnumPendingSubsModRsp; 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; idxnumStatsGroupDeleted; 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(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] Pending Subs modification rsp + * + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t duProcPendingSubsModRsp( PendingSubsModRspInfo *pendingSubsModRsp) +{ + if(pendingSubsModRsp->addActionCompleted && pendingSubsModRsp->removeActionCompleted && pendingSubsModRsp->modActionCompleted) + { +#if 0 + BuildAndSendRicSubsModRsp(pendingSubsModRsp); +#endif + memset(pendingSubsModRsp, 0, sizeof(PendingSubsModRspInfo)); + DU_LOG("\nProcessing of RIC subscription modification completed"); + } + return ROK; +} +/******************************************************************* + * + * @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; idxnumPendingSubsModRsp; 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; idxnumGrpAccepted; 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; idxnumGrpRejected; 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(pendingSubsModRsp) != ROK) + { + DU_LOG("\nERROR --> E2AP : failed to process subscription modification rsp"); + return RFAILED; + } + return ROK; +} + /******************************************************************* * * @brief Fill RIC Subscription datils in MAC Statistics @@ -1589,7 +2021,7 @@ uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp) * Function : fillRicSubsInMacStatsModificationReq * * Functionality: Fill RIC Subscription datils in MAC - * Modification Statistics Request + * Modification Statistics Request * [Step -1] Generate subscription ID using RIC Request ID and * RAN Function ID * [Step -2] Check all the action staus of each action present diff --git a/src/du_app/du_e2ap_mgr.h b/src/du_app/du_e2ap_mgr.h index 85447f225..dea3f1bff 100644 --- a/src/du_app/du_e2ap_mgr.h +++ b/src/du_app/du_e2ap_mgr.h @@ -422,6 +422,26 @@ typedef struct pendingSubsRspInfo RejectedAction rejectedActionList[MAX_RIC_ACTION]; }PendingSubsRspInfo; +typedef struct actionStatus +{ + uint8_t numOfAcceptedActions; + uint8_t acceptedActionList[MAX_RIC_ACTION]; + uint8_t numOfRejectedActions; + RejectedAction rejectedActionList[MAX_RIC_ACTION]; +}ActionStatus; + +typedef struct pendingSubsModRspInfo +{ + RicRequestId requestId; + uint16_t ranFuncId; + bool addActionCompleted; + ActionStatus addActionStatus; + bool modActionCompleted; + ActionStatus modActionStatus; + bool removeActionCompleted; + ActionStatus removeActionStatus; +}PendingSubsModRspInfo; + typedef struct { /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 */ @@ -438,6 +458,8 @@ typedef struct CmLListCp subscriptionList; uint8_t numPendingSubsRsp; PendingSubsRspInfo pendingSubsRspInfo[MAX_PENDING_SUBSCRIPTION_RSP]; + uint8_t numPendingSubsModRsp; + PendingSubsModRspInfo pendingSubsModRspInfo[MAX_PENDING_SUBSCRIPTION_RSP]; }RanFunction; /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26-9.2.27 */ @@ -509,7 +531,7 @@ typedef struct e2ConnectionList }E2ConnectionList; uint8_t assignTransactionId(); -ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSubscriptionInfo, CmLList ** actionNode); +ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSubscriptionInfo, CmLList ** actionNode, ConfigType configType); RicSubscription *fetchSubsInfoFromRicReqId(RicRequestId ricReqId, RanFunction *ranFuncDb, CmLList **ricSubscriptionNode); RanFunction *fetchRanFuncFromRanFuncId(uint16_t ranFuncId); uint8_t fetchSubsInfoFromSubsId(uint64_t subscriptionId, RanFunction **ranFuncDb, CmLList **ricSubscriptionNode, \ @@ -535,7 +557,9 @@ void removeE2NodeInformation(); void encodeSubscriptionId(uint64_t *subscriptionId, uint16_t ranFuncId, RicRequestId ricReqId); uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp); uint8_t fillRicSubsInMacStatsModificationReq(MacStatsModificationReq *macStatsModReq, RicSubscription* ricSubscriptionInfo); - +uint8_t e2ProcActionDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp); +uint8_t e2ProcStatsModificationRsp(MacStatsModificationRsp *statsModificationRsp); +uint8_t duProcPendingSubsModRsp( PendingSubsModRspInfo *pendingSubsModRsp); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index 5a1c1dd8e..5a3c425a6 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -29,6 +29,7 @@ #include "du_sctp.h" #include "du_mgr.h" #include "du_mgr_main.h" +#include "du_msg_hdl.h" #include "du_utils.h" #include "GlobalE2node-gNB-ID.h" #include "ProtocolIE-FieldE2.h" @@ -3275,7 +3276,6 @@ CmLList *addRicSubsAction(RanFunction *ranFuncDb, PTR ricSubsInfo, CmLListCp *ac RICaction_ToBeSetup_Item_t *setupItem= NULLP; RICaction_ToBeAddedForModification_Item_t *addIem= NULLP; RICaction_ToBeModifiedForModification_Item_t *modifiedItem= NULLP; - RICaction_ToBeRemovedForModification_Item_t *removedItem= NULLP; switch(procedureCode) { @@ -3290,7 +3290,7 @@ CmLList *addRicSubsAction(RanFunction *ranFuncDb, PTR ricSubsInfo, CmLListCp *ac } break; } - case ProtocolIE_IDE2_id_RICactionsToBeAddedForModification_List: + case ProtocolIE_IDE2_id_RICaction_ToBeAddedForModification_Item: { addIem = (RICaction_ToBeAddedForModification_Item_t*) ricSubsInfo; ricActionID= addIem->ricActionID; @@ -3299,22 +3299,19 @@ CmLList *addRicSubsAction(RanFunction *ranFuncDb, PTR ricSubsInfo, CmLListCp *ac break; } - case ProtocolIE_IDE2_id_RICactionsToBeModifiedForModification_List: + case ProtocolIE_IDE2_id_RICaction_ToBeModifiedForModification_Item: { modifiedItem= (RICaction_ToBeModifiedForModification_Item_t*)ricSubsInfo; ricActionID= modifiedItem->ricActionID; + /* Added since ricActionType IE is not present in case of + * modification */ + ricActionType = RICactionType_report; if(modifiedItem->ricActionDefinition) { ricActionDefinition = modifiedItem->ricActionDefinition; } break; } - case ProtocolIE_IDE2_id_RICactionsToBeRemovedForModification_List: - { - removedItem= (RICaction_ToBeRemovedForModification_Item_t*)ricSubsInfo; - ricActionID= removedItem->ricActionID; - break; - } } @@ -3401,7 +3398,7 @@ uint8_t extractRicActionToBeSetup(RanFunction *ranFuncDb, RicSubscription *ricSu if(failureCause->causeType == E2_NOTHING) { failureCause->causeType = E2_RIC_REQUEST; - failureCause->cause = E2_ACTION_NOT_SUPPORTED; + failureCause->cause = E2_CONTROL_FAILED_TO_EXECUTE; } memcpy(&subsRsp->rejectedActionList[subsRsp->numOfRejectedActions].failureCause, \ failureCause, sizeof(E2FailureCause)); @@ -6858,7 +6855,7 @@ void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg) modCfmListItem = (RICaction_ConfirmedForModification_ItemIEs_t *)modCfmList->list.array[arrIdx]; actionId = modCfmListItem->value.choice.RICaction_ConfirmedForModification_Item.ricActionID; - actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode); + actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode, CONFIG_UNKNOWN); if(!actionDb) { DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId); @@ -6881,7 +6878,7 @@ void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg) { modRefusedListItem = (RICaction_RefusedToBeModified_ItemIEs_t *)modRefusedList->list.array[arrIdx]; actionId = modRefusedListItem->value.choice.RICaction_RefusedToBeModified_Item.ricActionID; - actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode); + actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode, CONFIG_UNKNOWN); if(!actionDb) { DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId); @@ -6906,13 +6903,14 @@ void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg) { rmvCfmListItem = (RICaction_ConfirmedForRemoval_ItemIEs_t *)rmvCfmList->list.array[arrIdx]; actionId = rmvCfmListItem->value.choice.RICaction_ConfirmedForRemoval_Item.ricActionID; - actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode); + actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode, CONFIG_UNKNOWN); if(!actionDb) { DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId); } else { + cmLListDelFrm(&ricSubsDb->actionSequence, actionNode); deleteActionSequence(actionNode); actionDb =NULLP; /* Further handling can include : @@ -6931,7 +6929,7 @@ void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg) { rmvFailListItem = (RICaction_RefusedToBeRemoved_ItemIEs_t *)rmvFailList->list.array[arrIdx]; actionId = rmvFailListItem->value.choice.RICaction_RefusedToBeRemoved_Item.ricActionID; - actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode); + actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb, &actionNode, CONFIG_UNKNOWN); if(!actionDb) { DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId); @@ -8073,7 +8071,7 @@ void procRicSubscriptionDeleteRequest(E2AP_PDU_t *e2apMsg) break; } - if(BuildAndSendStatsDeleteReq(ricSubsDb) != ROK) + if(BuildAndSendStatsDeleteReq(ricSubsDb, true) != ROK) { DU_LOG("\nERROR --> E2AP : Failed to build and send ric subscription delete req to du layers"); } @@ -9707,6 +9705,289 @@ void freeAperDecodingOfRicSubsModificationReq(E2AP_PDU_t *e2apRicMsg) free(ricSubscriptionModReq->protocolIEs.list.array); } } +/******************************************************************* + * + * @brief Extract RIC Action to be added + * + * @details + * + * Function : extractRicActionToBeAddedForModification + * + * Functionality : This function : + * - [Step -1] Traverse each AddedForModification item indexes. + * - [Step -2] Add each action id related information in + * RicSubscription Db. + * - [Step -3] If failed to store then add action related info in + * pending rsp's rejectedActionList. + * - [Step -4] Else increment action added count + * - [Step -5] If there is even 1 action that can be added, + * return ROK, else RFAILED. + * + * @params[in] RAN Function Database structure + * RIC Subscription Info to be added to RAN function + * RIC Action To Be AddedForModification List received from RIC + * failure Cause + * Pending Subs Mod Rsp Info + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +uint8_t extractRicActionToBeAddedForModification(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \ + RICactions_ToBeAddedForModification_List_t *actionList, E2FailureCause *failureCause, PendingSubsModRspInfo *subsModRsp) +{ + uint8_t actionAdded=0; + CmLList *actionNode = NULLP; + uint8_t actionIdx = 0; + uint8_t ricActionId = 0; + RICaction_ToBeAddedForModification_ItemIEs_t *actionItem = NULLP; + + if(actionList->list.array) + { + for(actionIdx = 0; actionIdx < actionList->list.count; actionIdx++) + { + /* Step -1 */ + actionItem =(RICaction_ToBeAddedForModification_ItemIEs_t *)actionList->list.array[actionIdx]; + switch(actionItem->id) + { + case ProtocolIE_IDE2_id_RICaction_ToBeAddedForModification_Item: + { + /* Step -2 */ + actionNode = addRicSubsAction(ranFuncDb, (PTR)&actionItem->value.choice.RICaction_ToBeAddedForModification_Item,\ + &ricSubscriptionInfo->actionSequence, ProtocolIE_IDE2_id_RICaction_ToBeAddedForModification_Item, failureCause); + + if(!actionNode) + { + /* Step -3 */ + subsModRsp->addActionStatus.rejectedActionList[subsModRsp->addActionStatus.numOfRejectedActions].id = ricActionId; + if(failureCause->causeType == E2_NOTHING) + { + failureCause->causeType = E2_RIC_REQUEST; + failureCause->cause = E2_CONTROL_FAILED_TO_EXECUTE; + } + memcpy(&subsModRsp->addActionStatus.rejectedActionList[subsModRsp->addActionStatus.numOfRejectedActions].failureCause, \ + failureCause, sizeof(E2FailureCause)); + subsModRsp->addActionStatus.numOfRejectedActions++; + } + else + { + /* Step -4 */ + actionAdded++; + } + break; + } + default: + DU_LOG("\nERROR --> E2AP : Invalid IE received in RicAddedForModificationLst:%ld",actionItem->id); + break; + } + } + } + + /* Step -5 */ + if(actionAdded) + return ROK; + + if(failureCause->causeType == E2_NOTHING) + { + failureCause->causeType = E2_RIC_REQUEST; + failureCause->cause = E2_ACTION_NOT_SUPPORTED; + } + return RFAILED; +} + +/******************************************************************* + * + * @brief Extract RIC Action to be Modified + * + * @details + * + * Function : extractRicActionToBeModifiedForModification + * + * Functionality : This function : + * - [Step -1] Traverse each Modification item indexes. + * - [Step -2] Find each action id related information in + * RicSubscription Db. + * - [Step -3] If not found store the action related info in pending + * rsp's action rejected. + * - [Step -4] If found store the new node in action seq list. + * [Step -4.1] If action failed to store, add the action + * info in pending subscription rsp's rejected list. + * [Step -4.2] If action stored successfully, change the status + * of added action to modified because action added as part of + * ric subscription modification req. + * - [Step -5] If there is even 1 action that can be modified, + * return ROK, else RFAILED. + * + * @params[in] RAN Function Database structure + * RIC Subscription Info to be Modified to RAN function + * RIC Action To Be ModifiedForModification List received from RIC + * failure Cause + * Pending Subs Mod Rsp Info + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +uint8_t extractRicActionToBeModifiedForModification(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \ + RICactions_ToBeModifiedForModification_List_t *actionList, E2FailureCause *failureCause, PendingSubsModRspInfo *subsModRsp) +{ + uint8_t actionId=0; + uint8_t actionIdx = 0; + uint8_t actionFound=0; + CmLList *actionNode = NULLP; + ActionInfo *actionDb = NULLP; + RICaction_ToBeModifiedForModification_ItemIEs_t *actionItem = NULLP; + + if(actionList->list.array) + { + for(actionIdx = 0; actionIdx < actionList->list.count; actionIdx++) + { + /* [Step -1] */ + actionItem =(RICaction_ToBeModifiedForModification_ItemIEs_t *)actionList->list.array[actionIdx]; + switch(actionItem->id) + { + case ProtocolIE_IDE2_id_RICaction_ToBeModifiedForModification_Item: + { + /* [Step -2] */ + actionId=actionItem->value.choice.RICaction_ToBeModifiedForModification_Item.ricActionID; + actionDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_UNKNOWN); + if(!actionNode) + { + /* [Step -3] */ + subsModRsp->removeActionStatus.rejectedActionList[subsModRsp->modActionStatus.numOfRejectedActions].id = actionDb->actionId; + failureCause->causeType = E2_RIC_REQUEST; + failureCause->cause = E2_ACTION_NOT_SUPPORTED; + memcpy(&subsModRsp->removeActionStatus.rejectedActionList[subsModRsp->modActionStatus.numOfRejectedActions].failureCause, \ + failureCause, sizeof(E2FailureCause)); + subsModRsp->modActionStatus.numOfRejectedActions++; + } + else + { + /* [Step -4] */ + actionNode = NULLP; + actionNode = addRicSubsAction(ranFuncDb, (PTR)&actionItem->value.choice.RICaction_ToBeModifiedForModification_Item,\ + &ricSubscriptionInfo->actionSequence, ProtocolIE_IDE2_id_RICaction_ToBeModifiedForModification_Item, failureCause); + + if(!actionNode) + { + /* [Step -4.1] */ + subsModRsp->modActionStatus.rejectedActionList[subsModRsp->modActionStatus.numOfRejectedActions].id = actionId; + if(failureCause->causeType == E2_NOTHING) + { + failureCause->causeType = E2_RIC_REQUEST; + failureCause->cause = E2_CONTROL_FAILED_TO_EXECUTE; + } + memcpy(&subsModRsp->modActionStatus.rejectedActionList[subsModRsp->modActionStatus.numOfRejectedActions].failureCause, \ + failureCause, sizeof(E2FailureCause)); + subsModRsp->addActionStatus.numOfRejectedActions++; + } + else + { + /* [Step -4.2] */ + actionDb = (ActionInfo*)actionNode->node; + actionDb->action=CONFIG_MOD; + actionFound++; + } + break; + } + break; + } + default: + DU_LOG("\nERROR --> E2AP : Invalid IE received in RicModifiedForModificationLst:%ld",actionItem->id); + break; + } + } + } + + /* [Step -5] */ + if(actionFound) + return ROK; + + return RFAILED; +} + +/******************************************************************* + * + * @brief Extract RIC Action to be Removed + * + * @details + * + * Function : extractRicActionToBeRemovedForModification + * + * Functionality : This function : + * - [Step -1] Traverse each RemovedForModification item indexes. + * - [Step -2] Find each action id related information in + * RicSubscription Db. + * - [Step -3] If not found store the action related info in pending + * rsp's rejectedActionList. + * - [Step -4] If found mark action's status CONFIG_DEL. + * - [Step -5] If there is even 1 action that can be Removed, + * return ROK, else RFAILED. + * + * @params[in] RAN Function Database structure + * RIC Subscription Info to be Removed to RAN function + * RIC Action To Be RemovedForModification List received from RIC + * failure Cause + * Pending ric subs mod Rsp Info to store failure result + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +uint8_t extractRicActionToBeRemovedForModification(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \ + RICactions_ToBeRemovedForModification_List_t *actionList, E2FailureCause *failureCause, PendingSubsModRspInfo *subsModRsp) +{ + uint8_t actionId=0; + uint8_t actionIdx = 0; + uint8_t actionFound=0; + CmLList *actionNode = NULLP; + ActionInfo *actionDb = NULLP; + RICaction_ToBeRemovedForModification_ItemIEs_t *actionItem = NULLP; + + if(actionList->list.array) + { + for(actionIdx = 0; actionIdx < actionList->list.count; actionIdx++) + { + /* [Step -1] */ + actionItem =(RICaction_ToBeRemovedForModification_ItemIEs_t *)actionList->list.array[actionIdx]; + switch(actionItem->id) + { + case ProtocolIE_IDE2_id_RICaction_ToBeRemovedForModification_Item: + { + /* [Step -2] */ + actionId = actionItem->value.choice.RICaction_ToBeRemovedForModification_Item.ricActionID; + actionDb = fetchActionInfoFromActionId(actionId, ricSubscriptionInfo, &actionNode, CONFIG_UNKNOWN); + if(!actionNode) + { + /* [Step -3] */ + subsModRsp->removeActionStatus.rejectedActionList[subsModRsp->removeActionStatus.numOfRejectedActions].id = actionDb->actionId; + if(failureCause->causeType == E2_NOTHING) + { + failureCause->causeType = E2_RIC_REQUEST; + failureCause->cause = E2_ACTION_NOT_SUPPORTED; + } + memcpy(&subsModRsp->removeActionStatus.rejectedActionList[subsModRsp->removeActionStatus.numOfRejectedActions].failureCause, \ + failureCause, sizeof(E2FailureCause)); + subsModRsp->removeActionStatus.numOfRejectedActions++; + } + else + { + /* [Step -4] */ + actionDb->action=CONFIG_DEL; + actionFound++; + } + break; + } + default: + DU_LOG("\nERROR --> E2AP : Invalid IE received in RicRemovedForModificationLst:%ld",actionItem->id); + break; + } + } + } + + /* [Step -5] */ + if(actionFound) + return ROK; + + return RFAILED; +} /******************************************************************* * @@ -9726,14 +10007,18 @@ void procRicSubscriptionModificationRequest(E2AP_PDU_t *e2apMsg) { uint8_t ieIdx = 0; uint16_t ranFuncId = 0; - bool procFailure = false; RicRequestId ricReqId; - RanFunction *ranFuncDb = NULLP; + E2FailureCause failureCause; + bool procFailure = false; + bool addActionIeProcessed=false; + bool modActionIeProcessed =false; + bool removeActionIeProcessed =false; CmLList *ricSubsNode = NULLP; + RanFunction *ranFuncDb = NULLP; RicSubscription *ricSubsDb = NULLP; RICsubscriptionModificationRequest_t *ricSubsModifyReq = NULLP; RICsubscriptionModificationRequest_IEs_t *ricSubsModifyReqIe = NULLP; - + DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Modification Request", __func__); do{ @@ -9788,10 +10073,44 @@ void procRicSubscriptionModificationRequest(E2AP_PDU_t *e2apMsg) procFailure = true; break; } + memset(&ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp], 0, sizeof(PendingSubsModRspInfo)); + memcpy(&ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp].requestId, + &ricReqId, sizeof(RicRequestId)); + ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp].ranFuncId = ranFuncId; break; } + case ProtocolIE_IDE2_id_RICactionsToBeRemovedForModification_List: + { + if(extractRicActionToBeRemovedForModification(ranFuncDb, ricSubsDb,\ + &ricSubsModifyReqIe->value.choice.RICactions_ToBeRemovedForModification_List,\ + &failureCause, &ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp]) == ROK) + { + removeActionIeProcessed= true; + } + break; + } + case ProtocolIE_IDE2_id_RICactionsToBeModifiedForModification_List: + { + if(extractRicActionToBeModifiedForModification(ranFuncDb, ricSubsDb,\ + &ricSubsModifyReqIe->value.choice.RICactions_ToBeModifiedForModification_List,\ + &failureCause, &ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp]) == ROK) + { + modActionIeProcessed = true; + } + break; + } + case ProtocolIE_IDE2_id_RICactionsToBeAddedForModification_List: + { + if(extractRicActionToBeAddedForModification(ranFuncDb, ricSubsDb,\ + &ricSubsModifyReqIe->value.choice.RICactions_ToBeAddedForModification_List,\ + &failureCause, &ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp]) == ROK) + { + addActionIeProcessed = true; + } + break; + } default: break; } /* End of switch for Protocol IE Id */ @@ -9802,6 +10121,50 @@ void procRicSubscriptionModificationRequest(E2AP_PDU_t *e2apMsg) break; }while(true); + + if(!removeActionIeProcessed && !addActionIeProcessed && !modActionIeProcessed) + { + BuildAndSendRicSubscriptionModificationFailure(ranFuncId, ricReqId, failureCause); + } + else + { + ricSubsDb->action = CONFIG_MOD; + ranFuncDb->numPendingSubsModRsp++; + + /*If the remove-action ie is present, send a stats delete request; + * otherwise, change removeActionCompleted to true in the pendingSubsModRspInfo. */ + if(removeActionIeProcessed) + { + BuildAndSendStatsDeleteReq(ricSubsDb, false); + } + else + { + ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp-1].removeActionCompleted = true; + } + + /*If the mod-action ie is present, send a stats modification request; + * otherwise, change modActionCompleted to true in the pendingSubsModRspInfo. */ + if(modActionIeProcessed) + { + BuildAndSendStatsModificationReq(ricSubsDb); + } + else + { + ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp-1].modActionCompleted= true; + } + + /*If the add-action ie is present, send a stats add request; + * otherwise, change addActionCompleted to true in the pendingSubsModRspInfo. */ + if(addActionIeProcessed) + { + BuildAndSendStatsReq(ricSubsDb); + } + else + { + ranFuncDb->pendingSubsModRspInfo[ranFuncDb->numPendingSubsModRsp-1].addActionCompleted= true; + } + + } freeAperDecodingOfRicSubsModificationReq(e2apMsg); } diff --git a/src/du_app/du_e2ap_msg_hdl.h b/src/du_app/du_e2ap_msg_hdl.h index f61e3057d..c433a6f5f 100644 --- a/src/du_app/du_e2ap_msg_hdl.h +++ b/src/du_app/du_e2ap_msg_hdl.h @@ -33,6 +33,7 @@ uint8_t BuildAndSendRicSubscriptionFailure(RicRequestId ricReqId, uint16_t ranFu uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo, ActionInfo *actionInfo); uint8_t BuildAndSendRicSubscriptionDeleteResponse(uint16_t ranFuncId, RicRequestId requestId); uint8_t BuildAndSendRicSubscriptionDeleteFailure(uint16_t ranFuncId, RicRequestId requestId, E2FailureCause failureCause); +uint8_t BuildAndSendRicSubscriptionModificationFailure(uint16_t ranFuncId, RicRequestId requestId, E2FailureCause failureCause); /********************************************************************** End of file diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 88043ee17..b545555c8 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -586,7 +586,7 @@ uint8_t commonInit() 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, 16, 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) @@ -594,7 +594,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed"); return RFAILED; } - //ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0); + ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0); /* system task for RLC_DL and MAC */ if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK) @@ -604,7 +604,7 @@ uint8_t commonInit() } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - //ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 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) @@ -612,7 +612,7 @@ uint8_t commonInit() 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, 22, 0); + ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); /* system task for SCH */ if(ODU_CREATE_TASK(PRIOR1, &sch_stsk) != ROK) @@ -620,7 +620,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCH failed"); return RFAILED; } - //ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); + ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0); /* system task for SCTP receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK) @@ -628,7 +628,7 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed"); return RFAILED; } - //ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0); + ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0); /* system task for lower-mac receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK) @@ -636,7 +636,7 @@ uint8_t commonInit() 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, 21, 0); + ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0); #ifndef INTEL_WLS_MEM /* system task for phy stub's slot indication generator thread */ diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 1089a5ec1..323fcf112 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -41,6 +41,7 @@ #include "legtp.h" #include "du_utils.h" #include "du_cell_mgr.h" +#include "du_msg_hdl.h" #ifdef O1_ENABLE @@ -57,17 +58,6 @@ uint8_t numRlcMacSaps = 0; uint8_t macCfg = 0; uint8_t macCfgInst = 0; -DuCfgParams duCfgParam; -uint8_t packRlcConfigReq(Pst *pst, RlcMngmt *cfg); -uint8_t cmPkLkwCntrlReq(Pst *pst, RlcMngmt *cfg); -uint8_t cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg); -uint8_t egtpHdlDatInd(EgtpMsg egtpMsg); -uint8_t BuildAndSendDUConfigUpdate(); -uint16_t getTransId(); -uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg); -uint8_t sendCellDeleteReqToMac(uint16_t cellId); -uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo); - packMacCellCfgReq packMacCellCfgOpts[] = { packMacCellCfg, /* packing for loosely coupled */ @@ -2326,7 +2316,10 @@ uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp) } else { - /* TODO calling ric sub modification action to be deleted functions */ + if((ret = e2ProcActionDeleteRsp(statsDeleteRsp)) != ROK) + { + DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__); + } } DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsDeleteRsp, sizeof(MacStatsDeleteRsp)); } @@ -2398,6 +2391,7 @@ uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo, bo macStatsDelete->statsGrpIdToBeDelList[actionIdx] = actionDb->actionId; actionIdx++; } + actionNode= actionNode->next; } macStatsDelete->numStatsGroupToBeDeleted=actionIdx; } @@ -2426,16 +2420,18 @@ uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo, bo * * Functionality: Statistics delete to DU layers * - * @params[in] Subscription Info + * @params[in] + * Subscription Info + * delete All Stats * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo) +uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo, bool deleteAllStats) { /* Build and sent subscription information to MAC in Statistics delete */ - if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo, true) != ROK) + if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo, deleteAllStats) != ROK) { DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsDeleteReqToMac()"); return RFAILED; @@ -2563,15 +2559,10 @@ uint8_t DuProcMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsMo DU_LOG("\n Group Id [%d]", statsModificationRsp->statsGrpRejectedList[idx].groupId); } #endif -#if 0 - /*TODO*/ - /* Check the list of accepted and rejected statistics group and send - * Ric subscription modification response/failure accordingly */ if((ret = e2ProcStatsModificationRsp(statsModificationRsp)) != ROK) { DU_LOG("\nERROR --> DU_APP : DuProcMacStatsModificationRsp: Failed in %s at line %d", __func__, __LINE__); } -#endif DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsModificationRsp, sizeof(MacStatsModificationRsp)); } else diff --git a/src/du_app/du_msg_hdl.h b/src/du_app/du_msg_hdl.h new file mode 100644 index 000000000..33a2771a2 --- /dev/null +++ b/src/du_app/du_msg_hdl.h @@ -0,0 +1,35 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + + +uint8_t packRlcConfigReq(Pst *pst, RlcMngmt *cfg); +uint8_t cmPkLkwCntrlReq(Pst *pst, RlcMngmt *cfg); +uint8_t cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg); +uint8_t egtpHdlDatInd(EgtpMsg egtpMsg); +uint8_t BuildAndSendDUConfigUpdate(); +uint16_t getTransId(); +uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg); +uint8_t sendCellDeleteReqToMac(uint16_t cellId); +uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo, bool deleteAllStats); +uint8_t BuildAndSendStatsModificationReqToMac(RicSubscription *ricSubscriptionInfo); +uint8_t BuildAndSendStatsModificationReq(RicSubscription *ricSubscriptionInfo); + + +/********************************************************************** + End of file + **********************************************************************/ diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index bed82e70a..b7a9eab75 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -7972,7 +7972,7 @@ void BuildRicSubsModificationReq(DuDb *duDb, RicSubscription *ricSubsInfo) { actionInfoDb = (ActionInfo*)(actionNode->node); /* Change the condition based on the action required to be modiified or removed */ - if(((actionInfoDb->actionId)%2) == 0) + if(((actionInfoDb->actionId+1)%2) == 0) { tmpActionIdx = ricSubsModReq.numOfActionToBeModify; ricSubsModReq.actionToBeModify[tmpActionIdx].actionId = actionInfoDb->actionId; @@ -7984,6 +7984,7 @@ void BuildRicSubsModificationReq(DuDb *duDb, RicSubscription *ricSubsInfo) ricSubsModReq.actionToBeRemove[tmpActionIdx].actionId = actionInfoDb->actionId; ricSubsModReq.numOfActionToBeRemove++; } + actionNode= actionNode->next; } /* Change the value of actionToBeAdded based on the number of action required to be added */ actionToBeAdded =1;