From 5b669934530a541a73f027aff9be4269a5fd6b52 Mon Sep 17 00:00:00 2001 From: pborla Date: Fri, 20 Oct 2023 17:08:23 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-535] Processing of E2 Removal Procedure(RIC initiated) Change-Id: I5f61779e24a9c15e4016902e177aa9c58219e710 Signed-off-by: pborla --- src/du_app/du_e2ap_mgr.c | 34 ++++++++++++++ src/du_app/du_e2ap_mgr.h | 1 + src/du_app/du_e2ap_msg_hdl.c | 4 +- src/ric_stub/ric_e2ap_msg_hdl.c | 99 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 2 deletions(-) diff --git a/src/du_app/du_e2ap_mgr.c b/src/du_app/du_e2ap_mgr.c index e003e2ffd..0c4b0b3b8 100644 --- a/src/du_app/du_e2ap_mgr.c +++ b/src/du_app/du_e2ap_mgr.c @@ -1432,6 +1432,40 @@ void fetchRicSubsToBeDeleted(CmLListCp *ricSubsToBeDelList) } } +/****************************************************************** + * + * @brief Delete e2 node information from the database + * + * @details + * + * Function : removeE2NodeInformation + * + * Functionality: Delete e2 node information from the database + * + * @params[in] + * + * @return void + * +******************************************************************/ +void removeE2NodeInformation() +{ + uint16_t ranFuncIdx = 0; + + DU_LOG("\nINFO --> E2AP : Deleting all the E2 node configuration"); + for(ranFuncIdx=0; ranFuncIdx0) + { + deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList)); + memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo)); + } + } + memset(&duCb.e2apDb.ricId, 0, sizeof(GlobalRicId)); + duCb.e2apDb.numOfTNLAssoc = 0; + memset(&duCb.e2apDb.tnlAssoc, 0, MAX_TNL_ASSOCIATION*sizeof(TNLAssociation)); + cmInetClose(&ricParams.sockFd); + memset(&ricParams, 0, sizeof(DuSctpDestCb)); +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_e2ap_mgr.h b/src/du_app/du_e2ap_mgr.h index a4d05f9ca..df06ada0d 100644 --- a/src/du_app/du_e2ap_mgr.h +++ b/src/du_app/du_e2ap_mgr.h @@ -518,6 +518,7 @@ void deleteRicSubscriptionNode(CmLList *ricSubscriptionInfo); void deleteMeasurementInfoList(CmLListCp *measInfoList); void deleteActionSequence(ActionInfo *action); void deleteMeasuredValueList(CmLListCp *measuredValueList); +void removeE2NodeInformation(); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index ece43c87b..83be943cb 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -482,6 +482,7 @@ uint8_t BuildAndSendRemovalResponse(uint8_t transId) }while(true); FreeE2RemovalResponse(e2apMsg); + removeE2NodeInformation(); return ret; } @@ -537,14 +538,13 @@ void freeAperDecodingOfE2RemovalReq(E2RemovalRequest_t *removalReq) void procE2RemovalRequest(E2AP_PDU_t *e2apMsg) { - uint8_t arrIdx =0, transId =0, count =0; + uint8_t arrIdx =0, transId =0; E2FailureCause failureCause; E2RemovalRequest_t *removalReq=NULLP; DU_LOG("\nINFO --> E2AP : E2 Removal request received"); removalReq = &e2apMsg->choice.initiatingMessage->value.choice.E2RemovalRequest; - count =removalReq->protocolIEs.list.count; for(arrIdx=0; arrIdxprotocolIEs.list.count; arrIdx++) { switch(removalReq->protocolIEs.list.array[arrIdx]->id) diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index b8b4888f4..5f8b11563 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -5983,6 +5983,104 @@ void ProcE2RemovalFailure(E2RemovalFailure_t *e2RemovalFailure) } } +/******************************************************************* + * + * @brief process the E2 node information from ric db + * + * @details + * + * Function : deleteE2NodeInfo + * + * Functionality: process the E2 node information from ric db + * + * @params[in] + * du Id + * + * @return void + * + ******************************************************************/ +void deleteE2NodeInfo(DuDb *duDb) +{ + uint16_t ranFuncIdx =0; + RanFunction *ranFuncDb=NULLP; + + DU_LOG("\nINFO --> E2AP : Removing all the E2 node information"); + for(ranFuncIdx = 0; ranFuncIdx < MAX_RAN_FUNCTION; ranFuncIdx++) + { + ranFuncDb = &duDb->ranFunction[ranFuncIdx]; + if(ranFuncDb->id > 0) + { + deleteRicSubscriptionList(&ranFuncDb->subscriptionList); + } + } + + cmInetClose(&sctpCb.e2LstnSockFd); +} + +/******************************************************************* + * + * @brief process the E2 Removal Response + * + * @details + * + * Function : ProcRemovalResponse + * + * Functionality: Process E2 Removal Response + * + * @params[in] + * du Id + * Pointer to removal response + * @return void + * + ******************************************************************/ + +void ProcRemovalResponse(uint32_t duId, E2RemovalResponse_t *removalRsp) +{ + uint8_t ieIdx = 0, duIdx =0; + DuDb *duDb = NULLP; + RanFunction *ranFuncDb = NULLP; + uint16_t ranFuncIdx = 0; + + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb == NULLP) + { + DU_LOG("\nERROR --> E2AP : duDb is not present for duId %d",duId); + return; + } + + if(!removalRsp) + { + DU_LOG("\nERROR --> E2AP : removalRsp pointer is null"); + return; + } + + if(!removalRsp->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : removalRsp array pointer is null"); + return; + } + + for(ieIdx=0; ieIdx < removalRsp->protocolIEs.list.count; ieIdx++) + { + if(removalRsp->protocolIEs.list.array[ieIdx]) + { + switch(removalRsp->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + { + deleteE2NodeInfo(duDb); + break; + } + default: + { + DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", removalRsp->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } +} + /******************************************************************* * * @brief Handles received E2AP message and sends back response @@ -6131,6 +6229,7 @@ void E2APMsgHdlr(uint32_t *duId, Buffer *mBuf) } case SuccessfulOutcomeE2__value_PR_E2RemovalResponse: { + ProcRemovalResponse(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse); break; } default: -- 2.16.6