From 760f81397ca10d4983c4b21414edbaa13d181173 Mon Sep 17 00:00:00 2001 From: pborla Date: Mon, 30 Oct 2023 19:54:34 +0530 Subject: [PATCH] [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-533] Implementation of E2 Node Connection Update Change-Id: Idc7e275fcf2a370229d7239bb8df0986ff84f73f Signed-off-by: pborla --- src/du_app/du_e2ap_msg_hdl.c | 286 ++++++++++++++++++++++++++++++++ src/ric_stub/ric_e2ap_msg_hdl.c | 353 ++++++++++++++++++++++++++++++++++++++++ src/ric_stub/ric_e2ap_msg_hdl.h | 1 + src/ric_stub/ric_stub.c | 3 +- src/ric_stub/ric_stub_sctp.h | 11 +- 5 files changed, 652 insertions(+), 2 deletions(-) diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index 6dffb518a..a1c7d8c2a 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -8244,6 +8244,286 @@ void ProcE2RemovalResponse(E2AP_PDU_t *e2apMsg) freeAperDecodingOfE2RemovalResponse(removalRsp); } +/******************************************************************* + * + * @brief Deallocate the memory allocated for E2 Connection Update Failure + * + * @details + * + * Function : FreeE2ConnectionUpdateFailure + * + * Functionality: + * - freeing the memory allocated for E2ConnectionUpdateFailure + * + * @params[in] E2AP_PDU_t *e2apMsg + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void FreeE2ConnectionUpdateFailure(E2AP_PDU_t *e2apMsg) +{ + uint8_t ieIdx =0; + E2connectionUpdateFailure_t *e2ConnectionUpdateFailure=NULLP; + + if(e2apMsg != NULLP) + { + if(e2apMsg->choice.unsuccessfulOutcome != NULLP) + { + e2ConnectionUpdateFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2connectionUpdateFailure; + if(e2ConnectionUpdateFailure->protocolIEs.list.array) + { + for(ieIdx=0; ieIdx < e2ConnectionUpdateFailure->protocolIEs.list.count; ieIdx++) + { + DU_FREE(e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateFailure_IEs_t)); + } + DU_FREE(e2ConnectionUpdateFailure->protocolIEs.list.array, e2ConnectionUpdateFailure->protocolIEs.list.size); + } + DU_FREE(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t)); + } + DU_FREE(e2apMsg, sizeof(E2AP_PDU_t)); + } +} + +/******************************************************************* + * + * @brief Buld and send the E2 Connection Update Failure msg + * + * @details + * + * Function : BuildAndSendE2ConnectionUpdateFailure + * + * Functionality: + * - Buld and send the E2 Connection Update Failure Message + * @params[in] + * Trans Id + * Failure Cause + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t BuildAndSendE2ConnectionUpdateFailure(uint16_t transId, E2FailureCause failureCause) +{ + uint8_t ieIdx = 0, elementCnt = 0; + uint8_t ret = RFAILED; + E2AP_PDU_t *e2apMsg = NULLP; + E2connectionUpdateFailure_t *e2ConnectionUpdateFailure=NULLP; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\nINFO --> E2AP : Building E2 Connection Update Failure Message\n"); + do + { + DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t)); + if(e2apMsg == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + e2apMsg->present = E2AP_PDU_PR_unsuccessfulOutcome; + + DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t)); + if(e2apMsg->choice.unsuccessfulOutcome == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + + e2apMsg->choice.unsuccessfulOutcome->procedureCode = ProcedureCodeE2_id_E2connectionUpdate; + e2apMsg->choice.unsuccessfulOutcome->criticality = CriticalityE2_reject; + e2apMsg->choice.unsuccessfulOutcome->value.present = UnsuccessfulOutcomeE2__value_PR_E2connectionUpdateFailure; + e2ConnectionUpdateFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2connectionUpdateFailure; + + elementCnt = 2; + e2ConnectionUpdateFailure->protocolIEs.list.count = elementCnt; + e2ConnectionUpdateFailure->protocolIEs.list.size = elementCnt * sizeof(E2connectionUpdateFailure_IEs_t *); + DU_ALLOC(e2ConnectionUpdateFailure->protocolIEs.list.array, e2ConnectionUpdateFailure->protocolIEs.list.size); + if(!e2ConnectionUpdateFailure->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + + for(ieIdx=0; ieIdx < elementCnt; ieIdx++) + { + DU_ALLOC(e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateFailure_IEs_t)); + if(!e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + } + if(ieIdx < elementCnt) + break; + + ieIdx = 0; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdateFailure_IEs__value_PR_TransactionID; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId; + + /* Cause */ + ieIdx++; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_CauseE2; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_ignore; + e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdateFailure_IEs__value_PR_CauseE2; + fillE2Cause(&e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx]->value.choice.CauseE2, failureCause); + + xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg); + + memset(encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf, encBuf); + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nERROR --> E2AP : Could not encode E2 connection update failure structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2 Connection Update Failure \n"); + for(int i=0; i< encBufSize; i++) + { + DU_LOG("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection Update Failure"); + break; + } + + ret = ROK; + break; + }while(true); + + FreeE2ConnectionUpdateFailure(e2apMsg); + return ret; +} + +/****************************************************************** + * + * @brief Deallocation of memory allocated by aper decoder for + * E2 Connection Update + * + * @details + * + * Function :freeAperDecodingOfE2ConnectionUpdate + * + * Functionality: Deallocation of memory allocated by aper decoder for + * E2 Connection Update + * + * @params[in] Pointer to connectionUpdate + * @return void + * + * ****************************************************************/ + +void freeAperDecodingOfE2ConnectionUpdate(E2connectionUpdate_t *connectionUpdate) +{ + uint8_t ieIdx =0, arrIdx=0; + E2connectionUpdate_List_t *connectionToBeModifyList = NULLP; + + if(connectionUpdate->protocolIEs.list.array) + { + for(ieIdx = 0; ieIdx < connectionUpdate->protocolIEs.list.count; ieIdx++) + { + if(connectionUpdate->protocolIEs.list.array[ieIdx]) + { + switch(connectionUpdate->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + break; + + case ProtocolIE_IDE2_id_E2connectionUpdateModify: + { + connectionToBeModifyList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List; + if(connectionToBeModifyList->list.array) + { + for(arrIdx= 0; arrIdx< connectionToBeModifyList->list.count; arrIdx++) + { + free(connectionToBeModifyList->list.array[arrIdx]); + } + free(connectionToBeModifyList->list.array); + } + break; + } + } + free(connectionUpdate->protocolIEs.list.array[ieIdx]); + } + } + free(connectionUpdate->protocolIEs.list.array); + } +} + +/******************************************************************* + * + * @brief Process e2 connection update received from RIC + * + * @details + * + * Function : procE2ConnectionUpdate + * + * Functionality: Process e2 connection update received from RIC + * + * @param E2AP_PDU_t *e2apMsg + * @return void + * + ******************************************************************/ + +void procE2ConnectionUpdate(E2AP_PDU_t *e2apMsg) +{ + bool invalidTransId = false; + uint8_t arrIdx =0, transId =0, count=0; + E2FailureCause failureCause; + E2connectionUpdate_t *connectionUpdate=NULLP; + + DU_LOG("\nINFO --> E2AP : E2 connection update received"); + connectionUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2connectionUpdate; + + count = connectionUpdate->protocolIEs.list.count; + for(arrIdx=0; arrIdxprotocolIEs.list.count; arrIdx++) + { + switch(connectionUpdate->protocolIEs.list.array[arrIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + { + transId = connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.TransactionID; + if(transId>255) + { + invalidTransId = true; + } + break; + } + case ProtocolIE_IDE2_id_E2connectionUpdateModify: + { + /*TODO*/ + break; + } + } + + if(invalidTransId == true) + break; + } + + if(invalidTransId == true) + { + failureCause.causeType = E2_PROTOCOL; + failureCause.cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE; + if(BuildAndSendE2ConnectionUpdateFailure(transId, failureCause) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to build and send E2 connection update failure"); + } + } + else + { + /*TODO*/ + } + + freeAperDecodingOfE2ConnectionUpdate(connectionUpdate); +} + /******************************************************************* * * @brief Handles received E2AP message and sends back response @@ -8438,6 +8718,12 @@ void E2APMsgHdlr(Buffer *mBuf) procE2RemovalRequest(e2apMsg); break; } + case InitiatingMessageE2__value_PR_E2connectionUpdate: + { + DU_LOG("\nINFO --> E2AP : E2 coneection update received"); + procE2ConnectionUpdate(e2apMsg); + break; + } default: { DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_initiatingMessage [%d]",\ diff --git a/src/ric_stub/ric_e2ap_msg_hdl.c b/src/ric_stub/ric_e2ap_msg_hdl.c index e9bc3f5fb..bf427f8be 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.c +++ b/src/ric_stub/ric_e2ap_msg_hdl.c @@ -42,6 +42,7 @@ #include "E2SM-KPM-ActionDefinition.h" #include "E2SM-KPM-EventTriggerDefinition-Format1.h" #include "E2SM-KPM-EventTriggerDefinition.h" +#include "E2connectionUpdate-Item.h" /******************************************************************* * @@ -6461,6 +6462,353 @@ void procE2RemovalRequest(uint32_t duId, E2RemovalRequest_t *removalReq) } } +/******************************************************************* + * + * @brief fill E2 connection update item + * + * @details + * + * Function : fillE2connectionUpdateItem + * + * Functionality: fill E2 connection update item + * + * @params[in] + * E2connectionUpdate Item to be filled + * + * @return ROK - success + * RFAILED - failure + * ****************************************************************/ + +uint8_t fillE2connectionUpdateItem(E2connectionUpdate_Item_t *connectionModifyItem) +{ + connectionModifyItem->tnlInformation.tnlAddress.size = 4*sizeof(uint8_t); + RIC_ALLOC(connectionModifyItem->tnlInformation.tnlAddress.buf, \ + connectionModifyItem->tnlInformation.tnlAddress.size); + if(!connectionModifyItem->tnlInformation.tnlAddress.buf) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + return RFAILED; + } + + connectionModifyItem->tnlInformation.tnlAddress.buf[0] = ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr & 0xFF; + connectionModifyItem->tnlInformation.tnlAddress.buf[1] = (ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr>> 8) & 0xFF; + connectionModifyItem->tnlInformation.tnlAddress.buf[2] = (ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr>> 16) & 0xFF; + connectionModifyItem->tnlInformation.tnlAddress.buf[3] = (ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr>> 24) & 0xFF; + connectionModifyItem->tnlInformation.tnlAddress.bits_unused = 0; + connectionModifyItem->tnlUsage = TNLusage_support_function; + return ROK; +} + +/******************************************************************* + * + * @brief Build E2 connection modification list + * + * @details + * + * Function : BuildE2ConnectionModifyList + * + * Functionality: Build E2 connection modification list + * + * @params[in] + * E2 connection modification list to be filled + * + * @return ROK - success + * RFAILED - failure + * ****************************************************************/ + +uint8_t BuildE2ConnectionModifyList(E2connectionUpdate_List_t *connectionToBeModifyList) +{ + uint8_t arrIdx = 0; + E2connectionUpdate_ItemIEs_t *ConnectionModify=NULL; + + connectionToBeModifyList->list.count = 1; + + connectionToBeModifyList->list.size = connectionToBeModifyList->list.count*sizeof(E2connectionUpdate_ItemIEs_t*); + RIC_ALLOC(connectionToBeModifyList->list.array, connectionToBeModifyList->list.size); + if(connectionToBeModifyList->list.array) + { + for(arrIdx = 0; arrIdx< connectionToBeModifyList->list.count; arrIdx++) + { + RIC_ALLOC(connectionToBeModifyList->list.array[arrIdx], sizeof(E2connectionUpdate_ItemIEs_t)); + if(connectionToBeModifyList->list.array[arrIdx] == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + return RFAILED; + } + ConnectionModify = (E2connectionUpdate_ItemIEs_t*)connectionToBeModifyList->list.array[arrIdx]; + ConnectionModify->id = ProtocolIE_IDE2_id_E2connectionUpdate_Item; + ConnectionModify->criticality= CriticalityE2_ignore; + ConnectionModify->value.present = E2connectionUpdate_ItemIEs__value_PR_E2connectionUpdate_Item; + if(fillE2connectionUpdateItem(&ConnectionModify->value.choice.E2connectionUpdate_Item) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to fill E2 connection update item"); + return RFAILED; + } + + } + } + else + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief Deallocate the memory allocated for E2ConnectionUpdate msg + * + * @details + * + * Function : FreeE2ConnectionUpdate + * + * Functionality: + * - freeing the memory allocated for E2ConnectionUpdate + * + * @params[in] E2AP_PDU_t *e2apMsg + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void FreeE2ConnectionUpdate(E2AP_PDU_t *e2apMsg) +{ + uint8_t ieIdx =0, arrIdx=0; + E2connectionUpdate_t *connectionUpdate = NULLP; + E2connectionUpdate_List_t *connectionToBeModifyList = NULLP; + + if(e2apMsg != NULLP) + { + if(e2apMsg->choice.initiatingMessage != NULLP) + { + connectionUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2connectionUpdate; + if(connectionUpdate->protocolIEs.list.array) + { + for(ieIdx = 0; ieIdx < connectionUpdate->protocolIEs.list.count; ieIdx++) + { + if(connectionUpdate->protocolIEs.list.array[ieIdx]) + { + switch(connectionUpdate->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + break; + + case ProtocolIE_IDE2_id_E2connectionUpdateModify: + { + connectionToBeModifyList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List; + if(connectionToBeModifyList->list.array) + { + for(arrIdx = 0; arrIdx < connectionToBeModifyList->list.count; arrIdx++) + { + RIC_FREE(connectionToBeModifyList->list.array[arrIdx], sizeof(E2connectionUpdate_ItemIEs_t)); + } + RIC_FREE(connectionToBeModifyList->list.array, connectionToBeModifyList->list.size); + } + break; + } + } + RIC_FREE(connectionUpdate->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdate_IEs_t)); + } + } + RIC_FREE(connectionUpdate->protocolIEs.list.array, connectionUpdate->protocolIEs.list.size); + } + RIC_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t)); + } + RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t)); + } +} + +/******************************************************************* + * + * @brief Buld and send the E2 Connection Update msg + * + * @details + * + * Function : BuildAndSendE2ConnectionUpdate + * + * Functionality: + * - Buld and send the E2 Connection Update Message + * @params[in] + * Du Id + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t BuildAndSendE2ConnectionUpdate(uint32_t duId) +{ + uint8_t ieIdx = 0, elementCnt = 0; + uint8_t ret = RFAILED, duIdx =0; + DuDb *duDb = NULLP; + E2AP_PDU_t *e2apMsg = NULLP; + E2connectionUpdate_t *e2ConnectionUpdate=NULLP; + asn_enc_rval_t encRetVal; /* Encoder return value */ + + DU_LOG("\nINFO --> E2AP : Building E2 Connection Update Message\n"); + do + { + SEARCH_DU_DB(duIdx, duId, duDb); + if(duDb == NULLP) + { + DU_LOG("\nERROR --> E2AP : duDb is not present for duId %d",duId); + return RFAILED; + } + + RIC_ALLOC(e2apMsg, sizeof(E2AP_PDU_t)); + if(e2apMsg == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + e2apMsg->present = E2AP_PDU_PR_initiatingMessage; + + RIC_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t)); + if(e2apMsg->choice.initiatingMessage == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + + e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2connectionUpdate; + e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject; + e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2connectionUpdate; + e2ConnectionUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2connectionUpdate; + + elementCnt = 2; + e2ConnectionUpdate->protocolIEs.list.count = elementCnt; + e2ConnectionUpdate->protocolIEs.list.size = elementCnt * sizeof(E2connectionUpdate_IEs_t*); + RIC_ALLOC(e2ConnectionUpdate->protocolIEs.list.array, e2ConnectionUpdate->protocolIEs.list.size); + if(!e2ConnectionUpdate->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + + for(ieIdx=0; ieIdx < elementCnt; ieIdx++) + { + RIC_ALLOC(e2ConnectionUpdate->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdate_IEs_t)); + if(!e2ConnectionUpdate->protocolIEs.list.array[ieIdx]) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__); + break; + } + } + if(ieIdx < elementCnt) + break; + + ieIdx = 0; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdate_IEs__value_PR_TransactionID; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = assignTransactionId(duDb); + + ieIdx++; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_E2connectionUpdateModify; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject; + e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdate_IEs__value_PR_E2connectionUpdate_List; + if(BuildE2ConnectionModifyList(&e2ConnectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to build the connection update modify list"); + break; + } + + xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg); + + memset(encBuf, 0, ENC_BUF_MAX_LEN); + encBufSize = 0; + encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf, encBuf); + if(encRetVal.encoded == ENCODE_FAIL) + { + DU_LOG("\nERROR --> E2AP : Could not encode E2 connection update structure (at %s)\n",\ + encRetVal.failed_type ? encRetVal.failed_type->name : "unknown"); + break; + } + else + { + DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2 Connection Update \n"); + for(int i=0; i< encBufSize; i++) + { + DU_LOG("%x",encBuf[i]); + } + } + + /* Sending msg */ + if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL, duId) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection Update"); + break; + } + + ret = ROK; + break; + }while(true); + + FreeE2ConnectionUpdate(e2apMsg); + return ret; +} + +/****************************************************************** + * + * @brief Processes the E2 connection update failure msg + * + * @details + * + * Function : procE2connectionUpdateFailure + * + * Functionality: Processes the E2 connection update failure msg + * + * @params[in] + * E2 connection update failure information + * + * @return void + * + * ****************************************************************/ +void ProcE2connectionUpdateFailure(E2connectionUpdateFailure_t *updateFailure) +{ + uint8_t ieIdx = 0; + uint16_t transId=0; + CauseE2_t *cause = NULLP; + + if(!updateFailure) + { + DU_LOG("\nERROR --> E2AP : updateFailure pointer is null"); + return; + } + + if(!updateFailure->protocolIEs.list.array) + { + DU_LOG("\nERROR --> E2AP : updateFailure array pointer is null"); + return; + } + + for(ieIdx=0; ieIdx < updateFailure->protocolIEs.list.count; ieIdx++) + { + if(updateFailure->protocolIEs.list.array[ieIdx]) + { + switch(updateFailure->protocolIEs.list.array[ieIdx]->id) + { + case ProtocolIE_IDE2_id_TransactionID: + { + transId = updateFailure->protocolIEs.list.array[ieIdx]->value.choice.TransactionID; + DU_LOG("\nERROR --> E2AP : Received transID %d", transId); + break; + } + case ProtocolIE_IDE2_id_CauseE2: + { + cause = &updateFailure->protocolIEs.list.array[ieIdx]->value.choice.CauseE2; + printE2ErrorCause(cause); + break; + } + default: + { + DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%d]", updateFailure->protocolIEs.list.array[ieIdx]->id); + break; + } + } + } + } +} + /******************************************************************* * * @brief Handles received E2AP message and sends back response @@ -6644,6 +6992,11 @@ void E2APMsgHdlr(uint32_t *duId, Buffer *mBuf) ProcE2RemovalFailure(&e2apMsg->choice.unsuccessfulOutcome->value.choice.E2RemovalFailure); break; } + case UnsuccessfulOutcomeE2__value_PR_E2connectionUpdateFailure: + { + ProcE2connectionUpdateFailure(&e2apMsg->choice.unsuccessfulOutcome->value.choice.E2connectionUpdateFailure); + break; + } default: { DU_LOG("\nERROR --> E2AP : Invalid type of unsuccessfulOutcome message [%d]", \ diff --git a/src/ric_stub/ric_e2ap_msg_hdl.h b/src/ric_stub/ric_e2ap_msg_hdl.h index d1850e0c2..32061723c 100644 --- a/src/ric_stub/ric_e2ap_msg_hdl.h +++ b/src/ric_stub/ric_e2ap_msg_hdl.h @@ -63,6 +63,7 @@ uint8_t fillE2NodeConfigAck(PTR e2NodeCfg, uint8_t procedureCode, E2NodeComponen E2NodeComponent *fetchE2NodeComponentInfo(DuDb *duDb, InterfaceType interfaceType,CmLList **e2ComponentNode); uint8_t handleE2NodeComponentAction(DuDb *duDb, PTR e2NodeCfg, uint8_t protocolId, E2NodeConfigItem *storeCfg); uint8_t BuildAndSendE2NodeConfigUpdateAck(DuDb *duDb, uint8_t transId, E2NodeConfigList *e2NodeList); +uint8_t BuildAndSendConnectionUpdate(uint32_t duId); /********************************************************************** End of file diff --git a/src/ric_stub/ric_stub.c b/src/ric_stub/ric_stub.c index 690307129..152a583f3 100644 --- a/src/ric_stub/ric_stub.c +++ b/src/ric_stub/ric_stub.c @@ -132,7 +132,7 @@ void readRicCfg() ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr = ipv4_ric; ricCb.ricCfgParams.sctpParams.localIpAddr.ipV6Pres = false; ricCb.ricCfgParams.sctpParams.e2SctpPort = g_cfg.RIC_Port; - + ricCb.ricCfgParams.sctpParams.usage = BOTH_FUNCTIONALITY; ricCb.ricCfgParams.sctpParams.numDestNode = 1; #else @@ -142,6 +142,7 @@ void readRicCfg() ricCb.ricCfgParams.sctpParams.localIpAddr.ipV4Addr = ipv4_ric; ricCb.ricCfgParams.sctpParams.localIpAddr.ipV6Pres = false; ricCb.ricCfgParams.sctpParams.e2SctpPort = E2_SCTP_PORT; + ricCb.ricCfgParams.sctpParams.usage = BOTH_FUNCTIONALITY; ricCb.ricCfgParams.sctpParams.numDestNode = 0; numDu = &ricCb.ricCfgParams.sctpParams.numDestNode; diff --git a/src/ric_stub/ric_stub_sctp.h b/src/ric_stub/ric_stub_sctp.h index 9f9a8fea8..00ae12658 100644 --- a/src/ric_stub/ric_stub_sctp.h +++ b/src/ric_stub/ric_stub_sctp.h @@ -28,7 +28,15 @@ /* Global variable declaration */ uint8_t socket_type; /* Socket type */ - + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.30 */ +typedef enum +{ + RIC_SERVICE, + SUPPORT_FUNCTIONS, + BOTH_FUNCTIONALITY +}AssocUsage; + typedef struct { uint16_t numFd; @@ -74,6 +82,7 @@ typedef struct ricSctpParams uint16_t e2SctpPort; uint8_t numDestNode; SctpDestInfo destCb[MAX_DU_SUPPORTED]; + AssocUsage usage; }RicSctpParams; typedef struct sctpGlobalCb -- 2.16.6