X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fric_stub%2Fric_e2ap_msg_hdl.c;h=f9540ce22872433093867b01901a438876ad79db;hb=c371a26d48604a5d60686d9ca347e68671e69637;hp=75a657cfef2c4dbcac760baf8b96bf85e7c17a0f;hpb=3886341e5a7ddaa873b8bd210bccf51fb7d07d2c;p=o-du%2Fl2.git diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index 75a657cfe..f9540ce22 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -5983,6 +5983,36 @@ void ProcE2RemovalFailure(E2RemovalFailure_t *e2RemovalFailure) } } } +/******************************************************************* + * + * @brief Delete E2 component node list + * + * @details + * + * Function : deleteE2ComponentNodeList + * + * Functionality: Delete E2 component node list + * + * @params[in] E2 component node list + * @return void + + * + ******************************************************************/ + +void deleteE2ComponentNodeList(CmLListCp *componentList) +{ + E2NodeComponent *cfgInfo = NULLP; + CmLList *e2ComponentNode = NULLP; + + CM_LLIST_FIRST_NODE(componentList, e2ComponentNode); + while(e2ComponentNode) + { + cfgInfo = (E2NodeComponent*)e2ComponentNode->node; + cmLListDelFrm(componentList, e2ComponentNode); + memset(cfgInfo, 0, sizeof(E2NodeComponent)); + CM_LLIST_FIRST_NODE(componentList, e2ComponentNode); + } +} /******************************************************************* * @@ -6014,8 +6044,7 @@ void deleteE2NodeInfo(DuDb *duDb) deleteRicSubscriptionList(&ranFuncDb->subscriptionList); } } - - cmInetClose(&sctpCb.e2LstnSockFd); + deleteE2ComponentNodeList(&duDb->e2NodeComponent); } /******************************************************************* @@ -6067,8 +6096,10 @@ void ProcE2RemovalResponse(uint32_t duId, E2RemovalResponse_t *removalRsp) { case ProtocolIE_IDE2_id_TransactionID: { + DU_LOG("\nINFO --> E2AP : Sending request to close the sctp connection"); + cmInetClose(&sctpCb.e2LstnSockFd); deleteE2NodeInfo(duDb); - break; + exit(0); } default: { @@ -6401,7 +6432,6 @@ uint8_t BuildAndSendRemovalResponse(uint32_t duId, uint16_t transId) }while(true); FreeE2RemovalResponse(e2apMsg); - deleteE2NodeInfo(duDb); return ret; } @@ -6927,6 +6957,269 @@ void ProcE2connectionUpdateFailure(E2connectionUpdateFailure_t *updateFailure) } } +/******************************************************************* + * + * @brief process the E2 Connection update ack + * + * @details + * + * Function : ProcE2ConnectionUpdateAck + * + * Functionality: Process E2 Connection update ack + * + * @params[in] + * du Id + * Pointer to Connection update ack + * @return void + * + ******************************************************************/ + +void ProcE2ConnectionUpdateAck(uint32_t duId, E2connectionUpdateAcknowledge_t *connectionUpdateAck) +{ + uint16_t transId =0; + uint32_t ipAddress=0; + DuDb *duDb = NULLP; + uint8_t ieIdx = 0, duIdx =0, arrIdx=0; + E2connectionUpdate_Item_t *connectionSetupItem=NULLP; + E2connectionUpdate_ItemIEs_t *connectionSetupItemIe=NULLP; + E2connectionUpdate_List_t *connectionSetupList=NULLP; + E2connectionSetupFailed_Item_t *setupFailedItem =NULLP; + E2connectionSetupFailed_List_t *setupFailedList=NULLP; + E2connectionSetupFailed_ItemIEs_t *setupFailedItemIe =NULLP; + + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb == NULLP) + { + DU_LOG("\nERROR --> E2AP : duDb is not present for duId %d",duId); + return; + } + + if(!connectionUpdateAck) + { + DU_LOG("\nERROR --> E2AP : connectionUpdateAck pointer is null"); + return; + } + + if(!connectionUpdateAck->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : connectionUpdateAck array pointer is null"); + return; + } + + for(ieIdx=0; ieIdx < connectionUpdateAck->protocolIEs.list.count; ieIdx++) + { + if(connectionUpdateAck->protocolIEs.list.array[ieIdx]) + { + switch(connectionUpdateAck->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + { + transId = connectionUpdateAck->protocolIEs.list.array[arrIdx]->value.choice.TransactionID; + if(transId>255) + { + DU_LOG("\nERROR --> E2AP : Received invalid trans id %d ",transId); + return; + } + break; + } + case ProtocolIE_IDE2_id_E2connectionSetup: + { + connectionSetupList=&connectionUpdateAck->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List; + if(connectionSetupList->list.array) + { + for(arrIdx = 0; arrIdx< connectionSetupList->list.count; arrIdx++) + { + connectionSetupItemIe = (E2connectionUpdate_ItemIEs_t*)connectionSetupList->list.array[arrIdx]; + connectionSetupItem = &connectionSetupItemIe->value.choice.E2connectionUpdate_Item; + bitStringToInt(&connectionSetupItem->tnlInformation.tnlAddress, &ipAddress); + if(ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr == ipAddress) + { + ricCb.ricCfgParams.sctpParams.usage = connectionSetupItem->tnlUsage; + } + } + } + break; + } + + case ProtocolIE_IDE2_id_E2connectionSetupFailed: + { + setupFailedList=&connectionUpdateAck->protocolIEs.list.array[ieIdx]->value.choice.E2connectionSetupFailed_List; + if(setupFailedList->list.array) + { + for(arrIdx = 0; arrIdx< setupFailedList->list.count; arrIdx++) + { + setupFailedItemIe = (E2connectionSetupFailed_ItemIEs_t*)setupFailedList->list.array[arrIdx]; + setupFailedItem = &setupFailedItemIe->value.choice.E2connectionSetupFailed_Item; + printE2ErrorCause(&setupFailedItem->cause); + } + } + break; + } + default: + { + DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", connectionUpdateAck->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } +} + +/****************************************************************** + * + * @brief Processes the Ric Subs delete failure msg + * + * @details + * + * Function : procRicSubsDeleteFailure + * + * Functionality: Processes the Ric Subs delete failure msg + * + * @params[in] + * Ric Subs delete failure information + * + * @return void + * + * ****************************************************************/ +void ProcRicSubsDeleteFailure(RICsubscriptionDeleteFailure_t *ricSubsDeleteFail) +{ + uint8_t ieIdx = 0; + uint16_t ranFuncId=0; + CauseE2_t *cause = NULLP; + RICrequestID_t ricRequestID; + + if(!ricSubsDeleteFail) + { + DU_LOG("\nERROR --> E2AP : ricSubsDeleteFail pointer is null"); + return; + } + + if(!ricSubsDeleteFail->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : ricSubsDeleteFail array pointer is null"); + return; + } + + for(ieIdx=0; ieIdx < ricSubsDeleteFail->protocolIEs.list.count; ieIdx++) + { + if(ricSubsDeleteFail->protocolIEs.list.array[ieIdx]) + { + switch(ricSubsDeleteFail->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_RICrequestID: + { + memcpy(&ricSubsDeleteFail->protocolIEs.list.array[ieIdx]->value.choice.RICrequestID, &ricRequestID, sizeof(RICrequestID_t)); + DU_LOG("\nERROR --> E2AP : Received RicReqId %ld and InstanceId %ld", ricRequestID.ricRequestorID, ricRequestID.ricInstanceID); + break; + } + case ProtocolIE_IDE2_id_RANfunctionID: + { + ranFuncId = ricSubsDeleteFail->protocolIEs.list.array[ieIdx]->value.choice.RANfunctionID; + DU_LOG("\nERROR --> E2AP : Received ranfuncId %d", ranFuncId); + break; + } + case ProtocolIE_IDE2_id_CauseE2: + { + cause = &ricSubsDeleteFail->protocolIEs.list.array[ieIdx]->value.choice.CauseE2; + printE2ErrorCause(cause); + break; + } + default: + { + DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", ricSubsDeleteFail->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } +} + + +/****************************************************************** + * + * @brief Processes the Ric Subs delete rsp msg + * + * @details + * + * Function : ProcRicSubsDeleteRsp + * + * Functionality: Processes the Ric Subs delete rsp msg + * + * @params[in] + * Ric Subs delete rsp information + * + * @return void + * + * ****************************************************************/ +void ProcRicSubsDeleteRsp(uint32_t duId, RICsubscriptionDeleteResponse_t *ricSubsDeleteRsp) +{ + uint8_t ieIdx = 0; + uint8_t duIdx= 0; + uint16_t ranFuncId=0; + RanFunction *ranFuncDb = NULLP; + RicRequestId ricReqId; + DuDb *duDb = NULLP; + RicSubscription *ricSubs = NULLP; + CmLList *ricSubsNode = NULLP; + + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb == NULLP) + { + DU_LOG("\nERROR --> E2AP : duDb is not present for duId %d",duId); + return; + } + + if(!ricSubsDeleteRsp) + { + DU_LOG("\nERROR --> E2AP : ricSubsDeleteRsp pointer is null"); + return; + } + + if(!ricSubsDeleteRsp->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : ricSubsDeleteRsp array pointer is null"); + return; + } + for(ieIdx=0; ieIdx < ricSubsDeleteRsp->protocolIEs.list.count; ieIdx++) + { + if(ricSubsDeleteRsp->protocolIEs.list.array[ieIdx]) + { + switch(ricSubsDeleteRsp->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_RICrequestID: + { + ricReqId.requestorId = ricSubsDeleteRsp->protocolIEs.list.array[ieIdx]->value.choice.RICrequestID.ricRequestorID; + ricReqId.instanceId = ricSubsDeleteRsp->protocolIEs.list.array[ieIdx]->value.choice.RICrequestID.ricInstanceID; + break; + } + case ProtocolIE_IDE2_id_RANfunctionID: + { + ranFuncId = ricSubsDeleteRsp->protocolIEs.list.array[ieIdx]->value.choice.RANfunctionID; + ranFuncDb = fetchRanFuncFromRanFuncId(duDb, ranFuncId); + if(!ranFuncDb) + { + DU_LOG("\nERROR --> E2AP : Invalid Ran Function id %d received",ranFuncId); + return; + } + + ricSubs = fetchSubsInfoFromRicReqId(ricReqId, ranFuncDb, &ricSubsNode); + if(ricSubs) + { + deleteRicSubscriptionNode(ricSubsNode); + DU_LOG("\nINFO --> E2AP : Ric subscription node deleted successfully"); + } + else + { + DU_LOG("\nERROR --> E2AP : Ric subscription node is not present "); + return; + } + break; + } + } + } + } +} + /******************************************************************* * * @brief Handles received E2AP message and sends back response @@ -7085,6 +7378,16 @@ void E2APMsgHdlr(uint32_t *duId, Buffer *mBuf) ProcE2RemovalResponse(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse); break; } + case SuccessfulOutcomeE2__value_PR_E2connectionUpdateAcknowledge: + { + ProcE2ConnectionUpdateAck(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2connectionUpdateAcknowledge); + break; + } + case SuccessfulOutcomeE2__value_PR_RICsubscriptionDeleteResponse: + { + ProcRicSubsDeleteRsp(*duId, &e2apMsg->choice.successfulOutcome->value.choice.RICsubscriptionDeleteResponse); + break; + } default: { DU_LOG("\nERROR --> E2AP : Invalid type of successfulOutcome message [%d]", \ @@ -7115,6 +7418,11 @@ void E2APMsgHdlr(uint32_t *duId, Buffer *mBuf) ProcE2connectionUpdateFailure(&e2apMsg->choice.unsuccessfulOutcome->value.choice.E2connectionUpdateFailure); break; } + case UnsuccessfulOutcomeE2__value_PR_RICsubscriptionDeleteFailure: + { + ProcRicSubsDeleteFailure(&e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionDeleteFailure); + break; + } default: { DU_LOG("\nERROR --> E2AP : Invalid type of unsuccessfulOutcome message [%d]", \