#include "du_e2ap_mgr.h"
#include "du_e2ap_msg_hdl.h"
#include "du_cfg.h"
+#include "du_sctp.h"
#include "du_mgr.h"
#include "du_mgr_main.h"
#include "du_utils.h"
/*******************************************************************
*
- * @brief Free the ErrorIndication Message
+ * @brief Deallocate the memory allocated for E2 Removal Failure
*
* @details
*
- * Function : FreeRicIndication
+ * Function : FreeE2RemovalFailure
*
- * Functionality: Free the ErrorIndication Message
+ * Functionality:
+ * - freeing the memory allocated for E2RemovalFailure
*
- * @params[in]
- * E2AP_PDU is to freed
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void FreeErrorIndication(E2AP_PDU_t *e2apMsg)
+ * ****************************************************************/
+void FreeE2RemovalFailure(E2AP_PDU_t *e2apMsg)
{
- uint8_t arrIdx = 0;
- ErrorIndicationE2_t *errorIndicationMsg= NULLP;
+ uint8_t ieIdx =0;
+ E2RemovalFailure_t *e2RemovalFailure=NULLP;
if(e2apMsg != NULLP)
{
- if(e2apMsg->choice.initiatingMessage != NULLP)
+ if(e2apMsg->choice.unsuccessfulOutcome != NULLP)
{
- errorIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.ErrorIndicationE2;
- if(errorIndicationMsg!= NULLP)
+ e2RemovalFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2RemovalFailure;
+ if(e2RemovalFailure->protocolIEs.list.array)
{
- if(errorIndicationMsg->protocolIEs.list.array != NULLP)
+ for(ieIdx=0; ieIdx < e2RemovalFailure->protocolIEs.list.count; ieIdx++)
{
- for(arrIdx=0; arrIdx<errorIndicationMsg->protocolIEs.list.count; arrIdx++)
+ if(e2RemovalFailure->protocolIEs.list.array[ieIdx])
{
- DU_FREE(errorIndicationMsg->protocolIEs.list.array[arrIdx],sizeof(ErrorIndicationE2_t));
+ DU_FREE(e2RemovalFailure->protocolIEs.list.array[ieIdx], sizeof(E2RemovalFailureIEs_t));
}
- DU_FREE(errorIndicationMsg->protocolIEs.list.array,errorIndicationMsg->protocolIEs.list.size);
}
+ DU_FREE(e2RemovalFailure->protocolIEs.list.array, e2RemovalFailure->protocolIEs.list.size);
}
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ DU_FREE(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
}
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
/*******************************************************************
*
- * @brief Builds and Send the ErrorIndication Message
+ * @brief Buld and send the E2 Removal Failure msg
*
* @details
*
- * Function : BuildAndSendErrorIndication
- *
- * Functionality:Fills the ErrorIndication Message
+ * Function : BuildAndSendE2RemovalFailure
*
- * @params[in]
- * Trans id
- * Ric req id
- * Ran function id
- * Cause of failure
+ * Functionality:
+ * - Buld and send the E2 Removal Failure Message
+ * @params[in] Trans Id
* @return ROK - success
* RFAILED - failure
*
- ******************************************************************/
+ * ****************************************************************/
-uint8_t BuildAndSendErrorIndication(int8_t transId, RicRequestId requestId, uint16_t ranFuncId, E2FailureCause failureCause)
+uint8_t BuildAndSendRemovalFailure(uint16_t transId, E2FailureCause failureCause)
{
- uint8_t elementCnt =0, arrIdx=0, ret = RFAILED;
- E2AP_PDU_t *e2apMsg = NULLP;
- ErrorIndicationE2_t *errorIndicationMsg=NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
+ uint8_t ieIdx = 0, elementCnt = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ E2RemovalFailure_t *e2RemovalFailure=NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- while(true)
+ DU_LOG("\nINFO --> E2AP : Building E2 Removal Failure Message\n");
+ do
{
- DU_LOG("\nINFO --> E2AP : Building Error Indication Message\n");
-
DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed in %s at line %d",__func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
+ e2apMsg->present = E2AP_PDU_PR_unsuccessfulOutcome;
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
+ DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
+ if(e2apMsg->choice.unsuccessfulOutcome == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed in %s at line %d",__func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_ErrorIndicationE2;
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_ErrorIndicationE2;
- errorIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.ErrorIndicationE2;
-
- /* Element count is 2 for TransactionID/RICrequestID and Cause.
- * If the RAN function id is present, the count will be increased.*/
- elementCnt = 2;
- if(ranFuncId>0)
- {
- elementCnt++;
- }
-
- errorIndicationMsg->protocolIEs.list.count = elementCnt;
- errorIndicationMsg->protocolIEs.list.size = elementCnt * sizeof(ErrorIndicationE2_IEs_t*);
+ e2apMsg->choice.unsuccessfulOutcome->procedureCode = ProcedureCodeE2_id_E2removal;
+ e2apMsg->choice.unsuccessfulOutcome->criticality = CriticalityE2_reject;
+ e2apMsg->choice.unsuccessfulOutcome->value.present = UnsuccessfulOutcomeE2__value_PR_E2RemovalFailure;
+ e2RemovalFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2RemovalFailure;
- /* Initialize the E2Setup members */
- DU_ALLOC(errorIndicationMsg->protocolIEs.list.array, errorIndicationMsg->protocolIEs.list.size);
- if(errorIndicationMsg->protocolIEs.list.array == NULLP)
+ elementCnt = 2;
+ e2RemovalFailure->protocolIEs.list.count = elementCnt;
+ e2RemovalFailure->protocolIEs.list.size = elementCnt * sizeof(E2RemovalFailureIEs_t *);
+ DU_ALLOC(e2RemovalFailure->protocolIEs.list.array, e2RemovalFailure->protocolIEs.list.size);
+ if(!e2RemovalFailure->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements in %s at line %d",__func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
-
- for(arrIdx = 0; arrIdx < elementCnt; (arrIdx)++)
+
+ for(ieIdx=0; ieIdx < elementCnt; ieIdx++)
{
- DU_ALLOC(errorIndicationMsg->protocolIEs.list.array[arrIdx], sizeof(ErrorIndicationE2_IEs_t));
- if(errorIndicationMsg->protocolIEs.list.array[arrIdx] == NULLP)
+ DU_ALLOC(e2RemovalFailure->protocolIEs.list.array[ieIdx], sizeof(E2RemovalFailureIEs_t));
+ if(!e2RemovalFailure->protocolIEs.list.array[ieIdx])
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for array [%d] elements in %s at line %d", arrIdx, __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
}
- if(arrIdx < elementCnt)
+ if(ieIdx < elementCnt)
break;
- arrIdx = 0;
-
- if(transId >=0 && transId<=255)
- {
- /* TransactionID */
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_TransactionID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
- }
- else
- {
- /* RICrequestID */
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RICrequestID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_RICrequestID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RICrequestID.ricRequestorID = requestId.requestorId;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RICrequestID.ricInstanceID = requestId.instanceId;
- }
-
- if(ranFuncId>0)
- {
- /* RAN Function ID */
- arrIdx++;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RANfunctionID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_RANfunctionID;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionID = ranFuncId;
- }
+ ieIdx = 0;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->value.present = E2RemovalFailureIEs__value_PR_TransactionID;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
/* Cause */
- arrIdx++;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_CauseE2;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_ignore;
- errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_CauseE2;
- fillE2Cause(&errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.CauseE2, failureCause);
-
- /* Prints the Msg formed */
+ ieIdx++;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_CauseE2;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_ignore;
+ e2RemovalFailure->protocolIEs.list.array[ieIdx]->value.present = ErrorIndicationE2_IEs__value_PR_CauseE2;
+ fillE2Cause(&e2RemovalFailure->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);
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf, encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> E2AP : Could not encode Error Indication Message (at %s)\n",\
+ DU_LOG("\nERROR --> E2AP : Could not encode E2 removal failure structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
break;
}
else
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for Error Indication Message \n");
-#ifdef DEBUG_ASN_PRINT
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2 Removal Failure \n");
for(int i=0; i< encBufSize; i++)
{
- printf("%x",encBuf[i]);
- }
-#endif
+ DU_LOG("%x",encBuf[i]);
+ }
}
+ /* Sending msg */
if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
- DU_LOG("\nINFO --> E2AP : Sending Error Indication Message");
-
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 Removal Failure");
+ break;
}
+
ret = ROK;
break;
- }
- FreeErrorIndication(e2apMsg);
+ }while(true);
+
+ FreeE2RemovalFailure(e2apMsg);
return ret;
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for e2
- * Config Update Failure
+ * @brief Deallocate the memory allocated for E2 Removal Response
*
* @details
*
- * Function : freeAperDecodingOfE2Node Config UpdateFailure
+ * Function : FreeE2RemovalResponse
*
- * Functionality: Deallocation of memory allocated by aper decoder
- * for e2 Config Update Failure
+ * Functionality:
+ * - freeing the memory allocated for E2RemovalResponse
*
- * @params[in] E2nodeConfigurationUpdateFailure_t to be deallocated
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-
-void freeAperDecodingOfE2NodeConfigUpdateFailure(E2nodeConfigurationUpdateFailure_t *e2NodeCfgUpdFail)
+void FreeE2RemovalResponse(E2AP_PDU_t *e2apMsg)
{
- uint8_t arrIdx =0;
+ uint8_t ieIdx =0;
+ E2RemovalResponse_t *e2RemovalResponse=NULLP;
- if(e2NodeCfgUpdFail)
+ if(e2apMsg != NULLP)
{
- if(e2NodeCfgUpdFail->protocolIEs.list.array)
+ if(e2apMsg->choice.successfulOutcome != NULLP)
{
- for(arrIdx=0; arrIdx<e2NodeCfgUpdFail->protocolIEs.list.count; arrIdx++)
+ e2RemovalResponse = &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse;
+ if(e2RemovalResponse->protocolIEs.list.array)
{
- if(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx])
+ for(ieIdx=0; ieIdx < e2RemovalResponse->protocolIEs.list.count; ieIdx++)
{
- free(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]);
+ if(e2RemovalResponse->protocolIEs.list.array[ieIdx])
+ {
+ DU_FREE(e2RemovalResponse->protocolIEs.list.array[ieIdx], sizeof(E2RemovalResponseIEs_t));
+ }
}
+ DU_FREE(e2RemovalResponse->protocolIEs.list.array, e2RemovalResponse->protocolIEs.list.size);
}
- free(e2NodeCfgUpdFail->protocolIEs.list.array);
+ DU_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Processes E2 Node Config Update Failure sent by RIC
+ * @brief Buld and send the E2 Removal Response msg
*
* @details
*
- * Function : procE2NodeConfigUpdateFailure
- *
- * Functionality: Processes E2 Node Config Update failure sent by RIC
+ * Function : BuildAndSendE2RemovalResponse
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * Functionality:
+ * - Buld and send the E2 Removal Response Message
+ * @params[in] Trans Id
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-
-void procE2NodeConfigUpdateFailure(E2AP_PDU_t *e2apMsg)
+uint8_t BuildAndSendRemovalResponse(uint16_t transId)
{
- uint8_t arrIdx =0, transId =0, timerValue=0;
- E2nodeConfigurationUpdateFailure_t *e2NodeCfgUpdFail=NULL;
-
- DU_LOG("\nINFO --> E2AP : E2 Node Config Update failure received");
- e2NodeCfgUpdFail = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2nodeConfigurationUpdateFailure;
+ uint8_t ieIdx = 0, elementCnt = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ E2RemovalResponse_t *e2RemovalResponse=NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- for(arrIdx=0; arrIdx<e2NodeCfgUpdFail->protocolIEs.list.count; arrIdx++)
+ DU_LOG("\nINFO --> E2AP : Building E2 Removal Response Message\n");
+ do
{
- switch(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->id)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- case ProtocolIE_IDE2_id_TransactionID:
- {
- transId = e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
- (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
- }
- break;
- }
- case ProtocolIE_IDE2_id_TimeToWaitE2:
- {
- timerValue = convertE2WaitTimerEnumToValue(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
- if((duChkTmr((PTR)&(duCb.e2apDb), EVENT_E2_NODE_CONFIG_UPDATE_TMR)) == FALSE)
- {
- duStartTmr((PTR)&(duCb.e2apDb), EVENT_E2_NODE_CONFIG_UPDATE_TMR, timerValue);
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : EVENT_E2_NODE_CONFIG_UPDATE_TMR timer is already running");
- }
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ break;
}
- }
+ e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
- freeAperDecodingOfE2NodeConfigUpdateFailure(e2NodeCfgUpdFail);
-}
+ DU_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ if(e2apMsg->choice.successfulOutcome == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ break;
+ }
-/*******************************************************************
- *
- * @brief Builds Global gNodeB Params
- *
- * @details
- *
- * Function : BuildGlobalgNBId
- *
- * Functionality: Building the Plmn and gNB id
- *
- * @params[in] GlobalE2node_gNB_ID_t *gNbId
- * @return ROK - success
- * RFAILED - failure
- *
- ******************************************************************/
+ e2apMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_E2removal;
+ e2apMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
+ e2apMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_E2RemovalResponse;
+ e2RemovalResponse = &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse;
-uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId)
-{
- uint8_t unused = 0;
- uint8_t byteSize = 4;
- uint8_t gnbId = duCb.gnbId;
- uint8_t ret = ROK;
-
- /* fill Global gNB ID Id */
- gNbId->global_gNB_ID.plmn_id.size = 3 * sizeof(uint8_t);
- gNbId->global_gNB_ID.plmn_id.buf = NULLP;
- DU_ALLOC(gNbId->global_gNB_ID.plmn_id.buf , gNbId->global_gNB_ID.plmn_id.size);
- if(gNbId->global_gNB_ID.plmn_id.buf == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for Plmn buffer");
- ret = RFAILED;
- }
- else
- {
- buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
- gNbId->global_gNB_ID.plmn_id.buf);
- gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
- /* Allocate Buffer size */
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = byteSize * sizeof(uint8_t);
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf = NULLP;
- DU_ALLOC(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf, \
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
- if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf == NULLP)
+ elementCnt = 1;
+ e2RemovalResponse->protocolIEs.list.count = elementCnt;
+ e2RemovalResponse->protocolIEs.list.size = elementCnt * sizeof(E2RemovalResponseIEs_t *);
+ DU_ALLOC(e2RemovalResponse->protocolIEs.list.array, e2RemovalResponse->protocolIEs.list.size);
+ if(!e2RemovalResponse->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for gnb buffer");
- ret = RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ break;
}
- else
+
+ for(ieIdx=0; ieIdx < elementCnt; ieIdx++)
{
- fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, gnbId);
+ DU_ALLOC(e2RemovalResponse->protocolIEs.list.array[ieIdx], sizeof(E2RemovalResponseIEs_t));
+ if(!e2RemovalResponse->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ break;
+ }
}
- }
+ if(ieIdx < elementCnt)
+ break;
- /* fill gNB-DU ID */
- DU_ALLOC( gNbId->gNB_DU_ID, sizeof(GNB_DU_ID_t));
- if(gNbId->gNB_DU_ID == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for gNB_DU_ID ");
- ret = RFAILED;
- }
- else
- {
- gNbId->gNB_DU_ID->size = sizeof(uint8_t);
- DU_ALLOC( gNbId->gNB_DU_ID->buf, sizeof(uint8_t));
- if(gNbId->gNB_DU_ID->buf)
+ ieIdx = 0;
+ e2RemovalResponse->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2RemovalResponse->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ e2RemovalResponse->protocolIEs.list.array[ieIdx]->value.present = E2RemovalResponseIEs__value_PR_TransactionID;
+ e2RemovalResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ 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)
{
- gNbId->gNB_DU_ID->buf[0] =duCb.e2apDb.e2NodeId;
+ DU_LOG("\nERROR --> E2AP : Could not encode E2 removal response structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
else
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for gNB_DU_ID buffer");
- ret = RFAILED;
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2 Removal Response \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 Removal Response");
+ break;
+ }
+
+ ret = ROK;
+ break;
+ }while(true);
+
+ FreeE2RemovalResponse(e2apMsg);
return ret;
}
-/*******************************************************************
+/******************************************************************
*
- * @brief fill the E2 node config information
+ * @brief Deallocation of memory allocated by aper decoder for Removal req
*
* @details
*
- * Function : fillE2NodeConfig
+ * Function : freeAperDecodingOfE2RemovalReq
*
- * Functionality: fill E2 node config information
+ * Functionality: Deallocation of memory allocated by aper decoder for
+ * Removal req
*
- * @params[in]
- * Pointer to e2NodeCfg to be filled
- * E2 Node Component information
- * Type of configuration
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] Pointer to removalReq
+ * @return void
*
- ******************************************************************/
-
-uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, ConfigType configType)
+ * ****************************************************************/
+void freeAperDecodingOfE2RemovalReq(E2RemovalRequest_t *removalReq)
{
- E2nodeComponentInterfaceType_t *interfaceType=NULLP;
- E2nodeComponentID_t *componentID =NULLP;
- E2nodeComponentConfiguration_t *configuration=NULLP;
- E2nodeComponentConfigAddition_Item_t *e2NodeAddItem=NULL;
- E2nodeComponentConfigUpdate_Item_t *e2NodeUpdateItem =NULL;
- E2nodeComponentConfigRemoval_Item_t *e2NodeRemovalItem=NULL;
-
- switch(configType)
+ uint8_t arrIdx=0;
+
+ if(removalReq)
{
- case CONFIG_ADD:
- {
- e2NodeAddItem = (E2nodeComponentConfigAddition_Item_t*)e2NodeCfg;
- interfaceType = &e2NodeAddItem->e2nodeComponentInterfaceType;
- componentID = &e2NodeAddItem->e2nodeComponentID;
- configuration = &e2NodeAddItem->e2nodeComponentConfiguration;
- break;
- }
- case CONFIG_MOD:
- {
- e2NodeUpdateItem = (E2nodeComponentConfigUpdate_Item_t *) e2NodeCfg;
- interfaceType = &e2NodeUpdateItem->e2nodeComponentInterfaceType;
- componentID = &e2NodeUpdateItem->e2nodeComponentID;
- configuration = &e2NodeUpdateItem->e2nodeComponentConfiguration;
- break;
- }
- case CONFIG_DEL:
- {
- e2NodeRemovalItem = (E2nodeComponentConfigRemoval_Item_t*) e2NodeCfg;
- interfaceType = &e2NodeRemovalItem->e2nodeComponentInterfaceType;
- componentID = &e2NodeRemovalItem->e2nodeComponentID;
- break;
- }
- default:
+ if(removalReq->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : Configuration type %d does not supported ", configType);
- return RFAILED;
+ for(arrIdx=0; arrIdx<removalReq->protocolIEs.list.count; arrIdx++)
+ {
+ if(removalReq->protocolIEs.list.array[arrIdx])
+ {
+ free(removalReq->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(removalReq->protocolIEs.list.array);
}
}
- /* E2nodeComponentInterfaceType */
- *interfaceType = convertInterfaceToE2ComponentInterfaceType(e2NodeComponentInfo->interfaceType);
-
- /* We now only support the F1 interface out of these interfaces
- * (NG,XN,E1,F1,W1,S1,X2), therefore only the F1 component identifier was filled in. */
+}
+
+/*******************************************************************
+ *
+ * @brief Process Removal req received from RIC
+ *
+ * @details
+ *
+ * Function : procE2RemovalRequest
+ *
+ * Functionality: Process Removal req received from RIC
+ *
+ * @param E2AP_PDU_t *e2apMsg
+ * @return void
+ *
+ ******************************************************************/
+
+void procE2RemovalRequest(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0;
+ uint16_t transId =0;
+ E2FailureCause failureCause;
+ E2RemovalRequest_t *removalReq=NULLP;
+
+ DU_LOG("\nINFO --> E2AP : E2 Removal request received");
+ removalReq = &e2apMsg->choice.initiatingMessage->value.choice.E2RemovalRequest;
- if(*interfaceType == F1)
+ for(arrIdx=0; arrIdx<removalReq->protocolIEs.list.count; arrIdx++)
{
- /* E2 Node Component ID */
- componentID->present = E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1;
- DU_ALLOC(componentID->choice.e2nodeComponentInterfaceTypeF1,sizeof(E2nodeComponentInterfaceF1_t));
- if(componentID->choice.e2nodeComponentInterfaceTypeF1 == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
- return RFAILED;
- }
- componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size = sizeof(uint8_t);
- DU_ALLOC(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
- componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
-
- if(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf == NULLP)
+ switch(removalReq->protocolIEs.list.array[arrIdx]->id)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
- return RFAILED;
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = removalReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid IE recevied [%d]", transId);
+ break;
+ }
}
- memcpy(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf, &e2NodeComponentInfo->componentId,\
- componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
- }
-
- if(configType == CONFIG_DEL)
- {
- /* We don't need to fill out the E2 Node Component Request and Response
- * information in the case of CONFIG_DEL, therefore returning ROK from here. */
- return ROK;
}
-
- /* E2 Node Component Request Part */
- if(e2NodeComponentInfo->componentRequestPart)
+
+ if(transId>=0 && transId<=255)
{
- configuration->e2nodeComponentRequestPart.size = e2NodeComponentInfo->reqBufSize ;
- DU_ALLOC(configuration->e2nodeComponentRequestPart.buf,\
- configuration->e2nodeComponentRequestPart.size);
- if(configuration->e2nodeComponentRequestPart.buf == NULLP)
+ if(BuildAndSendRemovalResponse(transId) != ROK)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Failed to build and send Removal response");
}
-
- memcpy(configuration->e2nodeComponentRequestPart.buf,\
- e2NodeComponentInfo->componentRequestPart, configuration->\
- e2nodeComponentRequestPart.size);
}
else
{
- DU_LOG("\nERROR --> E2AP: componentRequestPart is null ");
- return RFAILED;
- }
+ failureCause.causeType = E2_PROTOCOL;
+ failureCause.cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
- /* E2 Node Component Response Part */
- if(e2NodeComponentInfo->componentResponsePart)
- {
- configuration->e2nodeComponentResponsePart.size = e2NodeComponentInfo->rspBufSize;
- DU_ALLOC(configuration->e2nodeComponentResponsePart.buf, configuration->e2nodeComponentResponsePart.size);
- if(configuration->e2nodeComponentResponsePart.buf == NULLP)
+ if(BuildAndSendRemovalFailure(transId, failureCause) != ROK)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Failed to build and send Removal response");
}
- memcpy(configuration->e2nodeComponentResponsePart.buf, e2NodeComponentInfo->componentResponsePart, configuration->\
- e2nodeComponentResponsePart.size);
- }
- else
- {
- DU_LOG("\nERROR --> E2AP: componentResponsePart is null");
- return RFAILED;
}
-
- return ROK;
+ freeAperDecodingOfE2RemovalReq(removalReq);
}
/*******************************************************************
*
- * @brief Builds E2 node config addition list
+ * @brief Free the ErrorIndication Message
*
* @details
*
- * Function : BuildE2NodeConfigAddList
+ * Function : FreeRicIndication
*
- * Functionality: Building E2 node config addition list
+ * Functionality: Free the ErrorIndication Message
*
* @params[in]
- * E2nodeComponentConfigAddition_List_t to be filled
- * Procedure Code
- * Count of E2 node to be added in the list
- * Received list of E2 node configuration
- *
- * @return ROK - success
- * RFAILED - failure
+ * E2AP_PDU is to freed
+ * @return void
*
******************************************************************/
-
-uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAddList, uint8_t procedureCode, uint16_t count, E2NodeConfigItem *e2NodeList)
+void FreeErrorIndication(E2AP_PDU_t *e2apMsg)
{
uint8_t arrIdx = 0;
- CmLList *node =NULL;
- E2NodeComponent *e2NodeComponentInfo=NULL;
- E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItemIe=NULL;
- E2nodeComponentConfigAddition_Item_t *e2NodeAddItem=NULL;
-
-
- /* For ProcedureCodeE2_id_E2setup, the number of E2 node configuration list items is
- * equal to the number of E2 node configuration entries stored in the database.
- * For any other procedure, the E2 node configuration list count is equal
- * to the count of E2 node configuration obtained from the function's caller */
-
- if(procedureCode == ProcedureCodeE2_id_E2setup)
- e2NodeAddList->list.count = duCb.e2apDb.e2NodeComponentList.count;
- else
- e2NodeAddList->list.count = count;
+ ErrorIndicationE2_t *errorIndicationMsg= NULLP;
- e2NodeAddList->list.size = e2NodeAddList->list.count * sizeof(E2nodeComponentConfigAddition_ItemIEs_t *);
- DU_ALLOC(e2NodeAddList->list.array, e2NodeAddList->list.size);
- if(e2NodeAddList->list.array == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
- return RFAILED;
- }
-
- for(arrIdx = 0; arrIdx< e2NodeAddList->list.count; arrIdx++)
+ if(e2apMsg != NULLP)
{
- DU_ALLOC(e2NodeAddList->list.array[arrIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
- if(e2NodeAddList->list.array[arrIdx] == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
- return RFAILED;
- }
-
- if(procedureCode == ProcedureCodeE2_id_E2setup)
+ if(e2apMsg->choice.initiatingMessage != NULLP)
{
- /* Getting all of the E2 node configuration's information from DuCb one by one*/
- if(arrIdx == 0)
- {
- CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
- }
- else
- {
- node = node->next;
- }
- if(!node)
+ errorIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.ErrorIndicationE2;
+ if(errorIndicationMsg!= NULLP)
{
- DU_LOG("\nERROR --> E2AP : E2 node component list node is null");
- return RFAILED;
+ if(errorIndicationMsg->protocolIEs.list.array != NULLP)
+ {
+ for(arrIdx=0; arrIdx<errorIndicationMsg->protocolIEs.list.count; arrIdx++)
+ {
+ DU_FREE(errorIndicationMsg->protocolIEs.list.array[arrIdx],sizeof(ErrorIndicationE2_t));
+ }
+ DU_FREE(errorIndicationMsg->protocolIEs.list.array,errorIndicationMsg->protocolIEs.list.size);
+ }
}
- e2NodeComponentInfo = (E2NodeComponent*)node->node;
- }
- else
- {
- /* Getting only those E2 node configuration from DuCb whose interface
- * and action type is present in the received array */
- e2NodeComponentInfo = fetchE2NodeComponentInfo(e2NodeList[arrIdx].interface, e2NodeList[arrIdx].actionType, &node);
- }
-
- if(!e2NodeComponentInfo)
- {
- DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
- return RFAILED;
- }
-
- e2NodeAddItemIe = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[arrIdx];
- e2NodeAddItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition_Item;
- e2NodeAddItemIe->criticality = CriticalityE2_reject;
- e2NodeAddItemIe->value.present = E2nodeComponentConfigAddition_ItemIEs__value_PR_E2nodeComponentConfigAddition_Item;
- e2NodeAddItem = &e2NodeAddItemIe->value.choice.E2nodeComponentConfigAddition_Item;
- if(fillE2NodeConfig((PTR)e2NodeAddItem, e2NodeComponentInfo, CONFIG_ADD) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
- return RFAILED;
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
- return ROK;
}
/*******************************************************************
*
- * @brief Builds E2 node config update list
+ * @brief Builds and Send the ErrorIndication Message
*
* @details
*
- * Function : BuildE2NodeConfigUpdateList
+ * Function : BuildAndSendErrorIndication
*
- * Functionality: Building E2 node config update list
+ * Functionality:Fills the ErrorIndication Message
*
* @params[in]
- * E2nodeComponentConfigUpdate_List_t to be filled
- * Count of E2 node to be update in the list
- * Received list of E2 node configuration
- *
+ * Trans id
+ * Ric req id
+ * Ran function id
+ * Cause of failure
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t BuildE2NodeConfigUpdateList(E2nodeComponentConfigUpdate_List_t *e2NodeUpdateList, uint16_t count, E2NodeConfigItem *updateE2Node)
+uint8_t BuildAndSendErrorIndication(int8_t transId, RicRequestId requestId, uint16_t ranFuncId, E2FailureCause failureCause)
{
- uint8_t arrIdx = 0;
- CmLList *node =NULL;
- E2NodeComponent *e2NodeComponentInfo =NULL;
- E2nodeComponentConfigUpdate_ItemIEs_t *e2NodeUpdateItemIe =NULL;
- E2nodeComponentConfigUpdate_Item_t *e2NodeUpdateItem =NULL;
+ uint8_t elementCnt =0, arrIdx=0, ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ ErrorIndicationE2_t *errorIndicationMsg=NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- e2NodeUpdateList->list.count = count;
- e2NodeUpdateList->list.size = e2NodeUpdateList->list.count * sizeof(E2nodeComponentConfigUpdate_ItemIEs_t *);
- DU_ALLOC(e2NodeUpdateList->list.array, e2NodeUpdateList->list.size);
- if(e2NodeUpdateList->list.array == NULLP)
+ while(true)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigUpdateList %d",__LINE__);
- return RFAILED;
- }
+ DU_LOG("\nINFO --> E2AP : Building Error Indication Message\n");
- for(arrIdx = 0; arrIdx< e2NodeUpdateList->list.count; arrIdx++)
- {
- DU_ALLOC(e2NodeUpdateList->list.array[arrIdx], sizeof(E2nodeComponentConfigUpdate_ItemIEs_t));
- if(e2NodeUpdateList->list.array[arrIdx] == NULLP)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigUpdateList %d",__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed in %s at line %d",__func__, __LINE__);
+ break;
}
- e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].actionType, &node);
- if(!e2NodeComponentInfo)
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed in %s at line %d",__func__, __LINE__);
+ break;
}
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_ErrorIndicationE2;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_ErrorIndicationE2;
- e2NodeUpdateItemIe = (E2nodeComponentConfigUpdate_ItemIEs_t *) e2NodeUpdateList->list.array[arrIdx];
- e2NodeUpdateItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate_Item;
- e2NodeUpdateItemIe->criticality = CriticalityE2_reject;
- e2NodeUpdateItemIe->value.present = E2nodeComponentConfigUpdate_ItemIEs__value_PR_E2nodeComponentConfigUpdate_Item;
- e2NodeUpdateItem = &e2NodeUpdateItemIe->value.choice.E2nodeComponentConfigUpdate_Item;
+ errorIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.ErrorIndicationE2;
+
+ /* Element count is 2 for TransactionID/RICrequestID and Cause.
+ * If the RAN function id is present, the count will be increased.*/
+ elementCnt = 2;
+ if(ranFuncId>0)
+ {
+ elementCnt++;
+ }
+
+ errorIndicationMsg->protocolIEs.list.count = elementCnt;
+ errorIndicationMsg->protocolIEs.list.size = elementCnt * sizeof(ErrorIndicationE2_IEs_t*);
- if(fillE2NodeConfig((PTR)e2NodeUpdateItem, e2NodeComponentInfo, CONFIG_MOD) != ROK)
+ /* Initialize the E2Setup members */
+ DU_ALLOC(errorIndicationMsg->protocolIEs.list.array, errorIndicationMsg->protocolIEs.list.size);
+ if(errorIndicationMsg->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements in %s at line %d",__func__, __LINE__);
+ break;
+ }
+
+ for(arrIdx = 0; arrIdx < elementCnt; (arrIdx)++)
+ {
+ DU_ALLOC(errorIndicationMsg->protocolIEs.list.array[arrIdx], sizeof(ErrorIndicationE2_IEs_t));
+ if(errorIndicationMsg->protocolIEs.list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for array [%d] elements in %s at line %d", arrIdx, __func__, __LINE__);
+ break;
+ }
}
+ if(arrIdx < elementCnt)
+ break;
- }
- return ROK;
+ arrIdx = 0;
-}
+ if(transId >=0 && transId<=255)
+ {
+ /* TransactionID */
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_TransactionID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
+ }
+ else
+ {
+ /* RICrequestID */
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RICrequestID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_RICrequestID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RICrequestID.ricRequestorID = requestId.requestorId;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RICrequestID.ricInstanceID = requestId.instanceId;
+ }
+
+ if(ranFuncId>0)
+ {
+ /* RAN Function ID */
+ arrIdx++;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RANfunctionID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_RANfunctionID;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionID = ranFuncId;
+ }
+
+ /* Cause */
+ arrIdx++;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_CauseE2;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_ignore;
+ errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.present = ErrorIndicationE2_IEs__value_PR_CauseE2;
+ fillE2Cause(&errorIndicationMsg->protocolIEs.list.array[arrIdx]->value.choice.CauseE2, failureCause);
+
+ /* Prints the Msg formed */
+ 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 Error Indication Message (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for Error Indication Message \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nINFO --> E2AP : Sending Error Indication Message");
-/*******************************************************************
+ }
+ ret = ROK;
+ break;
+ }
+ FreeErrorIndication(e2apMsg);
+ return ret;
+}
+
+/******************************************************************
*
- * @brief Builds E2 node config remove list
+ * @brief Deallocation of memory allocated by aper decoder for e2
+ * Config Update Failure
*
* @details
*
- * Function :BuildE2NodeConfigRemoveList
+ * Function : freeAperDecodingOfE2Node Config UpdateFailure
*
- * Functionality: Building E2 node config remove list
+ * Functionality: Deallocation of memory allocated by aper decoder
+ * for e2 Config Update Failure
*
- * @params[in]
- * E2nodeComponentConfigRemoval_List_t to be filled
- * Count of E2 node to be remove in the list
- * Received list of E2 node configuration
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] E2nodeConfigurationUpdateFailure_t to be deallocated
+ * @return void
*
- ******************************************************************/
+ * ****************************************************************/
-uint8_t BuildE2NodeConfigRemoveList(E2nodeComponentConfigRemoval_List_t *e2NodeRemoveList, uint16_t count, E2NodeConfigItem *updateE2Node)
+void freeAperDecodingOfE2NodeConfigUpdateFailure(E2nodeConfigurationUpdateFailure_t *e2NodeCfgUpdFail)
{
- uint8_t arrIdx = 0;
- CmLList *node=NULL;
- E2NodeComponent *e2NodeComponentInfo=NULL;
- E2nodeComponentConfigRemoval_ItemIEs_t *e2NodeRemovalItemIe=NULL;
- E2nodeComponentConfigRemoval_Item_t *e2NodeRemovalItem=NULL;
-
- e2NodeRemoveList->list.count = count;
- e2NodeRemoveList->list.size = e2NodeRemoveList->list.count * sizeof(E2nodeComponentConfigRemoval_ItemIEs_t *);
- DU_ALLOC(e2NodeRemoveList->list.array, e2NodeRemoveList->list.size);
- if(e2NodeRemoveList->list.array == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigRemoveList %d",__LINE__);
- return RFAILED;
- }
+ uint8_t arrIdx =0;
- for(arrIdx = 0; arrIdx< e2NodeRemoveList->list.count; arrIdx++)
+ if(e2NodeCfgUpdFail)
{
- DU_ALLOC(e2NodeRemoveList->list.array[arrIdx], sizeof(E2nodeComponentConfigRemoval_ItemIEs_t));
- if(e2NodeRemoveList->list.array[arrIdx] == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigRemoveList %d",__LINE__);
- return RFAILED;
- }
-
- e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].actionType, &node);
- if(!e2NodeComponentInfo)
- {
- DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
- return RFAILED;
- }
-
- e2NodeRemovalItemIe = (E2nodeComponentConfigRemoval_ItemIEs_t *) e2NodeRemoveList->list.array[arrIdx];
- e2NodeRemovalItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval_Item;
- e2NodeRemovalItemIe->criticality = CriticalityE2_reject;
- e2NodeRemovalItemIe->value.present = E2nodeComponentConfigRemoval_ItemIEs__value_PR_E2nodeComponentConfigRemoval_Item;
- e2NodeRemovalItem = &e2NodeRemovalItemIe->value.choice.E2nodeComponentConfigRemoval_Item;
-
- if(fillE2NodeConfig((PTR)e2NodeRemovalItem, e2NodeComponentInfo, CONFIG_DEL) != ROK)
+ if(e2NodeCfgUpdFail->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
- return RFAILED;
+ for(arrIdx=0; arrIdx<e2NodeCfgUpdFail->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx])
+ {
+ free(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(e2NodeCfgUpdFail->protocolIEs.list.array);
}
-
}
- return ROK;
}
-/*******************************************************************
+
+/******************************************************************
*
- * @brief deallocation of E2SM_KPM_RANfunction_Description_t
+ * @brief Processes E2 Node Config Update Failure sent by RIC
*
* @details
*
- * Function : freeE2smKpmRanFunctionDefinition
+ * Function : procE2NodeConfigUpdateFailure
*
- * Functionality: deallocation of E2SM_KPM_RANfunction_Description_t
+ * Functionality: Processes E2 Node Config Update failure sent by RIC
*
- * @params[in] E2SM_KPM_RANfunction_Description_t *ranFunctionDefinition
- * @return void
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
+ * ****************************************************************/
-void freeE2smKpmRanFunctionDefinition(E2SM_KPM_RANfunction_Description_t *ranFunctionDefinition)
+void procE2NodeConfigUpdateFailure(E2AP_PDU_t *e2apMsg)
{
- MeasurementInfo_Action_Item_t *measInfoList;
- uint8_t eventTriggerIdx, reportStyleIdx, measInfoIdx;
- RANfunction_Name_t *ranFuncName;
- struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle;
- struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List *eventTriggerStyle;
- if(ranFunctionDefinition)
- {
- ranFuncName = &ranFunctionDefinition->ranFunction_Name;
- /* Free RAN function Name */
- DU_FREE(ranFuncName->ranFunction_ShortName.buf, ranFuncName->ranFunction_ShortName.size);
- DU_FREE(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncName->ranFunction_E2SM_OID.size);
- DU_FREE(ranFuncName->ranFunction_Description.buf, ranFuncName->ranFunction_Description.size);
+ uint8_t arrIdx =0, transId =0, timerValue=0;
+ E2nodeConfigurationUpdateFailure_t *e2NodeCfgUpdFail=NULL;
- /* Sequence of Event Trigger styles */
- eventTriggerStyle = ranFunctionDefinition->ric_EventTriggerStyle_List;
- if(eventTriggerStyle)
+ DU_LOG("\nINFO --> E2AP : E2 Node Config Update failure received");
+ e2NodeCfgUpdFail = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2nodeConfigurationUpdateFailure;
+
+ for(arrIdx=0; arrIdx<e2NodeCfgUpdFail->protocolIEs.list.count; arrIdx++)
+ {
+ switch(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->id)
{
- if(eventTriggerStyle->list.array)
- {
- for(eventTriggerIdx =0;eventTriggerIdx<eventTriggerStyle->list.count; eventTriggerIdx++)
+ case ProtocolIE_IDE2_id_TransactionID:
{
- if(eventTriggerStyle->list.array[eventTriggerIdx])
+ transId = e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
{
- DU_FREE(eventTriggerStyle->list.array[eventTriggerIdx]->ric_EventTriggerStyle_Name.buf,\
- eventTriggerStyle->list.array[eventTriggerIdx]->ric_EventTriggerStyle_Name.size);
- DU_FREE(eventTriggerStyle->list.array[eventTriggerIdx], sizeof(RIC_EventTriggerStyle_Item_t ));
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
}
- }
- DU_FREE(eventTriggerStyle->list.array, eventTriggerStyle->list.size)
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ }
+ break;
}
- DU_FREE(eventTriggerStyle, sizeof(struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List));
- }
-
- /* Sequence of Report styles */
- ricReportStyle = ranFunctionDefinition->ric_ReportStyle_List;
- if(ricReportStyle)
- {
- if(ricReportStyle->list.array)
- {
- for(reportStyleIdx =0;reportStyleIdx<ricReportStyle->list.count; reportStyleIdx++)
+ case ProtocolIE_IDE2_id_TimeToWaitE2:
{
- if(ricReportStyle->list.array[reportStyleIdx])
+ timerValue = convertE2WaitTimerEnumToValue(e2NodeCfgUpdFail->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
+ if((duChkTmr((PTR)&(duCb.e2apDb), EVENT_E2_NODE_CONFIG_UPDATE_TMR)) == FALSE)
{
- if(ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.buf)
- {
- DU_FREE(ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.buf,\
- ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.size);
- }
- if(ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.array)
- {
- for(measInfoIdx=0; measInfoIdx<ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.count; \
- measInfoIdx++)
- {
- measInfoList = ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.array[measInfoIdx];
- if(measInfoList)
- {
- DU_FREE(measInfoList->measID, sizeof(long));
- DU_FREE(measInfoList->measName.buf, measInfoList->measName.size);
- DU_FREE(measInfoList,sizeof(MeasurementInfo_Action_Item_t));
- }
- }
- DU_FREE(measInfoList,ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.size);
- }
- DU_FREE(ricReportStyle->list.array[reportStyleIdx], sizeof(RIC_ReportStyle_Item_t));
+ duStartTmr((PTR)&(duCb.e2apDb), EVENT_E2_NODE_CONFIG_UPDATE_TMR, timerValue);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : EVENT_E2_NODE_CONFIG_UPDATE_TMR timer is already running");
}
+ break;
}
- DU_FREE(ricReportStyle->list.array, ricReportStyle->list.size);
- }
- DU_FREE(ricReportStyle, sizeof(struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List));
}
- DU_FREE(ranFunctionDefinition, sizeof(E2SM_KPM_RANfunction_Description_t));
}
+
+ freeAperDecodingOfE2NodeConfigUpdateFailure(e2NodeCfgUpdFail);
}
/*******************************************************************
*
- * @brief fill the e2sm ric report style
+ * @brief Builds Global gNodeB Params
*
* @details
*
- * Function : fillRicReportStyle
+ * Function : BuildGlobalgNBId
*
- * Functionality: fill the report style
+ * Functionality: Building the Plmn and gNB id
*
- * @params[in] RanFunction *ranFuncDb, struct
- * E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle
+ * @params[in] GlobalE2node_gNB_ID_t *gNbId
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillRicReportStyle(RanFunction *ranFuncDb, struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle)
+
+uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId)
{
- uint8_t styleIdx, measInfoIdx;
- MeasurementInfo_Action_List_t *measInfo;
- CmLList *node;
-
- ricReportStyle->list.count = ranFuncDb->numOfReportStyleSupported;
- ricReportStyle->list.size = ricReportStyle->list.count * sizeof(RIC_ReportStyle_Item_t*);
- DU_ALLOC(ricReportStyle->list.array, ricReportStyle->list.size);
- if(!ricReportStyle->list.array)
+ uint8_t unused = 0;
+ uint8_t byteSize = 4;
+ uint8_t gnbId = duCb.gnbId;
+ uint8_t ret = ROK;
+
+ /* fill Global gNB ID Id */
+ gNbId->global_gNB_ID.plmn_id.size = 3 * sizeof(uint8_t);
+ gNbId->global_gNB_ID.plmn_id.buf = NULLP;
+ DU_ALLOC(gNbId->global_gNB_ID.plmn_id.buf , gNbId->global_gNB_ID.plmn_id.size);
+ if(gNbId->global_gNB_ID.plmn_id.buf == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for ranFuncDefinition %d",__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for Plmn buffer");
+ ret = RFAILED;
}
-
- for(styleIdx =0;styleIdx<ricReportStyle->list.count; styleIdx++)
+ else
{
- DU_ALLOC(ricReportStyle->list.array[styleIdx], sizeof(RIC_ReportStyle_Item_t));
- if(!ricReportStyle->list.array[styleIdx])
+ buildPlmnId(duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrCgi.plmn, \
+ gNbId->global_gNB_ID.plmn_id.buf);
+ gNbId->global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
+ /* Allocate Buffer size */
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size = byteSize * sizeof(uint8_t);
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf = NULLP;
+ DU_ALLOC(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf, \
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+ if(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for gnb buffer");
+ ret = RFAILED;
}
-
- /* RIC Report Style Type */
- ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Type = ranFuncDb->reportStyleList[styleIdx].reportStyle.styleType;
-
- /* RIC Report Style Format Type */
- ricReportStyle->list.array[styleIdx]->ric_ActionFormat_Type = ranFuncDb->reportStyleList[styleIdx].reportStyle.formatType;
-
- /* RIC Report Style Name */
- ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size = strlen(ranFuncDb->reportStyleList[styleIdx].reportStyle.name);
- DU_ALLOC(ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf,\
- ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size);
- if(!ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf)
+ else
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
+ fillBitString(&gNbId->global_gNB_ID.gnb_id.choice.gnb_ID, unused, byteSize, gnbId);
}
- memcpy(ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf, ranFuncDb->reportStyleList[styleIdx].reportStyle.name,\
- ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size);
-
- /* RIC Indication Header Format Type*/
- ricReportStyle->list.array[styleIdx]->ric_IndicationHeaderFormat_Type = ranFuncDb->ricIndicationHeaderFormat;
+ }
- /* RIC Indication Message Format Type*/
- ricReportStyle->list.array[styleIdx]->ric_IndicationMessageFormat_Type = ranFuncDb->ricIndicationMessageFormat;
-
- /* Measurement Info Action List */
- CmLListCp measInfoList =ranFuncDb->reportStyleList[styleIdx].measurementInfoList;
- if(!measInfoList.count)
+ /* fill gNB-DU ID */
+ DU_ALLOC( gNbId->gNB_DU_ID, sizeof(GNB_DU_ID_t));
+ if(gNbId->gNB_DU_ID == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for gNB_DU_ID ");
+ ret = RFAILED;
+ }
+ else
+ {
+ gNbId->gNB_DU_ID->size = sizeof(uint8_t);
+ DU_ALLOC( gNbId->gNB_DU_ID->buf, sizeof(uint8_t));
+ if(gNbId->gNB_DU_ID->buf)
{
- continue;
+ gNbId->gNB_DU_ID->buf[0] =duCb.e2apDb.e2NodeId;
}
-
- CM_LLIST_FIRST_NODE(&ranFuncDb->reportStyleList[styleIdx].measurementInfoList, node);
- measInfo = &ricReportStyle->list.array[styleIdx]->measInfo_Action_List;
-
- measInfo->list.count = measInfoList.count;
- measInfo->list.size = measInfoList.count*sizeof(MeasurementInfo_Action_Item_t*);
- DU_ALLOC(measInfo->list.array, measInfo->list.size);
- if(!measInfo->list.array)
+ else
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
- }
-
- for(measInfoIdx=0; measInfoIdx<measInfo->list.count; measInfoIdx++)
- {
- if(!node)
- {
- DU_LOG("\nERROR --> E2AP: Measurement info node is null");
- return RFAILED;
- }
-
- DU_ALLOC(measInfo->list.array[measInfoIdx],sizeof(MeasurementInfo_Action_Item_t));
- if(!measInfo->list.array[measInfoIdx])
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
- }
- MeasurementInfoForAction *measInfoForAction= (MeasurementInfoForAction*)node->node;
- DU_ALLOC(measInfo->list.array[measInfoIdx]->measID, sizeof(long));
- if(!measInfo->list.array[measInfoIdx]->measID)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
- }
-
- memcpy(measInfo->list.array[measInfoIdx]->measID, &measInfoForAction->measurementTypeId,sizeof(long));
- measInfo->list.array[measInfoIdx]->measName.size= strlen(measInfoForAction->measurementTypeName);
- DU_ALLOC(measInfo->list.array[measInfoIdx]->measName.buf, measInfo->list.array[measInfoIdx]->measName.size);
- if(!measInfo->list.array[measInfoIdx]->measName.size)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- return RFAILED;
- }
-
- memcpy(measInfo->list.array[measInfoIdx]->measName.buf, \
- measInfoForAction->measurementTypeName,\
- measInfo->list.array[measInfoIdx]->measName.size);
- node = node->next;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for gNB_DU_ID buffer");
+ ret = RFAILED;
}
-
}
- return ROK;
+
+ return ret;
}
+
/*******************************************************************
*
- * @brief fill the ric event trigger style
+ * @brief fill the E2 node config information
*
* @details
*
- * Function : fillRicEventTriggerStyle
+ * Function : fillE2NodeConfig
*
- * Functionality: fill the ric event trigger style
+ * Functionality: fill E2 node config information
*
- * @params[in]
+ * @params[in]
+ * Pointer to e2NodeCfg to be filled
+ * E2 Node Component information
+ * Type of configuration
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillRicEventTriggerStyle(RanFunction *ranFuncDb, struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List *ricEventTriggerStyle)
+
+uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, ConfigType configType)
{
- uint8_t styleIdx;
+ E2NodeConfig *e2NodeConfig=NULLP;
+ E2nodeComponentInterfaceType_t *interfaceType=NULLP;
+ E2nodeComponentID_t *componentID =NULLP;
+ E2nodeComponentConfiguration_t *configuration=NULLP;
+ E2nodeComponentConfigAddition_Item_t *e2NodeAddItem=NULL;
+ E2nodeComponentConfigUpdate_Item_t *e2NodeUpdateItem =NULL;
+ E2nodeComponentConfigRemoval_Item_t *e2NodeRemovalItem=NULL;
+
+ switch(configType)
+ {
+ case CONFIG_ADD:
+ {
+ e2NodeAddItem = (E2nodeComponentConfigAddition_Item_t*)e2NodeCfg;
+ interfaceType = &e2NodeAddItem->e2nodeComponentInterfaceType;
+ componentID = &e2NodeAddItem->e2nodeComponentID;
+ configuration = &e2NodeAddItem->e2nodeComponentConfiguration;
+ e2NodeConfig = e2NodeComponentInfo->addConfiguration;
+ break;
+ }
+ case CONFIG_MOD:
+ {
+ e2NodeUpdateItem = (E2nodeComponentConfigUpdate_Item_t *) e2NodeCfg;
+ interfaceType = &e2NodeUpdateItem->e2nodeComponentInterfaceType;
+ componentID = &e2NodeUpdateItem->e2nodeComponentID;
+ configuration = &e2NodeUpdateItem->e2nodeComponentConfiguration;
+ e2NodeConfig = e2NodeComponentInfo->updateConfiguration;
+ break;
+ }
+ case CONFIG_DEL:
+ {
+ e2NodeRemovalItem = (E2nodeComponentConfigRemoval_Item_t*) e2NodeCfg;
+ interfaceType = &e2NodeRemovalItem->e2nodeComponentInterfaceType;
+ componentID = &e2NodeRemovalItem->e2nodeComponentID;
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Configuration type %d does not supported ", configType);
+ return RFAILED;
+ }
+ }
+ /* E2nodeComponentInterfaceType */
+ *interfaceType = convertInterfaceToE2ComponentInterfaceType(e2NodeComponentInfo->interfaceType);
+
+ /* We now only support the F1 interface out of these interfaces
+ * (NG,XN,E1,F1,W1,S1,X2), therefore only the F1 component identifier was filled in. */
+
+ if(*interfaceType == F1)
+ {
+ /* E2 Node Component ID */
+ componentID->present = E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1;
+ DU_ALLOC(componentID->choice.e2nodeComponentInterfaceTypeF1,sizeof(E2nodeComponentInterfaceF1_t));
+ if(componentID->choice.e2nodeComponentInterfaceTypeF1 == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+ componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size = sizeof(uint8_t);
+ DU_ALLOC(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
+ componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
- ricEventTriggerStyle->list.count = ranFuncDb->numOfEventTriggerStyleSupported;
- ricEventTriggerStyle->list.size = ricEventTriggerStyle->list.count* sizeof(RIC_EventTriggerStyle_Item_t *);
- DU_ALLOC(ricEventTriggerStyle->list.array, ricEventTriggerStyle->list.size);
- if(!ricEventTriggerStyle->list.array)
+ if(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
+ return RFAILED;
+ }
+ memcpy(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf, &e2NodeComponentInfo->componentId,\
+ componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
+ }
+
+ if(configType == CONFIG_DEL)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed for ric_EventTriggerStyle_List %d",__LINE__);
- return RFAILED;
+ /* We don't need to fill out the E2 Node Component Request and Response
+ * information in the case of CONFIG_DEL, therefore returning ROK from here. */
+ return ROK;
}
- for(styleIdx =0;styleIdx<ricEventTriggerStyle->list.count; styleIdx++)
+ /* E2 Node Component Request Part */
+ if(e2NodeConfig->componentRequestPart)
{
- DU_ALLOC(ricEventTriggerStyle->list.array[styleIdx], sizeof(RIC_EventTriggerStyle_Item_t ));
- if(!ricEventTriggerStyle->list.array[styleIdx])
+ configuration->e2nodeComponentRequestPart.size = e2NodeConfig->reqBufSize ;
+ DU_ALLOC(configuration->e2nodeComponentRequestPart.buf,\
+ configuration->e2nodeComponentRequestPart.size);
+ if(configuration->e2nodeComponentRequestPart.buf == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
return RFAILED;
}
- ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Type = ranFuncDb->eventTriggerStyleList[styleIdx].styleType;
- ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerFormat_Type = ranFuncDb->eventTriggerStyleList[styleIdx].formatType;
+ memcpy(configuration->e2nodeComponentRequestPart.buf,\
+ e2NodeConfig->componentRequestPart, configuration->\
+ e2nodeComponentRequestPart.size);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP: componentRequestPart is null ");
+ return RFAILED;
+ }
- ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size = strlen(ranFuncDb->eventTriggerStyleList[styleIdx].name);
- DU_ALLOC(ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf,\
- ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size);
- if(!ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf)
+ /* E2 Node Component Response Part */
+ if(e2NodeConfig->componentResponsePart)
+ {
+ configuration->e2nodeComponentResponsePart.size = e2NodeConfig->rspBufSize;
+ DU_ALLOC(configuration->e2nodeComponentResponsePart.buf, configuration->e2nodeComponentResponsePart.size);
+ if(configuration->e2nodeComponentResponsePart.buf == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at line %d",__func__,__LINE__);
return RFAILED;
}
- memcpy(ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf,ranFuncDb->eventTriggerStyleList[styleIdx].name,\
- ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size);
-
+ memcpy(configuration->e2nodeComponentResponsePart.buf, e2NodeConfig->componentResponsePart, configuration->\
+ e2nodeComponentResponsePart.size);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP: componentResponsePart is null");
+ return RFAILED;
}
+
return ROK;
}
/*******************************************************************
*
- * @brief Builds Ran function item
+ * @brief Builds E2 node config addition list
*
* @details
*
- * Function : BuildRanFunctionItem
+ * Function : BuildE2NodeConfigAddList
*
- * Functionality: Building RAN function item
+ * Functionality: Building E2 node config addition list
*
* @params[in]
- * RAN function item that has to be filled
- * Stored RAN Function information
+ * E2nodeComponentConfigAddition_List_t to be filled
+ * Procedure Code
+ * Count of E2 node to be added in the list
+ * Received list of E2 node configuration
+ *
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t BuildRanFunctionItem(RANfunction_Item_t *ranFuncItem, RanFunction *ranFuncDb)
+uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAddList, uint8_t procedureCode, uint16_t count, E2NodeConfigItem *e2NodeList)
{
- uint8_t ret =RFAILED;
- RANfunctionDefinition_t *ranFunctionDefinition;
- RANfunction_Name_t *ranFuncName;
- asn_enc_rval_t encRetVal;
- E2SM_KPM_RANfunction_Description_t *ranFuncDefinition;
+ uint8_t arrIdx = 0;
+ CmLList *node =NULL;
+ E2NodeComponent *e2NodeComponentInfo=NULL;
+ E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItemIe=NULL;
+ E2nodeComponentConfigAddition_Item_t *e2NodeAddItem=NULL;
- while(true)
- {
- /* RAN function Id*/
- ranFuncItem->ranFunctionID = ranFuncDb->id;
-
- /* RAN Function Revision*/
- ranFuncItem->ranFunctionRevision = ranFuncDb->revisionCounter;
- /* RAN function OID*/
- ranFuncItem->ranFunctionOID.size = strlen(ranFuncDb->name.serviceModelOID);
- DU_ALLOC(ranFuncItem->ranFunctionOID.buf, ranFuncItem->ranFunctionOID.size);
- if(!ranFuncItem->ranFunctionOID.buf)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
- }
- memcpy(ranFuncItem->ranFunctionOID.buf, ranFuncDb->name.serviceModelOID, ranFuncItem->ranFunctionOID.size);
+ /* For ProcedureCodeE2_id_E2setup, the number of E2 node configuration list items is
+ * equal to the number of E2 node configuration entries stored in the database.
+ * For any other procedure, the E2 node configuration list count is equal
+ * to the count of E2 node configuration obtained from the function's caller */
- /* RAN function Definition */
- DU_ALLOC(ranFuncDefinition, sizeof(E2SM_KPM_RANfunction_Description_t));
- if(!ranFuncDefinition)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
- }
+ if(procedureCode == ProcedureCodeE2_id_E2setup)
+ e2NodeAddList->list.count = duCb.e2apDb.e2NodeComponentList.count;
+ else
+ e2NodeAddList->list.count = count;
- /* RAN function Name */
- ranFuncName = &ranFuncDefinition->ranFunction_Name;
+ e2NodeAddList->list.size = e2NodeAddList->list.count * sizeof(E2nodeComponentConfigAddition_ItemIEs_t *);
+ DU_ALLOC(e2NodeAddList->list.array, e2NodeAddList->list.size);
+ if(e2NodeAddList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
+ }
- /* RAN function ShortName */
- ranFuncName->ranFunction_ShortName.size = strlen(ranFuncDb->name.shortName);
- DU_ALLOC(ranFuncName->ranFunction_ShortName.buf, ranFuncName->ranFunction_ShortName.size);
- if(!ranFuncName->ranFunction_ShortName.buf)
+ for(arrIdx = 0; arrIdx< e2NodeAddList->list.count; arrIdx++)
+ {
+ DU_ALLOC(e2NodeAddList->list.array[arrIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
+ if(e2NodeAddList->list.array[arrIdx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__);
+ return RFAILED;
}
- memcpy(ranFuncName->ranFunction_ShortName.buf, ranFuncDb->name.shortName, strlen(ranFuncDb->name.shortName));
-
- /* RAN function E2SM_OID */
- ranFuncName->ranFunction_E2SM_OID.size = strlen(ranFuncDb->name.serviceModelOID);
- DU_ALLOC(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncName->ranFunction_E2SM_OID.size);
- if(!ranFuncName->ranFunction_E2SM_OID.buf)
+
+ if(procedureCode == ProcedureCodeE2_id_E2setup)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
+ /* Getting all of the E2 node configuration's information from DuCb one by one*/
+ if(arrIdx == 0)
+ {
+ CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
+ }
+ else
+ {
+ node = node->next;
+ }
+ if(!node)
+ {
+ DU_LOG("\nERROR --> E2AP : E2 node component list node is null");
+ return RFAILED;
+ }
+ e2NodeComponentInfo = (E2NodeComponent*)node->node;
}
- memcpy(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncDb->name.serviceModelOID, ranFuncName->ranFunction_E2SM_OID.size);
-
- /* RAN Function Name Description */
- ranFuncName->ranFunction_Description.size = strlen(ranFuncDb->name.description);
- DU_ALLOC(ranFuncName->ranFunction_Description.buf, ranFuncName->ranFunction_Description.size);
- if(!ranFuncName->ranFunction_Description.buf)
+ else
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
+ /* Getting only those E2 node configuration from DuCb whose interface
+ * and action type is present in the received array */
+ e2NodeComponentInfo = fetchE2NodeComponentInfo(e2NodeList[arrIdx].interface, e2NodeList[arrIdx].componentId, &node);
}
- memcpy(ranFuncName->ranFunction_Description.buf, ranFuncDb->name.description, ranFuncName->ranFunction_Description.size);
-
- /* RIC Event Trigger Style List */
- DU_ALLOC(ranFuncDefinition->ric_EventTriggerStyle_List, sizeof(struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List));
- if(!ranFuncDefinition->ric_EventTriggerStyle_List)
+
+ if(!e2NodeComponentInfo)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
+ DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
+ return RFAILED;
}
- if(fillRicEventTriggerStyle(ranFuncDb, ranFuncDefinition->ric_EventTriggerStyle_List)!=ROK)
+ e2NodeAddItemIe = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[arrIdx];
+ e2NodeAddItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition_Item;
+ e2NodeAddItemIe->criticality = CriticalityE2_reject;
+ e2NodeAddItemIe->value.present = E2nodeComponentConfigAddition_ItemIEs__value_PR_E2nodeComponentConfigAddition_Item;
+ e2NodeAddItem = &e2NodeAddItemIe->value.choice.E2nodeComponentConfigAddition_Item;
+ if(fillE2NodeConfig((PTR)e2NodeAddItem, e2NodeComponentInfo, CONFIG_ADD) != ROK)
{
- DU_LOG("\nERROR --> E2AP: failed to fill ric event trigger style");
- break;
+ DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
+ return RFAILED;
}
+ }
+ return ROK;
+}
- /* RIC Report Style List */
- DU_ALLOC(ranFuncDefinition->ric_ReportStyle_List, sizeof(struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List));
- if(!ranFuncDefinition->ric_ReportStyle_List)
+/*******************************************************************
+ *
+ * @brief Builds E2 node config update list
+ *
+ * @details
+ *
+ * Function : BuildE2NodeConfigUpdateList
+ *
+ * Functionality: Building E2 node config update list
+ *
+ * @params[in]
+ * E2nodeComponentConfigUpdate_List_t to be filled
+ * Count of E2 node to be update in the list
+ * Received list of E2 node configuration
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t BuildE2NodeConfigUpdateList(E2nodeComponentConfigUpdate_List_t *e2NodeUpdateList, uint16_t count, E2NodeConfigItem *updateE2Node)
+{
+ uint8_t arrIdx = 0;
+ CmLList *node =NULL;
+ E2NodeComponent *e2NodeComponentInfo =NULL;
+ E2nodeComponentConfigUpdate_ItemIEs_t *e2NodeUpdateItemIe =NULL;
+ E2nodeComponentConfigUpdate_Item_t *e2NodeUpdateItem =NULL;
+
+ e2NodeUpdateList->list.count = count;
+ e2NodeUpdateList->list.size = e2NodeUpdateList->list.count * sizeof(E2nodeComponentConfigUpdate_ItemIEs_t *);
+ DU_ALLOC(e2NodeUpdateList->list.array, e2NodeUpdateList->list.size);
+ if(e2NodeUpdateList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigUpdateList %d",__LINE__);
+ return RFAILED;
+ }
+
+ for(arrIdx = 0; arrIdx< e2NodeUpdateList->list.count; arrIdx++)
+ {
+ DU_ALLOC(e2NodeUpdateList->list.array[arrIdx], sizeof(E2nodeComponentConfigUpdate_ItemIEs_t));
+ if(e2NodeUpdateList->list.array[arrIdx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
- break;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigUpdateList %d",__LINE__);
+ return RFAILED;
}
- if(fillRicReportStyle(ranFuncDb, ranFuncDefinition->ric_ReportStyle_List) != ROK)
+
+ e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].componentId, &node);
+ if(!e2NodeComponentInfo)
{
- DU_LOG("\nERROR --> E2AP: failed to fill ric report style");
- break;
+ DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
+ return RFAILED;
}
- /* Encode the F1SetupRequest type as APER */
- xer_fprint(stdout, &asn_DEF_E2SM_KPM_RANfunction_Description, ranFuncDefinition);
-
- memset(encBuf, 0, ENC_BUF_MAX_LEN);
- encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_E2SM_KPM_RANfunction_Description, 0, ranFuncDefinition, PrepFinalEncBuf, encBuf);
+ e2NodeUpdateItemIe = (E2nodeComponentConfigUpdate_ItemIEs_t *) e2NodeUpdateList->list.array[arrIdx];
+ e2NodeUpdateItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate_Item;
+ e2NodeUpdateItemIe->criticality = CriticalityE2_reject;
+ e2NodeUpdateItemIe->value.present = E2nodeComponentConfigUpdate_ItemIEs__value_PR_E2nodeComponentConfigUpdate_Item;
+ e2NodeUpdateItem = &e2NodeUpdateItemIe->value.choice.E2nodeComponentConfigUpdate_Item;
- /* Encode results */
- if(encRetVal.encoded == ENCODE_FAIL)
- {
- DU_LOG("\nERROR --> F1AP : Could not encode RAN function definition (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
+ if(fillE2NodeConfig((PTR)e2NodeUpdateItem, e2NodeComponentInfo, CONFIG_MOD) != ROK)
{
- DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RAN function definition \n");
- for(uint8_t measIeIdx=0; measIeIdx< encBufSize; measIeIdx++)
- {
- printf("%x",encBuf[measIeIdx]);
- }
- ranFunctionDefinition = &ranFuncItem->ranFunctionDefinition;
- ranFunctionDefinition->size = encBufSize;
- DU_ALLOC(ranFunctionDefinition->buf, encBufSize);
- if(ranFunctionDefinition->buf == NULLP)
- {
- DU_LOG("\nERROR --> F1AP : Memory allocation failed for RAN function definition buffer");
- break;
- }
- memcpy(ranFunctionDefinition->buf, &encBuf, encBufSize);
- ret = ROK;
- break;
+ DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
+ return RFAILED;
}
+
}
- freeE2smKpmRanFunctionDefinition(ranFuncDefinition);
- return ret;
+ return ROK;
+
}
+
/*******************************************************************
*
- * @brief Builds Ran function add list based on the procedure code
+ * @brief Builds E2 node config remove list
*
* @details
*
- * Function : BuildRanFunctionAddList
+ * Function :BuildE2NodeConfigRemoveList
*
- * Functionality: Building RAN addition addition list
- * In case of ProcedureCodeE2_id_E2setup we add all the RAN Function list
- * which is present in E2 database.
- * In the case of other procedures, we just fill the RAN functions whose ID
- * is contained in recvList
+ * Functionality: Building E2 node config remove list
*
* @params[in]
- * RAN Function list
- * Procedure code
- * Count of ran functions to be added in the list
- * Received list of RAN functions
- *
+ * E2nodeComponentConfigRemoval_List_t to be filled
+ * Count of E2 node to be remove in the list
+ * Received list of E2 node configuration
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t BuildRanFunctionAddList(RANfunctions_List_t *ranFunctionsList, uint8_t procedureCode, uint8_t count, RanFuncInfo *recvList)
+uint8_t BuildE2NodeConfigRemoveList(E2nodeComponentConfigRemoval_List_t *e2NodeRemoveList, uint16_t count, E2NodeConfigItem *updateE2Node)
{
- uint16_t id;
- RanFunction *ranFuncDb;
- uint8_t ranFuncIdx;
- RANfunction_ItemIEs_t *ranFuncItemIe;
-
- /* For ProcedureCodeE2_id_E2setup, the number of RAN function list items is
- * equal to the number of ran function entries stored in the database.
- * For any other procedure, the RAN function list count is equal
- * to the count of ran functions obtained from the function's caller */
-
- if(procedureCode == ProcedureCodeE2_id_E2setup)
- ranFunctionsList->list.count = duCb.e2apDb.numOfRanFunction;
- else
- ranFunctionsList->list.count = count;
+ uint8_t arrIdx = 0;
+ CmLList *node=NULL;
+ E2NodeComponent *e2NodeComponentInfo=NULL;
+ E2nodeComponentConfigRemoval_ItemIEs_t *e2NodeRemovalItemIe=NULL;
+ E2nodeComponentConfigRemoval_Item_t *e2NodeRemovalItem=NULL;
- ranFunctionsList->list.size = ranFunctionsList->list.count * sizeof(RANfunction_ItemIEs_t*);
- DU_ALLOC(ranFunctionsList->list.array, ranFunctionsList->list.size);
- if(ranFunctionsList->list.array == NULLP)
+ e2NodeRemoveList->list.count = count;
+ e2NodeRemoveList->list.size = e2NodeRemoveList->list.count * sizeof(E2nodeComponentConfigRemoval_ItemIEs_t *);
+ DU_ALLOC(e2NodeRemoveList->list.array, e2NodeRemoveList->list.size);
+ if(e2NodeRemoveList->list.array == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigRemoveList %d",__LINE__);
return RFAILED;
}
- for(ranFuncIdx = 0; ranFuncIdx< ranFunctionsList->list.count; ranFuncIdx++)
+ for(arrIdx = 0; arrIdx< e2NodeRemoveList->list.count; arrIdx++)
{
- DU_ALLOC(ranFunctionsList->list.array[ranFuncIdx], sizeof(RANfunction_ItemIEs_t));
- if(ranFunctionsList->list.array[ranFuncIdx] == NULLP)
+ DU_ALLOC(e2NodeRemoveList->list.array[arrIdx], sizeof(E2nodeComponentConfigRemoval_ItemIEs_t));
+ if(e2NodeRemoveList->list.array[arrIdx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigRemoveList %d",__LINE__);
return RFAILED;
}
- if(procedureCode == ProcedureCodeE2_id_E2setup)
+
+ e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface,updateE2Node[arrIdx].componentId, &node);
+ if(!e2NodeComponentInfo)
{
- /* Getting all of the RAN function's information from DuCb one by one*/
- ranFuncDb = &duCb.e2apDb.ranFunction[ranFuncIdx];
+ DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
+ return RFAILED;
}
- else
+
+ e2NodeRemovalItemIe = (E2nodeComponentConfigRemoval_ItemIEs_t *) e2NodeRemoveList->list.array[arrIdx];
+ e2NodeRemovalItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval_Item;
+ e2NodeRemovalItemIe->criticality = CriticalityE2_reject;
+ e2NodeRemovalItemIe->value.present = E2nodeComponentConfigRemoval_ItemIEs__value_PR_E2nodeComponentConfigRemoval_Item;
+ e2NodeRemovalItem = &e2NodeRemovalItemIe->value.choice.E2nodeComponentConfigRemoval_Item;
+
+ if(fillE2NodeConfig((PTR)e2NodeRemovalItem, e2NodeComponentInfo, CONFIG_DEL) != ROK)
{
- /* Getting only the RAN function information from DuCb whose Id is
- * present in the received array */
- id =recvList[ranFuncIdx].id;
- ranFuncDb = &duCb.e2apDb.ranFunction[id-1];
+ DU_LOG("\nERROR --> E2AP : Failed to fill the E2 node configuration");
+ return RFAILED;
}
- ranFuncItemIe = (RANfunction_ItemIEs_t *) ranFunctionsList->list.array[ranFuncIdx];
- ranFuncItemIe->id = ProtocolIE_IDE2_id_RANfunction_Item;
- ranFuncItemIe->criticality = CriticalityE2_ignore;
- ranFuncItemIe->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
- BuildRanFunctionItem(&ranFuncItemIe->value.choice.RANfunction_Item, ranFuncDb);
+
}
return ROK;
-}
-
+}
/*******************************************************************
*
- * @brief De Allocate E2 Setup Request Message
+ * @brief deallocation of E2SM_KPM_RANfunction_Description_t
*
* @details
*
- * Function : FreeE2SetupReq
+ * Function : freeE2smKpmRanFunctionDefinition
*
- * Functionality: De-Allocating E2 Setup request Message
+ * Functionality: deallocation of E2SM_KPM_RANfunction_Description_t
*
- * @params[in] E2AP_PDU_t *e2apMsg
-
+ * @params[in] E2SM_KPM_RANfunction_Description_t *ranFunctionDefinition
* @return void
*
- * ****************************************************************/
+ ******************************************************************/
-void FreeE2SetupReq(E2AP_PDU_t *e2apMsg)
+void freeE2smKpmRanFunctionDefinition(E2SM_KPM_RANfunction_Description_t *ranFunctionDefinition)
{
- uint8_t arrIdx = 0;
- uint8_t e2NodeAddListIdx =0, ranFuncAddListIdx;
- E2setupRequest_t *e2SetupReq;
- E2nodeComponentConfigAddition_List_t *e2NodeAddList;
- E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItem;
- RANfunctions_List_t *ranFunctionsList;
- RANfunction_ItemIEs_t *ranFuncItemIe;
- RANfunction_Item_t *ranFunItem;
-
- /* De-allocating Memory */
- if(e2apMsg != NULLP)
+ MeasurementInfo_Action_Item_t *measInfoList;
+ uint8_t eventTriggerIdx, reportStyleIdx, measInfoIdx;
+ RANfunction_Name_t *ranFuncName;
+ struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle;
+ struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List *eventTriggerStyle;
+ if(ranFunctionDefinition)
{
- if(e2apMsg->choice.initiatingMessage != NULLP)
+ ranFuncName = &ranFunctionDefinition->ranFunction_Name;
+ /* Free RAN function Name */
+ DU_FREE(ranFuncName->ranFunction_ShortName.buf, ranFuncName->ranFunction_ShortName.size);
+ DU_FREE(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncName->ranFunction_E2SM_OID.size);
+ DU_FREE(ranFuncName->ranFunction_Description.buf, ranFuncName->ranFunction_Description.size);
+
+ /* Sequence of Event Trigger styles */
+ eventTriggerStyle = ranFunctionDefinition->ric_EventTriggerStyle_List;
+ if(eventTriggerStyle)
{
- e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
- if(e2SetupReq->protocolIEs.list.array != NULLP)
+ if(eventTriggerStyle->list.array)
{
- for(arrIdx = 0; arrIdx < e2SetupReq->protocolIEs.list.count; arrIdx++)
+ for(eventTriggerIdx =0;eventTriggerIdx<eventTriggerStyle->list.count; eventTriggerIdx++)
{
- if(e2SetupReq->protocolIEs.list.array[arrIdx] != NULLP)
+ if(eventTriggerStyle->list.array[eventTriggerIdx])
{
- switch(e2SetupReq->protocolIEs.list.array[arrIdx]->id)
+ DU_FREE(eventTriggerStyle->list.array[eventTriggerIdx]->ric_EventTriggerStyle_Name.buf,\
+ eventTriggerStyle->list.array[eventTriggerIdx]->ric_EventTriggerStyle_Name.size);
+ DU_FREE(eventTriggerStyle->list.array[eventTriggerIdx], sizeof(RIC_EventTriggerStyle_Item_t ));
+ }
+ }
+ DU_FREE(eventTriggerStyle->list.array, eventTriggerStyle->list.size)
+ }
+ DU_FREE(eventTriggerStyle, sizeof(struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List));
+ }
+
+ /* Sequence of Report styles */
+ ricReportStyle = ranFunctionDefinition->ric_ReportStyle_List;
+ if(ricReportStyle)
+ {
+ if(ricReportStyle->list.array)
+ {
+ for(reportStyleIdx =0;reportStyleIdx<ricReportStyle->list.count; reportStyleIdx++)
+ {
+ if(ricReportStyle->list.array[reportStyleIdx])
+ {
+ if(ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.buf)
{
- case ProtocolIE_IDE2_id_TransactionID:
- break;
- case ProtocolIE_IDE2_id_GlobalE2node_ID:
- {
- if(e2SetupReq->protocolIEs.list.array[arrIdx]->\
- value.choice.GlobalE2node_ID.choice.gNB != NULLP)
- {
- GlobalE2node_gNB_ID_t *gNbId = NULLP;
- gNbId = e2SetupReq->protocolIEs.list.array[arrIdx]->\
- value.choice.GlobalE2node_ID.choice.gNB;
- if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
- {
- DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
- gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
- DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
- gNbId->global_gNB_ID.plmn_id.size);
- }
-
- if(gNbId->gNB_DU_ID != NULLP)
- {
- DU_FREE( gNbId->gNB_DU_ID->buf, gNbId->gNB_DU_ID->size);
- DU_FREE(gNbId->gNB_DU_ID, sizeof(GNB_DU_ID_t));
- }
- DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
- choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
- }
- break;
- }
- case ProtocolIE_IDE2_id_E2nodeComponentConfigAddition:
- {
- e2NodeAddList = &e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List;
- if(e2NodeAddList->list.array)
- {
- for(e2NodeAddListIdx = 0; e2NodeAddListIdx< e2NodeAddList->list.count; e2NodeAddListIdx++)
- {
- e2NodeAddItem = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[e2NodeAddListIdx];
-
- /* Free E2 Node Component Request Part */
- DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\
- e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.size);
-
- /* Free E2 Node Component Response Part */
- DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.\
- e2nodeComponentResponsePart.buf, \
- e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentResponsePart.size);
-
- /* Free E2 Node Component ID */
- if(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1)
- {
- DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
- e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
- e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
- e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
- DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1,\
- sizeof(E2nodeComponentInterfaceF1_t));
- }
- DU_FREE(e2NodeAddList->list.array[e2NodeAddListIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
- }
- DU_FREE(e2NodeAddList->list.array, e2NodeAddList->list.size);
- }
- break;
- }
- case ProtocolIE_IDE2_id_RANfunctionsAdded:
+ DU_FREE(ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.buf,\
+ ricReportStyle->list.array[reportStyleIdx]->ric_ReportStyle_Name.size);
+ }
+ if(ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.array)
+ {
+ for(measInfoIdx=0; measInfoIdx<ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.count; \
+ measInfoIdx++)
{
- ranFunctionsList = &(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.RANfunctions_List);
- if(ranFunctionsList->list.array)
- {
- for(ranFuncAddListIdx= 0; ranFuncAddListIdx< ranFunctionsList->list.count; ranFuncAddListIdx++)
- {
- if(ranFunctionsList->list.array[ranFuncAddListIdx])
- {
- ranFuncItemIe = (RANfunction_ItemIEs_t *) ranFunctionsList->list.array[ranFuncAddListIdx];
- ranFunItem = &ranFuncItemIe->value.choice.RANfunction_Item;
- DU_FREE(ranFunItem->ranFunctionOID.buf, ranFunItem->ranFunctionOID.size);
- DU_FREE(ranFunItem->ranFunctionDefinition.buf, ranFunItem->ranFunctionDefinition.size);
- DU_FREE(ranFunctionsList->list.array[ranFuncAddListIdx], sizeof(RANfunction_ItemIEs_t));
- }
- }
- DU_FREE(ranFunctionsList->list.array, ranFunctionsList->list.size);
+ measInfoList = ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.array[measInfoIdx];
+ if(measInfoList)
+ {
+ DU_FREE(measInfoList->measID, sizeof(long));
+ DU_FREE(measInfoList->measName.buf, measInfoList->measName.size);
+ DU_FREE(measInfoList,sizeof(MeasurementInfo_Action_Item_t));
}
- break;
}
-
- default:
- DU_LOG("\nERROR --> E2AP: Invalid event at e2SetupRequet %ld ",\
- (e2SetupReq->protocolIEs.list.array[arrIdx]->id));
- break;
+ DU_FREE(measInfoList,ricReportStyle->list.array[reportStyleIdx]->measInfo_Action_List.list.size);
}
- DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx], sizeof(E2setupRequestIEs_t));
+ DU_FREE(ricReportStyle->list.array[reportStyleIdx], sizeof(RIC_ReportStyle_Item_t));
}
}
- DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
+ DU_FREE(ricReportStyle->list.array, ricReportStyle->list.size);
}
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ DU_FREE(ricReportStyle, sizeof(struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List));
}
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ DU_FREE(ranFunctionDefinition, sizeof(E2SM_KPM_RANfunction_Description_t));
}
}
/*******************************************************************
*
- * @brief Builds and Send the E2SetupRequest
+ * @brief fill the e2sm ric report style
*
* @details
*
- * Function : BuildAndSendE2SetupReq
+ * Function : fillRicReportStyle
*
- * Functionality:Fills the E2SetupRequest
+ * Functionality: fill the report style
*
+ * @params[in] RanFunction *ranFuncDb, struct
+ * E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-
-uint8_t BuildAndSendE2SetupReq()
+uint8_t fillRicReportStyle(RanFunction *ranFuncDb, struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List *ricReportStyle)
{
- uint8_t arrIdx = 0, elementCnt=0;
- uint8_t transId = 0, ret = ROK;
- bool memAllocFailed;
- E2AP_PDU_t *e2apMsg = NULLP;
- E2setupRequest_t *e2SetupReq = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
+ uint8_t styleIdx, measInfoIdx;
+ MeasurementInfo_Action_List_t *measInfo;
+ CmLList *node;
+
+ ricReportStyle->list.count = ranFuncDb->numOfReportStyleSupported;
+ ricReportStyle->list.size = ricReportStyle->list.count * sizeof(RIC_ReportStyle_Item_t*);
+ DU_ALLOC(ricReportStyle->list.array, ricReportStyle->list.size);
+ if(!ricReportStyle->list.array)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for ranFuncDefinition %d",__LINE__);
+ return RFAILED;
+ }
- DU_LOG("\nINFO --> E2AP : Building E2 Setup Request\n");
- do
+ for(styleIdx =0;styleIdx<ricReportStyle->list.count; styleIdx++)
{
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
+ DU_ALLOC(ricReportStyle->list.array[styleIdx], sizeof(RIC_ReportStyle_Item_t));
+ if(!ricReportStyle->list.array[styleIdx])
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
}
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
+
+ /* RIC Report Style Type */
+ ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Type = ranFuncDb->reportStyleList[styleIdx].reportStyle.styleType;
+
+ /* RIC Report Style Format Type */
+ ricReportStyle->list.array[styleIdx]->ric_ActionFormat_Type = ranFuncDb->reportStyleList[styleIdx].reportStyle.formatType;
+
+ /* RIC Report Style Name */
+ ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size = strlen(ranFuncDb->reportStyleList[styleIdx].reportStyle.name);
+ DU_ALLOC(ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf,\
+ ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size);
+ if(!ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
}
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2setupRequest;
- e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
+ memcpy(ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.buf, ranFuncDb->reportStyleList[styleIdx].reportStyle.name,\
+ ricReportStyle->list.array[styleIdx]->ric_ReportStyle_Name.size);
- elementCnt = 4;
- e2SetupReq->protocolIEs.list.count = elementCnt;
- e2SetupReq->protocolIEs.list.size = elementCnt * sizeof(E2setupRequestIEs_t*);
+ /* RIC Indication Header Format Type*/
+ ricReportStyle->list.array[styleIdx]->ric_IndicationHeaderFormat_Type = ranFuncDb->ricIndicationHeaderFormat;
- /* Initialize the E2Setup members */
- DU_ALLOC(e2SetupReq->protocolIEs.list.array, \
- e2SetupReq->protocolIEs.list.size);
- if(e2SetupReq->protocolIEs.list.array == NULLP)
+ /* RIC Indication Message Format Type*/
+ ricReportStyle->list.array[styleIdx]->ric_IndicationMessageFormat_Type = ranFuncDb->ricIndicationMessageFormat;
+
+ /* Measurement Info Action List */
+ CmLListCp measInfoList =ranFuncDb->reportStyleList[styleIdx].measurementInfoList;
+ if(!measInfoList.count)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements");
- break;
+ continue;
}
- for(arrIdx = 0; arrIdx < elementCnt; (arrIdx)++)
+
+ CM_LLIST_FIRST_NODE(&ranFuncDb->reportStyleList[styleIdx].measurementInfoList, node);
+ measInfo = &ricReportStyle->list.array[styleIdx]->measInfo_Action_List;
+
+ measInfo->list.count = measInfoList.count;
+ measInfo->list.size = measInfoList.count*sizeof(MeasurementInfo_Action_Item_t*);
+ DU_ALLOC(measInfo->list.array, measInfo->list.size);
+ if(!measInfo->list.array)
{
- DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx],\
- sizeof(E2setupRequestIEs_t));
- if(e2SetupReq->protocolIEs.list.array[arrIdx] == NULLP)
- {
- memAllocFailed = true;
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for arrayarrIdx [%d]", arrIdx);
- break;
- }
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
}
- if(memAllocFailed == true)
- break;
-
- arrIdx = 0;
-
- /* TransactionID */
- e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
- e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_TransactionID;
- transId = assignTransactionId();
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
-
- arrIdx++;
- /* GlobalE2node_gNB_ID */
- e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_GlobalE2node_ID;
- e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
- DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
- GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
- if(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
- GlobalE2node_ID.choice.gNB == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for gNbId");
- break;
- }
- else
+ for(measInfoIdx=0; measInfoIdx<measInfo->list.count; measInfoIdx++)
{
- ret = BuildGlobalgNBId(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
- choice.GlobalE2node_ID.choice.gNB);
- if(ret != ROK)
+ if(!node)
{
- DU_LOG("\nERROR --> E2AP : Failed to build Global Gnb Id");
- break;
+ DU_LOG("\nERROR --> E2AP: Measurement info node is null");
+ return RFAILED;
}
- }
-
- /* RAN Functions Added List */
- arrIdx++;
- e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RANfunctionsAdded;
- e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_RANfunctions_List;
- if(BuildRanFunctionAddList(&(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.RANfunctions_List), ProcedureCodeE2_id_E2setup, 0, NULL)!=ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to create RAN Function");
- break;
- }
-
- /* E2 Node Component Configuration Addition List */
- arrIdx++;
- e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition;
- e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_E2nodeComponentConfigAddition_List;
- if(BuildE2NodeConfigAddList(&(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List), ProcedureCodeE2_id_E2setup, 0, NULL)!=ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to create E2 Node config list");
- break;
- }
-
-
- /* Prints the Msg formed */
- 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 E2SetupRequest structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
- {
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupRequest\n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
+ DU_ALLOC(measInfo->list.array[measInfoIdx],sizeof(MeasurementInfo_Action_Item_t));
+ if(!measInfo->list.array[measInfoIdx])
{
- printf("%x",encBuf[i]);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
+ }
+ MeasurementInfoForAction *measInfoForAction= (MeasurementInfoForAction*)node->node;
+ DU_ALLOC(measInfo->list.array[measInfoIdx]->measID, sizeof(long));
+ if(!measInfo->list.array[measInfoIdx]->measID)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
+ }
+
+ memcpy(measInfo->list.array[measInfoIdx]->measID, &measInfoForAction->measurementTypeId,sizeof(long));
+ measInfo->list.array[measInfoIdx]->measName.size= strlen(measInfoForAction->measurementTypeName);
+ DU_ALLOC(measInfo->list.array[measInfoIdx]->measName.buf, measInfo->list.array[measInfoIdx]->measName.size);
+ if(!measInfo->list.array[measInfoIdx]->measName.size)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
}
-#endif
- }
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
- }
- break;
- }while(true);
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
-
- FreeE2SetupReq(e2apMsg);
- return ret;
-}/* End of BuildAndSendE2SetupReq */
+ memcpy(measInfo->list.array[measInfoIdx]->measName.buf, \
+ measInfoForAction->measurementTypeName,\
+ measInfo->list.array[measInfoIdx]->measName.size);
+ node = node->next;
+ }
+ }
+ return ROK;
+}
/*******************************************************************
*
- * @brief Builds RIC Action Admitted List
+ * @brief fill the ric event trigger style
*
* @details
*
- * Function : BuildRicActionAdmitList
+ * Function : fillRicEventTriggerStyle
*
- * Functionality: Builds RIC Action Admitted List
+ * Functionality: fill the ric event trigger style
*
- * @params[in] Pointer to RIC Action Admitted List to be filled
- * Subscription Response information
+ * @params[in]
* @return ROK - success
* RFAILED - failure
*
- * ****************************************************************/
-uint8_t BuildRicActionAdmitList(RICaction_Admitted_List_t *admitList, PendingSubsRspInfo *subsRspInfo)
+ ******************************************************************/
+uint8_t fillRicEventTriggerStyle(RanFunction *ranFuncDb, struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List *ricEventTriggerStyle)
{
- uint8_t idx = 0;
- uint8_t elementCnt = 0;
- RICaction_Admitted_ItemIEs_t *admitItem = NULLP;
-
- elementCnt = subsRspInfo->numOfAcceptedActions;
-
- admitList->list.count = elementCnt;
- admitList->list.size = elementCnt * sizeof(RICaction_Admitted_ItemIEs_t *);
+ uint8_t styleIdx;
- DU_ALLOC(admitList->list.array, admitList->list.size);
- if(admitList->list.array == NULLP)
+ ricEventTriggerStyle->list.count = ranFuncDb->numOfEventTriggerStyleSupported;
+ ricEventTriggerStyle->list.size = ricEventTriggerStyle->list.count* sizeof(RIC_EventTriggerStyle_Item_t *);
+ DU_ALLOC(ricEventTriggerStyle->list.array, ricEventTriggerStyle->list.size);
+ if(!ricEventTriggerStyle->list.array)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed for ric_EventTriggerStyle_List %d",__LINE__);
return RFAILED;
}
- for(idx=0; idx<elementCnt; idx++)
+ for(styleIdx =0;styleIdx<ricEventTriggerStyle->list.count; styleIdx++)
{
- DU_ALLOC(admitList->list.array[idx], sizeof(RICaction_Admitted_ItemIEs_t));
- if(admitList->list.array[idx] == NULLP)
+ DU_ALLOC(ricEventTriggerStyle->list.array[styleIdx], sizeof(RIC_EventTriggerStyle_Item_t ));
+ if(!ricEventTriggerStyle->list.array[styleIdx])
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
return RFAILED;
}
+ ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Type = ranFuncDb->eventTriggerStyleList[styleIdx].styleType;
- admitItem = (RICaction_Admitted_ItemIEs_t *)admitList->list.array[idx];
- admitItem->id = ProtocolIE_IDE2_id_RICaction_Admitted_Item;
- admitItem->criticality = CriticalityE2_reject;
- admitItem->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
- admitItem->value.choice.RICaction_Admitted_Item.ricActionID = subsRspInfo->acceptedActionList[idx];
+ ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerFormat_Type = ranFuncDb->eventTriggerStyleList[styleIdx].formatType;
+
+ ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size = strlen(ranFuncDb->eventTriggerStyleList[styleIdx].name);
+ DU_ALLOC(ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf,\
+ ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size);
+ if(!ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ return RFAILED;
+ }
+ memcpy(ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.buf,ranFuncDb->eventTriggerStyleList[styleIdx].name,\
+ ricEventTriggerStyle->list.array[styleIdx]->ric_EventTriggerStyle_Name.size);
+
}
return ROK;
}
/*******************************************************************
*
- * @brief Builds RIC Action Not Admitted List
+ * @brief Builds Ran function item
*
* @details
*
- * Function : BuildRicActionNotAdmitList
+ * Function : BuildRanFunctionItem
*
- * Functionality: Builds RIC Action Not Admitted List
+ * Functionality: Building RAN function item
*
- * @params[in] Pointer to RIC Action Not Admitted List to be filled
- * Subscription Response information
+ * @params[in]
+ * RAN function item that has to be filled
+ * Stored RAN Function information
* @return ROK - success
* RFAILED - failure
*
- * ****************************************************************/
-uint8_t BuildRicActionNotAdmitList(RICaction_NotAdmitted_List_t *notAdmitList, PendingSubsRspInfo *subsRspInfo)
-{
- uint8_t idx = 0;
- uint8_t elementCnt = 0;
- RICaction_NotAdmitted_ItemIEs_t *notAdmitItem = NULLP;
+ ******************************************************************/
- elementCnt = subsRspInfo->numOfRejectedActions;
+uint8_t BuildRanFunctionItem(RANfunction_Item_t *ranFuncItem, RanFunction *ranFuncDb)
+{
+ uint8_t ret =RFAILED;
+ RANfunctionDefinition_t *ranFunctionDefinition;
+ RANfunction_Name_t *ranFuncName;
+ asn_enc_rval_t encRetVal;
+ E2SM_KPM_RANfunction_Description_t *ranFuncDefinition;
+
+ while(true)
+ {
+ /* RAN function Id*/
+ ranFuncItem->ranFunctionID = ranFuncDb->id;
- notAdmitList->list.count = elementCnt;
- notAdmitList->list.size = elementCnt * sizeof(RICaction_NotAdmitted_ItemIEs_t *);
+ /* RAN Function Revision*/
+ ranFuncItem->ranFunctionRevision = ranFuncDb->revisionCounter;
- DU_ALLOC(notAdmitList->list.array, notAdmitList->list.size);
- if(notAdmitList->list.array == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
- return RFAILED;
- }
+ /* RAN function OID*/
+ ranFuncItem->ranFunctionOID.size = strlen(ranFuncDb->name.serviceModelOID);
+ DU_ALLOC(ranFuncItem->ranFunctionOID.buf, ranFuncItem->ranFunctionOID.size);
+ if(!ranFuncItem->ranFunctionOID.buf)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+ memcpy(ranFuncItem->ranFunctionOID.buf, ranFuncDb->name.serviceModelOID, ranFuncItem->ranFunctionOID.size);
- for(idx=0; idx<elementCnt; idx++)
- {
- DU_ALLOC(notAdmitList->list.array[idx], sizeof(RICaction_NotAdmitted_ItemIEs_t));
- if(notAdmitList->list.array[idx] == NULLP)
+ /* RAN function Definition */
+ DU_ALLOC(ranFuncDefinition, sizeof(E2SM_KPM_RANfunction_Description_t));
+ if(!ranFuncDefinition)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
}
- notAdmitItem = (RICaction_NotAdmitted_ItemIEs_t *)notAdmitList->list.array[idx];
- notAdmitItem->id = ProtocolIE_IDE2_id_RICaction_NotAdmitted_Item;
- notAdmitItem->criticality = CriticalityE2_reject;
- notAdmitItem->value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;
- notAdmitItem->value.choice.RICaction_NotAdmitted_Item.ricActionID = \
- subsRspInfo->rejectedActionList[idx].id;
- fillE2Cause(¬AdmitItem->value.choice.RICaction_NotAdmitted_Item.cause, \
- subsRspInfo->rejectedActionList[idx].failureCause);
- }
- return ROK;
-}
+ /* RAN function Name */
+ ranFuncName = &ranFuncDefinition->ranFunction_Name;
-/*******************************************************************
- *
- * @breif Deallocation of BuildAndSendRicSubscriptionRsp memory
- *
- * @details
- *
- * Function : FreeRicSubscriptionRsp
- *
- * Functionality:Free the RicSubscriptionRsp
- *
- * @param[in] E2AP_PDU_t *e2apRicMsg
- *
- * @return void
- *
- ******************************************************************/
-void FreeRicSubscriptionRsp(E2AP_PDU_t *e2apRicMsg)
-{
- RICsubscriptionResponse_t *ricSubscriptionRsp= NULLP;
- uint8_t idx=0;
- uint8_t listIdx=0;
- RICaction_Admitted_List_t *admitList = NULLP;
- RICaction_NotAdmitted_List_t *notAdmitList = NULLP;
+ /* RAN function ShortName */
+ ranFuncName->ranFunction_ShortName.size = strlen(ranFuncDb->name.shortName);
+ DU_ALLOC(ranFuncName->ranFunction_ShortName.buf, ranFuncName->ranFunction_ShortName.size);
+ if(!ranFuncName->ranFunction_ShortName.buf)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+ memcpy(ranFuncName->ranFunction_ShortName.buf, ranFuncDb->name.shortName, strlen(ranFuncDb->name.shortName));
- if(e2apRicMsg != NULLP)
- {
- if(e2apRicMsg->choice.successfulOutcome != NULLP)
+ /* RAN function E2SM_OID */
+ ranFuncName->ranFunction_E2SM_OID.size = strlen(ranFuncDb->name.serviceModelOID);
+ DU_ALLOC(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncName->ranFunction_E2SM_OID.size);
+ if(!ranFuncName->ranFunction_E2SM_OID.buf)
{
- ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
- if(ricSubscriptionRsp)
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+ memcpy(ranFuncName->ranFunction_E2SM_OID.buf, ranFuncDb->name.serviceModelOID, ranFuncName->ranFunction_E2SM_OID.size);
+
+ /* RAN Function Name Description */
+ ranFuncName->ranFunction_Description.size = strlen(ranFuncDb->name.description);
+ DU_ALLOC(ranFuncName->ranFunction_Description.buf, ranFuncName->ranFunction_Description.size);
+ if(!ranFuncName->ranFunction_Description.buf)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+ memcpy(ranFuncName->ranFunction_Description.buf, ranFuncDb->name.description, ranFuncName->ranFunction_Description.size);
+
+ /* RIC Event Trigger Style List */
+ DU_ALLOC(ranFuncDefinition->ric_EventTriggerStyle_List, sizeof(struct E2SM_KPM_RANfunction_Description__ric_EventTriggerStyle_List));
+ if(!ranFuncDefinition->ric_EventTriggerStyle_List)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+
+ if(fillRicEventTriggerStyle(ranFuncDb, ranFuncDefinition->ric_EventTriggerStyle_List)!=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP: failed to fill ric event trigger style");
+ break;
+ }
+
+ /* RIC Report Style List */
+ DU_ALLOC(ranFuncDefinition->ric_ReportStyle_List, sizeof(struct E2SM_KPM_RANfunction_Description__ric_ReportStyle_List));
+ if(!ranFuncDefinition->ric_ReportStyle_List)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in function %s at %d",__func__,__LINE__);
+ break;
+ }
+ if(fillRicReportStyle(ranFuncDb, ranFuncDefinition->ric_ReportStyle_List) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP: failed to fill ric report style");
+ break;
+ }
+
+ /* Encode the F1SetupRequest type as APER */
+ xer_fprint(stdout, &asn_DEF_E2SM_KPM_RANfunction_Description, ranFuncDefinition);
+
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2SM_KPM_RANfunction_Description, 0, ranFuncDefinition, PrepFinalEncBuf, encBuf);
+
+ /* Encode results */
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> F1AP : Could not encode RAN function definition (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RAN function definition \n");
+ for(uint8_t measIeIdx=0; measIeIdx< encBufSize; measIeIdx++)
{
- if(ricSubscriptionRsp->protocolIEs.list.array != NULLP)
- {
- for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
- {
- if(ricSubscriptionRsp->protocolIEs.list.array[idx] != NULLP)
- {
- switch(ricSubscriptionRsp->protocolIEs.list.array[idx]->id)
- {
- case ProtocolIE_IDE2_id_RICactions_Admitted:
- {
- admitList = &ricSubscriptionRsp->protocolIEs.list.\
- array[idx]->value.choice.RICaction_Admitted_List;
- if(admitList->list.array != NULLP)
- {
- for(listIdx=0 ; listIdx < admitList->list.count; listIdx++)
- {
- DU_FREE(admitList->list.array[listIdx], sizeof(RICaction_Admitted_ItemIEs_t));
- }
- DU_FREE(admitList->list.array, admitList->list.size);
- }
- break;
- }
- case ProtocolIE_IDE2_id_RICactions_NotAdmitted:
- {
- notAdmitList = &ricSubscriptionRsp->protocolIEs.list.\
- array[idx]->value.choice.RICaction_NotAdmitted_List;
- if(notAdmitList->list.array != NULLP)
- {
- for(listIdx=0 ; listIdx < notAdmitList->list.count; listIdx++)
- {
- DU_FREE(notAdmitList->list.array[listIdx], sizeof(RICaction_NotAdmitted_ItemIEs_t));
- }
- DU_FREE(notAdmitList->list.array, notAdmitList->list.size);
- }
- break;
- }
- default:
- break;
- }
- DU_FREE(ricSubscriptionRsp->protocolIEs.list.array[idx], sizeof(RICsubscriptionResponse_IEs_t));
- }
- }
- DU_FREE(ricSubscriptionRsp->protocolIEs.list.array, ricSubscriptionRsp->protocolIEs.list.size);
- }
- }
- DU_FREE(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
- }
- DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
+ printf("%x",encBuf[measIeIdx]);
+ }
+ ranFunctionDefinition = &ranFuncItem->ranFunctionDefinition;
+ ranFunctionDefinition->size = encBufSize;
+ DU_ALLOC(ranFunctionDefinition->buf, encBufSize);
+ if(ranFunctionDefinition->buf == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed for RAN function definition buffer");
+ break;
+ }
+ memcpy(ranFunctionDefinition->buf, &encBuf, encBufSize);
+ ret = ROK;
+ break;
+ }
}
+ freeE2smKpmRanFunctionDefinition(ranFuncDefinition);
+ return ret;
}
/*******************************************************************
*
- * @brief Fill RIC Subscription Response IEs
+ * @brief Builds Ran function add list based on the procedure code
*
* @details
*
- * Function : fillRicSubscriptionRsp
+ * Function : BuildRanFunctionAddList
*
- * functionality: Fill RIC Subscription Response IEs
+ * Functionality: Building RAN addition addition list
+ * In case of ProcedureCodeE2_id_E2setup we add all the RAN Function list
+ * which is present in E2 database.
+ * In the case of other procedures, we just fill the RAN functions whose ID
+ * is contained in recvList
+ *
+ * @params[in]
+ * RAN Function list
+ * Procedure code
+ * Count of ran functions to be added in the list
+ * Received list of RAN functions
*
- * @param Pointer to RIC subscription response
- * Subscription response information
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillRicSubscriptionRsp(RICsubscriptionResponse_t *ricSubscriptionRsp, PendingSubsRspInfo *subsRspInfo)
+
+uint8_t BuildRanFunctionAddList(RANfunctions_List_t *ranFunctionsList, uint8_t procedureCode, uint8_t count, RanFuncInfo *recvList)
{
- uint8_t ieIdx = 0;
- uint8_t elementCnt = 0;
- RICsubscriptionResponse_IEs_t *subsRspIe = NULLP;
+ uint16_t id;
+ RanFunction *ranFuncDb;
+ uint8_t ranFuncIdx;
+ RANfunction_ItemIEs_t *ranFuncItemIe;
+
+ /* For ProcedureCodeE2_id_E2setup, the number of RAN function list items is
+ * equal to the number of ran function entries stored in the database.
+ * For any other procedure, the RAN function list count is equal
+ * to the count of ran functions obtained from the function's caller */
- elementCnt = 3;
- if(subsRspInfo->numOfRejectedActions)
- elementCnt++;
+ if(procedureCode == ProcedureCodeE2_id_E2setup)
+ ranFunctionsList->list.count = duCb.e2apDb.numOfRanFunction;
+ else
+ ranFunctionsList->list.count = count;
- ricSubscriptionRsp->protocolIEs.list.count = elementCnt;
- ricSubscriptionRsp->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionResponse_IEs_t);
- DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array, ricSubscriptionRsp->protocolIEs.list.size);
- if(ricSubscriptionRsp->protocolIEs.list.array == NULLP)
+ ranFunctionsList->list.size = ranFunctionsList->list.count * sizeof(RANfunction_ItemIEs_t*);
+ DU_ALLOC(ranFunctionsList->list.array, ranFunctionsList->list.size);
+ if(ranFunctionsList->list.array == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at %s : line %d", __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
return RFAILED;
}
- for(ieIdx=0; ieIdx<ricSubscriptionRsp->protocolIEs.list.count; ieIdx++)
+ for(ranFuncIdx = 0; ranFuncIdx< ranFunctionsList->list.count; ranFuncIdx++)
{
- DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionResponse_IEs_t));
- if(ricSubscriptionRsp->protocolIEs.list.array[ieIdx] == NULLP)
+ DU_ALLOC(ranFunctionsList->list.array[ranFuncIdx], sizeof(RANfunction_ItemIEs_t));
+ if(ranFunctionsList->list.array[ranFuncIdx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d] : ieIdx [%d]", __func__, __LINE__,ieIdx);
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
return RFAILED;
}
+ if(procedureCode == ProcedureCodeE2_id_E2setup)
+ {
+ /* Getting all of the RAN function's information from DuCb one by one*/
+ ranFuncDb = &duCb.e2apDb.ranFunction[ranFuncIdx];
+ }
+ else
+ {
+ /* Getting only the RAN function information from DuCb whose Id is
+ * present in the received array */
+ id =recvList[ranFuncIdx].id;
+ ranFuncDb = &duCb.e2apDb.ranFunction[id-1];
+ }
+ ranFuncItemIe = (RANfunction_ItemIEs_t *) ranFunctionsList->list.array[ranFuncIdx];
+ ranFuncItemIe->id = ProtocolIE_IDE2_id_RANfunction_Item;
+ ranFuncItemIe->criticality = CriticalityE2_ignore;
+ ranFuncItemIe->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
+ BuildRanFunctionItem(&ranFuncItemIe->value.choice.RANfunction_Item, ranFuncDb);
}
+ return ROK;
+}
- /* RIC Request ID */
- ieIdx=0;
- subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
- subsRspIe->id = ProtocolIE_IDE2_id_RICrequestID;
- subsRspIe->criticality = CriticalityE2_reject;
- subsRspIe->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID;
- subsRspIe->value.choice.RICrequestID.ricRequestorID = subsRspInfo->requestId.requestorId;
- subsRspIe->value.choice.RICrequestID.ricInstanceID = subsRspInfo->requestId.instanceId;
-
- /* RAN Function ID */
- ieIdx++;
- subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
- subsRspIe->id = ProtocolIE_IDE2_id_RANfunctionID;
- subsRspIe->criticality = CriticalityE2_reject;
- subsRspIe->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
- subsRspIe->value.choice.RANfunctionID = subsRspInfo->ranFuncId;
+/*******************************************************************
+ *
+ * @brief De Allocate E2 Setup Request Message
+ *
+ * @details
+ *
+ * Function : FreeE2SetupReq
+ *
+ * Functionality: De-Allocating E2 Setup request Message
+ *
+ * @params[in] E2AP_PDU_t *e2apMsg
+
+ * @return void
+ *
+ * ****************************************************************/
- /* RIC Action Admitted List */
- ieIdx++;
- subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
- subsRspIe->id = ProtocolIE_IDE2_id_RICactions_Admitted;
- subsRspIe->criticality = CriticalityE2_reject;
- subsRspIe->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
- if(BuildRicActionAdmitList(&subsRspIe->value.choice.RICaction_Admitted_List, subsRspInfo) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill RIC Action Admitted List in RIC Subscription Response");
- return RFAILED;
- }
+void FreeE2SetupReq(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx = 0;
+ uint8_t e2NodeAddListIdx =0, ranFuncAddListIdx;
+ E2setupRequest_t *e2SetupReq;
+ E2nodeComponentConfigAddition_List_t *e2NodeAddList;
+ E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItem;
+ RANfunctions_List_t *ranFunctionsList;
+ RANfunction_ItemIEs_t *ranFuncItemIe;
+ RANfunction_Item_t *ranFunItem;
- /* RIC Action Not Admitted List */
- if(subsRspInfo->numOfRejectedActions)
+ /* De-allocating Memory */
+ if(e2apMsg != NULLP)
{
- ieIdx++;
- subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
- subsRspIe->id = ProtocolIE_IDE2_id_RICactions_NotAdmitted;
- subsRspIe->criticality = CriticalityE2_reject;
- subsRspIe->criticality = CriticalityE2_reject;
- subsRspIe->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
- if(BuildRicActionNotAdmitList(&subsRspIe->value.choice.RICaction_NotAdmitted_List, subsRspInfo) != ROK)
+ if(e2apMsg->choice.initiatingMessage != NULLP)
{
- DU_LOG("\nERROR --> E2AP : Failed to fill RIC Action Not Admitted List in RIC Subscription Response");
- return RFAILED;
+ e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
+ if(e2SetupReq->protocolIEs.list.array != NULLP)
+ {
+ for(arrIdx = 0; arrIdx < e2SetupReq->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2SetupReq->protocolIEs.list.array[arrIdx] != NULLP)
+ {
+ switch(e2SetupReq->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+ case ProtocolIE_IDE2_id_GlobalE2node_ID:
+ {
+ if(e2SetupReq->protocolIEs.list.array[arrIdx]->\
+ value.choice.GlobalE2node_ID.choice.gNB != NULLP)
+ {
+ GlobalE2node_gNB_ID_t *gNbId = NULLP;
+ gNbId = e2SetupReq->protocolIEs.list.array[arrIdx]->\
+ value.choice.GlobalE2node_ID.choice.gNB;
+ if(gNbId->global_gNB_ID.plmn_id.buf != NULLP)
+ {
+ DU_FREE(gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.buf,\
+ gNbId->global_gNB_ID.gnb_id.choice.gnb_ID.size);
+ DU_FREE(gNbId->global_gNB_ID.plmn_id.buf,\
+ gNbId->global_gNB_ID.plmn_id.size);
+ }
+
+ if(gNbId->gNB_DU_ID != NULLP)
+ {
+ DU_FREE( gNbId->gNB_DU_ID->buf, gNbId->gNB_DU_ID->size);
+ DU_FREE(gNbId->gNB_DU_ID, sizeof(GNB_DU_ID_t));
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
+ choice.GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAddition:
+ {
+ e2NodeAddList = &e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List;
+ if(e2NodeAddList->list.array)
+ {
+ for(e2NodeAddListIdx = 0; e2NodeAddListIdx< e2NodeAddList->list.count; e2NodeAddListIdx++)
+ {
+ e2NodeAddItem = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[e2NodeAddListIdx];
+
+ /* Free E2 Node Component Request Part */
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentRequestPart.size);
+
+ /* Free E2 Node Component Response Part */
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.\
+ e2nodeComponentResponsePart.buf, \
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration.e2nodeComponentResponsePart.size);
+
+ /* Free E2 Node Component ID */
+ if(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1)
+ {
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf,\
+ e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
+ DU_FREE(e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1,\
+ sizeof(E2nodeComponentInterfaceF1_t));
+ }
+ DU_FREE(e2NodeAddList->list.array[e2NodeAddListIdx], sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
+ }
+ DU_FREE(e2NodeAddList->list.array, e2NodeAddList->list.size);
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_RANfunctionsAdded:
+ {
+ ranFunctionsList = &(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.RANfunctions_List);
+ if(ranFunctionsList->list.array)
+ {
+ for(ranFuncAddListIdx= 0; ranFuncAddListIdx< ranFunctionsList->list.count; ranFuncAddListIdx++)
+ {
+ if(ranFunctionsList->list.array[ranFuncAddListIdx])
+ {
+ ranFuncItemIe = (RANfunction_ItemIEs_t *) ranFunctionsList->list.array[ranFuncAddListIdx];
+ ranFunItem = &ranFuncItemIe->value.choice.RANfunction_Item;
+ DU_FREE(ranFunItem->ranFunctionOID.buf, ranFunItem->ranFunctionOID.size);
+ DU_FREE(ranFunItem->ranFunctionDefinition.buf, ranFunItem->ranFunctionDefinition.size);
+ DU_FREE(ranFunctionsList->list.array[ranFuncAddListIdx], sizeof(RANfunction_ItemIEs_t));
+ }
+ }
+ DU_FREE(ranFunctionsList->list.array, ranFunctionsList->list.size);
+ }
+ break;
+ }
+
+ default:
+ DU_LOG("\nERROR --> E2AP: Invalid event at e2SetupRequet %ld ",\
+ (e2SetupReq->protocolIEs.list.array[arrIdx]->id));
+ break;
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array[arrIdx], sizeof(E2setupRequestIEs_t));
+ }
+ }
+ DU_FREE(e2SetupReq->protocolIEs.list.array, e2SetupReq->protocolIEs.list.size);
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
-
- return ROK;
}
/*******************************************************************
*
- * @brief Builds and Send the RicSubscriptionRsp
+ * @brief Builds and Send the E2SetupRequest
*
* @details
*
- * Function : BuildAndSendRicSubscriptionRsp
+ * Function : BuildAndSendE2SetupReq
*
- * Functionality:Fills the RicSubscriptionRsp
+ * Functionality:Fills the E2SetupRequest
*
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t BuildAndSendRicSubscriptionRsp(PendingSubsRspInfo *subsRspInfo)
+uint8_t BuildAndSendE2SetupReq()
{
- uint8_t ret = RFAILED;
- E2AP_PDU_t *e2apRicMsg = NULLP;
- RICsubscriptionResponse_t *ricSubscriptionRsp=NULLP;
- asn_enc_rval_t encRetVal;
+ uint8_t arrIdx = 0, elementCnt=0;
+ uint8_t transId = 0, ret = RFAILED;
+ bool memAllocFailed = false;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ E2setupRequest_t *e2SetupReq = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- while(true)
+ DU_LOG("\nINFO --> E2AP : Building E2 Setup Request\n");
+ do
{
- DU_LOG("\nINFO --> E2AP : Building RIC Subscription Response\n");
-
- DU_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t));
- if(e2apRicMsg == NULLP)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
break;
}
-
- e2apRicMsg->present = E2AP_PDU_PR_successfulOutcome;
- DU_ALLOC(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
- if(e2apRicMsg->choice.successfulOutcome == NULLP)
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for RIC subscription Response failed");
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
break;
}
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2setup;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2setupRequest;
+ e2SetupReq = &e2apMsg->choice.initiatingMessage->value.choice.E2setupRequest;
- e2apRicMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
- e2apRicMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
- e2apRicMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse;
-
- ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
+ elementCnt = 4;
+ e2SetupReq->protocolIEs.list.count = elementCnt;
+ e2SetupReq->protocolIEs.list.size = elementCnt * sizeof(E2setupRequestIEs_t*);
- if(fillRicSubscriptionRsp(ricSubscriptionRsp, subsRspInfo) != ROK)
+ /* Initialize the E2Setup members */
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array, \
+ e2SetupReq->protocolIEs.list.size);
+ if(e2SetupReq->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for RICsubscriptionResponseIE failed");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for array elements");
break;
}
+ for(arrIdx = 0; arrIdx < elementCnt; (arrIdx)++)
+ {
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx],\
+ sizeof(E2setupRequestIEs_t));
+ if(e2SetupReq->protocolIEs.list.array[arrIdx] == NULLP)
+ {
+ memAllocFailed = true;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for arrayarrIdx [%d]", arrIdx);
+ break;
+ }
+ }
+ if(memAllocFailed == true)
+ break;
- /* Prints the Msg formed */
- xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apRicMsg);
+ arrIdx = 0;
- memset(encBuf, 0, ENC_BUF_MAX_LEN);
- encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apRicMsg, PrepFinalEncBuf, encBuf);
- if(encRetVal.encoded == ENCODE_FAIL)
+ /* TransactionID */
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
+
+ arrIdx++;
+ /* GlobalE2node_gNB_ID */
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_GlobalE2node_ID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_GlobalE2node_ID;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
+
+ DU_ALLOC(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
+ GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+ if(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.\
+ GlobalE2node_ID.choice.gNB == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Could not encode RIC Subscription Response structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for gNbId");
break;
}
else
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC subscription response \n");
+ ret = BuildGlobalgNBId(e2SetupReq->protocolIEs.list.array[arrIdx]->value.\
+ choice.GlobalE2node_ID.choice.gNB);
+ if(ret != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build Global Gnb Id");
+ break;
+ }
+ }
+
+ /* RAN Functions Added List */
+ arrIdx++;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_RANfunctionsAdded;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_RANfunctions_List;
+ if(BuildRanFunctionAddList(&(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.RANfunctions_List), ProcedureCodeE2_id_E2setup, 0, NULL)!=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to create RAN Function");
+ break;
+ }
+
+ /* E2 Node Component Configuration Addition List */
+ arrIdx++;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2SetupReq->protocolIEs.list.array[arrIdx]->value.present = E2setupRequestIEs__value_PR_E2nodeComponentConfigAddition_List;
+ if(BuildE2NodeConfigAddList(&(e2SetupReq->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List), ProcedureCodeE2_id_E2setup, 0, NULL)!=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to create E2 Node config list");
+ break;
+ }
+
+
+
+ /* Prints the Msg formed */
+ 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 E2SetupRequest structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SetupRequest\n");
#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
printf("%x",encBuf[i]);
- }
+ }
#endif
- }
-
+ }
if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
- DU_LOG("\nERROR --> E2AP : Sending RIC Subscription Response failed");
- break;
+ DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
}
-
- ret = ROK;
break;
+ }while(true);
- }
-
- FreeRicSubscriptionRsp(e2apRicMsg);
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+
+ FreeE2SetupReq(e2apMsg);
return ret;
-}
+}/* End of BuildAndSendE2SetupReq */
-/******************************************************************
+/*******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for e2 setup response
+ * @brief Builds RIC Action Admitted List
*
* @details
*
- * Function : freeAperDecodingOfE2SetupRsp
+ * Function : BuildRicActionAdmitList
*
- * Functionality: Deallocation of memory allocated by aper decoder for e2
- * setup response
+ * Functionality: Builds RIC Action Admitted List
*
- * @params[in] E2setupResponse_t *e2SetRspMsg;
- * @return void
+ * @params[in] Pointer to RIC Action Admitted List to be filled
+ * Subscription Response information
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-void freeAperDecodingOfE2SetupRsp(E2setupResponse_t *e2SetRspMsg)
+uint8_t BuildRicActionAdmitList(RICaction_Admitted_List_t *admitList, PendingSubsRspInfo *subsRspInfo)
{
- uint8_t arrIdx, e2NodeConfigAddAckListIdx;
- E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAddAckItem;
- E2nodeComponentConfigAdditionAck_List_t *e2NodeConfigAddAckList;
+ uint8_t idx = 0;
+ uint8_t elementCnt = 0;
+ RICaction_Admitted_ItemIEs_t *admitItem = NULLP;
- if(e2SetRspMsg)
- {
- if(e2SetRspMsg->protocolIEs.list.array)
- {
- for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
- {
- if(e2SetRspMsg->protocolIEs.list.array[arrIdx])
- {
- switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
- {
- case ProtocolIE_IDE2_id_TransactionID:
- break;
+ elementCnt = subsRspInfo->numOfAcceptedActions;
- case ProtocolIE_IDE2_id_GlobalRIC_ID:
- {
- free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.pLMN_Identity.buf);
- free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID.buf);
- break;
- }
+ admitList->list.count = elementCnt;
+ admitList->list.size = elementCnt * sizeof(RICaction_Admitted_ItemIEs_t *);
- case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
- {
- e2NodeConfigAddAckList = &e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
- if(e2NodeConfigAddAckList->list.array )
- {
- for(e2NodeConfigAddAckListIdx = 0; e2NodeConfigAddAckListIdx< e2NodeConfigAddAckList->list.count; e2NodeConfigAddAckListIdx++)
- {
- if(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx])
- {
- e2NodeAddAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx];
- free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
- e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf);
- free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
- e2nodeComponentInterfaceTypeF1);
- free(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx]);
- }
- }
- free(e2NodeConfigAddAckList->list.array);
- }
- break;
- }
- }
- free(e2SetRspMsg->protocolIEs.list.array[arrIdx]);
- }
- }
- free(e2SetRspMsg->protocolIEs.list.array);
+ DU_ALLOC(admitList->list.array, admitList->list.size);
+ if(admitList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ for(idx=0; idx<elementCnt; idx++)
+ {
+ DU_ALLOC(admitList->list.array[idx], sizeof(RICaction_Admitted_ItemIEs_t));
+ if(admitList->list.array[idx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ return RFAILED;
}
+
+ admitItem = (RICaction_Admitted_ItemIEs_t *)admitList->list.array[idx];
+ admitItem->id = ProtocolIE_IDE2_id_RICaction_Admitted_Item;
+ admitItem->criticality = CriticalityE2_reject;
+ admitItem->value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
+ admitItem->value.choice.RICaction_Admitted_Item.ricActionID = subsRspInfo->acceptedActionList[idx];
}
+ return ROK;
}
-/******************************************************************
+
+/*******************************************************************
*
- * @brief Processes E2 Setup Response sent by RIC
+ * @brief Builds RIC Action Not Admitted List
*
* @details
*
- * Function : procE2SetupRsp
+ * Function : BuildRicActionNotAdmitList
*
- * Functionality: Processes E2 Setup Response sent by RIC
+ * Functionality: Builds RIC Action Not Admitted List
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
- * @return void
+ * @params[in] Pointer to RIC Action Not Admitted List to be filled
+ * Subscription Response information
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-
-void procE2SetupRsp(E2AP_PDU_t *e2apMsg)
+uint8_t BuildRicActionNotAdmitList(RICaction_NotAdmitted_List_t *notAdmitList, PendingSubsRspInfo *subsRspInfo)
{
- bool invalidTransId = false;
- uint8_t arrIdx =0, transId=0, idx=0;
- uint32_t recvBufLen;
- E2setupResponse_t *e2SetRspMsg=NULL;
- CmLList *node=NULL;
- E2NodeComponent *e2NodeComponentInfo=NULL;
- E2nodeComponentConfigAdditionAck_List_t *e2NodeCfgAckList=NULL;
- E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAddAckItem=NULL;
+ uint8_t idx = 0;
+ uint8_t elementCnt = 0;
+ RICaction_NotAdmitted_ItemIEs_t *notAdmitItem = NULLP;
- DU_LOG("\nINFO --> E2AP : E2 Setup Response received");
- duCb.e2Status = TRUE; //Set E2 status as true
- e2SetRspMsg = &e2apMsg->choice.successfulOutcome->value.choice.E2setupResponse;
+ elementCnt = subsRspInfo->numOfRejectedActions;
- for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
+ notAdmitList->list.count = elementCnt;
+ notAdmitList->list.size = elementCnt * sizeof(RICaction_NotAdmitted_ItemIEs_t *);
+
+ DU_ALLOC(notAdmitList->list.array, notAdmitList->list.size);
+ if(notAdmitList->list.array == NULLP)
{
- switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ for(idx=0; idx<elementCnt; idx++)
+ {
+ DU_ALLOC(notAdmitList->list.array[idx], sizeof(RICaction_NotAdmitted_ItemIEs_t));
+ if(notAdmitList->list.array[idx] == NULLP)
{
- case ProtocolIE_IDE2_id_TransactionID:
- {
- transId = e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
- (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
- invalidTransId = true;
- }
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- case ProtocolIE_IDE2_id_GlobalRIC_ID:
- {
- /* To store the Ric Id Params */
- recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value\
- .choice.GlobalRIC_ID.pLMN_Identity.size);
- memcpy(&duCb.e2apDb.ricId.plmnId, e2SetRspMsg->protocolIEs.list.array[arrIdx]\
- ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
- bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID, &duCb.e2apDb.ricId);
- /*TODO : duCb.e2apDb.ricId.plmnId memory to be deallocated after the usage */
- break;
- }
-
- case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
- {
- e2NodeCfgAckList = &e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
- for(idx =0; idx <e2NodeCfgAckList->list.count; idx++)
- {
- e2NodeAddAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeCfgAckList->list.array[idx];
- switch(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.present)
- {
- case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1:
- {
- e2NodeComponentInfo = fetchE2NodeComponentInfo(F1, E2_NODE_COMPONENT_ADD, &node);
- if(!e2NodeComponentInfo)
- {
- DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
- }
- else
- {
- cmLListDelFrm(&duCb.e2apDb.e2NodeComponentList, node);
- DU_FREE(e2NodeComponentInfo->componentRequestPart, e2NodeComponentInfo->reqBufSize);
- DU_FREE(e2NodeComponentInfo->componentResponsePart, e2NodeComponentInfo->rspBufSize);
- DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent));
- DU_FREE(node, sizeof(CmLList));
- }
- break;
- }
- default:
- break;
- }
- }
- break;
- }
-
- default:
- {
- DU_LOG("\nERROR --> E2AP : Invalid IE received in E2SetupRsp:%ld",
- e2SetRspMsg->protocolIEs.list.array[arrIdx]->id);
- break;
- }
- }
-
- if(invalidTransId == true)
- {
- break;
- }
- }
- freeAperDecodingOfE2SetupRsp(e2SetRspMsg);
-
- if(invalidTransId == false)
- {
- if(duSendE2NodeConfigurationUpdate() != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to send E2 node config update");
- }
- }
-}
+ notAdmitItem = (RICaction_NotAdmitted_ItemIEs_t *)notAdmitList->list.array[idx];
+ notAdmitItem->id = ProtocolIE_IDE2_id_RICaction_NotAdmitted_Item;
+ notAdmitItem->criticality = CriticalityE2_reject;
+ notAdmitItem->value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;
+ notAdmitItem->value.choice.RICaction_NotAdmitted_Item.ricActionID = \
+ subsRspInfo->rejectedActionList[idx].id;
+ fillE2Cause(¬AdmitItem->value.choice.RICaction_NotAdmitted_Item.cause, \
+ subsRspInfo->rejectedActionList[idx].failureCause);
+ }
+ return ROK;
+}
/*******************************************************************
*
- * @brief Free RIC Subscription Request
+ * @breif Deallocation of BuildAndSendRicSubscriptionRsp memory
*
* @details
*
- * Function : freeAperDecodingOfRicSubsReq
+ * Function : FreeRicSubscriptionRsp
*
- * Functionality : Free RIC Subscription Request
+ * Functionality:Free the RicSubscriptionRsp
*
- * @return void
+ * @param[in] E2AP_PDU_t *e2apRicMsg
*
+ * @return void
+ *
******************************************************************/
-void freeAperDecodingOfRicSubsReq(RICsubscriptionRequest_t *ricSubscriptionReq)
+void FreeRicSubscriptionRsp(E2AP_PDU_t *e2apRicMsg)
{
- uint8_t idx = 0;
- uint8_t elementIdx = 0;
- RICsubscriptionDetails_t *subsDetails = NULLP;
- RICaction_ToBeSetup_ItemIEs_t *actionItem = NULLP;
+ RICsubscriptionResponse_t *ricSubscriptionRsp= NULLP;
+ uint8_t idx=0;
+ uint8_t listIdx=0;
+ RICaction_Admitted_List_t *admitList = NULLP;
+ RICaction_NotAdmitted_List_t *notAdmitList = NULLP;
- if(ricSubscriptionReq->protocolIEs.list.array)
+ if(e2apRicMsg != NULLP)
{
- for(idx=0; idx < ricSubscriptionReq->protocolIEs.list.count; idx++)
+ if(e2apRicMsg->choice.successfulOutcome != NULLP)
{
- switch(ricSubscriptionReq->protocolIEs.list.array[idx]->id)
+ ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
+ if(ricSubscriptionRsp)
{
- case ProtocolIE_IDE2_id_RICsubscriptionDetails:
+ if(ricSubscriptionRsp->protocolIEs.list.array != NULLP)
+ {
+ for(idx=0; idx<ricSubscriptionRsp->protocolIEs.list.count; idx++)
{
- subsDetails = &(ricSubscriptionReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails);
- free(subsDetails->ricEventTriggerDefinition.buf);
-
- if(subsDetails->ricAction_ToBeSetup_List.list.array)
+ if(ricSubscriptionRsp->protocolIEs.list.array[idx] != NULLP)
{
- for(elementIdx = 0; elementIdx < subsDetails->ricAction_ToBeSetup_List.list.count; elementIdx++)
+ switch(ricSubscriptionRsp->protocolIEs.list.array[idx]->id)
{
- if(subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx])
- {
- actionItem = (RICaction_ToBeSetup_ItemIEs_t *)subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx];
- if(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition)
+ case ProtocolIE_IDE2_id_RICactions_Admitted:
{
- free(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf);
- free(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition);
+ admitList = &ricSubscriptionRsp->protocolIEs.list.\
+ array[idx]->value.choice.RICaction_Admitted_List;
+ if(admitList->list.array != NULLP)
+ {
+ for(listIdx=0 ; listIdx < admitList->list.count; listIdx++)
+ {
+ DU_FREE(admitList->list.array[listIdx], sizeof(RICaction_Admitted_ItemIEs_t));
+ }
+ DU_FREE(admitList->list.array, admitList->list.size);
+ }
+ break;
}
- free(subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx]);
- }
+ case ProtocolIE_IDE2_id_RICactions_NotAdmitted:
+ {
+ notAdmitList = &ricSubscriptionRsp->protocolIEs.list.\
+ array[idx]->value.choice.RICaction_NotAdmitted_List;
+ if(notAdmitList->list.array != NULLP)
+ {
+ for(listIdx=0 ; listIdx < notAdmitList->list.count; listIdx++)
+ {
+ DU_FREE(notAdmitList->list.array[listIdx], sizeof(RICaction_NotAdmitted_ItemIEs_t));
+ }
+ DU_FREE(notAdmitList->list.array, notAdmitList->list.size);
+ }
+ break;
+ }
+ default:
+ break;
}
- free(subsDetails->ricAction_ToBeSetup_List.list.array);
+ DU_FREE(ricSubscriptionRsp->protocolIEs.list.array[idx], sizeof(RICsubscriptionResponse_IEs_t));
}
- break;
}
- }
- free(ricSubscriptionReq->protocolIEs.list.array[idx]);
- }
- free(ricSubscriptionReq->protocolIEs.list.array);
+ DU_FREE(ricSubscriptionRsp->protocolIEs.list.array, ricSubscriptionRsp->protocolIEs.list.size);
+ }
+ }
+ DU_FREE(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ }
+ DU_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
}
}
/*******************************************************************
*
- * @brief Free Event Trigger Definition
+ * @brief Fill RIC Subscription Response IEs
*
* @details
*
- * Function : freeAperDecodingOfEventTriggerDef
+ * Function : fillRicSubscriptionRsp
*
- * Functionality: Free Event Trigger Definition
+ * functionality: Fill RIC Subscription Response IEs
*
- * @params[in] E2SM-KPM Event Trigger Definition
- * @return void
+ * @param Pointer to RIC subscription response
+ * Subscription response information
+ * @return ROK - success
+ * RFAILED - failure
*
- * ****************************************************************/
-void freeAperDecodingOfEventTriggerDef(E2SM_KPM_EventTriggerDefinition_t *eventTiggerDef)
+ ******************************************************************/
+uint8_t fillRicSubscriptionRsp(RICsubscriptionResponse_t *ricSubscriptionRsp, PendingSubsRspInfo *subsRspInfo)
{
- if(eventTiggerDef)
+ uint8_t ieIdx = 0;
+ uint8_t elementCnt = 0;
+ RICsubscriptionResponse_IEs_t *subsRspIe = NULLP;
+
+ elementCnt = 3;
+ if(subsRspInfo->numOfRejectedActions)
+ elementCnt++;
+
+ ricSubscriptionRsp->protocolIEs.list.count = elementCnt;
+ ricSubscriptionRsp->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionResponse_IEs_t);
+ DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array, ricSubscriptionRsp->protocolIEs.list.size);
+ if(ricSubscriptionRsp->protocolIEs.list.array == NULLP)
{
- switch(eventTiggerDef->eventDefinition_formats.present)
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at %s : line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ for(ieIdx=0; ieIdx<ricSubscriptionRsp->protocolIEs.list.count; ieIdx++)
+ {
+ DU_ALLOC(ricSubscriptionRsp->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionResponse_IEs_t));
+ if(ricSubscriptionRsp->protocolIEs.list.array[ieIdx] == NULLP)
{
- case E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_NOTHING:
- break;
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed at [%s] : line [%d] : ieIdx [%d]", __func__, __LINE__,ieIdx);
+ return RFAILED;
+ }
+ }
- case E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_eventDefinition_Format1:
- free(eventTiggerDef->eventDefinition_formats.choice.eventDefinition_Format1);
- break;
+ /* RIC Request ID */
+ ieIdx=0;
+ subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
+ subsRspIe->id = ProtocolIE_IDE2_id_RICrequestID;
+ subsRspIe->criticality = CriticalityE2_reject;
+ subsRspIe->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID;
+ subsRspIe->value.choice.RICrequestID.ricRequestorID = subsRspInfo->requestId.requestorId;
+ subsRspIe->value.choice.RICrequestID.ricInstanceID = subsRspInfo->requestId.instanceId;
+
+ /* RAN Function ID */
+ ieIdx++;
+ subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
+ subsRspIe->id = ProtocolIE_IDE2_id_RANfunctionID;
+ subsRspIe->criticality = CriticalityE2_reject;
+ subsRspIe->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
+ subsRspIe->value.choice.RANfunctionID = subsRspInfo->ranFuncId;
+
+ /* RIC Action Admitted List */
+ ieIdx++;
+ subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
+ subsRspIe->id = ProtocolIE_IDE2_id_RICactions_Admitted;
+ subsRspIe->criticality = CriticalityE2_reject;
+ subsRspIe->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
+ if(BuildRicActionAdmitList(&subsRspIe->value.choice.RICaction_Admitted_List, subsRspInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill RIC Action Admitted List in RIC Subscription Response");
+ return RFAILED;
+ }
+
+ /* RIC Action Not Admitted List */
+ if(subsRspInfo->numOfRejectedActions)
+ {
+ ieIdx++;
+ subsRspIe = ricSubscriptionRsp->protocolIEs.list.array[ieIdx];
+ subsRspIe->id = ProtocolIE_IDE2_id_RICactions_NotAdmitted;
+ subsRspIe->criticality = CriticalityE2_reject;
+ subsRspIe->criticality = CriticalityE2_reject;
+ subsRspIe->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
+ if(BuildRicActionNotAdmitList(&subsRspIe->value.choice.RICaction_NotAdmitted_List, subsRspInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill RIC Action Not Admitted List in RIC Subscription Response");
+ return RFAILED;
}
}
+
+ return ROK;
}
/*******************************************************************
*
- * @brief Extract E2SM-KPM Event trigger definition
+ * @brief Builds and Send the RicSubscriptionRsp
*
* @details
*
- * Function : extractEventTriggerDef
+ * Function : BuildAndSendRicSubscriptionRsp
*
- * Functionality : This function :
- * - Decodes E2SM-KPM Event Trigger Definition
- * - Validates that even trigger style is supported by E2 node
- * - Stores event trigger details in local DB
+ * Functionality:Fills the RicSubscriptionRsp
*
- * @params[in] RAN Function Database structure
- * RIC Subscription Info to be added to RAN function
- * RIC Event Trigger Definition buffer received from RIC
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t extractEventTriggerDef(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \
- RICeventTriggerDefinition_t *ricEventTriggerDef, E2FailureCause *failureCause)
-{
- uint8_t ret = RFAILED;
- uint8_t eventIdx = 0;
- asn_dec_rval_t rval ={0};
- E2SM_KPM_EventTriggerDefinition_t eventTiggerDef, *eventTiggerDefPtr = NULLP;
- /* Decoding E2SM-KPM Even Trigger Definition */
- eventTiggerDefPtr = &eventTiggerDef;
- memset(eventTiggerDefPtr, 0, sizeof(E2SM_KPM_EventTriggerDefinition_t));
+uint8_t BuildAndSendRicSubscriptionRsp(PendingSubsRspInfo *subsRspInfo)
+{
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apRicMsg = NULLP;
+ RICsubscriptionResponse_t *ricSubscriptionRsp=NULLP;
+ asn_enc_rval_t encRetVal;
- rval = aper_decode(0, &asn_DEF_E2SM_KPM_EventTriggerDefinition, (void **)&eventTiggerDefPtr, ricEventTriggerDef->buf,\
- ricEventTriggerDef->size, 0, 0);
- if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+ while(true)
{
- DU_LOG("\nERROR --> E2AP : ASN decode failed for E2SM-KPM Event Trigger Definition");
- failureCause->causeType = E2_PROTOCOL;
- failureCause->cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
- return RFAILED;
- }
- printf("\n");
- xer_fprint(stdout, &asn_DEF_E2SM_KPM_EventTriggerDefinition, eventTiggerDefPtr);
+ DU_LOG("\nINFO --> E2AP : Building RIC Subscription Response\n");
- /* Validating the received event trigger definition format */
- for(eventIdx = 0; eventIdx < ranFuncDb->numOfEventTriggerStyleSupported; eventIdx++)
- {
- if((eventTiggerDefPtr->eventDefinition_formats.present != \
- E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_NOTHING) && \
- (eventTiggerDefPtr->eventDefinition_formats.present == ranFuncDb->eventTriggerStyleList[eventIdx].formatType))
+ DU_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t));
+ if(e2apRicMsg == NULLP)
{
- ricSubscriptionInfo->eventTriggerDefinition.formatType = ranFuncDb->eventTriggerStyleList[eventIdx].formatType;
- ricSubscriptionInfo->eventTriggerDefinition.choice.format1.reportingPeriod = \
- eventTiggerDefPtr->eventDefinition_formats.choice.eventDefinition_Format1->reportingPeriod;
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
+ }
- ret = ROK;
+ e2apRicMsg->present = E2AP_PDU_PR_successfulOutcome;
+ DU_ALLOC(e2apRicMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ if(e2apRicMsg->choice.successfulOutcome == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for RIC subscription Response failed");
break;
}
- }
- if(ret == RFAILED)
- {
- failureCause->causeType = E2_RIC_REQUEST;
- failureCause->cause = E2_EVENT_TRIGGER_NOT_SUPPORTED;
+ e2apRicMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
+ e2apRicMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
+ e2apRicMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse;
+
+ ricSubscriptionRsp = &e2apRicMsg->choice.successfulOutcome->value.choice.RICsubscriptionResponse;
+
+ if(fillRicSubscriptionRsp(ricSubscriptionRsp, subsRspInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for RICsubscriptionResponseIE failed");
+ break;
+ }
+
+ /* Prints the Msg formed */
+ xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apRicMsg);
+
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apRicMsg, PrepFinalEncBuf, encBuf);
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> E2AP : Could not encode RIC Subscription Response structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC subscription response \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Sending RIC Subscription Response failed");
+ break;
+ }
+
+ ret = ROK;
+ break;
+
}
- /* Free E2SM_KPM_EventTriggerDefinition_t */
- freeAperDecodingOfEventTriggerDef(eventTiggerDefPtr);
+
+ FreeRicSubscriptionRsp(e2apRicMsg);
return ret;
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Free RIC Action Definition
+ * @brief Deallocation of memory allocated by aper decoder for e2 setup response
*
* @details
*
- * Function : freeAperDecodingOfRicActionDefinition
+ * Function : freeAperDecodingOfE2SetupRsp
*
- * Functionality: Free RIC Action Definition
+ * Functionality: Deallocation of memory allocated by aper decoder for e2
+ * setup response
*
- * @params[in] E2SM-KPM Action definition
+ * @params[in] E2setupResponse_t *e2SetRspMsg;
* @return void
*
* ****************************************************************/
-void freeAperDecodingOfRicActionDefinition(E2SM_KPM_ActionDefinition_t *actionDef)
+void freeAperDecodingOfE2SetupRsp(E2setupResponse_t *e2SetRspMsg)
{
- uint8_t elementIdx = 0;
- E2SM_KPM_ActionDefinition_Format1_t *actionFormat1 = NULLP;
- MeasurementInfoItem_t *measItem = NULLP;
+ uint8_t arrIdx, e2NodeConfigAddAckListIdx;
+ E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAddAckItem;
+ E2nodeComponentConfigAdditionAck_List_t *e2NodeConfigAddAckList;
- switch(actionDef->actionDefinition_formats.present)
+ if(e2SetRspMsg)
{
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1:
+ if(e2SetRspMsg->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
{
- if(actionDef->actionDefinition_formats.choice.actionDefinition_Format1)
+ if(e2SetRspMsg->protocolIEs.list.array[arrIdx])
{
- actionFormat1 = actionDef->actionDefinition_formats.choice.actionDefinition_Format1;
- if(actionFormat1->measInfoList.list.array)
+ switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
{
- for(elementIdx = 0; elementIdx < actionFormat1->measInfoList.list.count; elementIdx++)
- {
- if(actionFormat1->measInfoList.list.array[elementIdx])
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+
+ case ProtocolIE_IDE2_id_GlobalRIC_ID:
{
- measItem = actionFormat1->measInfoList.list.array[elementIdx];
- switch(measItem->measType.present)
- {
- case MeasurementType_PR_NOTHING:
- break;
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.pLMN_Identity.buf);
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID.buf);
+ break;
+ }
- case MeasurementType_PR_measName:
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ e2NodeConfigAddAckList = &e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
+ if(e2NodeConfigAddAckList->list.array )
+ {
+ for(e2NodeConfigAddAckListIdx = 0; e2NodeConfigAddAckListIdx< e2NodeConfigAddAckList->list.count; e2NodeConfigAddAckListIdx++)
{
- free(measItem->measType.choice.measName.buf);
- break;
+ if(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx])
+ {
+ e2NodeAddAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx];
+ free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf);
+ free(e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.\
+ e2nodeComponentInterfaceTypeF1);
+ free(e2NodeConfigAddAckList->list.array[e2NodeConfigAddAckListIdx]);
+ }
}
-
- case MeasurementType_PR_measID:
- break;
+ free(e2NodeConfigAddAckList->list.array);
}
- free(measItem);
+ break;
}
- }
- free(actionFormat1->measInfoList.list.array);
}
- free(actionFormat1);
+ free(e2SetRspMsg->protocolIEs.list.array[arrIdx]);
}
- break;
}
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format2:
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format3:
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format4:
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format5:
- default:
- break;
+ free(e2SetRspMsg->protocolIEs.list.array);
+ }
}
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Extract Measurement Info list from action definition
+ * @brief handling of e2 noe config update ack ies
*
* @details
*
- * Function : extractMeasInfoList
- *
- * Functionality : This function :
- * - Traverses Measurement-to-be-subscribed list
- * - Validates that each measurement in Measurement-to-be-subscribed
- * list is supported in RAN-Function->Measurement-supported list.
- * - If all measurements in an action is supported by RAN function,
- * it is added to measurement-subscribed list in local DB
+ * Function :handleE2NodeConfigUpdateAckIes
*
- * @params[in] Measurement Info supported list by RAN function
- * Measurement Info to be subscribed as requested by RIC
- * Measurement Info finally subscribed
- * Memory failure indicator
- * @return ROK - success
- * RFAILED - failure
+ * Functionality: handling of e2 noe config update ack ies
*
- ******************************************************************/
-uint8_t extractMeasInfoList(CmLListCp *measInfoSupportedList, MeasurementInfoList_t *measInfoToBeSubscribedList, \
- CmLListCp *measInfoSubscribedList, bool *memFailure)
+ * @params[in]
+ * Pointer to the E2 Node cfg
+ * Procedure code
+ * @return void
+******************************************************************/
+
+void handleE2NodeConfigUpdateAckIes(PTR e2NodeCfg, uint8_t procedureCode)
{
- uint8_t elementIdx = 0;
- MeasurementInfoForAction *measInfoSupportedDb = NULLP;
- MeasurementInfo *measInfoSubscribedDb = NULLP;
- CmLList *supportedMeasNode = NULLP, *measToAddNode = NULLP;
- MeasurementInfoItem_t *measItem = NULLP;
+ CmLList *node=NULLP;
+ E2NodeComponent *e2NodeComponentInfo=NULLP;
+ E2nodeComponentID_t *e2nodeComponentID=NULLP;
+ E2nodeComponentConfigRemovalAck_Item_t *removalAckItem=NULLP;
+ E2nodeComponentConfigUpdateAck_Item_t *updateAckItem=NULLP;
+ E2nodeComponentConfigAdditionAck_Item_t *additionAckItem=NULLP;
- /* Validate Measurement list is supported by E2 node.
- *
- * Traverse and compare the Measurement-Supported List in E2
- * node with Measurement-to-be-subscribed list received from RIC.
- * If a match is found, add it to measurement-subscription list.
- */
- for(elementIdx = 0; elementIdx < measInfoToBeSubscribedList->list.count; elementIdx++)
+ switch(procedureCode)
{
- measInfoSubscribedDb = NULLP;
- measToAddNode = NULLP;
- measItem = measInfoToBeSubscribedList->list.array[elementIdx];
-
- CM_LLIST_FIRST_NODE(measInfoSupportedList, supportedMeasNode);
- while(supportedMeasNode)
- {
- measInfoSupportedDb = (MeasurementInfoForAction*)supportedMeasNode->node;
- switch(measItem->measType.present)
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
{
- case MeasurementType_PR_measName:
- {
- if(!strcmp(measInfoSupportedDb->measurementTypeName, (char *)measItem->measType.choice.measName.buf))
- {
- DU_ALLOC(measInfoSubscribedDb, sizeof(MeasurementInfo));
- }
- break;
- }
-
- case MeasurementType_PR_measID:
- {
- if(measInfoSupportedDb->measurementTypeId == measItem->measType.choice.measID)
- {
- DU_ALLOC(measInfoSubscribedDb, sizeof(MeasurementInfo));
- }
- break;
- }
-
- default:
- {
- DU_LOG("\nERROR -> DUAPP: Invalid Measurement-type identifier in \
- E2SM-KPM Action Definition Format");
- break;
- }
- } /* End of switch, for measurement type identifier */
-
- /* If measurement type is supported, add to measurement-subscription list */
- if(measInfoSubscribedDb)
+ additionAckItem = (E2nodeComponentConfigAdditionAck_Item_t *)e2NodeCfg;
+ e2nodeComponentID = &additionAckItem->e2nodeComponentID;
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck:
{
- measInfoSubscribedDb->measurementTypeId = measInfoSupportedDb->measurementTypeId;
- memcpy(measInfoSubscribedDb->measurementTypeName, measInfoSupportedDb->measurementTypeName, \
- strlen(measInfoSupportedDb->measurementTypeName));
-
- DU_ALLOC(measToAddNode, sizeof(CmLList));
- if(measToAddNode)
- {
- measToAddNode->node = (PTR) measInfoSubscribedDb;
- cmLListAdd2Tail(measInfoSubscribedList, measToAddNode);
+ updateAckItem = (E2nodeComponentConfigUpdateAck_Item_t*) e2NodeCfg;
+ e2nodeComponentID = &updateAckItem->e2nodeComponentID;
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck:
+ {
+ removalAckItem= (E2nodeComponentConfigRemovalAck_Item_t*)e2NodeCfg;
+ e2nodeComponentID = &removalAckItem->e2nodeComponentID;
+ break;
+ }
+ }
- /* Break out of while loop if measurement info is found in measurement-supported list */
- break;
- }
- else
+ switch(e2nodeComponentID->present)
+ {
+ case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1:
+ {
+ e2NodeComponentInfo = fetchE2NodeComponentInfo(F1, e2nodeComponentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf[0], &node);
+ if(!e2NodeComponentInfo)
{
- DU_FREE(measInfoSubscribedDb, sizeof(MeasurementInfo));
- measInfoSubscribedDb = NULLP;
- *memFailure = true;
- break;
+ DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__);
+ return;
}
+ break;
}
-
- supportedMeasNode = supportedMeasNode->next;
-
- } /* End of while for traversing measurement-supported list in a report style */
-
- /* If a measurement-to-be-subscribed is not found in measurement-supported list in this report style
- * Then :
- * Delete all entries from measurement-subscription list and
- * Break out of for loop to search in next report style */
- if(!measInfoSubscribedDb)
- {
- deleteMeasurementInfoList(measInfoSubscribedList);
+ default:
break;
- }
-
- } /* End of for loop , traversing measurement-to-be-subscribed list */
-
- /* If all measurement-to-be-subscribed was found in measurement-supported list and
- * was added to measurement-subscription list successfully, return from here */
- if(measInfoToBeSubscribedList->list.count == measInfoSubscribedList->count)
- return ROK;
-
- return RFAILED;
+ }
+
+ switch(procedureCode)
+ {
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ DU_FREE(e2NodeComponentInfo->addConfiguration->componentRequestPart, e2NodeComponentInfo->addConfiguration->reqBufSize);
+ DU_FREE(e2NodeComponentInfo->addConfiguration->componentResponsePart, e2NodeComponentInfo->addConfiguration->rspBufSize);
+ DU_FREE(e2NodeComponentInfo->addConfiguration, sizeof(E2NodeConfig));
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck:
+ {
+ DU_FREE(e2NodeComponentInfo->updateConfiguration->componentRequestPart, e2NodeComponentInfo->updateConfiguration->reqBufSize);
+ DU_FREE(e2NodeComponentInfo->updateConfiguration->componentResponsePart, e2NodeComponentInfo->updateConfiguration->rspBufSize);
+ DU_FREE(e2NodeComponentInfo->updateConfiguration, sizeof(E2NodeConfig));
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck:
+ {
+ cmLListDelFrm(&duCb.e2apDb.e2NodeComponentList, node);
+ if(e2NodeComponentInfo->addConfiguration)
+ {
+ DU_FREE(e2NodeComponentInfo->addConfiguration->componentRequestPart, e2NodeComponentInfo->addConfiguration->reqBufSize);
+ DU_FREE(e2NodeComponentInfo->addConfiguration->componentResponsePart, e2NodeComponentInfo->addConfiguration->rspBufSize);
+ DU_FREE(e2NodeComponentInfo->addConfiguration, sizeof(E2NodeConfig));
+ }
+ if(e2NodeComponentInfo->updateConfiguration)
+ {
+ DU_FREE(e2NodeComponentInfo->updateConfiguration->componentRequestPart, e2NodeComponentInfo->updateConfiguration->reqBufSize);
+ DU_FREE(e2NodeComponentInfo->updateConfiguration->componentResponsePart, e2NodeComponentInfo->updateConfiguration->rspBufSize);
+ DU_FREE(e2NodeComponentInfo->updateConfiguration, sizeof(E2NodeConfig));
+ }
+ DU_FREE(node, sizeof(CmLList));
+ break;
+ }
+ }
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Extract E2SM-KPM Action definition
+ * @brief Processes E2 Setup Response sent by RIC
*
* @details
*
- * Function : extractRicActionDef
+ * Function : procE2SetupRsp
*
- * Functionality : This function :
- * - Decodes E2SM-KPM Action Definition
- * - Validates that action is supported by E2 node
- * - Stores action details in local DB
+ * Functionality: Processes E2 Setup Response sent by RIC
*
- * @params[in] RAN Function Database structure
- * RIC subscription's Action definition to be added to
- * RAN function
- * RIC Action Definition buffer received from RIC
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return void
*
- ******************************************************************/
-uint8_t extractRicActionDef(RanFunction *ranFuncDb, ActionDefinition *actionDefDb, RICactionDefinition_t *ricActionDef,\
- E2FailureCause *failureCause)
-{
- bool memFailure = false;
- uint8_t styleIdx = 0;
- asn_dec_rval_t rval ={0};
-
- E2SM_KPM_ActionDefinition_t actionDef, *actionDefPtr = NULLP;
- E2SM_KPM_ActionDefinition_Format1_t *actionFormat1 = NULLP;
- CmLListCp *measInfoSupportedList = NULLP;
- CmLListCp *measInfoSubscribedList = NULLP;
-
- /* Decoding E2SM-KPM Action Definition */
- actionDefPtr = &actionDef;
- memset(actionDefPtr, 0, sizeof(E2SM_KPM_EventTriggerDefinition_t));
+ * ****************************************************************/
- rval = aper_decode(0, &asn_DEF_E2SM_KPM_ActionDefinition, (void **)&actionDefPtr, ricActionDef->buf,\
- ricActionDef->size, 0, 0);
- if(rval.code == RC_FAIL || rval.code == RC_WMORE)
- {
- DU_LOG("\nERROR --> E2AP : ASN decode failed for E2SM-KPM Action Definition");
- failureCause->causeType = E2_PROTOCOL;
- failureCause->cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
- return RFAILED;
- }
- printf("\n");
- xer_fprint(stdout, &asn_DEF_E2SM_KPM_ActionDefinition, actionDefPtr);
+void procE2SetupRsp(E2AP_PDU_t *e2apMsg)
+{
+ bool invalidTransId = false;
+ uint8_t arrIdx =0, transId=0, idx=0;
+ uint32_t recvBufLen;
+ E2setupResponse_t *e2SetRspMsg=NULL;
+ E2nodeComponentConfigAdditionAck_List_t *e2NodeCfgAckList=NULL;
+ E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAddAckItem=NULL;
+ DU_LOG("\nINFO --> E2AP : E2 Setup Response received");
+ duCb.e2Status = TRUE; //Set E2 status as true
+ e2SetRspMsg = &e2apMsg->choice.successfulOutcome->value.choice.E2setupResponse;
- /* Validate if Report style to subscribe is supported by E2 Node */
- for(styleIdx= 0; styleIdx < ranFuncDb->numOfReportStyleSupported; styleIdx++)
+ for(arrIdx=0; arrIdx<e2SetRspMsg->protocolIEs.list.count; arrIdx++)
{
- /* Validate Report style type and report style format type is supported by E2 Node */
- if((ranFuncDb->reportStyleList[styleIdx].reportStyle.styleType == actionDefPtr->ric_Style_Type) &&
- (ranFuncDb->reportStyleList[styleIdx].reportStyle.formatType == actionDefPtr->actionDefinition_formats.present))
+ switch(e2SetRspMsg->protocolIEs.list.array[arrIdx]->id)
{
- /* Fetch Report stype type and format type */
- actionDefDb->styleType = actionDefPtr->ric_Style_Type;
- actionDefDb->formatType = actionDefPtr->actionDefinition_formats.present;
-
- switch(actionDefPtr->actionDefinition_formats.present)
- {
- case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1:
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
{
- actionFormat1 = actionDefPtr->actionDefinition_formats.choice.actionDefinition_Format1;
-
- /* Fetch granularity period */
- actionDefDb->choice.format1.granularityPeriod = actionFormat1->granulPeriod;
-
- /* Validate and add the Measurement to subscription list */
- measInfoSupportedList = &ranFuncDb->reportStyleList[styleIdx].measurementInfoList;
- measInfoSubscribedList = &actionDefDb->choice.format1.measurementInfoList;
- if(extractMeasInfoList(measInfoSupportedList, &actionFormat1->measInfoList, \
- measInfoSubscribedList, &memFailure) == ROK)
- {
- if(!memFailure)
- {
- /* Free E2SM_KPM_ActionDefinition_t */
- freeAperDecodingOfRicActionDefinition(actionDefPtr);
- return ROK;
- }
- }
-
- break; /* End of E2SM-KPM Action definition format 1 case */
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ invalidTransId = true;
}
+ break;
+ }
- default :
+ case ProtocolIE_IDE2_id_GlobalRIC_ID:
+ {
+ /* To store the Ric Id Params */
+ recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value\
+ .choice.GlobalRIC_ID.pLMN_Identity.size);
+ memcpy(&duCb.e2apDb.ricId.plmnId, e2SetRspMsg->protocolIEs.list.array[arrIdx]\
+ ->value.choice.GlobalRIC_ID.pLMN_Identity.buf, recvBufLen);
+ bitStringToInt(&e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.GlobalRIC_ID.ric_ID, &duCb.e2apDb.ricId);
+ /*TODO : duCb.e2apDb.ricId.plmnId memory to be deallocated after the usage */
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ e2NodeCfgAckList = &e2SetRspMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
+ for(idx =0; idx <e2NodeCfgAckList->list.count; idx++)
{
- DU_LOG("\nERROR -> DUAPP: Only E2SM-KPM Action Definition Format 1 is supported");
- break;
+ e2NodeAddAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeCfgAckList->list.array[idx];
+ handleE2NodeConfigUpdateAckIes((PTR)&e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item,\
+ ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck);
}
- } /* End of switch for E2SM-KPM Action definition formats */
+ break;
+ }
+
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in E2SetupRsp:%ld",
+ e2SetRspMsg->protocolIEs.list.array[arrIdx]->id);
+ break;
+ }
}
- if(memFailure)
+ if(invalidTransId == true)
{
- failureCause->causeType = E2_MISCELLANEOUS;
- failureCause->cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
break;
}
- } /* End of for loop, traversing Report-styles-supported list in E2 node */
-
- /* Memset action Db and Free E2SM_KPM_ActionDefinition_t */
- memset(actionDefDb, 0, sizeof(ActionDefinition));
- freeAperDecodingOfRicActionDefinition(actionDefPtr);
+ }
+ freeAperDecodingOfE2SetupRsp(e2SetRspMsg);
- if(failureCause->causeType == E2_NOTHING)
+ if(invalidTransId == false)
{
- failureCause->causeType = E2_RIC_REQUEST;
- failureCause->cause = E2_ACTION_NOT_SUPPORTED;
+ if(duSendE2NodeConfigurationUpdate() != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 node config update");
+ }
}
- return RFAILED;
}
/*******************************************************************
*
- * @brief Extract RIC Action to be setup
+ * @brief Free RIC Subscription Request
*
* @details
*
- * Function : extractRicActionToBeSetup
+ * Function : freeAperDecodingOfRicSubsReq
*
- * Functionality : This function :
- * - Validates that each action-to-be-setup is supported by E2 node
- * - Stores event trigger details in local DB
+ * Functionality : Free RIC Subscription Request
*
- * @params[in] RAN Function Database structure
- * RIC Subscription Info to be added to RAN function
- * RIC Action To Be Setup List received from RIC
- * @return ROK - success
- * RFAILED - failure
+ * @return void
*
******************************************************************/
-uint8_t extractRicActionToBeSetup(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \
- RICactions_ToBeSetup_List_t *actionList, E2FailureCause *failureCause, PendingSubsRspInfo *subsRsp)
+void freeAperDecodingOfRicSubsReq(RICsubscriptionRequest_t *ricSubscriptionReq)
{
- uint8_t actionIdx = 0;
- uint8_t ricActionId = 0;
+ uint8_t idx = 0;
+ uint8_t elementIdx = 0;
+ RICsubscriptionDetails_t *subsDetails = NULLP;
RICaction_ToBeSetup_ItemIEs_t *actionItem = NULLP;
- if(actionList->list.array)
+ if(ricSubscriptionReq->protocolIEs.list.array)
{
- for(actionIdx = 0; actionIdx < actionList->list.count; actionIdx++)
+ for(idx=0; idx < ricSubscriptionReq->protocolIEs.list.count; idx++)
{
- actionItem =(RICaction_ToBeSetup_ItemIEs_t *)actionList->list.array[actionIdx];
- switch(actionItem->id)
+ switch(ricSubscriptionReq->protocolIEs.list.array[idx]->id)
{
- case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
+ case ProtocolIE_IDE2_id_RICsubscriptionDetails:
{
- /* If Action type is REPORT and
- * If RIC action definition's extraction and validation passes,
- * Then :
- * This action is added to action sequence list of subscription info */
- ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
+ subsDetails = &(ricSubscriptionReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails);
+ free(subsDetails->ricEventTriggerDefinition.buf);
- if(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType == RICactionType_report)
+ if(subsDetails->ricAction_ToBeSetup_List.list.array)
{
- ricSubscriptionInfo->actionSequence[ricActionId].actionId = ricActionId;
- ricSubscriptionInfo->actionSequence[ricActionId].type = REPORT;
-
- if(extractRicActionDef(ranFuncDb, &ricSubscriptionInfo->actionSequence[ricActionId].definition, \
- actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition, failureCause) == ROK)
+ for(elementIdx = 0; elementIdx < subsDetails->ricAction_ToBeSetup_List.list.count; elementIdx++)
{
- ricSubscriptionInfo->actionSequence[ricActionId].action = CONFIG_ADD;
- ricSubscriptionInfo->numOfActions++;
- break;
+ if(subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx])
+ {
+ actionItem = (RICaction_ToBeSetup_ItemIEs_t *)subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx];
+ if(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition)
+ {
+ free(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition->buf);
+ free(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition);
+ }
+ free(subsDetails->ricAction_ToBeSetup_List.list.array[elementIdx]);
+ }
}
+ free(subsDetails->ricAction_ToBeSetup_List.list.array);
}
-
- /* In case of any failure, action is rejected
- * Added to rejected-action-list in subscription response */
- deleteActionSequence(&ricSubscriptionInfo->actionSequence[ricActionId]);
-
- subsRsp->rejectedActionList[subsRsp->numOfRejectedActions].id = ricActionId;
- if(failureCause->causeType == E2_NOTHING)
- {
- failureCause->causeType = E2_RIC_REQUEST;
- failureCause->cause = E2_ACTION_NOT_SUPPORTED;
- }
- memcpy(&subsRsp->rejectedActionList[subsRsp->numOfRejectedActions].failureCause, \
- failureCause, sizeof(E2FailureCause));
- subsRsp->numOfRejectedActions++;
break;
}
- default:
- DU_LOG("\nERROR --> E2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
- break;
}
+ free(ricSubscriptionReq->protocolIEs.list.array[idx]);
}
+ free(ricSubscriptionReq->protocolIEs.list.array);
}
-
- /* If there is even 1 action that can be added, return ROK */
- if(ricSubscriptionInfo->numOfActions)
- return ROK;
-
- if(failureCause->causeType == E2_NOTHING)
- {
- failureCause->causeType = E2_RIC_REQUEST;
- failureCause->cause = E2_ACTION_NOT_SUPPORTED;
- }
- return RFAILED;
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Processes RIC Subscription Req sent by RIC
+ * @brief Free Event Trigger Definition
*
* @details
*
- * Function : procRicSubscriptionRequest
+ * Function : freeAperDecodingOfEventTriggerDef
*
- * Functionality: Processes RIC Subscription Request from RIC
+ * Functionality: Free Event Trigger Definition
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] E2SM-KPM Event Trigger Definition
+ * @return void
*
* ****************************************************************/
-uint8_t procRicSubscriptionRequest(E2AP_PDU_t *e2apMsg)
+void freeAperDecodingOfEventTriggerDef(E2SM_KPM_EventTriggerDefinition_t *eventTiggerDef)
{
- uint8_t idx = 0, actionIdx = 0;
- uint8_t ret = ROK;
- uint16_t ranFuncId = 0;
- RicRequestId ricReqId;
- CmLList *ricSubscriptionNode = NULLP;
- RanFunction *ranFuncDb = NULLP;
- RICsubscriptionRequest_t *ricSubsReq = NULLP;
- RICsubscriptionDetails_t *subsDetails = NULLP;
- RicSubscription *ricSubscriptionInfo = NULLP;
- E2FailureCause failureCause;
-
- DU_LOG("\nINFO --> E2AP : RIC Subscription request received");
-
- memset(&failureCause, 0, sizeof(E2FailureCause));
- memset(&ricReqId, 0, sizeof(RicRequestId));
-
- ricSubsReq = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionRequest;
- for(idx=0; idx<ricSubsReq->protocolIEs.list.count; idx++)
+ if(eventTiggerDef)
{
- if(ricSubsReq->protocolIEs.list.array[idx])
+ switch(eventTiggerDef->eventDefinition_formats.present)
{
- switch(ricSubsReq->protocolIEs.list.array[idx]->id)
- {
- case ProtocolIE_IDE2_id_RICrequestID:
- {
- ricReqId.requestorId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID;
- ricReqId.instanceId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID;
-
- break;
- }
-
- case ProtocolIE_IDE2_id_RANfunctionID:
- {
- ranFuncId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RANfunctionID;
-
- /* Validating RAN Function id */
- ranFuncDb = fetchRanFuncFromRanFuncId(ranFuncId);
-
- if(!ranFuncDb)
- {
- failureCause.causeType = E2_RIC_REQUEST;
- failureCause.cause = E2_RAN_FUNCTION_ID_INVALID;
- ret = RFAILED;
- break;
- }
-
- if(ranFuncDb->numPendingSubsRsp >= MAX_PENDING_SUBSCRIPTION_RSP)
- {
- failureCause.causeType = E2_RIC_REQUEST;
- failureCause.cause = E2_FUNCTION_RESOURCE_LIMIT;
- ret = RFAILED;
- break;
- }
-
- DU_ALLOC(ricSubscriptionInfo, sizeof(RicSubscription));
- if(!ricSubscriptionInfo)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed for ricSubscriptionInfo");
- failureCause.causeType = E2_MISCELLANEOUS;
- failureCause.cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
- ret = RFAILED;
- break;
- }
- ricSubscriptionInfo->requestId.requestorId = ricReqId.requestorId;
- ricSubscriptionInfo->requestId.instanceId = ricReqId.instanceId;
- ricSubscriptionInfo->ranFuncId = ranFuncId;
-
- for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
- {
- ricSubscriptionInfo->actionSequence[actionIdx].actionId = -1;
- }
-
- memset(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp], 0, sizeof(PendingSubsRspInfo));
- memcpy(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp].requestId,
- &ricReqId, sizeof(RicRequestId));
- ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp].ranFuncId = ranFuncId;
- break;
- }
-
- case ProtocolIE_IDE2_id_RICsubscriptionDetails:
- {
- subsDetails = &ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails;
-
- /* Decode, Validate and record Event Trigger Definition */
- if(extractEventTriggerDef(ranFuncDb, ricSubscriptionInfo, &subsDetails->ricEventTriggerDefinition, \
- &failureCause) != ROK)
- {
- ret = RFAILED;
- break;
- }
-
- /* Decode, Validate and record RIC actions */
- if(extractRicActionToBeSetup(ranFuncDb, ricSubscriptionInfo, &subsDetails->ricAction_ToBeSetup_List, \
- &failureCause, &ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp]) != ROK)
- {
- ret = RFAILED;
- break;
- }
- }
- break;
-
- default:
- DU_LOG("\nERROR --> E2AP : Invalid IE received in RIC SubsReq:%ld",
- ricSubsReq->protocolIEs.list.array[idx]->id);
- break;
- }
+ case E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_NOTHING:
+ break;
- if(ret == RFAILED)
+ case E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_eventDefinition_Format1:
+ free(eventTiggerDef->eventDefinition_formats.choice.eventDefinition_Format1);
break;
}
}
+}
- freeAperDecodingOfRicSubsReq(ricSubsReq);
-
- if(ret == ROK)
- {
- cmInitTimers(&(ricSubscriptionInfo->ricSubsReportTimer), 1);
- ricSubscriptionInfo->action = CONFIG_ADD;
-
- /* Add RAN subcription detail to RAN function */
- DU_ALLOC(ricSubscriptionNode, sizeof(CmLList));
- if(ricSubscriptionNode)
- {
- ricSubscriptionNode->node = (PTR) ricSubscriptionInfo;
- cmLListAdd2Tail(&ranFuncDb->subscriptionList, ricSubscriptionNode);
- }
+/*******************************************************************
+ *
+ * @brief Extract E2SM-KPM Event trigger definition
+ *
+ * @details
+ *
+ * Function : extractEventTriggerDef
+ *
+ * Functionality : This function :
+ * - Decodes E2SM-KPM Event Trigger Definition
+ * - Validates that even trigger style is supported by E2 node
+ * - Stores event trigger details in local DB
+ *
+ * @params[in] RAN Function Database structure
+ * RIC Subscription Info to be added to RAN function
+ * RIC Event Trigger Definition buffer received from RIC
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t extractEventTriggerDef(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \
+ RICeventTriggerDefinition_t *ricEventTriggerDef, E2FailureCause *failureCause)
+{
+ uint8_t ret = RFAILED;
+ uint8_t eventIdx = 0;
+ asn_dec_rval_t rval ={0};
+ E2SM_KPM_EventTriggerDefinition_t eventTiggerDef, *eventTiggerDefPtr = NULLP;
- ranFuncDb->numPendingSubsRsp++;
+ /* Decoding E2SM-KPM Even Trigger Definition */
+ eventTiggerDefPtr = &eventTiggerDef;
+ memset(eventTiggerDefPtr, 0, sizeof(E2SM_KPM_EventTriggerDefinition_t));
-#ifdef KPI_CALCULATION
- /* Send statistics request to other DU entities */
- BuildAndSendStatsReq(ricSubscriptionInfo);
-#endif
- }
- else
+ rval = aper_decode(0, &asn_DEF_E2SM_KPM_EventTriggerDefinition, (void **)&eventTiggerDefPtr, ricEventTriggerDef->buf,\
+ ricEventTriggerDef->size, 0, 0);
+ if(rval.code == RC_FAIL || rval.code == RC_WMORE)
{
- DU_FREE(ricSubscriptionInfo, sizeof(RicSubscription));
+ DU_LOG("\nERROR --> E2AP : ASN decode failed for E2SM-KPM Event Trigger Definition");
+ failureCause->causeType = E2_PROTOCOL;
+ failureCause->cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
+ return RFAILED;
+ }
+ printf("\n");
+ xer_fprint(stdout, &asn_DEF_E2SM_KPM_EventTriggerDefinition, eventTiggerDefPtr);
- if(ranFuncDb)
+ /* Validating the received event trigger definition format */
+ for(eventIdx = 0; eventIdx < ranFuncDb->numOfEventTriggerStyleSupported; eventIdx++)
+ {
+ if((eventTiggerDefPtr->eventDefinition_formats.present != \
+ E2SM_KPM_EventTriggerDefinition__eventDefinition_formats_PR_NOTHING) && \
+ (eventTiggerDefPtr->eventDefinition_formats.present == ranFuncDb->eventTriggerStyleList[eventIdx].formatType))
{
- memset(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp], 0, sizeof(PendingSubsRspInfo));
- }
+ ricSubscriptionInfo->eventTriggerDefinition.formatType = ranFuncDb->eventTriggerStyleList[eventIdx].formatType;
+ ricSubscriptionInfo->eventTriggerDefinition.choice.format1.reportingPeriod = \
+ eventTiggerDefPtr->eventDefinition_formats.choice.eventDefinition_Format1->reportingPeriod;
- /* Send RIC Subcription Failure */
- BuildAndSendRicSubscriptionFailure(ricReqId, ranFuncId, failureCause);
+ ret = ROK;
+ break;
+ }
}
+ if(ret == RFAILED)
+ {
+ failureCause->causeType = E2_RIC_REQUEST;
+ failureCause->cause = E2_EVENT_TRIGGER_NOT_SUPPORTED;
+ }
+ /* Free E2SM_KPM_EventTriggerDefinition_t */
+ freeAperDecodingOfEventTriggerDef(eventTiggerDefPtr);
return ret;
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Free RIC Subscription Failure
+ * @brief Free RIC Action Definition
*
* @details
*
- * Function : FreeRicSubscriptionFailure
+ * Function : freeAperDecodingOfRicActionDefinition
*
- * Functionality: Free RIC Subscription Failure
+ * Functionality: Free RIC Action Definition
*
- * @params[in] E2AP PDU
+ * @params[in] E2SM-KPM Action definition
* @return void
*
* ****************************************************************/
-void FreeRicSubscriptionFailure(E2AP_PDU_t *e2apMsg)
+void freeAperDecodingOfRicActionDefinition(E2SM_KPM_ActionDefinition_t *actionDef)
{
- uint8_t elemIdx = 0;
- RICsubscriptionFailure_t *ricSubscriptionFailure = NULLP;
+ uint8_t elementIdx = 0;
+ E2SM_KPM_ActionDefinition_Format1_t *actionFormat1 = NULLP;
+ MeasurementInfoItem_t *measItem = NULLP;
- if(e2apMsg)
+ switch(actionDef->actionDefinition_formats.present)
{
- if(e2apMsg->choice.unsuccessfulOutcome)
- {
- ricSubscriptionFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionFailure;
- if(ricSubscriptionFailure->protocolIEs.list.array)
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1:
{
- for(elemIdx = 0; elemIdx < ricSubscriptionFailure->protocolIEs.list.count; elemIdx++)
+ if(actionDef->actionDefinition_formats.choice.actionDefinition_Format1)
{
- DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array[elemIdx], sizeof(RICsubscriptionFailure_IEs_t));
+ actionFormat1 = actionDef->actionDefinition_formats.choice.actionDefinition_Format1;
+ if(actionFormat1->measInfoList.list.array)
+ {
+ for(elementIdx = 0; elementIdx < actionFormat1->measInfoList.list.count; elementIdx++)
+ {
+ if(actionFormat1->measInfoList.list.array[elementIdx])
+ {
+ measItem = actionFormat1->measInfoList.list.array[elementIdx];
+ switch(measItem->measType.present)
+ {
+ case MeasurementType_PR_NOTHING:
+ break;
+
+ case MeasurementType_PR_measName:
+ {
+ free(measItem->measType.choice.measName.buf);
+ break;
+ }
+
+ case MeasurementType_PR_measID:
+ break;
+ }
+ free(measItem);
+ }
+ }
+ free(actionFormat1->measInfoList.list.array);
+ }
+ free(actionFormat1);
}
- DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array, ricSubscriptionFailure->protocolIEs.list.size);
+ break;
}
- DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
- }
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format2:
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format3:
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format4:
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format5:
+ default:
+ break;
}
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Fill and Send RIC Subscription Failure to RIC
+ * @brief Extract Measurement Info list from action definition
*
* @details
*
- * Function : BuildAndSendRicSubscriptionFailure
+ * Function : extractMeasInfoList
*
- * Functionality: Fill and Send RIC Subscription Failure to RIC
+ * Functionality : This function :
+ * - Traverses Measurement-to-be-subscribed list
+ * - Validates that each measurement in Measurement-to-be-subscribed
+ * list is supported in RAN-Function->Measurement-supported list.
+ * - If all measurements in an action is supported by RAN function,
+ * it is added to measurement-subscribed list in local DB
*
- * @params[in] RIC Request ID
- * RAN Function ID
- * Cause of Failure
+ * @params[in] Measurement Info supported list by RAN function
+ * Measurement Info to be subscribed as requested by RIC
+ * Measurement Info finally subscribed
+ * Memory failure indicator
* @return ROK - success
* RFAILED - failure
*
- * ****************************************************************/
-uint8_t BuildAndSendRicSubscriptionFailure(RicRequestId ricReqId, uint16_t ranFuncId, E2FailureCause failureCause)
+ ******************************************************************/
+uint8_t extractMeasInfoList(CmLListCp *measInfoSupportedList, MeasurementInfoList_t *measInfoToBeSubscribedList, \
+ CmLListCp *measInfoSubscribedList, bool *memFailure)
{
- uint8_t ret = RFAILED;
- uint8_t elementCnt = 0, elemIdx = 0;
- E2AP_PDU_t *e2apMsg = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
- RICsubscriptionFailure_t *ricSubscriptionFailure = NULLP;
- RICsubscriptionFailure_IEs_t *ricSubsFailIe = NULLP;
+ uint8_t elementIdx = 0;
+ MeasurementInfoForAction *measInfoSupportedDb = NULLP;
+ MeasurementInfo *measInfoSubscribedDb = NULLP;
+ CmLList *supportedMeasNode = NULLP, *measToAddNode = NULLP;
+ MeasurementInfoItem_t *measItem = NULLP;
- while(true)
+ /* Validate Measurement list is supported by E2 node.
+ *
+ * Traverse and compare the Measurement-Supported List in E2
+ * node with Measurement-to-be-subscribed list received from RIC.
+ * If a match is found, add it to measurement-subscription list.
+ */
+ for(elementIdx = 0; elementIdx < measInfoToBeSubscribedList->list.count; elementIdx++)
{
- DU_LOG("\nINFO --> E2AP : Building RIC Subscription Failure\n");
-
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d]", __func__, __LINE__);
- break;
- }
+ measInfoSubscribedDb = NULLP;
+ measToAddNode = NULLP;
+ measItem = measInfoToBeSubscribedList->list.array[elementIdx];
- e2apMsg->present = E2AP_PDU_PR_unsuccessfulOutcome;
- DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
- if(e2apMsg->choice.unsuccessfulOutcome == NULLP)
+ CM_LLIST_FIRST_NODE(measInfoSupportedList, supportedMeasNode);
+ while(supportedMeasNode)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d]", __func__, __LINE__);
- break;
- }
- e2apMsg->choice.unsuccessfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
- e2apMsg->choice.unsuccessfulOutcome->criticality = CriticalityE2_reject;
- e2apMsg->choice.unsuccessfulOutcome->value.present = UnsuccessfulOutcomeE2__value_PR_RICsubscriptionFailure;
+ measInfoSupportedDb = (MeasurementInfoForAction*)supportedMeasNode->node;
+ switch(measItem->measType.present)
+ {
+ case MeasurementType_PR_measName:
+ {
+ if(!strcmp(measInfoSupportedDb->measurementTypeName, (char *)measItem->measType.choice.measName.buf))
+ {
+ DU_ALLOC(measInfoSubscribedDb, sizeof(MeasurementInfo));
+ }
+ break;
+ }
- ricSubscriptionFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionFailure;
+ case MeasurementType_PR_measID:
+ {
+ if(measInfoSupportedDb->measurementTypeId == measItem->measType.choice.measID)
+ {
+ DU_ALLOC(measInfoSubscribedDb, sizeof(MeasurementInfo));
+ }
+ break;
+ }
- elementCnt = 3;
- ricSubscriptionFailure->protocolIEs.list.count = elementCnt;
- ricSubscriptionFailure->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionFailure_IEs_t *);
- DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array, ricSubscriptionFailure->protocolIEs.list.size);
- if(!ricSubscriptionFailure->protocolIEs.list.array)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d]", __func__, __LINE__);
- break;
- }
+ default:
+ {
+ DU_LOG("\nERROR -> DUAPP: Invalid Measurement-type identifier in \
+ E2SM-KPM Action Definition Format");
+ break;
+ }
+ } /* End of switch, for measurement type identifier */
- for(elemIdx = 0; elemIdx < elementCnt; elemIdx++)
- {
- DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array[elemIdx], sizeof(RICsubscriptionFailure_IEs_t));
- if(!ricSubscriptionFailure->protocolIEs.list.array[elemIdx])
+ /* If measurement type is supported, add to measurement-subscription list */
+ if(measInfoSubscribedDb)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d] for IE at index [%d]", \
- __func__, __LINE__, elemIdx);
- break;
- }
- }
- if(elemIdx < elementCnt)
- break;
+ measInfoSubscribedDb->measurementTypeId = measInfoSupportedDb->measurementTypeId;
+ memcpy(measInfoSubscribedDb->measurementTypeName, measInfoSupportedDb->measurementTypeName, \
+ strlen(measInfoSupportedDb->measurementTypeName));
- elemIdx = 0;
+ DU_ALLOC(measToAddNode, sizeof(CmLList));
+ if(measToAddNode)
+ {
+ measToAddNode->node = (PTR) measInfoSubscribedDb;
+ cmLListAdd2Tail(measInfoSubscribedList, measToAddNode);
- /* RIC Request ID */
- ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
- ricSubsFailIe->id = ProtocolIE_IDE2_id_RICrequestID;
- ricSubsFailIe->criticality = CriticalityE2_reject;
- ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_RICrequestID;
- ricSubsFailIe->value.choice.RICrequestID.ricRequestorID = ricReqId.requestorId;
- ricSubsFailIe->value.choice.RICrequestID.ricInstanceID = ricReqId.instanceId;
+ /* Break out of while loop if measurement info is found in measurement-supported list */
+ break;
+ }
+ else
+ {
+ DU_FREE(measInfoSubscribedDb, sizeof(MeasurementInfo));
+ measInfoSubscribedDb = NULLP;
+ *memFailure = true;
+ break;
+ }
+ }
- /* RAN Function ID */
- ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
- ricSubsFailIe->id = ProtocolIE_IDE2_id_RANfunctionID;
- ricSubsFailIe->criticality = CriticalityE2_reject;
- ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
- ricSubsFailIe->value.choice.RANfunctionID = ranFuncId;
+ supportedMeasNode = supportedMeasNode->next;
- /* Cause */
- ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
- ricSubsFailIe->id = ProtocolIE_IDE2_id_CauseE2;
- ricSubsFailIe->criticality = CriticalityE2_reject;
- ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_CauseE2;
- fillE2Cause(&ricSubsFailIe->value.choice.CauseE2, failureCause);
+ } /* End of while for traversing measurement-supported list in a report style */
- /* Prints the Msg formed */
- 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)
+ /* If a measurement-to-be-subscribed is not found in measurement-supported list in this report style
+ * Then :
+ * Delete all entries from measurement-subscription list and
+ * Break out of for loop to search in next report style */
+ if(!measInfoSubscribedDb)
{
- DU_LOG("\nERROR --> E2AP : Could not encode RIC Subscription Failure Message (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ deleteMeasurementInfoList(measInfoSubscribedList);
break;
}
- else
- {
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Failure Message \n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
-#endif
- }
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
- {
- DU_LOG("\nINFO --> E2AP : Sending RIC Subscription Failure");
+ } /* End of for loop , traversing measurement-to-be-subscribed list */
- }
- ret = ROK;
- break;
- }
- FreeRicSubscriptionFailure(e2apMsg);
- return ret;
+ /* If all measurement-to-be-subscribed was found in measurement-supported list and
+ * was added to measurement-subscription list successfully, return from here */
+ if(measInfoToBeSubscribedList->list.count == measInfoSubscribedList->count)
+ return ROK;
+
+ return RFAILED;
}
/*******************************************************************
*
- * @brief Free the RicIndication Message
+ * @brief Extract E2SM-KPM Action definition
*
* @details
*
- * Function : FreeRicIndication
- *
- * Functionality: Free the RicIndication Message
+ * Function : extractRicActionDef
*
- * @return void
- *
+ * Functionality : This function :
+ * - Decodes E2SM-KPM Action Definition
+ * - Validates that action is supported by E2 node
+ * - Stores action details in local DB
+ *
+ * @params[in] RAN Function Database structure
+ * RIC subscription's Action definition to be added to
+ * RAN function
+ * RIC Action Definition buffer received from RIC
+ * @return ROK - success
+ * RFAILED - failure
*
******************************************************************/
-void FreeRicIndication(E2AP_PDU_t *e2apMsg)
+uint8_t extractRicActionDef(RanFunction *ranFuncDb, ActionDefinition *actionDefDb, RICactionDefinition_t *ricActionDef,\
+ E2FailureCause *failureCause)
{
- uint8_t idx = 0;
- RICindication_t *ricIndicationMsg= NULLP;
+ bool memFailure = false;
+ uint8_t styleIdx = 0;
+ asn_dec_rval_t rval ={0};
- if(e2apMsg != NULLP)
+ E2SM_KPM_ActionDefinition_t actionDef, *actionDefPtr = NULLP;
+ E2SM_KPM_ActionDefinition_Format1_t *actionFormat1 = NULLP;
+ CmLListCp *measInfoSupportedList = NULLP;
+ CmLListCp *measInfoSubscribedList = NULLP;
+
+ /* Decoding E2SM-KPM Action Definition */
+ actionDefPtr = &actionDef;
+ memset(actionDefPtr, 0, sizeof(E2SM_KPM_EventTriggerDefinition_t));
+
+ rval = aper_decode(0, &asn_DEF_E2SM_KPM_ActionDefinition, (void **)&actionDefPtr, ricActionDef->buf,\
+ ricActionDef->size, 0, 0);
+ if(rval.code == RC_FAIL || rval.code == RC_WMORE)
{
- if(e2apMsg->choice.initiatingMessage != NULLP)
+ DU_LOG("\nERROR --> E2AP : ASN decode failed for E2SM-KPM Action Definition");
+ failureCause->causeType = E2_PROTOCOL;
+ failureCause->cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
+ return RFAILED;
+ }
+ printf("\n");
+ xer_fprint(stdout, &asn_DEF_E2SM_KPM_ActionDefinition, actionDefPtr);
+
+
+ /* Validate if Report style to subscribe is supported by E2 Node */
+ for(styleIdx= 0; styleIdx < ranFuncDb->numOfReportStyleSupported; styleIdx++)
+ {
+ /* Validate Report style type and report style format type is supported by E2 Node */
+ if((ranFuncDb->reportStyleList[styleIdx].reportStyle.styleType == actionDefPtr->ric_Style_Type) &&
+ (ranFuncDb->reportStyleList[styleIdx].reportStyle.formatType == actionDefPtr->actionDefinition_formats.present))
{
- ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
- if(ricIndicationMsg!= NULLP)
+ /* Fetch Report stype type and format type */
+ actionDefDb->styleType = actionDefPtr->ric_Style_Type;
+ actionDefDb->formatType = actionDefPtr->actionDefinition_formats.present;
+
+ switch(actionDefPtr->actionDefinition_formats.present)
{
- if(ricIndicationMsg->protocolIEs.list.array != NULLP)
- {
- for(idx=0; idx<ricIndicationMsg->protocolIEs.list.count; idx++)
+ case E2SM_KPM_ActionDefinition__actionDefinition_formats_PR_actionDefinition_Format1:
{
- if(ricIndicationMsg->protocolIEs.list.array[idx] != NULLP)
+ actionFormat1 = actionDefPtr->actionDefinition_formats.choice.actionDefinition_Format1;
+
+ /* Fetch granularity period */
+ actionDefDb->choice.format1.granularityPeriod = actionFormat1->granulPeriod;
+
+ /* Validate and add the Measurement to subscription list */
+ measInfoSupportedList = &ranFuncDb->reportStyleList[styleIdx].measurementInfoList;
+ measInfoSubscribedList = &actionDefDb->choice.format1.measurementInfoList;
+ if(extractMeasInfoList(measInfoSupportedList, &actionFormat1->measInfoList, \
+ measInfoSubscribedList, &memFailure) == ROK)
{
- switch(ricIndicationMsg->protocolIEs.list.array[idx]->id)
+ if(!memFailure)
{
- case ProtocolIE_IDE2_id_RICrequestID:
- case ProtocolIE_IDE2_id_RANfunctionID:
- case ProtocolIE_IDE2_id_RICactionID:
- case ProtocolIE_IDE2_id_RICindicationType:
- break;
-
- case ProtocolIE_IDE2_id_RICindicationHeader:
- {
- DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf,\
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
- break;
- }
- case ProtocolIE_IDE2_id_RICindicationMessage:
- {
- DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf,\
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
- break;
- }
- default:
- break;
+ /* Free E2SM_KPM_ActionDefinition_t */
+ freeAperDecodingOfRicActionDefinition(actionDefPtr);
+ return ROK;
}
- DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx],sizeof(RICindication_IEs_t));
}
+
+ break; /* End of E2SM-KPM Action definition format 1 case */
}
- DU_FREE(ricIndicationMsg->protocolIEs.list.array,ricIndicationMsg->protocolIEs.list.size);
- }
- }
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+
+ default :
+ {
+ DU_LOG("\nERROR -> DUAPP: Only E2SM-KPM Action Definition Format 1 is supported");
+ break;
+ }
+ } /* End of switch for E2SM-KPM Action definition formats */
}
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+
+ if(memFailure)
+ {
+ failureCause->causeType = E2_MISCELLANEOUS;
+ failureCause->cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
+ break;
+ }
+ } /* End of for loop, traversing Report-styles-supported list in E2 node */
+
+ /* Memset action Db and Free E2SM_KPM_ActionDefinition_t */
+ memset(actionDefDb, 0, sizeof(ActionDefinition));
+ freeAperDecodingOfRicActionDefinition(actionDefPtr);
+
+ if(failureCause->causeType == E2_NOTHING)
+ {
+ failureCause->causeType = E2_RIC_REQUEST;
+ failureCause->cause = E2_ACTION_NOT_SUPPORTED;
}
+ return RFAILED;
}
/*******************************************************************
*
- * @brief Free measurement record
+ * @brief Extract RIC Action to be setup
*
* @details
*
- * Function : freeMeasRecord
+ * Function : extractRicActionToBeSetup
*
- * Functionality: Free all measurement recorded for a measurement
- * within an action in a RIC subscription
+ * Functionality : This function :
+ * - Validates that each action-to-be-setup is supported by E2 node
+ * - Stores event trigger details in local DB
*
- * @param Measurement data to be freed
- * @return void
+ * @params[in] RAN Function Database structure
+ * RIC Subscription Info to be added to RAN function
+ * RIC Action To Be Setup List received from RIC
+ * @return ROK - success
+ * RFAILED - failure
*
******************************************************************/
-void freeMeasData(MeasurementData_t *measData)
+uint8_t extractRicActionToBeSetup(RanFunction *ranFuncDb, RicSubscription *ricSubscriptionInfo, \
+ RICactions_ToBeSetup_List_t *actionList, E2FailureCause *failureCause, PendingSubsRspInfo *subsRsp)
{
- uint8_t measIdx = 0, measRecIdx = 0;
- MeasurementRecord_t *measRecord = NULLP;
+ uint8_t actionIdx = 0;
+ uint8_t ricActionId = 0;
+ RICaction_ToBeSetup_ItemIEs_t *actionItem = NULLP;
- if(measData->list.array)
+ if(actionList->list.array)
{
- for(measIdx = 0; measIdx < measData->list.count; measIdx++)
+ for(actionIdx = 0; actionIdx < actionList->list.count; actionIdx++)
{
- if(measData->list.array[measIdx])
+ actionItem =(RICaction_ToBeSetup_ItemIEs_t *)actionList->list.array[actionIdx];
+ switch(actionItem->id)
{
- measRecord = &measData->list.array[measIdx]->measRecord;
- if(measRecord->list.array)
- {
- for(measRecIdx = 0; measRecIdx < measRecord->list.count; measRecIdx++)
+ case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item:
{
- DU_FREE(measRecord->list.array[measRecIdx], sizeof(MeasurementRecordItem_t));
+ /* If Action type is REPORT and
+ * If RIC action definition's extraction and validation passes,
+ * Then :
+ * This action is added to action sequence list of subscription info */
+ ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID;
+
+ if(actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType == RICactionType_report)
+ {
+ ricSubscriptionInfo->actionSequence[ricActionId].actionId = ricActionId;
+ ricSubscriptionInfo->actionSequence[ricActionId].type = REPORT;
+
+ if(extractRicActionDef(ranFuncDb, &ricSubscriptionInfo->actionSequence[ricActionId].definition, \
+ actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionDefinition, failureCause) == ROK)
+ {
+ ricSubscriptionInfo->actionSequence[ricActionId].action = CONFIG_ADD;
+ ricSubscriptionInfo->numOfActions++;
+ break;
+ }
+ }
+
+ /* In case of any failure, action is rejected
+ * Added to rejected-action-list in subscription response */
+ deleteActionSequence(&ricSubscriptionInfo->actionSequence[ricActionId]);
+
+ subsRsp->rejectedActionList[subsRsp->numOfRejectedActions].id = ricActionId;
+ if(failureCause->causeType == E2_NOTHING)
+ {
+ failureCause->causeType = E2_RIC_REQUEST;
+ failureCause->cause = E2_ACTION_NOT_SUPPORTED;
+ }
+ memcpy(&subsRsp->rejectedActionList[subsRsp->numOfRejectedActions].failureCause, \
+ failureCause, sizeof(E2FailureCause));
+ subsRsp->numOfRejectedActions++;
+ break;
}
- DU_FREE(measRecord->list.array, measRecord->list.size);
- }
- DU_FREE(measData->list.array[measIdx], sizeof(MeasurementDataItem_t));
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in RicSetupLst:%ld",actionItem->id);
+ break;
}
}
- DU_FREE(measData->list.array, measData->list.size);
}
+
+ /* If there is even 1 action that can be added, return ROK */
+ if(ricSubscriptionInfo->numOfActions)
+ return ROK;
+
+ if(failureCause->causeType == E2_NOTHING)
+ {
+ failureCause->causeType = E2_RIC_REQUEST;
+ failureCause->cause = E2_ACTION_NOT_SUPPORTED;
+ }
+ return RFAILED;
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Fill measurement info list
+ * @brief Processes RIC Subscription Req sent by RIC
*
* @details
*
- * Function : freeMeasInfoList
+ * Function : procRicSubscriptionRequest
*
- * Functionality: Fills all measurement info within an action
- * in a RIC subscription
+ * Functionality: Processes RIC Subscription Request from RIC
*
- * @param Measurement Info list to be freed
- * @return void
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void freeMeasInfoList(MeasurementInfoList_t *measInfoList)
+ * ****************************************************************/
+uint8_t procRicSubscriptionRequest(E2AP_PDU_t *e2apMsg)
{
- uint8_t measInfoIdx = 0;
+ uint8_t idx = 0, actionIdx = 0;
+ uint8_t ret = ROK;
+ uint16_t ranFuncId = 0;
+ RicRequestId ricReqId;
+ CmLList *ricSubscriptionNode = NULLP;
+ RanFunction *ranFuncDb = NULLP;
+ RICsubscriptionRequest_t *ricSubsReq = NULLP;
+ RICsubscriptionDetails_t *subsDetails = NULLP;
+ RicSubscription *ricSubscriptionInfo = NULLP;
+ E2FailureCause failureCause;
- if(measInfoList->list.array)
+ DU_LOG("\nINFO --> E2AP : RIC Subscription request received");
+
+ memset(&failureCause, 0, sizeof(E2FailureCause));
+ memset(&ricReqId, 0, sizeof(RicRequestId));
+
+ ricSubsReq = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionRequest;
+ for(idx=0; idx<ricSubsReq->protocolIEs.list.count; idx++)
{
- for(measInfoIdx = 0; measInfoIdx < measInfoList->list.count; measInfoIdx++)
+ if(ricSubsReq->protocolIEs.list.array[idx])
{
- if(measInfoList->list.array[measInfoIdx])
+ switch(ricSubsReq->protocolIEs.list.array[idx]->id)
{
- DU_FREE(measInfoList->list.array[measInfoIdx]->measType.choice.measName.buf, \
- measInfoList->list.array[measInfoIdx]->measType.choice.measName.size);
+ case ProtocolIE_IDE2_id_RICrequestID:
+ {
+ ricReqId.requestorId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID;
+ ricReqId.instanceId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID;
- DU_FREE(measInfoList->list.array[measInfoIdx], measInfoList->list.size);
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RANfunctionID:
+ {
+ ranFuncId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RANfunctionID;
+
+ /* Validating RAN Function id */
+ ranFuncDb = fetchRanFuncFromRanFuncId(ranFuncId);
+
+ if(!ranFuncDb)
+ {
+ failureCause.causeType = E2_RIC_REQUEST;
+ failureCause.cause = E2_RAN_FUNCTION_ID_INVALID;
+ ret = RFAILED;
+ break;
+ }
+
+ if(ranFuncDb->numPendingSubsRsp >= MAX_PENDING_SUBSCRIPTION_RSP)
+ {
+ failureCause.causeType = E2_RIC_REQUEST;
+ failureCause.cause = E2_FUNCTION_RESOURCE_LIMIT;
+ ret = RFAILED;
+ break;
+ }
+
+ DU_ALLOC(ricSubscriptionInfo, sizeof(RicSubscription));
+ if(!ricSubscriptionInfo)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed for ricSubscriptionInfo");
+ failureCause.causeType = E2_MISCELLANEOUS;
+ failureCause.cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
+ ret = RFAILED;
+ break;
+ }
+ ricSubscriptionInfo->requestId.requestorId = ricReqId.requestorId;
+ ricSubscriptionInfo->requestId.instanceId = ricReqId.instanceId;
+ ricSubscriptionInfo->ranFuncId = ranFuncId;
+
+ for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ {
+ ricSubscriptionInfo->actionSequence[actionIdx].actionId = -1;
+ }
+
+ memset(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp], 0, sizeof(PendingSubsRspInfo));
+ memcpy(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp].requestId,
+ &ricReqId, sizeof(RicRequestId));
+ ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp].ranFuncId = ranFuncId;
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICsubscriptionDetails:
+ {
+ subsDetails = &ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails;
+
+ /* Decode, Validate and record Event Trigger Definition */
+ if(extractEventTriggerDef(ranFuncDb, ricSubscriptionInfo, &subsDetails->ricEventTriggerDefinition, \
+ &failureCause) != ROK)
+ {
+ ret = RFAILED;
+ break;
+ }
+
+ /* Decode, Validate and record RIC actions */
+ if(extractRicActionToBeSetup(ranFuncDb, ricSubscriptionInfo, &subsDetails->ricAction_ToBeSetup_List, \
+ &failureCause, &ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp]) != ROK)
+ {
+ ret = RFAILED;
+ break;
+ }
+ }
+ break;
+
+ default:
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in RIC SubsReq:%ld",
+ ricSubsReq->protocolIEs.list.array[idx]->id);
+ break;
}
+
+ if(ret == RFAILED)
+ break;
}
- DU_FREE(measInfoList->list.array, measInfoList->list.size);
}
+
+ freeAperDecodingOfRicSubsReq(ricSubsReq);
+
+ if(ret == ROK)
+ {
+ cmInitTimers(&(ricSubscriptionInfo->ricSubsReportTimer), 1);
+ ricSubscriptionInfo->action = CONFIG_ADD;
+
+ /* Add RAN subcription detail to RAN function */
+ DU_ALLOC(ricSubscriptionNode, sizeof(CmLList));
+ if(ricSubscriptionNode)
+ {
+ ricSubscriptionNode->node = (PTR) ricSubscriptionInfo;
+ cmLListAdd2Tail(&ranFuncDb->subscriptionList, ricSubscriptionNode);
+ }
+
+ ranFuncDb->numPendingSubsRsp++;
+
+#ifdef KPI_CALCULATION
+ /* Send statistics request to other DU entities */
+ BuildAndSendStatsReq(ricSubscriptionInfo);
+#endif
+ }
+ else
+ {
+ DU_FREE(ricSubscriptionInfo, sizeof(RicSubscription));
+
+ if(ranFuncDb)
+ {
+ memset(&ranFuncDb->pendingSubsRspInfo[ranFuncDb->numPendingSubsRsp], 0, sizeof(PendingSubsRspInfo));
+ }
+
+ /* Send RIC Subcription Failure */
+ BuildAndSendRicSubscriptionFailure(ricReqId, ranFuncId, failureCause);
+ }
+
+ return ret;
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Free E2SM-KPM Indication Message
+ * @brief Free RIC Subscription Failure
*
* @details
*
- * Function : FreeE2smKpmIndicationMessage
+ * Function : FreeRicSubscriptionFailure
*
- * Functionality: Free E2SM-KPM Indication Message
+ * Functionality: Free RIC Subscription Failure
*
- * @param E2SM-KPM Indication message to be freed
+ * @params[in] E2AP PDU
* @return void
*
- ******************************************************************/
-void FreeE2smKpmIndicationMessage(E2SM_KPM_IndicationMessage_t *e2smKpmIndMsg)
+ * ****************************************************************/
+void FreeRicSubscriptionFailure(E2AP_PDU_t *e2apMsg)
{
- E2SM_KPM_IndicationMessage_Format1_t *format1Msg = NULLP;
+ uint8_t elemIdx = 0;
+ RICsubscriptionFailure_t *ricSubscriptionFailure = NULLP;
- switch(e2smKpmIndMsg->indicationMessage_formats.present)
+ if(e2apMsg)
{
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format1:
+ if(e2apMsg->choice.unsuccessfulOutcome)
+ {
+ ricSubscriptionFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionFailure;
+ if(ricSubscriptionFailure->protocolIEs.list.array)
{
- if(e2smKpmIndMsg->indicationMessage_formats.choice.indicationMessage_Format1)
+ for(elemIdx = 0; elemIdx < ricSubscriptionFailure->protocolIEs.list.count; elemIdx++)
{
- format1Msg = e2smKpmIndMsg->indicationMessage_formats.choice.indicationMessage_Format1;
-
- /* Measurement Data */
- freeMeasData(&format1Msg->measData);
-
- /* Measurement Info List */
- if(format1Msg->measInfoList)
- {
- freeMeasInfoList(format1Msg->measInfoList);
- DU_FREE(format1Msg->measInfoList, sizeof(MeasurementInfoList_t));
- }
-
- /* Granularity Period */
- DU_FREE(format1Msg->granulPeriod, sizeof(GranularityPeriod_t));
-
- DU_FREE(format1Msg, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
+ DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array[elemIdx], sizeof(RICsubscriptionFailure_IEs_t));
}
- break;
+ DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array, ricSubscriptionFailure->protocolIEs.list.size);
}
-
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_NOTHING:
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format2:
- default:
- break;
+ DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
+ }
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
}
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Fill measurement record
+ * @brief Fill and Send RIC Subscription Failure to RIC
*
* @details
*
- * Function : fillMeasRecord
+ * Function : BuildAndSendRicSubscriptionFailure
*
- * Functionality: Fills all measurement value for a measurement
- * within an action in a RIC subscription
+ * Functionality: Fill and Send RIC Subscription Failure to RIC
*
- * @param Measurement record to be filled
- * Measurement database with measurement records
+ * @params[in] RIC Request ID
+ * RAN Function ID
+ * Cause of Failure
* @return ROK - success
* RFAILED - failure
*
- ******************************************************************/
-uint8_t fillMeasRecord(MeasurementRecord_t *measRecord, MeasurementInfo *measInfoDb)
+ * ****************************************************************/
+uint8_t BuildAndSendRicSubscriptionFailure(RicRequestId ricReqId, uint16_t ranFuncId, E2FailureCause failureCause)
{
- uint8_t measRecIdx = 0;
- CmLList *measValNode = NULLP;
- double measVal = 0;
-
- measRecord->list.count = measInfoDb->measuredValue.count;
- measRecord->list.size = measRecord->list.count * sizeof(MeasurementRecordItem_t *);
+ uint8_t ret = RFAILED;
+ uint8_t elementCnt = 0, elemIdx = 0;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+ RICsubscriptionFailure_t *ricSubscriptionFailure = NULLP;
+ RICsubscriptionFailure_IEs_t *ricSubsFailIe = NULLP;
- DU_ALLOC(measRecord->list.array, measRecord->list.size);
- if(!measRecord->list.array)
+ while(true)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
+ DU_LOG("\nINFO --> E2AP : Building RIC Subscription Failure\n");
- for(measRecIdx = 0; measRecIdx < measRecord->list.count; measRecIdx++)
- {
- DU_ALLOC(measRecord->list.array[measRecIdx], sizeof(MeasurementRecordItem_t));
- if(!measRecord->list.array[measRecIdx])
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d]", __func__, __LINE__);
+ break;
}
- }
-
- measRecIdx = 0;
- CM_LLIST_FIRST_NODE(&measInfoDb->measuredValue, measValNode);
- while(measValNode)
- {
- measVal = *(double *)measValNode->node;
- if(measVal == (int)measVal)
- {
- measRecord->list.array[measRecIdx]->present = MeasurementRecordItem_PR_integer;
- measRecord->list.array[measRecIdx]->choice.integer = (int)measVal;
- }
- else
- {
- measRecord->list.array[measRecIdx]->present = MeasurementRecordItem_PR_real;
- measRecord->list.array[measRecIdx]->choice.real = measVal;
- }
- measRecIdx++;
- measValNode= measValNode->next;
- /* Once the measurement record is added to the message, delete it from DB */
- measVal = 0;
- }
- deleteMeasuredValueList(&measInfoDb->measuredValue);
- return ROK;
-}
-/*******************************************************************
- *
- * @brief Fills measuerement data
- *
- * @details
- *
- * Function : fillMeasData
- *
- * Functionality: Fill all measurement recorded for all measurements
- * in an action in a RIC subscription
- *
- * @param Measurement data to be filled
- * Measurement info list from an action DB
- * @return ROK - success
- * RFAILED - failure
- *
- ******************************************************************/
-uint8_t fillMeasData(MeasurementData_t *measData, CmLListCp *measInfoListDb)
-{
- uint8_t measIdx = 0;
- CmLList *measInfoNode = NULLP;
- MeasurementInfo *measInfoDb = NULLP;
- MeasurementRecord_t *measRecord = NULLP;
+ 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 at [%s] : Line [%d]", __func__, __LINE__);
+ break;
+ }
+ e2apMsg->choice.unsuccessfulOutcome->procedureCode = ProcedureCodeE2_id_RICsubscription;
+ e2apMsg->choice.unsuccessfulOutcome->criticality = CriticalityE2_reject;
+ e2apMsg->choice.unsuccessfulOutcome->value.present = UnsuccessfulOutcomeE2__value_PR_RICsubscriptionFailure;
- measData->list.count = measInfoListDb->count;
- measData->list.size = measData->list.count * sizeof(MeasurementDataItem_t *);
+ ricSubscriptionFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionFailure;
- DU_ALLOC(measData->list.array, measData->list.size);
- if(!measData->list.array)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
+ elementCnt = 3;
+ ricSubscriptionFailure->protocolIEs.list.count = elementCnt;
+ ricSubscriptionFailure->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionFailure_IEs_t *);
+ DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array, ricSubscriptionFailure->protocolIEs.list.size);
+ if(!ricSubscriptionFailure->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d]", __func__, __LINE__);
+ break;
+ }
- measIdx = 0;
- CM_LLIST_FIRST_NODE(measInfoListDb, measInfoNode);
- while(measInfoNode)
- {
- measInfoDb = (MeasurementInfo *)measInfoNode->node;
- if(measInfoDb)
- {
- DU_ALLOC(measData->list.array[measIdx], sizeof(MeasurementDataItem_t));
- if(!measData->list.array[measIdx])
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
+ for(elemIdx = 0; elemIdx < elementCnt; elemIdx++)
+ {
+ DU_ALLOC(ricSubscriptionFailure->protocolIEs.list.array[elemIdx], sizeof(RICsubscriptionFailure_IEs_t));
+ if(!ricSubscriptionFailure->protocolIEs.list.array[elemIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation at [%s] : Line [%d] for IE at index [%d]", \
+ __func__, __LINE__, elemIdx);
+ break;
+ }
+ }
+ if(elemIdx < elementCnt)
+ break;
- measRecord = &measData->list.array[measIdx]->measRecord;
- if(fillMeasRecord(measRecord, measInfoDb) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill measurement record");
- return RFAILED;
- }
- measIdx++;
- }
- measInfoNode = measInfoNode->next;
- }
+ elemIdx = 0;
- return ROK;
+ /* RIC Request ID */
+ ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
+ ricSubsFailIe->id = ProtocolIE_IDE2_id_RICrequestID;
+ ricSubsFailIe->criticality = CriticalityE2_reject;
+ ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_RICrequestID;
+ ricSubsFailIe->value.choice.RICrequestID.ricRequestorID = ricReqId.requestorId;
+ ricSubsFailIe->value.choice.RICrequestID.ricInstanceID = ricReqId.instanceId;
+
+ /* RAN Function ID */
+ ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
+ ricSubsFailIe->id = ProtocolIE_IDE2_id_RANfunctionID;
+ ricSubsFailIe->criticality = CriticalityE2_reject;
+ ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
+ ricSubsFailIe->value.choice.RANfunctionID = ranFuncId;
+
+ /* Cause */
+ ricSubsFailIe = ricSubscriptionFailure->protocolIEs.list.array[elemIdx++];
+ ricSubsFailIe->id = ProtocolIE_IDE2_id_CauseE2;
+ ricSubsFailIe->criticality = CriticalityE2_reject;
+ ricSubsFailIe->value.present = RICsubscriptionFailure_IEs__value_PR_CauseE2;
+ fillE2Cause(&ricSubsFailIe->value.choice.CauseE2, failureCause);
+
+ /* Prints the Msg formed */
+ 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 RIC Subscription Failure Message (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Failure Message \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nINFO --> E2AP : Sending RIC Subscription Failure");
+
+ }
+ ret = ROK;
+ break;
+ }
+ FreeRicSubscriptionFailure(e2apMsg);
+ return ret;
}
/*******************************************************************
*
- * @brief Fill all measurement info
+ * @brief Free the RicIndication Message
*
* @details
*
- * Function : fillMeasInfoList
+ * Function : FreeRicIndication
*
- * Functionality: Fills all measurement info belonging to an action
- * in a RIC subscription
+ * Functionality: Free the RicIndication Message
*
- * @param Measurement Info list to be filled
- * Measurement Info list from E2AP DB
- * @return ROK - success
- * RFAILED - failure
+ * @return void
+ *
*
******************************************************************/
-uint8_t fillMeasInfoList(MeasurementInfoList_t *measInfoList, CmLListCp *measInfoListDb)
+void FreeRicIndication(E2AP_PDU_t *e2apMsg)
{
- uint8_t measInfoIdx = 0;
- CmLList *measInfoNode = NULLP;
- MeasurementInfo *measInfoDb = NULLP;
- MeasurementInfoItem_t *measInfoItem = NULLP;
-
- measInfoList->list.count = measInfoListDb->count;
- measInfoList->list.size = measInfoList->list.count * sizeof(MeasurementInfoItem_t *);
-
- DU_ALLOC(measInfoList->list.array, measInfoList->list.size);
- if(!measInfoList->list.array)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
+ uint8_t idx = 0;
+ RICindication_t *ricIndicationMsg= NULLP;
- measInfoIdx = 0;
- CM_LLIST_FIRST_NODE(measInfoListDb, measInfoNode);
- while(measInfoNode)
+ if(e2apMsg != NULLP)
{
- DU_ALLOC(measInfoList->list.array[measInfoIdx], sizeof(MeasurementInfoItem_t));
- if(!measInfoList->list.array[measInfoIdx])
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
-
- measInfoItem = measInfoList->list.array[measInfoIdx];
- measInfoDb = (MeasurementInfo *)measInfoNode->node;
- if(measInfoDb)
+ if(e2apMsg->choice.initiatingMessage != NULLP)
{
- /* Measurement Type */
- measInfoItem->measType.present = MeasurementType_PR_measName;
- measInfoItem->measType.choice.measName.size = strlen(measInfoDb->measurementTypeName);
-
- DU_ALLOC(measInfoItem->measType.choice.measName.buf, measInfoItem->measType.choice.measName.size);
- if(!measInfoItem->measType.choice.measName.buf)
+ ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
+ if(ricIndicationMsg!= NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
-
- memcpy(measInfoItem->measType.choice.measName.buf, measInfoDb->measurementTypeName,\
- measInfoItem->measType.choice.measName.size);
+ if(ricIndicationMsg->protocolIEs.list.array != NULLP)
+ {
+ for(idx=0; idx<ricIndicationMsg->protocolIEs.list.count; idx++)
+ {
+ if(ricIndicationMsg->protocolIEs.list.array[idx] != NULLP)
+ {
+ switch(ricIndicationMsg->protocolIEs.list.array[idx]->id)
+ {
+ case ProtocolIE_IDE2_id_RICrequestID:
+ case ProtocolIE_IDE2_id_RANfunctionID:
+ case ProtocolIE_IDE2_id_RICactionID:
+ case ProtocolIE_IDE2_id_RICindicationType:
+ break;
- measInfoIdx++;
+ case ProtocolIE_IDE2_id_RICindicationHeader:
+ {
+ DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.buf,\
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader.size);
+ break;
+ }
+ case ProtocolIE_IDE2_id_RICindicationMessage:
+ {
+ DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.buf,\
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage.size);
+ break;
+ }
+ default:
+ break;
+ }
+ DU_FREE(ricIndicationMsg->protocolIEs.list.array[idx],sizeof(RICindication_IEs_t));
+ }
+ }
+ DU_FREE(ricIndicationMsg->protocolIEs.list.array,ricIndicationMsg->protocolIEs.list.size);
+ }
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
- measInfoNode = measInfoNode->next;
- measInfoDb = NULLP;
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
-
- return ROK;
}
- /*******************************************************************
+/*******************************************************************
*
- * @brief Fill E2SM-KPM Indication Message Format 1
+ * @brief Free measurement record
*
* @details
*
- * Function : fillE2smKpmIndMsgFormat1
+ * Function : freeMeasRecord
*
- * Functionality: Fill E2SM-KPM Indication Message Format 1
+ * Functionality: Free all measurement recorded for a measurement
+ * within an action in a RIC subscription
*
- * @param Format 1 Message to be filled
- * Action Definition format 1 from E2AP DB
- * @return ROK - success
- * RFAILED - failure
+ * @param Measurement data to be freed
+ * @return void
*
******************************************************************/
-uint8_t fillE2smKpmIndMsgFormat1(E2SM_KPM_IndicationMessage_Format1_t *format1Msg, ActionDefFormat1 *format1)
+void freeMeasData(MeasurementData_t *measData)
{
- /* Measurement Data */
- if(fillMeasData(&format1Msg->measData, &format1->measurementInfoList) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill measurement data");
- return RFAILED;
- }
-
- /* Measurement Information */
- DU_ALLOC(format1Msg->measInfoList, sizeof(MeasurementInfoList_t));
- if(!format1Msg->measInfoList)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
-
- if(fillMeasInfoList(format1Msg->measInfoList, &format1->measurementInfoList) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill measurement information list");
- return RFAILED;
- }
-
- /* Granularity Period */
- DU_ALLOC(format1Msg->granulPeriod, sizeof(GranularityPeriod_t));
- if(!format1Msg->granulPeriod)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- return RFAILED;
- }
- *(format1Msg->granulPeriod) = format1->granularityPeriod;
+ uint8_t measIdx = 0, measRecIdx = 0;
+ MeasurementRecord_t *measRecord = NULLP;
- return ROK;
+ if(measData->list.array)
+ {
+ for(measIdx = 0; measIdx < measData->list.count; measIdx++)
+ {
+ if(measData->list.array[measIdx])
+ {
+ measRecord = &measData->list.array[measIdx]->measRecord;
+ if(measRecord->list.array)
+ {
+ for(measRecIdx = 0; measRecIdx < measRecord->list.count; measRecIdx++)
+ {
+ DU_FREE(measRecord->list.array[measRecIdx], sizeof(MeasurementRecordItem_t));
+ }
+ DU_FREE(measRecord->list.array, measRecord->list.size);
+ }
+ DU_FREE(measData->list.array[measIdx], sizeof(MeasurementDataItem_t));
+ }
+ }
+ DU_FREE(measData->list.array, measData->list.size);
+ }
}
/*******************************************************************
*
- * @brief Fill RIC Indication Message buffer
+ * @brief Fill measurement info list
*
* @details
*
- * Function : fillRicIndMsgBuf
+ * Function : freeMeasInfoList
*
- * Functionality: Fill E2SM-KPM Indication Message
- * Encode this message and copy to RIC Indication Message buffer
- *
- * @param RIC Indication Message buffer to be filled
- * Source action info from E2AP DB
- * @return ROK - success
- * RFAILED - failure
+ * Functionality: Fills all measurement info within an action
+ * in a RIC subscription
+ *
+ * @param Measurement Info list to be freed
+ * @return void
*
******************************************************************/
-uint8_t fillRicIndMsgBuf(RICindicationMessage_t *ricIndMsgBuf, ActionInfo *actionInfo)
+void freeMeasInfoList(MeasurementInfoList_t *measInfoList)
{
- uint8_t ret = RFAILED;
- bool failedInFormat = false;
- E2SM_KPM_IndicationMessage_t e2smKpmIndMsg;
- asn_enc_rval_t encRetVal; /* Encoder return value */
-
- memset(&e2smKpmIndMsg, 0, sizeof(E2SM_KPM_IndicationMessage_t));
+ uint8_t measInfoIdx = 0;
- while(true)
+ if(measInfoList->list.array)
{
- /* E2SM-KPM Indication message format type */
- e2smKpmIndMsg.indicationMessage_formats.present = actionInfo->definition.formatType;
- switch(e2smKpmIndMsg.indicationMessage_formats.present)
- {
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format1:
- {
- /* E2SM-KPM Indication message format 1 */
- DU_ALLOC(e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1, \
- sizeof(E2SM_KPM_IndicationMessage_Format1_t));
- if(!e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- failedInFormat = true;
- break;
- }
-
- if(fillE2smKpmIndMsgFormat1(e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1, \
- &actionInfo->definition.choice.format1) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill E2SM-KPM Indication message format 1");
- failedInFormat = true;
- break;
- }
- break;
- }
-
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_NOTHING:
- case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format2:
- default:
- {
- DU_LOG("\nERROR --> E2AP : fillRicIndMsgBuf: Only Format 1 supported");
- failedInFormat = true;
- break;
- }
- }
-
- if(failedInFormat)
- break;
-
- /* Encode E2SM-KPM Indication Message */
- xer_fprint(stdout, &asn_DEF_E2SM_KPM_IndicationMessage, &e2smKpmIndMsg);
- memset(encBuf, 0, ENC_BUF_MAX_LEN);
- encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_E2SM_KPM_IndicationMessage, 0, &e2smKpmIndMsg, PrepFinalEncBuf, encBuf);
- if(encRetVal.encoded == ENCODE_FAIL)
- {
- DU_LOG("\nERROR --> E2AP : Could not encode E2SM-KPM Indication Message (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
+ for(measInfoIdx = 0; measInfoIdx < measInfoList->list.count; measInfoIdx++)
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SM-KPM Indication Message \n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
+ if(measInfoList->list.array[measInfoIdx])
{
- printf("%x",encBuf[i]);
- }
-#endif
- }
+ DU_FREE(measInfoList->list.array[measInfoIdx]->measType.choice.measName.buf, \
+ measInfoList->list.array[measInfoIdx]->measType.choice.measName.size);
- /* Copy encoded string to RIC Indication Message buffer */
- ricIndMsgBuf->size = encBufSize;
- DU_ALLOC(ricIndMsgBuf->buf, ricIndMsgBuf->size);
- if(!ricIndMsgBuf->buf)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- break;
+ DU_FREE(measInfoList->list.array[measInfoIdx], measInfoList->list.size);
+ }
}
- memset(ricIndMsgBuf->buf, 0, ricIndMsgBuf->size);
- memcpy(ricIndMsgBuf->buf, encBuf, encBufSize);
-
- ret = ROK;
- break;
+ DU_FREE(measInfoList->list.array, measInfoList->list.size);
}
-
- /* Free E2SM-KPM Indication Message */
- FreeE2smKpmIndicationMessage(&e2smKpmIndMsg);
-
- return ret;
}
/*******************************************************************
*
- * @brief Free E2SM-KPM Indication Header
+ * @brief Free E2SM-KPM Indication Message
*
* @details
*
- * Function : FreeE2smKpmIndicationHeader
+ * Function : FreeE2smKpmIndicationMessage
*
- * Functionality: Free E2SM-KPM Indication Header
- *
- * @param E2SM-KPM Indication Header to be free
+ * Functionality: Free E2SM-KPM Indication Message
+ *
+ * @param E2SM-KPM Indication message to be freed
* @return void
*
******************************************************************/
-void FreeE2smKpmIndicationHeader(E2SM_KPM_IndicationHeader_t *e2smKpmIndHdr)
+void FreeE2smKpmIndicationMessage(E2SM_KPM_IndicationMessage_t *e2smKpmIndMsg)
{
- E2SM_KPM_IndicationHeader_Format1_t *format1 = NULLP;
+ E2SM_KPM_IndicationMessage_Format1_t *format1Msg = NULLP;
- if(e2smKpmIndHdr)
+ switch(e2smKpmIndMsg->indicationMessage_formats.present)
{
- switch(e2smKpmIndHdr->indicationHeader_formats.present)
- {
- case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_indicationHeader_Format1:
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format1:
+ {
+ if(e2smKpmIndMsg->indicationMessage_formats.choice.indicationMessage_Format1)
{
- if(e2smKpmIndHdr->indicationHeader_formats.choice.indicationHeader_Format1)
- {
- format1 = e2smKpmIndHdr->indicationHeader_formats.choice.indicationHeader_Format1;
+ format1Msg = e2smKpmIndMsg->indicationMessage_formats.choice.indicationMessage_Format1;
+
+ /* Measurement Data */
+ freeMeasData(&format1Msg->measData);
- DU_FREE(format1->colletStartTime.buf, format1->colletStartTime.size);
- DU_FREE(format1, sizeof(E2SM_KPM_IndicationHeader_Format1_t));
+ /* Measurement Info List */
+ if(format1Msg->measInfoList)
+ {
+ freeMeasInfoList(format1Msg->measInfoList);
+ DU_FREE(format1Msg->measInfoList, sizeof(MeasurementInfoList_t));
}
- break;
+
+ /* Granularity Period */
+ DU_FREE(format1Msg->granulPeriod, sizeof(GranularityPeriod_t));
+
+ DU_FREE(format1Msg, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
}
- case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_NOTHING:
- default:
break;
- }
+ }
+
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_NOTHING:
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format2:
+ default:
+ break;
}
}
/*******************************************************************
*
- * @brief Fill RIC Indication Header buffer
+ * @brief Fill measurement record
*
* @details
*
- * Function : fillRicIndHeader
+ * Function : fillMeasRecord
*
- * Functionality: Fill E2SM-KPM Indication Header
- * Encode this message and copy to RIC Indication Header buffer
- *
- * @param RIC Indication Header buffer to be filled
- * Source RIC subscription info from E2AP DB
+ * Functionality: Fills all measurement value for a measurement
+ * within an action in a RIC subscription
+ *
+ * @param Measurement record to be filled
+ * Measurement database with measurement records
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillRicIndHeader(RICindicationHeader_t *ricIndHdr, RicSubscription *ricSubsInfo)
+uint8_t fillMeasRecord(MeasurementRecord_t *measRecord, MeasurementInfo *measInfoDb)
{
- uint8_t ret = RFAILED;
- uint8_t secBufIdx = 0, milliSecBufIdx = 0;
- int8_t byteIdx = 0;
- bool formatFailure = false;
- RanFunction *ranFunc = NULLP;
- ReportStartTime *startTime = NULLP;
- E2SM_KPM_IndicationHeader_t e2smKpmIndHdr;
- E2SM_KPM_IndicationHeader_Format1_t *format1 = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
+ uint8_t measRecIdx = 0;
+ CmLList *measValNode = NULLP;
+ double measVal = 0;
- while(true)
+ measRecord->list.count = measInfoDb->measuredValue.count;
+ measRecord->list.size = measRecord->list.count * sizeof(MeasurementRecordItem_t *);
+
+ DU_ALLOC(measRecord->list.array, measRecord->list.size);
+ if(!measRecord->list.array)
{
- ranFunc = fetchRanFuncFromRanFuncId(ricSubsInfo->ranFuncId);
- if(ranFunc == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : RAN Function ID [%d] not found", ricSubsInfo->ranFuncId);
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- memset(&e2smKpmIndHdr, 0, sizeof(E2SM_KPM_IndicationHeader_t));
-
- e2smKpmIndHdr.indicationHeader_formats.present = ranFunc->ricIndicationHeaderFormat;
- switch(e2smKpmIndHdr.indicationHeader_formats.present)
+ for(measRecIdx = 0; measRecIdx < measRecord->list.count; measRecIdx++)
+ {
+ DU_ALLOC(measRecord->list.array[measRecIdx], sizeof(MeasurementRecordItem_t));
+ if(!measRecord->list.array[measRecIdx])
{
- case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_indicationHeader_Format1:
- {
- DU_ALLOC(e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1, \
- sizeof(E2SM_KPM_IndicationHeader_Format1_t));
- if(!e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- formatFailure = true;
- break;
- }
- format1 = e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1;
-
- /* Fetch reporting period start time from DB */
- switch(ricSubsInfo->eventTriggerDefinition.formatType)
- {
- case 1:
- {
- startTime = &ricSubsInfo->eventTriggerDefinition.choice.format1.startTime;
- }
- }
-
- format1->colletStartTime.size = 8 * sizeof(uint8_t);
- DU_ALLOC(format1->colletStartTime.buf, format1->colletStartTime.size);
- if(!format1->colletStartTime.buf)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- formatFailure = true;
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
+ }
- /* As per O-RAN.WG3.E2SM-KPM-R003-v03.00, section 8.3.12 and
- * RFC 5905, section 6 :
- * Time stamp has a 64-bit format where first 32-bit is seconds
- * and next 32-bit is fraction in picosecond-level.
- * This fraction has been rounded in microseconds.
- *
- * Hence,
- * Storing 32-bit seconds at MSB 0-3 and
- * 32-bit milliseconds at next 4 bytes i.e. bytes 4-7
- */
- secBufIdx = 0;
- milliSecBufIdx = 4;
- for(byteIdx = 3; byteIdx >= 0; byteIdx--)
- {
- format1->colletStartTime.buf[secBufIdx++] = startTime->timeInSec >> (8*byteIdx);
- format1->colletStartTime.buf[milliSecBufIdx++] = startTime->timeInMilliSec >> (8*byteIdx);
- }
- break;
- }
+ measRecIdx = 0;
+ CM_LLIST_FIRST_NODE(&measInfoDb->measuredValue, measValNode);
+ while(measValNode)
+ {
+ measVal = *(double *)measValNode->node;
+ if(measVal == (int)measVal)
+ {
+ measRecord->list.array[measRecIdx]->present = MeasurementRecordItem_PR_integer;
+ measRecord->list.array[measRecIdx]->choice.integer = (int)measVal;
+ }
+ else
+ {
+ measRecord->list.array[measRecIdx]->present = MeasurementRecordItem_PR_real;
+ measRecord->list.array[measRecIdx]->choice.real = measVal;
+ }
+ measRecIdx++;
+ measValNode= measValNode->next;
+ /* Once the measurement record is added to the message, delete it from DB */
+ measVal = 0;
+ }
+ deleteMeasuredValueList(&measInfoDb->measuredValue);
+ return ROK;
+}
- case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_NOTHING:
- default:
- {
- DU_LOG("\nERROR --> E2AP : Only E2SM-KPM Indication Header Format 1 supported");
- formatFailure = true;
- break;
- }
- }
+/*******************************************************************
+ *
+ * @brief Fills measuerement data
+ *
+ * @details
+ *
+ * Function : fillMeasData
+ *
+ * Functionality: Fill all measurement recorded for all measurements
+ * in an action in a RIC subscription
+ *
+ * @param Measurement data to be filled
+ * Measurement info list from an action DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t fillMeasData(MeasurementData_t *measData, CmLListCp *measInfoListDb)
+{
+ uint8_t measIdx = 0;
+ CmLList *measInfoNode = NULLP;
+ MeasurementInfo *measInfoDb = NULLP;
+ MeasurementRecord_t *measRecord = NULLP;
- if(formatFailure)
- break;
+ measData->list.count = measInfoListDb->count;
+ measData->list.size = measData->list.count * sizeof(MeasurementDataItem_t *);
- /* Encode E2SM-KPM Indication Header */
- xer_fprint(stdout, &asn_DEF_E2SM_KPM_IndicationHeader, &e2smKpmIndHdr);
- memset(encBuf, 0, ENC_BUF_MAX_LEN);
- encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_E2SM_KPM_IndicationHeader, 0, &e2smKpmIndHdr, PrepFinalEncBuf, encBuf);
- if(encRetVal.encoded == ENCODE_FAIL)
- {
- DU_LOG("\nERROR --> E2AP : Could not encode E2SM-KPM Indication Header (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
- {
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SM-KPM Indication Header \n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
-#endif
- }
+ DU_ALLOC(measData->list.array, measData->list.size);
+ if(!measData->list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- /* Copy encoded string to RIC Indication Header buffer */
- ricIndHdr->size = encBufSize;
- DU_ALLOC(ricIndHdr->buf, ricIndHdr->size);
- if(!ricIndHdr->buf)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
- break;
- }
- memset(ricIndHdr->buf, 0, ricIndHdr->size);
- memcpy(ricIndHdr->buf, encBuf, encBufSize);
- ret = ROK;
- break;
- }
+ measIdx = 0;
+ CM_LLIST_FIRST_NODE(measInfoListDb, measInfoNode);
+ while(measInfoNode)
+ {
+ measInfoDb = (MeasurementInfo *)measInfoNode->node;
+ if(measInfoDb)
+ {
+ DU_ALLOC(measData->list.array[measIdx], sizeof(MeasurementDataItem_t));
+ if(!measData->list.array[measIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- /* Free E2SM-KPM Indication Header */
- FreeE2smKpmIndicationHeader(&e2smKpmIndHdr);
+ measRecord = &measData->list.array[measIdx]->measRecord;
+ if(fillMeasRecord(measRecord, measInfoDb) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill measurement record");
+ return RFAILED;
+ }
+ measIdx++;
+ }
+ measInfoNode = measInfoNode->next;
+ }
- return ret;
+ return ROK;
}
/*******************************************************************
*
- * brief Fill the RIC Indication Message
+ * @brief Fill all measurement info
*
* @details
*
- * Function : fillRicIndication
+ * Function : fillMeasInfoList
*
- * Functionality: Fills the RIC Indication Message
+ * Functionality: Fills all measurement info belonging to an action
+ * in a RIC subscription
*
- * @param RIC Indication Message to be filled
- * RIC Subscription DB
- * Action DB
+ * @param Measurement Info list to be filled
+ * Measurement Info list from E2AP DB
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t fillRicIndication(RICindication_t *ricIndicationMsg, RicSubscription *ricSubscriptionInfo, ActionInfo *actionInfo)
+uint8_t fillMeasInfoList(MeasurementInfoList_t *measInfoList, CmLListCp *measInfoListDb)
{
- uint8_t elementCnt = 0, idx = 0;
- uint8_t ret = ROK;
-
- elementCnt = 6;
+ uint8_t measInfoIdx = 0;
+ CmLList *measInfoNode = NULLP;
+ MeasurementInfo *measInfoDb = NULLP;
+ MeasurementInfoItem_t *measInfoItem = NULLP;
- ricIndicationMsg->protocolIEs.list.count = elementCnt;
- ricIndicationMsg->protocolIEs.list.size = elementCnt * sizeof(RICindication_IEs_t *);
+ measInfoList->list.count = measInfoListDb->count;
+ measInfoList->list.size = measInfoList->list.count * sizeof(MeasurementInfoItem_t *);
- /* Initialize the Ric Indication members */
- DU_ALLOC(ricIndicationMsg->protocolIEs.list.array, ricIndicationMsg->protocolIEs.list.size);
- if(ricIndicationMsg->protocolIEs.list.array == NULLP)
+ DU_ALLOC(measInfoList->list.array, measInfoList->list.size);
+ if(!measInfoList->list.array)
{
DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
return RFAILED;
}
- for(idx=0; idx<elementCnt; idx++)
+ measInfoIdx = 0;
+ CM_LLIST_FIRST_NODE(measInfoListDb, measInfoNode);
+ while(measInfoNode)
{
- DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx], sizeof(RICindication_IEs_t));
- if(ricIndicationMsg->protocolIEs.list.array[idx] == NULLP)
+ DU_ALLOC(measInfoList->list.array[measInfoIdx], sizeof(MeasurementInfoItem_t));
+ if(!measInfoList->list.array[measInfoIdx])
{
DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
return RFAILED;
}
- }
- /* RIC Request ID */
- idx = 0;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICrequestID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID = \
- ricSubscriptionInfo->requestId.requestorId;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID = \
- ricSubscriptionInfo->requestId.instanceId;
+ measInfoItem = measInfoList->list.array[measInfoIdx];
+ measInfoDb = (MeasurementInfo *)measInfoNode->node;
+ if(measInfoDb)
+ {
+ /* Measurement Type */
+ measInfoItem->measType.present = MeasurementType_PR_measName;
+ measInfoItem->measType.choice.measName.size = strlen(measInfoDb->measurementTypeName);
- /* RAN Function ID */
- idx++;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RANfunctionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID = ricSubscriptionInfo->ranFuncId;
+ DU_ALLOC(measInfoItem->measType.choice.measName.buf, measInfoItem->measType.choice.measName.size);
+ if(!measInfoItem->measType.choice.measName.buf)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- /* RIC Action ID */
- idx++;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICactionID;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID = actionInfo->actionId;
-
- /* RIC Indication Type */
- idx++;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationType;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationType;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType = actionInfo->type;
-
- /* RIC Indication Header */
- idx++;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationHeader;
- if(fillRicIndHeader(&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader, \
- ricSubscriptionInfo) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication header");
- return RFAILED;
- }
+ memcpy(measInfoItem->measType.choice.measName.buf, measInfoDb->measurementTypeName,\
+ measInfoItem->measType.choice.measName.size);
- /* RIC Indication Message */
- idx++;
- ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationMessage;
- ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
- ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationMessage;
- if(fillRicIndMsgBuf(&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage, \
- actionInfo) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication Message");
- return RFAILED;
+ measInfoIdx++;
+ }
+ measInfoNode = measInfoNode->next;
+ measInfoDb = NULLP;
}
- return ret;
+ return ROK;
}
-/*******************************************************************
+ /*******************************************************************
*
- * @brief Builds and Send the RicIndication Message
+ * @brief Fill E2SM-KPM Indication Message Format 1
*
* @details
*
- * Function : BuildAndSendRicIndication
+ * Function : fillE2smKpmIndMsgFormat1
*
- * Functionality:Fills the RicIndication Message
+ * Functionality: Fill E2SM-KPM Indication Message Format 1
*
+ * @param Format 1 Message to be filled
+ * Action Definition format 1 from E2AP DB
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
+uint8_t fillE2smKpmIndMsgFormat1(E2SM_KPM_IndicationMessage_Format1_t *format1Msg, ActionDefFormat1 *format1)
+{
+ /* Measurement Data */
+ if(fillMeasData(&format1Msg->measData, &format1->measurementInfoList) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill measurement data");
+ return RFAILED;
+ }
-uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo, ActionInfo *actionInfo)
+ /* Measurement Information */
+ DU_ALLOC(format1Msg->measInfoList, sizeof(MeasurementInfoList_t));
+ if(!format1Msg->measInfoList)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ if(fillMeasInfoList(format1Msg->measInfoList, &format1->measurementInfoList) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill measurement information list");
+ return RFAILED;
+ }
+
+ /* Granularity Period */
+ DU_ALLOC(format1Msg->granulPeriod, sizeof(GranularityPeriod_t));
+ if(!format1Msg->granulPeriod)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
+ *(format1Msg->granulPeriod) = format1->granularityPeriod;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill RIC Indication Message buffer
+ *
+ * @details
+ *
+ * Function : fillRicIndMsgBuf
+ *
+ * Functionality: Fill E2SM-KPM Indication Message
+ * Encode this message and copy to RIC Indication Message buffer
+ *
+ * @param RIC Indication Message buffer to be filled
+ * Source action info from E2AP DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t fillRicIndMsgBuf(RICindicationMessage_t *ricIndMsgBuf, ActionInfo *actionInfo)
{
- uint8_t ret = RFAILED;
- E2AP_PDU_t *e2apMsg = NULLP;
- RICindication_t *ricIndicationMsg = NULLP;
+ uint8_t ret = RFAILED;
+ bool failedInFormat = false;
+ E2SM_KPM_IndicationMessage_t e2smKpmIndMsg;
asn_enc_rval_t encRetVal; /* Encoder return value */
+ memset(&e2smKpmIndMsg, 0, sizeof(E2SM_KPM_IndicationMessage_t));
+
while(true)
{
- DU_LOG("\nINFO --> E2AP : Building RIC Indication Message\n");
-
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
+ /* E2SM-KPM Indication message format type */
+ e2smKpmIndMsg.indicationMessage_formats.present = actionInfo->definition.formatType;
+ switch(e2smKpmIndMsg.indicationMessage_formats.present)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
- }
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format1:
+ {
+ /* E2SM-KPM Indication message format 1 */
+ DU_ALLOC(e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1, \
+ sizeof(E2SM_KPM_IndicationMessage_Format1_t));
+ if(!e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ failedInFormat = true;
+ break;
+ }
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
- }
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICindication;
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICindication;
+ if(fillE2smKpmIndMsgFormat1(e2smKpmIndMsg.indicationMessage_formats.choice.indicationMessage_Format1, \
+ &actionInfo->definition.choice.format1) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill E2SM-KPM Indication message format 1");
+ failedInFormat = true;
+ break;
+ }
+ break;
+ }
- ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_NOTHING:
+ case E2SM_KPM_IndicationMessage__indicationMessage_formats_PR_indicationMessage_Format2:
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : fillRicIndMsgBuf: Only Format 1 supported");
+ failedInFormat = true;
+ break;
+ }
+ }
- if(fillRicIndication(ricIndicationMsg, ricSubscriptionInfo, actionInfo) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication message");
+ if(failedInFormat)
break;
- }
- /* Prints the Msg formed */
- xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
+ /* Encode E2SM-KPM Indication Message */
+ xer_fprint(stdout, &asn_DEF_E2SM_KPM_IndicationMessage, &e2smKpmIndMsg);
memset(encBuf, 0, ENC_BUF_MAX_LEN);
encBufSize = 0;
- encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
- encBuf);
+ encRetVal = aper_encode(&asn_DEF_E2SM_KPM_IndicationMessage, 0, &e2smKpmIndMsg, PrepFinalEncBuf, encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> E2AP : Could not encode RIC Indication Message (at %s)\n",\
+ DU_LOG("\nERROR --> E2AP : Could not encode E2SM-KPM Indication Message (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
break;
}
else
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Indication Message \n");
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SM-KPM Indication Message \n");
#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
#endif
}
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ /* Copy encoded string to RIC Indication Message buffer */
+ ricIndMsgBuf->size = encBufSize;
+ DU_ALLOC(ricIndMsgBuf->buf, ricIndMsgBuf->size);
+ if(!ricIndMsgBuf->buf)
{
- DU_LOG("\nINFO --> E2AP : Sending RIC Indication Message");
-
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ break;
}
+ memset(ricIndMsgBuf->buf, 0, ricIndMsgBuf->size);
+ memcpy(ricIndMsgBuf->buf, encBuf, encBufSize);
+
ret = ROK;
break;
}
- FreeRicIndication(e2apMsg);
+
+ /* Free E2SM-KPM Indication Message */
+ FreeE2smKpmIndicationMessage(&e2smKpmIndMsg);
+
return ret;
}
/*******************************************************************
*
- * @brief free e2 node component configuration req and rsp
+ * @brief Free E2SM-KPM Indication Header
*
* @details
*
- * Function : freeE2NodeComponentConfiguration
- *
- * Functionality:
- * - free e2 node component configuration req and rsp
+ * Function : FreeE2smKpmIndicationHeader
*
- * @params[in] E2nodeComponentConfiguration_t *e2nodeComponentConfiguration
- * @return ROK - success
- * RFAILED - failure
+ * Functionality: Free E2SM-KPM Indication Header
+ *
+ * @param E2SM-KPM Indication Header to be free
+ * @return void
*
- * ****************************************************************/
-
-void freeE2NodeComponentConfiguration(E2nodeComponentConfiguration_t *e2nodeComponentConfiguration)
+ ******************************************************************/
+void FreeE2smKpmIndicationHeader(E2SM_KPM_IndicationHeader_t *e2smKpmIndHdr)
{
- /* Free E2 Node Component Request Part */
- DU_FREE(e2nodeComponentConfiguration->e2nodeComponentRequestPart.buf, e2nodeComponentConfiguration->e2nodeComponentRequestPart.size);
+ E2SM_KPM_IndicationHeader_Format1_t *format1 = NULLP;
- /* Free E2 Node Component Response Part */
- DU_FREE(e2nodeComponentConfiguration->e2nodeComponentResponsePart.buf, e2nodeComponentConfiguration->e2nodeComponentResponsePart.size);
-
+ if(e2smKpmIndHdr)
+ {
+ switch(e2smKpmIndHdr->indicationHeader_formats.present)
+ {
+ case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_indicationHeader_Format1:
+ {
+ if(e2smKpmIndHdr->indicationHeader_formats.choice.indicationHeader_Format1)
+ {
+ format1 = e2smKpmIndHdr->indicationHeader_formats.choice.indicationHeader_Format1;
+
+ DU_FREE(format1->colletStartTime.buf, format1->colletStartTime.size);
+ DU_FREE(format1, sizeof(E2SM_KPM_IndicationHeader_Format1_t));
+ }
+ break;
+ }
+ case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_NOTHING:
+ default:
+ break;
+ }
+ }
}
/*******************************************************************
*
- * @brief free e2 node component component identifier
+ * @brief Fill RIC Indication Header buffer
*
* @details
*
- * Function : freeE2NodeComponentIdentifier
- *
- * Functionality:
- * - free e2 node component component identifier
+ * Function : fillRicIndHeader
*
- * @params[in] E2nodeComponentID_t *componentID
+ * Functionality: Fill E2SM-KPM Indication Header
+ * Encode this message and copy to RIC Indication Header buffer
+ *
+ * @param RIC Indication Header buffer to be filled
+ * Source RIC subscription info from E2AP DB
* @return ROK - success
* RFAILED - failure
*
- * ****************************************************************/
-
-void freeE2NodeComponentIdentifier(E2nodeComponentID_t *componentID)
+ ******************************************************************/
+uint8_t fillRicIndHeader(RICindicationHeader_t *ricIndHdr, RicSubscription *ricSubsInfo)
{
- if(componentID->choice.e2nodeComponentInterfaceTypeF1)
- {
- DU_FREE(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf, componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
- DU_FREE(componentID->choice.e2nodeComponentInterfaceTypeF1, sizeof(E2nodeComponentInterfaceF1_t));
- }
-
-}
+ uint8_t ret = RFAILED;
+ uint8_t secBufIdx = 0, milliSecBufIdx = 0;
+ int8_t byteIdx = 0;
+ bool formatFailure = false;
+ RanFunction *ranFunc = NULLP;
+ ReportStartTime *startTime = NULLP;
+ E2SM_KPM_IndicationHeader_t e2smKpmIndHdr;
+ E2SM_KPM_IndicationHeader_Format1_t *format1 = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
-/*******************************************************************
- *
- * @brief Deallocate the memory allocated for E2nodeConfigurationUpdate msg
- *
- * @details
- *
- * Function : FreeE2NodeConfigUpdate
- *
- * Functionality:
- * - freeing the memory allocated for E2nodeConfigurationUpdate
- *
- * @params[in] E2AP_PDU_t *e2apMsg
- * @return ROK - success
- * RFAILED - failure
- *
- * ****************************************************************/
+ while(true)
+ {
+ ranFunc = fetchRanFuncFromRanFuncId(ricSubsInfo->ranFuncId);
+ if(ranFunc == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : RAN Function ID [%d] not found", ricSubsInfo->ranFuncId);
+ break;
+ }
-void FreeE2NodeConfigUpdate(E2AP_PDU_t *e2apMsg)
-{
- uint8_t arrIdx =0, e2NodeUpdateListIdx=0, e2NodeRemovalListIdx=0, e2NodeAddListIdx=0;
- E2nodeConfigurationUpdate_t *e2NodeConfigUpdate =NULL;
- E2nodeComponentConfigUpdate_List_t *e2NodeUpdateList =NULL;
- E2nodeComponentConfigUpdate_ItemIEs_t *e2NodeUpdateItem =NULL;
- E2nodeComponentConfigRemoval_List_t *e2NodeRemovalList =NULL;
- E2nodeComponentConfigRemoval_ItemIEs_t *e2NodeRemovalItem =NULL;
- E2nodeComponentConfigAddition_List_t *e2NodeAddList =NULL;
- E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItem =NULL;
+ memset(&e2smKpmIndHdr, 0, sizeof(E2SM_KPM_IndicationHeader_t));
- if(e2apMsg != NULLP)
- {
- if(e2apMsg->choice.initiatingMessage != NULLP)
+ e2smKpmIndHdr.indicationHeader_formats.present = ranFunc->ricIndicationHeaderFormat;
+ switch(e2smKpmIndHdr.indicationHeader_formats.present)
{
- e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
- if(e2NodeConfigUpdate->protocolIEs.list.array != NULLP)
- {
- for(arrIdx = 0; arrIdx < e2NodeConfigUpdate->protocolIEs.list.count; arrIdx++)
+ case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_indicationHeader_Format1:
{
- if(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx])
+ DU_ALLOC(e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1, \
+ sizeof(E2SM_KPM_IndicationHeader_Format1_t));
+ if(!e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1)
{
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ formatFailure = true;
+ break;
+ }
+ format1 = e2smKpmIndHdr.indicationHeader_formats.choice.indicationHeader_Format1;
- switch(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id)
+ /* Fetch reporting period start time from DB */
+ switch(ricSubsInfo->eventTriggerDefinition.formatType)
+ {
+ case 1:
{
- case ProtocolIE_IDE2_id_TransactionID:
- break;
+ startTime = &ricSubsInfo->eventTriggerDefinition.choice.format1.startTime;
+ }
+ }
- case ProtocolIE_IDE2_id_E2nodeComponentConfigAddition:
- {
- e2NodeAddList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List;
- if(e2NodeAddList->list.array)
- {
- for(e2NodeAddListIdx = 0; e2NodeAddListIdx< e2NodeAddList->list.count; e2NodeAddListIdx++)
- {
- e2NodeAddItem = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[e2NodeAddListIdx];
-
- freeE2NodeComponentConfiguration(&e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration);
- freeE2NodeComponentIdentifier(&e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID);
- DU_FREE(e2NodeAddItem, sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
- }
- DU_FREE(e2NodeAddList->list.array, e2NodeAddList->list.size);
- }
- break;
- }
- case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate:
- {
- e2NodeUpdateList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdate_List;
- if(e2NodeUpdateList->list.array)
- {
- for(e2NodeUpdateListIdx = 0; e2NodeUpdateListIdx< e2NodeUpdateList->list.count; e2NodeUpdateListIdx++)
- {
- e2NodeUpdateItem = (E2nodeComponentConfigUpdate_ItemIEs_t *) e2NodeUpdateList->list.array[e2NodeUpdateListIdx];
-
- freeE2NodeComponentConfiguration(&e2NodeUpdateItem->value.choice.E2nodeComponentConfigUpdate_Item.e2nodeComponentConfiguration);
- freeE2NodeComponentIdentifier(&e2NodeUpdateItem->value.choice.E2nodeComponentConfigUpdate_Item.e2nodeComponentID);
- DU_FREE(e2NodeUpdateItem, sizeof(E2nodeComponentConfigUpdate_ItemIEs_t));
- }
- DU_FREE(e2NodeUpdateList->list.array, e2NodeUpdateList->list.size);
- }
- break;
- }
- case ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval:
- {
- e2NodeRemovalList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemoval_List;
- if(e2NodeRemovalList->list.array)
- {
- for(e2NodeRemovalListIdx = 0; e2NodeRemovalListIdx< e2NodeRemovalList->list.count; e2NodeRemovalListIdx++)
- {
- e2NodeRemovalItem = (E2nodeComponentConfigRemoval_ItemIEs_t *) e2NodeRemovalList->list.array[e2NodeRemovalListIdx];
+ format1->colletStartTime.size = 8 * sizeof(uint8_t);
+ DU_ALLOC(format1->colletStartTime.buf, format1->colletStartTime.size);
+ if(!format1->colletStartTime.buf)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ formatFailure = true;
+ break;
+ }
- freeE2NodeComponentIdentifier(&e2NodeRemovalItem->value.choice.E2nodeComponentConfigRemoval_Item.e2nodeComponentID);
- DU_FREE(e2NodeRemovalItem, sizeof(E2nodeComponentConfigRemoval_ItemIEs_t));
- }
- DU_FREE(e2NodeRemovalList->list.array, e2NodeRemovalList->list.size);
- }
- break;
- }
-
- default:
- break;
- }
- DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
+ /* As per O-RAN.WG3.E2SM-KPM-R003-v03.00, section 8.3.12 and
+ * RFC 5905, section 6 :
+ * Time stamp has a 64-bit format where first 32-bit is seconds
+ * and next 32-bit is fraction in picosecond-level.
+ * This fraction has been rounded in microseconds.
+ *
+ * Hence,
+ * Storing 32-bit seconds at MSB 0-3 and
+ * 32-bit milliseconds at next 4 bytes i.e. bytes 4-7
+ */
+ secBufIdx = 0;
+ milliSecBufIdx = 4;
+ for(byteIdx = 3; byteIdx >= 0; byteIdx--)
+ {
+ format1->colletStartTime.buf[secBufIdx++] = startTime->timeInSec >> (8*byteIdx);
+ format1->colletStartTime.buf[milliSecBufIdx++] = startTime->timeInMilliSec >> (8*byteIdx);
}
+ break;
}
- DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array, e2NodeConfigUpdate->protocolIEs.list.size);
+
+ case E2SM_KPM_IndicationHeader__indicationHeader_formats_PR_NOTHING:
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Only E2SM-KPM Indication Header Format 1 supported");
+ formatFailure = true;
+ break;
}
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+
+ if(formatFailure)
+ break;
+
+ /* Encode E2SM-KPM Indication Header */
+ xer_fprint(stdout, &asn_DEF_E2SM_KPM_IndicationHeader, &e2smKpmIndHdr);
+ memset(encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_E2SM_KPM_IndicationHeader, 0, &e2smKpmIndHdr, PrepFinalEncBuf, encBuf);
+ if(encRetVal.encoded == ENCODE_FAIL)
+ {
+ DU_LOG("\nERROR --> E2AP : Could not encode E2SM-KPM Indication Header (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2SM-KPM Indication Header \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+
+ /* Copy encoded string to RIC Indication Header buffer */
+ ricIndHdr->size = encBufSize;
+ DU_ALLOC(ricIndHdr->buf, ricIndHdr->size);
+ if(!ricIndHdr->buf)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ break;
+ }
+ memset(ricIndHdr->buf, 0, ricIndHdr->size);
+ memcpy(ricIndHdr->buf, encBuf, encBufSize);
+ ret = ROK;
+ break;
}
+
+ /* Free E2SM-KPM Indication Header */
+ FreeE2smKpmIndicationHeader(&e2smKpmIndHdr);
+
+ return ret;
}
/*******************************************************************
*
- * @brief Buld and send the E2 node config update msg
+ * brief Fill the RIC Indication Message
*
* @details
*
- * Function : BuildAndSendE2NodeConfigUpdate
+ * Function : fillRicIndication
*
- * Functionality:
- * - Buld and send the E2 node config update msg
+ * Functionality: Fills the RIC Indication Message
*
- * @params[in]
+ * @param RIC Indication Message to be filled
+ * RIC Subscription DB
+ * Action DB
* @return ROK - success
* RFAILED - failure
*
- * ****************************************************************/
-
-uint8_t BuildAndSendE2NodeConfigUpdate(E2NodeConfigList *e2NodeList)
+ ******************************************************************/
+uint8_t fillRicIndication(RICindication_t *ricIndicationMsg, RicSubscription *ricSubscriptionInfo, ActionInfo *actionInfo)
{
- uint8_t ret = RFAILED;
- uint8_t arrIdx = 0,elementCnt = 0, transId=0;
- E2AP_PDU_t *e2apMsg = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
- E2nodeConfigurationUpdate_t *e2NodeConfigUpdate = NULLP;
+ uint8_t elementCnt = 0, idx = 0;
+ uint8_t ret = ROK;
- DU_LOG("\nINFO --> E2AP : Building E2 Node config update\n");
- do
+ elementCnt = 6;
+
+ ricIndicationMsg->protocolIEs.list.count = elementCnt;
+ ricIndicationMsg->protocolIEs.list.size = elementCnt * sizeof(RICindication_IEs_t *);
+
+ /* Initialize the Ric Indication members */
+ DU_ALLOC(ricIndicationMsg->protocolIEs.list.array, ricIndicationMsg->protocolIEs.list.size);
+ if(ricIndicationMsg->protocolIEs.list.array == NULLP)
{
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
+ }
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
+ for(idx=0; idx<elementCnt; idx++)
+ {
+ DU_ALLOC(ricIndicationMsg->protocolIEs.list.array[idx], sizeof(RICindication_IEs_t));
+ if(ricIndicationMsg->protocolIEs.list.array[idx] == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
- break;
+ DU_LOG("\nERROR --> E2AP : Memory allocation in [%s] at line [%d]", __func__, __LINE__);
+ return RFAILED;
}
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2nodeConfigurationUpdate;
- e2apMsg->choice.initiatingMessage->value.present = \
- InitiatingMessageE2__value_PR_E2nodeConfigurationUpdate;
- e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
-
- elementCnt =1;
- if(e2NodeList->addE2NodeCount)
- elementCnt++;
- if(e2NodeList->updateE2NodeCount)
- elementCnt++;
- if(e2NodeList->removeE2NodeCount)
- elementCnt++;
+ }
- e2NodeConfigUpdate->protocolIEs.list.count = elementCnt;
- e2NodeConfigUpdate->protocolIEs.list.size = elementCnt * sizeof(E2nodeConfigurationUpdate_IEs_t*);
- DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array, e2NodeConfigUpdate->protocolIEs.list.size);
- if(e2NodeConfigUpdate->protocolIEs.list.array == NULLP)
+ /* RIC Request ID */
+ idx = 0;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICrequestID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICrequestID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID = \
+ ricSubscriptionInfo->requestId.requestorId;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID = \
+ ricSubscriptionInfo->requestId.instanceId;
+
+ /* RAN Function ID */
+ idx++;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RANfunctionID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RANfunctionID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID = ricSubscriptionInfo->ranFuncId;
+
+ /* RIC Action ID */
+ idx++;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICactionID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICactionID;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID = actionInfo->actionId;
+
+ /* RIC Indication Type */
+ idx++;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationType;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationType;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType = actionInfo->type;
+
+ /* RIC Indication Header */
+ idx++;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationHeader;
+ if(fillRicIndHeader(&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationHeader, \
+ ricSubscriptionInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication header");
+ return RFAILED;
+ }
+
+ /* RIC Indication Message */
+ idx++;
+ ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationMessage;
+ ricIndicationMsg->protocolIEs.list.array[idx]->criticality = CriticalityE2_reject;
+ ricIndicationMsg->protocolIEs.list.array[idx]->value.present = RICindication_IEs__value_PR_RICindicationMessage;
+ if(fillRicIndMsgBuf(&ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationMessage, \
+ actionInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication Message");
+ return RFAILED;
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and Send the RicIndication Message
+ *
+ * @details
+ *
+ * Function : BuildAndSendRicIndication
+ *
+ * Functionality:Fills the RicIndication Message
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo, ActionInfo *actionInfo)
+{
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ RICindication_t *ricIndicationMsg = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ while(true)
+ {
+ DU_LOG("\nINFO --> E2AP : Building RIC Indication Message\n");
+
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
break;
}
-
- for(arrIdx =0; arrIdx<elementCnt; arrIdx++)
- {
- DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
- if(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx] == NULLP)
- {
-
- DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
- break;
- }
- }
-
- if(arrIdx<elementCnt)
- break;
-
- arrIdx = 0;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_TransactionID;
- transId = assignTransactionId();
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
- if(e2NodeList->addE2NodeCount)
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
- arrIdx++;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigAddition_List;
- if(BuildE2NodeConfigAddList(&(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List),\
- ProcedureCodeE2_id_E2nodeConfigurationUpdate, e2NodeList->addE2NodeCount, e2NodeList->addE2Node)!=ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to create E2 Node config list");
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
}
-
- if(e2NodeList->updateE2NodeCount)
- {
- arrIdx++;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigUpdate_List;
- if(BuildE2NodeConfigUpdateList(&e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdate_List,\
- e2NodeList->updateE2NodeCount, e2NodeList->updateE2Node) != ROK)
- {
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICindication;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICindication;
- DU_LOG("\nERROR --> E2AP : Failed to update the E2 node configuration");
- break;
- }
- }
-
- if(e2NodeList->removeE2NodeCount)
- {
- arrIdx++;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
- e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigRemoval_List;
- if(BuildE2NodeConfigRemoveList(&e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemoval_List,\
- e2NodeList->removeE2NodeCount, e2NodeList->removeE2Node) != ROK)
- {
+ ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication;
- DU_LOG("\nERROR --> E2AP : Failed to remove the E2 node configuration");
- break;
- }
+ if(fillRicIndication(ricIndicationMsg, ricSubscriptionInfo, actionInfo) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill RIC Indication message");
+ break;
}
/* Prints the Msg formed */
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);
+ encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf,\
+ encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> E2AP : Could not encode E2nodeConfigurationUpdate structure (at %s)\n",\
+ DU_LOG("\nERROR --> E2AP : Could not encode RIC Indication Message (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
break;
}
else
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2nodeConfigurationUpdate\n");
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Indication Message \n");
#ifdef DEBUG_ASN_PRINT
for(int i=0; i< encBufSize; i++)
{
printf("%x",encBuf[i]);
- }
+ }
#endif
}
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize))
+
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
- DU_LOG("\nERROR --> E2AP : Sending E2 node config update failed");
- break;
- }
+ DU_LOG("\nINFO --> E2AP : Sending RIC Indication Message");
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
- memcpy(&duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.configList, e2NodeList, sizeof(E2NodeConfigList));
+ }
ret = ROK;
break;
- }while(true);
-
- FreeE2NodeConfigUpdate(e2apMsg);
+ }
+ FreeRicIndication(e2apMsg);
return ret;
}
/*******************************************************************
*
- * @brief Deallocate the memory allocated for E2ResetRequest msg
+ * @brief free e2 node component configuration req and rsp
*
* @details
*
- * Function : FreeE2ResetRequest
+ * Function : freeE2NodeComponentConfiguration
*
* Functionality:
- * - freeing the memory allocated for E2ResetRequest
+ * - free e2 node component configuration req and rsp
*
- * @params[in] E2AP_PDU_t *e2apMsg
+ * @params[in] E2nodeComponentConfiguration_t *e2nodeComponentConfiguration
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-void FreeE2ResetRequest(E2AP_PDU_t *e2apMsg)
+
+void freeE2NodeComponentConfiguration(E2nodeComponentConfiguration_t *e2nodeComponentConfiguration)
{
- uint8_t ieIdx =0;
- ResetRequestE2_t *resetReq = NULLP;
+ /* Free E2 Node Component Request Part */
+ DU_FREE(e2nodeComponentConfiguration->e2nodeComponentRequestPart.buf, e2nodeComponentConfiguration->e2nodeComponentRequestPart.size);
- if(e2apMsg != NULLP)
- {
- if(e2apMsg->choice.initiatingMessage != NULLP)
- {
- resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
- if(resetReq->protocolIEs.list.array)
- {
- for(ieIdx = 0; ieIdx < resetReq->protocolIEs.list.count; ieIdx++)
- {
- DU_FREE(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
- }
- DU_FREE(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
- }
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- }
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- }
+ /* Free E2 Node Component Response Part */
+ DU_FREE(e2nodeComponentConfiguration->e2nodeComponentResponsePart.buf, e2nodeComponentConfiguration->e2nodeComponentResponsePart.size);
+
}
/*******************************************************************
*
- * @brief Build and send the E2 reset request msg
+ * @brief free e2 node component component identifier
*
* @details
*
- * Function : BuildAndSendE2ResetRequest
+ * Function : freeE2NodeComponentIdentifier
*
* Functionality:
- * - Buld and send the E2 reset request msg to RIC
+ * - free e2 node component component identifier
*
- * @params[in]
- * Reset cause
+ * @params[in] E2nodeComponentID_t *componentID
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendE2ResetRequest(E2FailureCause resetCause)
-{
- uint8_t ieIdx = 0, elementCnt = 0, transId = 0;
- uint8_t ret = RFAILED;
- E2AP_PDU_t *e2apMsg = NULLP;
- ResetRequestE2_t *resetReq = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
- DU_LOG("\nINFO --> E2AP : Building E2 Reset Request\n");
-
- do
+void freeE2NodeComponentIdentifier(E2nodeComponentID_t *componentID)
+{
+ if(componentID->choice.e2nodeComponentInterfaceTypeF1)
{
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for E2AP-PDU failed");
- break;
- }
-
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for initiatingMessage");
- break;
- }
-
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_Reset;
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_ResetRequestE2;
- resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
-
- elementCnt = 2;
- resetReq->protocolIEs.list.count = elementCnt;
- resetReq->protocolIEs.list.size = elementCnt * sizeof(ResetRequestIEs_t *);
-
- DU_ALLOC(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
- if(!resetReq->protocolIEs.list.array)
- {
- DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
- Reset Request IE array");
- break;
- }
-
- for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
- {
- DU_ALLOC(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
- if(!resetReq->protocolIEs.list.array[ieIdx])
- {
- DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
- Reset Request IE array element");
- break;
- }
- }
-
- /* In case of failure */
- if(ieIdx < elementCnt)
- break;
-
- ieIdx = 0;
- resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
- resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
- resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_TransactionID;
- transId = assignTransactionId();
- resetReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
-
- ieIdx++;
- resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_CauseE2;
- resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_ignore;
- resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_CauseE2;
- fillE2Cause(&resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2, resetCause);
-
- /* Prints the Msg formed */
- 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 reset request structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
- break;
- }
- else
- {
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for reset request\n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
-#endif
- }
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
- break;
- }
-
- /* In case the message is sent successfully, store the transaction info to
- * be used when response is received */
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
- duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
-
- ret = ROK;
- break;
- }while(true);
-
- /* Free all memory */
- FreeE2ResetRequest(e2apMsg);
- return ret;
+ DU_FREE(componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf, componentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.size);
+ DU_FREE(componentID->choice.e2nodeComponentInterfaceTypeF1, sizeof(E2nodeComponentInterfaceF1_t));
+ }
+
}
/*******************************************************************
*
- * @brief Deallocate the memory allocated for Reset Response msg
+ * @brief Deallocate the memory allocated for E2nodeConfigurationUpdate msg
*
* @details
*
- * Function : freeAperDecodingOfE2ResetRsp
+ * Function : FreeE2NodeConfigUpdate
*
* Functionality:
- * - freeing the memory allocated for Reset response
+ * - freeing the memory allocated for E2nodeConfigurationUpdate
*
- * @params[in] ResetResponseE2_t *resetResponse
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-void freeAperDecodingOfE2ResetRsp(ResetResponseE2_t *resetResponse)
+
+void FreeE2NodeConfigUpdate(E2AP_PDU_t *e2apMsg)
{
- uint8_t ieIdx;
+ uint8_t arrIdx =0, e2NodeUpdateListIdx=0, e2NodeRemovalListIdx=0, e2NodeAddListIdx=0;
+ E2nodeConfigurationUpdate_t *e2NodeConfigUpdate =NULL;
+ E2nodeComponentConfigUpdate_List_t *e2NodeUpdateList =NULL;
+ E2nodeComponentConfigUpdate_ItemIEs_t *e2NodeUpdateItem =NULL;
+ E2nodeComponentConfigRemoval_List_t *e2NodeRemovalList =NULL;
+ E2nodeComponentConfigRemoval_ItemIEs_t *e2NodeRemovalItem =NULL;
+ E2nodeComponentConfigAddition_List_t *e2NodeAddList =NULL;
+ E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItem =NULL;
- if(resetResponse)
+ if(e2apMsg != NULLP)
{
- if(resetResponse->protocolIEs.list.array)
+ if(e2apMsg->choice.initiatingMessage != NULLP)
{
- for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
+ e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
+ if(e2NodeConfigUpdate->protocolIEs.list.array != NULLP)
{
- if(resetResponse->protocolIEs.list.array[ieIdx])
+ for(arrIdx = 0; arrIdx < e2NodeConfigUpdate->protocolIEs.list.count; arrIdx++)
{
- switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
+ if(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx])
{
- case ProtocolIE_IDE2_id_TransactionID:
- break;
- case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
- break;
+ switch(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAddition:
+ {
+ e2NodeAddList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List;
+ if(e2NodeAddList->list.array)
+ {
+ for(e2NodeAddListIdx = 0; e2NodeAddListIdx< e2NodeAddList->list.count; e2NodeAddListIdx++)
+ {
+ e2NodeAddItem = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[e2NodeAddListIdx];
+
+ freeE2NodeComponentConfiguration(&e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentConfiguration);
+ freeE2NodeComponentIdentifier(&e2NodeAddItem->value.choice.E2nodeComponentConfigAddition_Item.e2nodeComponentID);
+ DU_FREE(e2NodeAddItem, sizeof(E2nodeComponentConfigAddition_ItemIEs_t));
+ }
+ DU_FREE(e2NodeAddList->list.array, e2NodeAddList->list.size);
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate:
+ {
+ e2NodeUpdateList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdate_List;
+ if(e2NodeUpdateList->list.array)
+ {
+ for(e2NodeUpdateListIdx = 0; e2NodeUpdateListIdx< e2NodeUpdateList->list.count; e2NodeUpdateListIdx++)
+ {
+ e2NodeUpdateItem = (E2nodeComponentConfigUpdate_ItemIEs_t *) e2NodeUpdateList->list.array[e2NodeUpdateListIdx];
+
+ freeE2NodeComponentConfiguration(&e2NodeUpdateItem->value.choice.E2nodeComponentConfigUpdate_Item.e2nodeComponentConfiguration);
+ freeE2NodeComponentIdentifier(&e2NodeUpdateItem->value.choice.E2nodeComponentConfigUpdate_Item.e2nodeComponentID);
+ DU_FREE(e2NodeUpdateItem, sizeof(E2nodeComponentConfigUpdate_ItemIEs_t));
+ }
+ DU_FREE(e2NodeUpdateList->list.array, e2NodeUpdateList->list.size);
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval:
+ {
+ e2NodeRemovalList = &e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemoval_List;
+ if(e2NodeRemovalList->list.array)
+ {
+ for(e2NodeRemovalListIdx = 0; e2NodeRemovalListIdx< e2NodeRemovalList->list.count; e2NodeRemovalListIdx++)
+ {
+ e2NodeRemovalItem = (E2nodeComponentConfigRemoval_ItemIEs_t *) e2NodeRemovalList->list.array[e2NodeRemovalListIdx];
+
+ freeE2NodeComponentIdentifier(&e2NodeRemovalItem->value.choice.E2nodeComponentConfigRemoval_Item.e2nodeComponentID);
+ DU_FREE(e2NodeRemovalItem, sizeof(E2nodeComponentConfigRemoval_ItemIEs_t));
+ }
+ DU_FREE(e2NodeRemovalList->list.array, e2NodeRemovalList->list.size);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
}
- free(resetResponse->protocolIEs.list.array[ieIdx]);
}
+ DU_FREE(e2NodeConfigUpdate->protocolIEs.list.array, e2NodeConfigUpdate->protocolIEs.list.size);
}
- free(resetResponse->protocolIEs.list.array);
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Processes E2 Reset Response sent by RIC
+ * @brief Buld and send the E2 node config update msg
*
* @details
*
- * Function : procResetResponse
+ * Function : BuildAndSendE2NodeConfigUpdate
*
- * Functionality: Processes E2 Reset Response sent by RIC
+ * Functionality:
+ * - Buld and send the E2 node config update msg
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
- * @return void
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-void procResetResponse(E2AP_PDU_t *e2apMsg)
-{
- bool invalidTransId=false;
- uint8_t ieIdx =0, transId =0;
- uint16_t ranFuncIdx=0;
- ResetResponseE2_t *resetResponse =NULLP;
- DU_LOG("\nINFO --> E2AP : E2 Reset Response received");
- resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;;
+uint8_t BuildAndSendE2NodeConfigUpdate(E2NodeConfigList *e2NodeList)
+{
+ uint8_t ret = RFAILED;
+ uint8_t arrIdx = 0,elementCnt = 0, transId=0;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+ E2nodeConfigurationUpdate_t *e2NodeConfigUpdate = NULLP;
- for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
+ DU_LOG("\nINFO --> E2AP : Building E2 Node config update\n");
+ do
{
- switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
- {
- case ProtocolIE_IDE2_id_TransactionID:
- {
- transId = resetResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
- if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) && \
- (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
- invalidTransId = true;
- }
- break;
- }
- case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
- {
- for(ranFuncIdx=0; ranFuncIdx<MAX_RAN_FUNCTION; ranFuncIdx++)
- {
- if(duCb.e2apDb.ranFunction[ranFuncIdx].id >0)
- {
- deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList));
- memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo));
- }
- }
- break;
- }
- default:
- {
- DU_LOG("\nERROR --> E2AP : Invalid IE received in E2 Reset Response : %ld",
- resetResponse->protocolIEs.list.array[ieIdx]->id);
- break;
- }
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
+ break;
}
- if(invalidTransId == true)
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
+ DU_LOG("\nERROR --> E2AP : Memory allocation for E2AP-PDU failed");
break;
}
- }
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2nodeConfigurationUpdate;
+ e2apMsg->choice.initiatingMessage->value.present = \
+ InitiatingMessageE2__value_PR_E2nodeConfigurationUpdate;
+ e2NodeConfigUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2nodeConfigurationUpdate;
+
+ elementCnt =1;
+ if(e2NodeList->addE2NodeCount)
+ elementCnt++;
+ if(e2NodeList->updateE2NodeCount)
+ elementCnt++;
+ if(e2NodeList->removeE2NodeCount)
+ elementCnt++;
- freeAperDecodingOfE2ResetRsp(resetResponse);
+ e2NodeConfigUpdate->protocolIEs.list.count = elementCnt;
+ e2NodeConfigUpdate->protocolIEs.list.size = elementCnt * sizeof(E2nodeConfigurationUpdate_IEs_t*);
+ DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array, e2NodeConfigUpdate->protocolIEs.list.size);
+ if(e2NodeConfigUpdate->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
+ break;
+ }
+
+ for(arrIdx =0; arrIdx<elementCnt; arrIdx++)
+ {
+ DU_ALLOC(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx], sizeof(E2nodeConfigurationUpdate_IEs_t));
+ if(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx] == NULLP)
+ {
+
+ DU_LOG("\nERROR --> E2AP : Memory allocation for e2NodeConfigUpdate failed");
+ break;
+ }
+ }
+
+ if(arrIdx<elementCnt)
+ break;
+
+ arrIdx = 0;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.TransactionID = transId;
+
+ if(e2NodeList->addE2NodeCount)
+ {
+ arrIdx++;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigAddition_List;
+ if(BuildE2NodeConfigAddList(&(e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAddition_List),\
+ ProcedureCodeE2_id_E2nodeConfigurationUpdate, e2NodeList->addE2NodeCount, e2NodeList->addE2Node)!=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to create E2 Node config list");
+ break;
+ }
+ }
+
+ if(e2NodeList->updateE2NodeCount)
+ {
+ arrIdx++;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigUpdate;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigUpdate_List;
+ if(BuildE2NodeConfigUpdateList(&e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdate_List,\
+ e2NodeList->updateE2NodeCount, e2NodeList->updateE2Node) != ROK)
+ {
+
+ DU_LOG("\nERROR --> E2AP : Failed to update the E2 node configuration");
+ break;
+ }
+ }
+
+ if(e2NodeList->removeE2NodeCount)
+ {
+ arrIdx++;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->id = ProtocolIE_IDE2_id_E2nodeComponentConfigRemoval;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->criticality = CriticalityE2_reject;
+ e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.present = E2nodeConfigurationUpdate_IEs__value_PR_E2nodeComponentConfigRemoval_List;
+ if(BuildE2NodeConfigRemoveList(&e2NodeConfigUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemoval_List,\
+ e2NodeList->removeE2NodeCount, e2NodeList->removeE2Node) != ROK)
+ {
+
+ DU_LOG("\nERROR --> E2AP : Failed to remove the E2 node configuration");
+ break;
+ }
+ }
+
+ /* Prints the Msg formed */
+ 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 E2nodeConfigurationUpdate structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2nodeConfigurationUpdate\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize))
+ {
+ DU_LOG("\nERROR --> E2AP : Sending E2 node config update failed");
+ break;
+ }
+
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+ memcpy(&duCb.e2apDb.e2TimersInfo.e2Timers.e2NodeConfigUpdate.configList, e2NodeList, sizeof(E2NodeConfigList));
+ ret = ROK;
+ break;
+ }while(true);
+
+ FreeE2NodeConfigUpdate(e2apMsg);
+ return ret;
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for e2 setup Failure
+ * @brief Deallocate the memory allocated for E2ResetRequest msg
*
* @details
*
- * Function : freeAperDecodingOfE2SetupFailure
+ * Function : FreeE2ResetRequest
*
- * Functionality: Deallocation of memory allocated by aper decoder for e2
- * setup Failure
+ * Functionality:
+ * - freeing the memory allocated for E2ResetRequest
*
- * @params[in] E2setupFailure_t *e2SetupFailure;
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
* ****************************************************************/
-void freeAperDecodingOfE2SetupFailure(E2setupFailure_t *e2SetupFailure)
+void FreeE2ResetRequest(E2AP_PDU_t *e2apMsg)
{
- uint8_t arrIdx;
+ uint8_t ieIdx =0;
+ ResetRequestE2_t *resetReq = NULLP;
- if(e2SetupFailure)
+ if(e2apMsg != NULLP)
{
- if(e2SetupFailure->protocolIEs.list.array)
+ if(e2apMsg->choice.initiatingMessage != NULLP)
{
- for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
+ if(resetReq->protocolIEs.list.array)
{
- if(e2SetupFailure->protocolIEs.list.array[arrIdx])
+ for(ieIdx = 0; ieIdx < resetReq->protocolIEs.list.count; ieIdx++)
{
- free(e2SetupFailure->protocolIEs.list.array[arrIdx]);
+ DU_FREE(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
}
+ DU_FREE(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
}
- free(e2SetupFailure->protocolIEs.list.array);
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
-/******************************************************************
+
+/*******************************************************************
*
- * @brief Processes E2 Setup Failure sent by RIC
+ * @brief Build and send the E2 reset request msg
*
* @details
*
- * Function : procE2SetupFailure
+ * Function : BuildAndSendE2ResetRequest
*
- * Functionality: Processes E2 Setup failure sent by RIC
+ * Functionality:
+ * - Buld and send the E2 reset request msg to RIC
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @params[in]
+ * Reset cause
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-void procE2SetupFailure(E2AP_PDU_t *e2apMsg)
+uint8_t BuildAndSendE2ResetRequest(E2FailureCause resetCause)
{
- uint8_t arrIdx =0, transId =0, timerValue=0;
- E2setupFailure_t *e2SetupFailure;
+ uint8_t ieIdx = 0, elementCnt = 0, transId = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ ResetRequestE2_t *resetReq = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- DU_LOG("\nINFO --> E2AP : E2 Setup failure received");
- e2SetupFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2setupFailure;
+ DU_LOG("\nINFO --> E2AP : Building E2 Reset Request\n");
- for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ do
{
- switch(e2SetupFailure->protocolIEs.list.array[arrIdx]->id)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- case ProtocolIE_IDE2_id_TransactionID:
- {
- transId = e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
- (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
- return ;
- }
- break;
- }
- case ProtocolIE_IDE2_id_TimeToWaitE2:
- {
- timerValue = convertE2WaitTimerEnumToValue(e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
- if((duChkTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), EVENT_E2_SETUP_TMR)) == FALSE)
- {
- duStartTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), EVENT_E2_SETUP_TMR, timerValue);
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : EVENT_E2_SETUP_TMR timer is already running");
- return;
- }
- break;
- }
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for E2AP-PDU failed");
+ break;
}
- }
- freeAperDecodingOfE2SetupFailure(e2SetupFailure);
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation for initiatingMessage");
+ break;
+ }
+
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_Reset;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_ResetRequestE2;
+ resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
+
+ elementCnt = 2;
+ resetReq->protocolIEs.list.count = elementCnt;
+ resetReq->protocolIEs.list.size = elementCnt * sizeof(ResetRequestIEs_t *);
+
+ DU_ALLOC(resetReq->protocolIEs.list.array, resetReq->protocolIEs.list.size);
+ if(!resetReq->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
+ Reset Request IE array");
+ break;
+ }
+
+ for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
+ {
+ DU_ALLOC(resetReq->protocolIEs.list.array[ieIdx], sizeof(ResetRequestIEs_t));
+ if(!resetReq->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendE2ResetRequest(): Memory allocation failed for \
+ Reset Request IE array element");
+ break;
+ }
+ }
+
+ /* In case of failure */
+ if(ieIdx < elementCnt)
+ break;
+
+ ieIdx = 0;
+ resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ resetReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ ieIdx++;
+ resetReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_CauseE2;
+ resetReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_ignore;
+ resetReq->protocolIEs.list.array[ieIdx]->value.present = ResetRequestIEs__value_PR_CauseE2;
+ fillE2Cause(&resetReq->protocolIEs.list.array[ieIdx]->value.choice.CauseE2, resetCause);
+
+ /* Prints the Msg formed */
+ 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 reset request structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for reset request\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Sending E2 Setup request failed");
+ break;
+ }
+
+ /* In case the message is sent successfully, store the transaction info to
+ * be used when response is received */
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+
+ ret = ROK;
+ break;
+ }while(true);
+
+ /* Free all memory */
+ FreeE2ResetRequest(e2apMsg);
+ return ret;
}
-/******************************************************************
+
+/*******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for RIC service Query
+ * @brief Deallocate the memory allocated for Reset Response msg
*
* @details
*
- * Function : freeAperDecodingOfRicServiceQuery
+ * Function : freeAperDecodingOfE2ResetRsp
*
- * Functionality: Deallocation of memory allocated by aper decoder for RIC
- * service Query
+ * Functionality:
+ * - freeing the memory allocated for Reset response
*
- * @params[in] RICserviceQuery_t *ricServiceQuery;
+ * @params[in] ResetResponseE2_t *resetResponse
* @return void
*
* ****************************************************************/
-
-void freeAperDecodingOfRicServiceQuery(RICserviceQuery_t *ricServiceQuery)
+void freeAperDecodingOfE2ResetRsp(ResetResponseE2_t *resetResponse)
{
- uint8_t arrIdx,ranFuncIdx;
- RANfunctionsID_List_t *ranFuncAddedList;
+ uint8_t ieIdx;
- if(ricServiceQuery)
+ if(resetResponse)
{
- if(ricServiceQuery->protocolIEs.list.array)
+ if(resetResponse->protocolIEs.list.array)
{
- for(arrIdx=0; arrIdx<ricServiceQuery->protocolIEs.list.count; arrIdx++)
+ for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
{
- if(ricServiceQuery->protocolIEs.list.array[arrIdx])
+ if(resetResponse->protocolIEs.list.array[ieIdx])
{
- switch(ricServiceQuery->protocolIEs.list.array[arrIdx]->id)
+ switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
{
- case ProtocolIE_IDE2_id_RANfunctionsAccepted:
- {
- ranFuncAddedList= &ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
- if(ranFuncAddedList->list.array)
- {
- for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
- {
- free(ranFuncAddedList->list.array[ranFuncIdx]);
- }
- free(ranFuncAddedList->list.array);;
- }
+ case ProtocolIE_IDE2_id_TransactionID:
break;
- }
- default:
+
+ case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
break;
}
- free(ricServiceQuery->protocolIEs.list.array[arrIdx]);
+ free(resetResponse->protocolIEs.list.array[ieIdx]);
}
}
- free(ricServiceQuery->protocolIEs.list.array);
+ free(resetResponse->protocolIEs.list.array);
}
}
}
-/*******************************************************************
+
+/******************************************************************
*
- * @brief Build RanFunction Delete List
+ * @brief Processes E2 Reset Response sent by RIC
*
* @details
*
- * Function : BuildRanFunctionDeleteList
- *
- * Functionality: Build RanFunction Delete List
+ * Function : procResetResponse
*
- * @params[in]
- * RANfunctionsID List
- * Count of the RAN function
- * Received RAN function list
+ * Functionality: Processes E2 Reset Response sent by RIC
*
- * @return ROK - success
- * RFAILED - failure
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return void
*
- ******************************************************************/
-
-uint8_t BuildRanFunctionDeleteList(RANfunctionsID_List_t *deleteList, uint8_t count, RanFuncInfo *recvdRanFunc)
+ * ****************************************************************/
+void procResetResponse(E2AP_PDU_t *e2apMsg)
{
- uint8_t ranFuncIdx=0;
- RANfunctionID_ItemIEs_t *delRanFuncItem;
+ bool invalidTransId=false;
+ uint8_t ieIdx =0, transId =0;
+ uint16_t ranFuncIdx=0;
+ ResetResponseE2_t *resetResponse =NULLP;
- if(count)
+ DU_LOG("\nINFO --> E2AP : E2 Reset Response received");
+ resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;;
+
+ for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
{
- deleteList->list.count = count;
- deleteList->list.size = deleteList->list.count * sizeof(RANfunctionID_ItemIEs_t*);
- DU_ALLOC(deleteList->list.array, deleteList->list.size);
- if(deleteList->list.array == NULLP)
+ switch(resetResponse->protocolIEs.list.array[ieIdx]->id)
{
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
- return RFAILED;
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = resetResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) && \
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.successfulOutcome->procedureCode))
+ {
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ invalidTransId = true;
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_CriticalityDiagnosticsE2:
+ {
+ for(ranFuncIdx=0; ranFuncIdx<MAX_RAN_FUNCTION; ranFuncIdx++)
+ {
+ if(duCb.e2apDb.ranFunction[ranFuncIdx].id >0)
+ {
+ deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList));
+ memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo));
+ }
+ }
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid IE received in E2 Reset Response : %ld",
+ resetResponse->protocolIEs.list.array[ieIdx]->id);
+ break;
+ }
}
- for(ranFuncIdx = 0; ranFuncIdx< deleteList->list.count; ranFuncIdx++)
- {
- DU_ALLOC(deleteList->list.array[ranFuncIdx], sizeof(RANfunctionID_ItemIEs_t));
- if(deleteList->list.array[ranFuncIdx] == NULLP)
- {
- DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
- return RFAILED;
- }
- delRanFuncItem= (RANfunctionID_ItemIEs_t *) deleteList->list.array[ranFuncIdx];
- delRanFuncItem->id = ProtocolIE_IDE2_id_RANfunctionID_Item;
- delRanFuncItem->criticality = CriticalityE2_ignore;
- delRanFuncItem->value.choice.RANfunctionID_Item.ranFunctionID = recvdRanFunc[ranFuncIdx].id;
- delRanFuncItem->value.choice.RANfunctionID_Item.ranFunctionRevision = recvdRanFunc[ranFuncIdx].revisionCounter;
+ if(invalidTransId == true)
+ {
+ break;
}
}
- return ROK;
+
+ freeAperDecodingOfE2ResetRsp(resetResponse);
}
-/*******************************************************************
+
+/******************************************************************
*
- * @brief De Allocate Ric Service Update message
+ * @brief Deallocation of memory allocated by aper decoder for e2 setup Failure
*
* @details
*
- * Function : FreeRicServiceUpdate
- *
- * Functionality: De-Allocating Ric Service Update message
+ * Function : freeAperDecodingOfE2SetupFailure
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder for e2
+ * setup Failure
+ *
+ * @params[in] E2setupFailure_t *e2SetupFailure;
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodingOfE2SetupFailure(E2setupFailure_t *e2SetupFailure)
+{
+ uint8_t arrIdx;
+
+ if(e2SetupFailure)
+ {
+ if(e2SetupFailure->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ {
+ if(e2SetupFailure->protocolIEs.list.array[arrIdx])
+ {
+ free(e2SetupFailure->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(e2SetupFailure->protocolIEs.list.array);
+ }
+ }
+}
+/******************************************************************
+ *
+ * @brief Processes E2 Setup Failure sent by RIC
+ *
+ * @details
+ *
+ * Function : procE2SetupFailure
+ *
+ * Functionality: Processes E2 Setup failure sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void procE2SetupFailure(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0, transId =0, timerValue=0;
+ E2setupFailure_t *e2SetupFailure;
+
+ DU_LOG("\nINFO --> E2AP : E2 Setup failure received");
+ e2SetupFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2setupFailure;
+
+ for(arrIdx=0; arrIdx<e2SetupFailure->protocolIEs.list.count; arrIdx++)
+ {
+ switch(e2SetupFailure->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
+ {
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ return ;
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_TimeToWaitE2:
+ {
+ timerValue = convertE2WaitTimerEnumToValue(e2SetupFailure->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
+ if((duChkTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), EVENT_E2_SETUP_TMR)) == FALSE)
+ {
+ duStartTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), EVENT_E2_SETUP_TMR, timerValue);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : EVENT_E2_SETUP_TMR timer is already running");
+ return;
+ }
+ break;
+ }
+ }
+ }
+
+ freeAperDecodingOfE2SetupFailure(e2SetupFailure);
+}
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated by aper decoder for RIC service Query
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfRicServiceQuery
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder for RIC
+ * service Query
+ *
+ * @params[in] RICserviceQuery_t *ricServiceQuery;
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeAperDecodingOfRicServiceQuery(RICserviceQuery_t *ricServiceQuery)
+{
+ uint8_t arrIdx,ranFuncIdx;
+ RANfunctionsID_List_t *ranFuncAddedList;
+
+ if(ricServiceQuery)
+ {
+ if(ricServiceQuery->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<ricServiceQuery->protocolIEs.list.count; arrIdx++)
+ {
+ if(ricServiceQuery->protocolIEs.list.array[arrIdx])
+ {
+ switch(ricServiceQuery->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_RANfunctionsAccepted:
+ {
+ ranFuncAddedList= &ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
+ if(ranFuncAddedList->list.array)
+ {
+ for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
+ {
+ free(ranFuncAddedList->list.array[ranFuncIdx]);
+ }
+ free(ranFuncAddedList->list.array);;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ free(ricServiceQuery->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(ricServiceQuery->protocolIEs.list.array);
+ }
+ }
+}
+/*******************************************************************
+ *
+ * @brief Build RanFunction Delete List
+ *
+ * @details
+ *
+ * Function : BuildRanFunctionDeleteList
+ *
+ * Functionality: Build RanFunction Delete List
+ *
+ * @params[in]
+ * RANfunctionsID List
+ * Count of the RAN function
+ * Received RAN function list
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t BuildRanFunctionDeleteList(RANfunctionsID_List_t *deleteList, uint8_t count, RanFuncInfo *recvdRanFunc)
+{
+ uint8_t ranFuncIdx=0;
+ RANfunctionID_ItemIEs_t *delRanFuncItem;
+
+ if(count)
+ {
+ deleteList->list.count = count;
+ deleteList->list.size = deleteList->list.count * sizeof(RANfunctionID_ItemIEs_t*);
+ DU_ALLOC(deleteList->list.array, deleteList->list.size);
+ if(deleteList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
+ return RFAILED;
+ }
+ for(ranFuncIdx = 0; ranFuncIdx< deleteList->list.count; ranFuncIdx++)
+ {
+ DU_ALLOC(deleteList->list.array[ranFuncIdx], sizeof(RANfunctionID_ItemIEs_t));
+ if(deleteList->list.array[ranFuncIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP: Memory allocation failed in %s at %d",__func__, __LINE__);
+ return RFAILED;
+ }
+ delRanFuncItem= (RANfunctionID_ItemIEs_t *) deleteList->list.array[ranFuncIdx];
+ delRanFuncItem->id = ProtocolIE_IDE2_id_RANfunctionID_Item;
+ delRanFuncItem->criticality = CriticalityE2_ignore;
+ delRanFuncItem->value.choice.RANfunctionID_Item.ranFunctionID = recvdRanFunc[ranFuncIdx].id;
+ delRanFuncItem->value.choice.RANfunctionID_Item.ranFunctionRevision = recvdRanFunc[ranFuncIdx].revisionCounter;
+
+ }
+ }
+ return ROK;
+}
+/*******************************************************************
+ *
+ * @brief De Allocate Ric Service Update message
+ *
+ * @details
+ *
+ * Function : FreeRicServiceUpdate
+ *
+ * Functionality: De-Allocating Ric Service Update message
*
* @params[in] E2AP_PDU_t *e2apMsg
ricUpdate.dir = RIC_INITIATED;
ricServiceQuery = &e2apMsg->choice.initiatingMessage->value.choice.RICserviceQuery;
- for(arrIdx=0; arrIdx<ricServiceQuery->protocolIEs.list.count; arrIdx++)
- {
- switch(ricServiceQuery->protocolIEs.list.array[arrIdx]->id)
- {
- /* TODO completing in next patch/gerrit */
- case ProtocolIE_IDE2_id_TransactionID:
- {
- ricUpdate.transId = ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- break;
- }
+ for(arrIdx=0; arrIdx<ricServiceQuery->protocolIEs.list.count; arrIdx++)
+ {
+ switch(ricServiceQuery->protocolIEs.list.array[arrIdx]->id)
+ {
+ /* TODO completing in next patch/gerrit */
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ ricUpdate.transId = ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RANfunctionsAccepted:
+ {
+ ranFuncAddedList= &ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
+ if(ranFuncAddedList->list.array)
+ {
+ for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
+ {
+ if(ranFuncAddedList->list.array[ranFuncIdx])
+ {
+ /* Using the RAN function Id, identify the RAN function to be modified or deleted. */
+
+ ranFuncAddedItemIe = (RANfunctionID_ItemIEs_t*)ranFuncAddedList->list.array[ranFuncIdx];
+ id = ranFuncAddedItemIe->value.choice.RANfunctionID_Item.ranFunctionID;
+ revisionCcounter = ranFuncAddedItemIe->value.choice.RANfunctionID_Item.ranFunctionRevision;
+
+ if((id != duCb.e2apDb.ranFunction[id-1].id))
+ {
+ action = CONFIG_DEL;
+ }
+ else if((id == duCb.e2apDb.ranFunction[id-1].id)&&(revisionCcounter!=duCb.e2apDb.ranFunction[id-1].revisionCounter))
+ {
+ action = CONFIG_MOD;
+ }
+
+ if(action == CONFIG_DEL)
+ {
+ ricUpdate.recvRanFuncList.ranFunToBeDeleted[ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted].id = id;
+ ricUpdate.recvRanFuncList.ranFunToBeDeleted[ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted].revisionCounter = revisionCcounter;
+ ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted++;
+ }
+ else if(action == CONFIG_MOD)
+ {
+ ricUpdate.recvRanFuncList.ranFunToBeModified[ricUpdate.recvRanFuncList.numOfRanFunToBeModified].id = id;
+ ricUpdate.recvRanFuncList.ranFunToBeModified[ricUpdate.recvRanFuncList.numOfRanFunToBeModified].revisionCounter = revisionCcounter;
+ ricUpdate.recvRanFuncList.numOfRanFunToBeModified++;
+ }
+
+ /* If any ID is set to true, it means that the ID has been used in either modification or deletion list.
+ * Else we will add the IDs into the added list */
+ tmpArray[id-1] = true;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /* Traversing the whole RAN function list in ducb to check if any new Ran function ids have been added. */
+ for(arrIdx =0; arrIdx<MAX_RAN_FUNCTION; arrIdx++)
+ {
+ tmpIdx= ricUpdate.recvRanFuncList.numOfRanFunToBeAdded;
+ if((duCb.e2apDb.ranFunction[arrIdx].id >0)&&(!tmpArray[arrIdx]))
+ {
+ ricUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].id = duCb.e2apDb.ranFunction[arrIdx].id;
+ ricUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].revisionCounter = duCb.e2apDb.ranFunction[arrIdx].revisionCounter;
+ ricUpdate.recvRanFuncList.numOfRanFunToBeAdded++;
+ }
+ }
+
+ if(BuildAndSendRicServiceUpdate(ricUpdate)!= ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build and send ric service update message");
+ }
+
+ freeAperDecodingOfRicServiceQuery(ricServiceQuery);
+}
+
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated by aper decoder for
+ * RIC service update ack
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfRicServiceUpdateAck
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder
+ * for RIC service update ack
+ *
+ * @params[in] RICserviceUpdateAck_t *ricServiceAck;
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeAperDecodingOfRicServiceUpdateAck(RICserviceUpdateAcknowledge_t *ricServiceAck)
+{
+ uint8_t arrIdx=0,ranFuncIdx=0;
+ RANfunctionsID_List_t *ranFuncAddedList=NULL;
+
+ if(ricServiceAck)
+ {
+ if(ricServiceAck->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<ricServiceAck->protocolIEs.list.count; arrIdx++)
+ {
+ if(ricServiceAck->protocolIEs.list.array[arrIdx])
+ {
+ switch(ricServiceAck->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_RANfunctionsAccepted:
+ {
+ ranFuncAddedList= &ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
+ if(ranFuncAddedList->list.array)
+ {
+ for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
+ {
+ free(ranFuncAddedList->list.array[ranFuncIdx]);
+ }
+ free(ranFuncAddedList->list.array);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ free(ricServiceAck->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(ricServiceAck->protocolIEs.list.array);
+ }
+ }
+}
+
+/******************************************************************
+ *
+ * @brief Processes RIC service update ack sent by RIC
+ *
+ * @details
+ *
+ * Function : procRicServiceUpdateAck
+ *
+ * Functionality: Processes RIC service update ack sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+void procRicServiceUpdateAck(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0, transId =0;
+ uint16_t id =0, tmpIdx=0, ranFuncIdx=0;
+ RicServiceUpdate serviceUpdate;
+ RANfunctionsIDcause_List_t *rejectedList=NULL;
+ RICserviceUpdateAcknowledge_t *ricServiceAck=NULL;
+ RANfunctionIDcause_ItemIEs_t *ranFuncRejectedItemIe=NULL;
+
+ DU_LOG("\nINFO --> E2AP : RIC service update ack received");
+ memset(&serviceUpdate, 0, sizeof(RicServiceUpdate));
+ ricServiceAck = &e2apMsg->choice.successfulOutcome->value.choice.RICserviceUpdateAcknowledge;
+
+ for(arrIdx=0; arrIdx<ricServiceAck->protocolIEs.list.count; arrIdx++)
+ {
+ switch(ricServiceAck->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
+ {
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else if((duCb.e2apDb.e2TransInfo.ricInitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.ricInitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
+ {
+ memset(&duCb.e2apDb.e2TransInfo.ricInitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
+ return ;
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RANfunctionsAccepted:
+ break;
+
+ case ProtocolIE_IDE2_id_RANfunctionsRejected:
+ {
+ rejectedList= &ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsIDcause_List;
+ if(rejectedList->list.array)
+ {
+ for(ranFuncIdx=0;ranFuncIdx<rejectedList->list.count; ranFuncIdx++)
+ {
+ ranFuncRejectedItemIe = (RANfunctionIDcause_ItemIEs_t*)rejectedList->list.array[ranFuncIdx];
+ id = ranFuncRejectedItemIe->value.choice.RANfunctionIDcause_Item.ranFunctionID;
+ tmpIdx= serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded;
+ serviceUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].id = duCb.e2apDb.ranFunction[id-1].id;
+ serviceUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].revisionCounter = duCb.e2apDb.ranFunction[id-1].revisionCounter;
+ serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded++;
+ }
+ }
+ break;
+ }
+
+ }
+ }
+
+ if(serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded)
+ {
+ serviceUpdate.dir = E2_NODE_INITIATED;
+ BuildAndSendRicServiceUpdate(serviceUpdate);
+ }
+ freeAperDecodingOfRicServiceUpdateAck(ricServiceAck);
+}
+
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated by aper decoder for
+ * RIC service update failure
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfRicServiceUpdateFailure
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder
+ * for RIC service update failure
+ *
+ * @params[in] RICserviceUpdateFailure_t *ricServiceFailure;
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeAperDecodingOfRicServiceUpdateFailure(RICserviceUpdateFailure_t *ricServiceFailure)
+{
+ uint8_t arrIdx=0;
+
+ if(ricServiceFailure)
+ {
+ if(ricServiceFailure->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<ricServiceFailure->protocolIEs.list.count; arrIdx++)
+ {
+ if(ricServiceFailure->protocolIEs.list.array[arrIdx])
+ {
+ free(ricServiceFailure->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(ricServiceFailure->protocolIEs.list.array);
+ }
+ }
+}
+
+/******************************************************************
+ *
+ * @brief Processes RIC service update failure sent by RIC
+ *
+ * @details
+ *
+ * Function : procRicServiceUpdateFailure
+ *
+ * Functionality: Processes RIC service update failure sent by RIC
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+void procRicServiceUpdateFailure(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0, timerValue=0;
+ RICserviceUpdateFailure_t *ricServiceFailure=NULL;
+
+ DU_LOG("\nINFO --> E2AP : RIC service update failure received");
+ ricServiceFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICserviceUpdateFailure;
+
+ for(arrIdx=0; arrIdx<ricServiceFailure->protocolIEs.list.count; arrIdx++)
+ {
+ switch(ricServiceFailure->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ break;
+ }
+ case ProtocolIE_IDE2_id_TimeToWaitE2:
+ {
+ timerValue = convertE2WaitTimerEnumToValue(ricServiceFailure->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
+ if((duChkTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer), EVENT_RIC_SERVICE_UPDATE_TMR)) == FALSE)
+ {
+ duStartTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer), EVENT_RIC_SERVICE_UPDATE_TMR, timerValue);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : EVENT_RIC_SERVICE_UPDATE_TMR timer is already running");
+ return;
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_CauseE2:
+ {
+ break;
+ }
+ }
+ }
+
+ freeAperDecodingOfRicServiceUpdateFailure(ricServiceFailure);
+}
+
+/******************************************************************
+ *
+ * @brief DU Send E2 Node Configuration Update
+ *
+ * @details
+ *
+ * Function : duSendE2NodeConfigurationUpdate
+ *
+ * Functionality: DU Send E2 Node Configuration Update
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duSendE2NodeConfigurationUpdate()
+{
+ E2NodeConfigList e2NodeList;
+ CmLList *node =NULL;
+ E2NodeComponent *e2NodeComponentInfo=NULL;
+
+ memset(&e2NodeList, 0, sizeof(E2NodeConfigList));
+ CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
+ while(node)
+ {
+ e2NodeComponentInfo = (E2NodeComponent*)node->node;
+
+ if(e2NodeComponentInfo->addConfiguration)
+ {
+ e2NodeList.addE2Node[e2NodeList.addE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
+ e2NodeList.addE2Node[e2NodeList.addE2NodeCount].componentId= e2NodeComponentInfo->componentId;
+ e2NodeList.addE2NodeCount++;
+ break;
+ }
+ if(e2NodeComponentInfo->updateConfiguration)
+ {
+ e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
+ e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].componentId= e2NodeComponentInfo->componentId;
+ e2NodeList.updateE2NodeCount++;
+ break;
+ }
+ if(e2NodeComponentInfo->deleteConfiguration == true)
+ {
+ e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
+ e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].componentId = e2NodeComponentInfo->componentId;
+ e2NodeList.removeE2NodeCount++;
+ break;
+ }
+ node = node->next;
+ }
+
+ if(BuildAndSendE2NodeConfigUpdate(&e2NodeList) !=ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build and send e2 node config update message to RIC_stub");
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Free RIC Subscription Modification Required
+ *
+ * @details
+ *
+ * Function : FreeRicSubsModRequired
+ *
+ * Functionality: Freqq RIC Subscription Modification required
+ *
+ * @param E2AP Message PDU to be freed
+ * @return void
+ *
+ ******************************************************************/
+void FreeRicSubsModRequired(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0, arrIdx = 0;
+ RICsubscriptionModificationRequired_t *ricSubsModReqd = NULLP;
+ RICsubscriptionModificationRequired_IEs_t *ricSubsModReqdIe = NULLP;
+ RICactions_RequiredToBeModified_List_t *actionToBeModList = NULLP;
+ RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList = NULLP;
+
+ if(e2apMsg)
+ {
+ if(e2apMsg->choice.initiatingMessage)
+ {
+ ricSubsModReqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionModificationRequired;
+ if(ricSubsModReqd->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < ricSubsModReqd->protocolIEs.list.count; ieIdx++)
+ {
+ if(ricSubsModReqd->protocolIEs.list.array[ieIdx])
+ {
+ ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
+ switch(ricSubsModReqdIe->id)
+ {
+ case ProtocolIE_IDE2_id_RICactionsRequiredToBeModified_List:
+ {
+ actionToBeModList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeModified_List;
+ if(actionToBeModList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < actionToBeModList->list.count; arrIdx++)
+ {
+ DU_FREE(actionToBeModList->list.array[arrIdx], \
+ sizeof(RICaction_RequiredToBeModified_ItemIEs_t));
+ }
+ DU_FREE(actionToBeModList->list.array, actionToBeModList->list.size);
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICactionsRequiredToBeRemoved_List:
+ {
+ actionToBeRmvList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeRemoved_List;
+ if(actionToBeRmvList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < actionToBeRmvList->list.count; arrIdx++)
+ {
+ DU_FREE(actionToBeRmvList->list.array[arrIdx], \
+ sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t));
+ }
+ DU_FREE(actionToBeRmvList->list.array, actionToBeRmvList->list.size);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ DU_FREE(ricSubsModReqd->protocolIEs.list.array[ieIdx], \
+ sizeof(RICsubscriptionModificationRequired_IEs_t));
+ }
+ }
+ DU_FREE(ricSubsModReqd->protocolIEs.list.array, ricSubsModReqd->protocolIEs.list.size);
+ }
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ }
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
+ }
+}
+
+/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
+ * However, E2SM-KPM supports only RIC Report service.
+ * Hence there is no subsequent action in RIC subscription that may require modification.
+ * So commenting the action-modification IEs for the time being
+ */
+#if 0
+/*******************************************************************
+ *
+ * @brief Fill Action required to be modified list
+ *
+ * @details
+ *
+ * Function : FillActionReqdToBeModList
+ *
+ * Functionality: Fill Action required to be modified list
+ *
+ * @param RIC Actions Required To Be Modified List to be filled
+ * Number of actions to be modified
+ * RIC Subscription DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t FillActionReqdToBeModList(RICactions_RequiredToBeModified_List_t *actionToBeModList, uint8_t numActionsMod, \
+ RicSubscription *ricSubscription)
+{
+ uint8_t arrIdx = 0, actionIdx = 0;
+ RICaction_RequiredToBeModified_ItemIEs_t *actionToBeMod = NULL;
+
+ actionToBeModList->list.count = numActionsMod;
+ actionToBeModList->list.size = numActionsMod * sizeof(RICaction_RequiredToBeModified_ItemIEs_t *);
+ DU_ALLOC(actionToBeModList->list.array, actionToBeModList->list.size);
+ if(!actionToBeModList->list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ arrIdx = 0;
+ for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ {
+ if(ricSubscription->actionSequence[actionIdx].action == CONFIG_MOD)
+ {
+ DU_ALLOC(actionToBeModList->list.array[arrIdx], sizeof(RICaction_RequiredToBeModified_ItemIEs_t));
+ if(!actionToBeModList->list.array[arrIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+ actionToBeMod = (RICaction_RequiredToBeModified_ItemIEs_t *)actionToBeModList->list.array[arrIdx];
+
+ actionToBeMod->id = ProtocolIE_IDE2_id_RICaction_RequiredToBeModified_Item;
+ actionToBeMod->criticality = CriticalityE2_reject;
+ actionToBeMod->value.present = \
+ RICaction_RequiredToBeModified_ItemIEs__value_PR_RICaction_RequiredToBeModified_Item;
+ actionToBeMod->value.choice.RICaction_RequiredToBeModified_Item.ricActionID = \
+ ricSubscription->actionSequence[actionIdx].actionId;
+ actionToBeMod->value.choice.RICaction_RequiredToBeModified_Item.ricTimeToWait = RICtimeToWait_w5ms;
+
+ arrIdx++;
+ }
+ }
+
+ return ROK;
+}
+#endif
+
+/*******************************************************************
+ *
+ * @brief Fill Action required to be removed list
+ *
+ * @details
+ *
+ * Function : FillActionReqdToBeRmvList
+ *
+ * Functionality: Fill Action required to be removed list
+ *
+ * @param RIC Actions Required To Be Removed List to be filled
+ * Number of actions to be removed
+ * RIC Subscription DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t FillActionReqdToBeRmvList(RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList, uint8_t numActionsRmv, \
+ RicSubscription *ricSubscription)
+{
+ uint8_t arrIdx = 0, actionIdx = 0;
+ RICaction_RequiredToBeRemoved_ItemIEs_t *actionToBeRmv = NULL;
+
+ actionToBeRmvList->list.count = numActionsRmv;
+ actionToBeRmvList->list.size = numActionsRmv * sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t *);
+ DU_ALLOC(actionToBeRmvList->list.array, actionToBeRmvList->list.size);
+ if(!actionToBeRmvList->list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ arrIdx = 0;
+ for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ {
+ if(ricSubscription->actionSequence[actionIdx].action == CONFIG_DEL)
+ {
+ DU_ALLOC(actionToBeRmvList->list.array[arrIdx], sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t));
+ if(!actionToBeRmvList->list.array[arrIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+ actionToBeRmv = (RICaction_RequiredToBeRemoved_ItemIEs_t *)actionToBeRmvList->list.array[arrIdx];
+
+ actionToBeRmv->id = ProtocolIE_IDE2_id_RICaction_RequiredToBeRemoved_Item;
+ actionToBeRmv->criticality = CriticalityE2_reject;
+ actionToBeRmv->value.present = \
+ RICaction_RequiredToBeRemoved_ItemIEs__value_PR_RICaction_RequiredToBeRemoved_Item;
+ actionToBeRmv->value.choice.RICaction_RequiredToBeRemoved_Item.ricActionID = \
+ ricSubscription->actionSequence[actionIdx].actionId;
+ fillE2Cause(&actionToBeRmv->value.choice.RICaction_RequiredToBeRemoved_Item.cause, \
+ ricSubscription->actionSequence[actionIdx].failureCause);
+
+ arrIdx++;
+ }
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill RIC Subscription Modification Required IEs
+ *
+ * @details
+ *
+ * Function : FillRicSubsModRequired
+ *
+ * Functionality: Fill RIC Subscription Modification Required IEs
+ *
+ * @param RIC Subscription Modification Required IEs to be filled
+ * RIC Subscription DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t FillRicSubsModRequired(RICsubscriptionModificationRequired_t *ricSubsModReqd, RicSubscription *ricSubscription)
+{
+ uint8_t ieIdx = 0, elementCnt=0, actionIdx = 0;
+ uint8_t numActionsMod = 0, numActionsRmv = 0;
+ RICsubscriptionModificationRequired_IEs_t *ricSubsModReqdIe = NULLP;
+ RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList = NULLP;
+
+/* Unused in case of E2SM-KPM */
+#if 0
+ RICactions_RequiredToBeModified_List_t *actionToBeModList = NULLP;
+#endif
+
+ /* Count number of Actions to be modified or deleted */
+ for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ {
+ if(ricSubscription->actionSequence[actionIdx].action == CONFIG_MOD)
+ numActionsMod++;
+ else if(ricSubscription->actionSequence[actionIdx].action == CONFIG_DEL)
+ numActionsRmv++;
+ }
+
+ /* Count number of IEs to be added to messages */
+ elementCnt = 2;
+ if(numActionsMod)
+ elementCnt++;
+ if(numActionsRmv)
+ elementCnt++;
+
+ ricSubsModReqd->protocolIEs.list.count = elementCnt;
+ ricSubsModReqd->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionModificationRequired_IEs_t *);
+ DU_ALLOC(ricSubsModReqd->protocolIEs.list.array, ricSubsModReqd->protocolIEs.list.size);
+ if(!ricSubsModReqd->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
+ {
+ DU_ALLOC(ricSubsModReqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionModificationRequired_IEs_t));
+ if(!ricSubsModReqd->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+ }
+
+ /* RIC Request ID */
+ ieIdx = 0;
+ ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
+ ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICrequestID;
+ ricSubsModReqdIe->criticality = CriticalityE2_reject;
+ ricSubsModReqdIe->value.present = RICsubscriptionModificationRequired_IEs__value_PR_RICrequestID;
+ ricSubsModReqdIe->value.choice.RICrequestID.ricRequestorID = ricSubscription->requestId.requestorId;
+ ricSubsModReqdIe->value.choice.RICrequestID.ricInstanceID = ricSubscription->requestId.instanceId;
+
+ /* RAN Function ID */
+ ieIdx++;
+ ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
+ ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RANfunctionID;
+ ricSubsModReqdIe->criticality = CriticalityE2_reject;
+ ricSubsModReqdIe->value.present = RICsubscriptionModificationRequired_IEs__value_PR_RANfunctionID;
+ ricSubsModReqdIe->value.choice.RANfunctionID = ricSubscription->ranFuncId;
+
+/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
+ * However, E2SM-KPM supports only RIC Report service.
+ * Hence there is no subsequent action in RIC subscription that may require modification.
+ * So commenting the action-modification IEs for the time being
+ */
+#if 0
+ /* RIC Actions Required to be Modified */
+ if(numActionsMod)
+ {
+ ieIdx++;
+ ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
+ ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICactionsRequiredToBeModified_List;
+ ricSubsModReqdIe->criticality = CriticalityE2_reject;
+ ricSubsModReqdIe->value.present = \
+ RICsubscriptionModificationRequired_IEs__value_PR_RICactions_RequiredToBeModified_List;
+ actionToBeModList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeModified_List;
+
+ if(FillActionReqdToBeModList(actionToBeModList, numActionsMod, ricSubscription) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Failed to fill actions required to be modified list", __func__);
+ return RFAILED;
+ }
+ }
+#endif
+
+ /* RIC Actions Required to be removed */
+ if(numActionsRmv)
+ {
+ ieIdx++;
+ ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
+ ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICactionsRequiredToBeRemoved_List;
+ ricSubsModReqdIe->criticality = CriticalityE2_reject;
+ ricSubsModReqdIe->value.present = \
+ RICsubscriptionModificationRequired_IEs__value_PR_RICactions_RequiredToBeRemoved_List;
+ actionToBeRmvList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeRemoved_List;
+
+ if(FillActionReqdToBeRmvList(actionToBeRmvList, numActionsRmv, ricSubscription) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Failed to fill actions required to be removed list", __func__);
+ return RFAILED;
+ }
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and Send RIC Subscription Modification Required
+ * message
+ *
+ * @details
+ *
+ * Function : BuildAndSendRicSubsModRequired
+ *
+ * Functionality: Builds and Send RIC Subscription Modification
+ * Required message
+ *
+ * @param RIC Subscription DB
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t BuildAndSendRicSubsModRequired(RicSubscription *ricSubscription)
+{
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ RICsubscriptionModificationRequired_t *ricSubsModReqd = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_LOG("\nINFO --> E2AP : Building RIC Subscription Modification Required \n");
+ while(true)
+ {
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ break;
+ }
+
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ break;
+ }
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICsubscriptionModificationRequired;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICsubscriptionModificationRequired;
+
+ ricSubsModReqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionModificationRequired;
+
+ if(FillRicSubsModRequired(ricSubsModReqd, ricSubscription) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Failed to fill RIC Subscription Modification Required IEs", __func__);
+ break;
+ }
+
+ /* Encode */
+ 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 RIC Subscription Modifiction Required structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Modification Required \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Sending RIC Subscription Modification Required failed");
+ }
+
+ ret = ROK;
+ break;
+ }
+
+ /* Free RIC Subscription modification required */
+ FreeRicSubsModRequired(e2apMsg);
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Free APER decoding of RIC Subscription Modification Confirm
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfRicSubsModConfirm
+ *
+ * Functionality: Free APER decoding of RIC Subscription
+ * Modification Confirm
+ *
+ * @param E2AP Message PDU
+ * @return void
+ *
+ ******************************************************************/
+void freeAperDecodingOfRicSubsModConfirm(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0, arrIdx=0;
+ RICsubscriptionModificationConfirm_t *ricSubsModCfm = NULLP;
+ RICsubscriptionModificationConfirm_IEs_t *ricSubsModCfmIe = NULLP;
+ RICactions_ConfirmedForModification_List_t *modCfmList = NULLP;
+ RICactions_RefusedToBeModified_List_t *modRefusedList = NULLP;
+ RICactions_ConfirmedForRemoval_List_t *rmvCfmList = NULLP;
+ RICactions_RefusedToBeRemoved_List_t *rmvFailList = NULLP;
+
+ if(e2apMsg && e2apMsg->choice.successfulOutcome)
+ {
+ ricSubsModCfm = &e2apMsg->choice.successfulOutcome->value.choice.RICsubscriptionModificationConfirm;
+ if(ricSubsModCfm->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < ricSubsModCfm->protocolIEs.list.count; ieIdx++)
+ {
+ if(ricSubsModCfm->protocolIEs.list.array[ieIdx])
+ {
+ ricSubsModCfmIe = ricSubsModCfm->protocolIEs.list.array[ieIdx];
+ switch(ricSubsModCfmIe->id)
+ {
+ case ProtocolIE_IDE2_id_RICactionsConfirmedForModification_List:
+ {
+ modCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForModification_List;
+ if(modCfmList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < modCfmList->list.count; arrIdx++)
+ {
+ if(modCfmList->list.array[arrIdx])
+ free(modCfmList->list.array[arrIdx]);
+ }
+ free(modCfmList->list.array);
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICactionsRefusedToBeModified_List:
+ {
+ modRefusedList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeModified_List;
+ if(modRefusedList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < modRefusedList->list.count; arrIdx++)
+ {
+ if(modRefusedList->list.array[arrIdx])
+ free(modRefusedList->list.array[arrIdx]);
+ }
+ free(modRefusedList->list.array);
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICactionsConfirmedForRemoval_List:
+ {
+ rmvCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForRemoval_List;
+ if(rmvCfmList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < rmvCfmList->list.count; arrIdx++)
+ {
+ if(rmvCfmList->list.array[arrIdx])
+ free(rmvCfmList->list.array[arrIdx]);
+ }
+ free(rmvCfmList->list.array);
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICactionsRefusedToBeRemoved_List:
+ {
+ rmvFailList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeRemoved_List;
+ if(rmvFailList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < rmvFailList->list.count; arrIdx++)
+ {
+ if(rmvFailList->list.array[arrIdx])
+ free(rmvFailList->list.array[arrIdx]);
+ }
+ free(rmvFailList->list.array);
+ }
+ break;
+ }
+
+ default:
+ break;
+
+ }
+ free(ricSubsModCfmIe);
+ }
+ }
+ free(ricSubsModCfm->protocolIEs.list.array);
+ }
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Process RIC Subscription Modification Confirm Message
+ *
+ * @details
+ *
+ * Function : procRicSubscriptionModificationConfirm
+ *
+ * Functionality: Process RIC Subscription Modification Confirm
+ * Message received from RIC.
+ *
+ * @param E2AP Message PDU
+ * @return void
+ *
+ ******************************************************************/
+void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t actionId = 0, ieIdx = 0, arrIdx = 0;
+ uint16_t ranFuncId = 0;
+ bool procFailure = false;
+ RicRequestId ricReqId;
+ RanFunction *ranFuncDb = NULLP;
+ CmLList *ricSubsNode = NULLP;
+ RicSubscription *ricSubsDb = NULLP;
+ ActionInfo *actionDb = NULLP;
+
+ RICsubscriptionModificationConfirm_t *ricSubsModCfm = NULLP;
+ RICsubscriptionModificationConfirm_IEs_t *ricSubsModCfmIe = NULLP;
+
+/* Not used in case of E2SM-KPM */
+#if 0
+ RICactions_ConfirmedForModification_List_t *modCfmList = NULLP;
+ RICaction_ConfirmedForModification_ItemIEs_t *modCfmListItem = NULLP;
+
+ RICactions_RefusedToBeModified_List_t *modRefusedList = NULLP;
+ RICaction_RefusedToBeModified_ItemIEs_t *modRefusedListItem = NULLP;
+#endif
+
+ RICactions_ConfirmedForRemoval_List_t *rmvCfmList = NULLP;
+ RICaction_ConfirmedForRemoval_ItemIEs_t *rmvCfmListItem = NULLP;
+
+ RICactions_RefusedToBeRemoved_List_t *rmvFailList = NULLP;
+ RICaction_RefusedToBeRemoved_ItemIEs_t *rmvFailListItem = NULLP;
+
+ DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Modification Confirm", __func__);
+
+ do{
+ if(!e2apMsg)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: E2AP Message is NULL", __func__);
+ break;
+ }
+
+ if(!e2apMsg->choice.successfulOutcome)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Successful Outcome in E2AP message is NULL", __func__);
+ break;
+ }
+
+ ricSubsModCfm = &e2apMsg->choice.successfulOutcome->value.choice.RICsubscriptionModificationConfirm;
+ if(!ricSubsModCfm->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Array conatining E2AP message IEs is null", __func__);
+ break;
+ }
+
+ for(ieIdx = 0; ieIdx < ricSubsModCfm->protocolIEs.list.count; ieIdx++)
+ {
+ if(!ricSubsModCfm->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : %s: IE at index [%d] in E2AP message IEs list is null", __func__, ieIdx);
+ break;
+ }
+
+ ricSubsModCfmIe = ricSubsModCfm->protocolIEs.list.array[ieIdx];
+ switch(ricSubsModCfmIe->id)
+ {
+ case ProtocolIE_IDE2_id_RICrequestID:
+ {
+ memset(&ricReqId, 0, sizeof(RicRequestId));
+ ricReqId.requestorId = ricSubsModCfmIe->value.choice.RICrequestID.ricRequestorID;
+ ricReqId.instanceId = ricSubsModCfmIe->value.choice.RICrequestID.ricInstanceID;
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RANfunctionID:
+ {
+ ranFuncId = ricSubsModCfmIe->value.choice.RANfunctionID;
+ ranFuncDb = fetchRanFuncFromRanFuncId(ranFuncId);
+ if(!ranFuncDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: RAN Function ID [%d] not found", __func__, ranFuncId);
+ procFailure = true;
+ break;
+ }
+
+ ricSubsDb = fetchSubsInfoFromRicReqId(ricReqId, ranFuncDb, &ricSubsNode);
+ if(!ricSubsDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: RIC Subscription not found for Requestor_ID [%d] Instance_ID [%d]",\
+ __func__, ricReqId.requestorId, ricReqId.instanceId);
+ procFailure = true;
+ break;
+ }
+
+ break;
+ }
+
+/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
+ * However, E2SM-KPM supports only RIC Report service.
+ * Hence there is no subsequent action in RIC subscription that may require modification.
+ * So commenting the action-modification IEs for the time being
+ */
+#if 0
+ case ProtocolIE_IDE2_id_RICactionsConfirmedForModification_List:
+ {
+ modCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForModification_List;
+ for(arrIdx = 0; arrIdx < modCfmList->list.count; arrIdx++)
+ {
+ modCfmListItem = (RICaction_ConfirmedForModification_ItemIEs_t *)modCfmList->list.array[arrIdx];
+ actionId = modCfmListItem->value.choice.RICaction_ConfirmedForModification_Item.ricActionID;
+
+ actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
+ if(!actionDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
+ }
+ else
+ {
+ actionDb->action = CONFIG_UNKNOWN;
+ /* Further handling can be added here in future once the
+ * use case of this procedure is identified */
+ }
+ actionDb = NULLP;
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RICactionsRefusedToBeModified_List:
+ {
+ modRefusedList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeModified_List;
+ for(arrIdx = 0; arrIdx < modRefusedList->list.count; arrIdx++)
+ {
+ modRefusedListItem = (RICaction_RefusedToBeModified_ItemIEs_t *)modRefusedList->list.array[arrIdx];
+ actionId = modRefusedListItem->value.choice.RICaction_RefusedToBeModified_Item.ricActionID;
+ actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
+ if(!actionDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
+ }
+ else
+ {
+ /* Spec doesnt mention if in case of failure, DU should retry for modify action
+ * Hence, chaging the action from CONFIG_MOD to CONFIG_UNKNOWN
+ */
+ actionDb->action = CONFIG_UNKNOWN;
+ }
+ actionDb = NULLP;
+ }
+ break;
+ }
+#endif
- case ProtocolIE_IDE2_id_RANfunctionsAccepted:
- {
- ranFuncAddedList= &ricServiceQuery->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
- if(ranFuncAddedList->list.array)
- {
- for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
+ case ProtocolIE_IDE2_id_RICactionsConfirmedForRemoval_List:
{
- if(ranFuncAddedList->list.array[ranFuncIdx])
+ rmvCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForRemoval_List;
+ for(arrIdx = 0; arrIdx < rmvCfmList->list.count; arrIdx++)
{
- /* Using the RAN function Id, identify the RAN function to be modified or deleted. */
-
- ranFuncAddedItemIe = (RANfunctionID_ItemIEs_t*)ranFuncAddedList->list.array[ranFuncIdx];
- id = ranFuncAddedItemIe->value.choice.RANfunctionID_Item.ranFunctionID;
- revisionCcounter = ranFuncAddedItemIe->value.choice.RANfunctionID_Item.ranFunctionRevision;
-
- if((id != duCb.e2apDb.ranFunction[id-1].id))
+ rmvCfmListItem = (RICaction_ConfirmedForRemoval_ItemIEs_t *)rmvCfmList->list.array[arrIdx];
+ actionId = rmvCfmListItem->value.choice.RICaction_ConfirmedForRemoval_Item.ricActionID;
+ actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
+ if(!actionDb)
{
- action = CONFIG_DEL;
+ DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
}
- else if((id == duCb.e2apDb.ranFunction[id-1].id)&&(revisionCcounter!=duCb.e2apDb.ranFunction[id-1].revisionCounter))
+ else
{
- action = CONFIG_MOD;
+ deleteActionSequence(actionDb);
+ actionDb =NULLP;
+ ricSubsDb->numOfActions--;
+ /* Further handling can include :
+ * Deletion of this action from all DU layers
+ */
}
+ actionDb = NULLP;
+ }
+ break;
+ }
- if(action == CONFIG_DEL)
+ case ProtocolIE_IDE2_id_RICactionsRefusedToBeRemoved_List:
+ {
+ rmvFailList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeRemoved_List;
+ for(arrIdx = 0; arrIdx < rmvFailList->list.count; arrIdx++)
+ {
+ rmvFailListItem = (RICaction_RefusedToBeRemoved_ItemIEs_t *)rmvFailList->list.array[arrIdx];
+ actionId = rmvFailListItem->value.choice.RICaction_RefusedToBeRemoved_Item.ricActionID;
+ actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
+ if(!actionDb)
{
- ricUpdate.recvRanFuncList.ranFunToBeDeleted[ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted].id = id;
- ricUpdate.recvRanFuncList.ranFunToBeDeleted[ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted].revisionCounter = revisionCcounter;
- ricUpdate.recvRanFuncList.numOfRanFunToBeDeleted++;
+ DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
}
- else if(action == CONFIG_MOD)
+ else
{
- ricUpdate.recvRanFuncList.ranFunToBeModified[ricUpdate.recvRanFuncList.numOfRanFunToBeModified].id = id;
- ricUpdate.recvRanFuncList.ranFunToBeModified[ricUpdate.recvRanFuncList.numOfRanFunToBeModified].revisionCounter = revisionCcounter;
- ricUpdate.recvRanFuncList.numOfRanFunToBeModified++;
+ actionDb->action = CONFIG_UNKNOWN;
}
-
- /* If any ID is set to true, it means that the ID has been used in either modification or deletion list.
- * Else we will add the IDs into the added list */
- tmpArray[id-1] = true;
+ actionDb = NULLP;
}
+ break;
}
- }
- break;
- }
- }
- }
- /* Traversing the whole RAN function list in ducb to check if any new Ran function ids have been added. */
- for(arrIdx =0; arrIdx<MAX_RAN_FUNCTION; arrIdx++)
- {
- tmpIdx= ricUpdate.recvRanFuncList.numOfRanFunToBeAdded;
- if((duCb.e2apDb.ranFunction[arrIdx].id >0)&&(!tmpArray[arrIdx]))
- {
- ricUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].id = duCb.e2apDb.ranFunction[arrIdx].id;
- ricUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].revisionCounter = duCb.e2apDb.ranFunction[arrIdx].revisionCounter;
- ricUpdate.recvRanFuncList.numOfRanFunToBeAdded++;
- }
- }
+ default:
+ break;
+ } /* End of switch for Protocol IE Id */
- if(BuildAndSendRicServiceUpdate(ricUpdate)!= ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to build and send ric service update message");
- }
+ if(procFailure)
+ break;
+ } /* End of for loop for Protocol IE list */
- freeAperDecodingOfRicServiceQuery(ricServiceQuery);
+ break;
+ }while(true);
+
+ freeAperDecodingOfRicSubsModConfirm(e2apMsg);
+ return;
}
/******************************************************************
- *
- * @brief Deallocation of memory allocated by aper decoder for
- * RIC service update ack
- *
- * @details
- *
- * Function : freeAperDecodingOfRicServiceUpdateAck
- *
- * Functionality: Deallocation of memory allocated by aper decoder
- * for RIC service update ack
- *
- * @params[in] RICserviceUpdateAck_t *ricServiceAck;
- * @return void
- *
- * ****************************************************************/
-
-void freeAperDecodingOfRicServiceUpdateAck(RICserviceUpdateAcknowledge_t *ricServiceAck)
+* @brief Deallocate the memory allocated for E2 Reset Response
+*
+* @details
+*
+* Function : FreeE2ResetResponse
+*
+* Functionality:
+* - freeing the memory allocated for E2ResetResponse
+*
+* @params[in] E2AP_PDU_t *e2apMsg
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+void FreeE2ResetResponse(E2AP_PDU_t *e2apMsg)
{
- uint8_t arrIdx=0,ranFuncIdx=0;
- RANfunctionsID_List_t *ranFuncAddedList=NULL;
+ uint8_t ieIdx =0;
+ ResetResponseE2_t *resetResponse;
- if(ricServiceAck)
+ if(e2apMsg != NULLP)
{
- if(ricServiceAck->protocolIEs.list.array)
+ if(e2apMsg->choice.successfulOutcome != NULLP)
{
- for(arrIdx=0; arrIdx<ricServiceAck->protocolIEs.list.count; arrIdx++)
+ resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;
+ if(resetResponse->protocolIEs.list.array)
{
- if(ricServiceAck->protocolIEs.list.array[arrIdx])
+ for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
{
- switch(ricServiceAck->protocolIEs.list.array[arrIdx]->id)
+ if(resetResponse->protocolIEs.list.array[ieIdx])
{
- case ProtocolIE_IDE2_id_RANfunctionsAccepted:
- {
- ranFuncAddedList= &ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsID_List;
- if(ranFuncAddedList->list.array)
- {
- for(ranFuncIdx=0;ranFuncIdx<ranFuncAddedList->list.count; ranFuncIdx++)
- {
- free(ranFuncAddedList->list.array[ranFuncIdx]);
- }
- free(ranFuncAddedList->list.array);
- }
- break;
- }
- default:
- break;
+ DU_FREE(resetResponse->protocolIEs.list.array[ieIdx], sizeof(ResetResponseIEs_t));
}
- free(ricServiceAck->protocolIEs.list.array[arrIdx]);
}
+ DU_FREE(resetResponse->protocolIEs.list.array, resetResponse->protocolIEs.list.size);
}
- free(ricServiceAck->protocolIEs.list.array);
+
+ DU_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Processes RIC service update ack sent by RIC
+ * @brief Buld and send the E2 Reset Response msg
*
* @details
*
- * Function : procRicServiceUpdateAck
+ * Function : BuildAndSendE2ResetResponse
*
- * Functionality: Processes RIC service update ack sent by RIC
+ * Functionality:
+ * - Buld and send the E2 Reset Response Message
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @params[in] Trans Id
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-
-void procRicServiceUpdateAck(E2AP_PDU_t *e2apMsg)
+uint8_t BuildAndSendResetResponse(uint8_t transId)
{
- uint8_t arrIdx =0, transId =0;
- uint16_t id =0, tmpIdx=0, ranFuncIdx=0;
- RicServiceUpdate serviceUpdate;
- RANfunctionsIDcause_List_t *rejectedList=NULL;
- RICserviceUpdateAcknowledge_t *ricServiceAck=NULL;
- RANfunctionIDcause_ItemIEs_t *ranFuncRejectedItemIe=NULL;
-
- DU_LOG("\nINFO --> E2AP : RIC service update ack received");
- memset(&serviceUpdate, 0, sizeof(RicServiceUpdate));
- ricServiceAck = &e2apMsg->choice.successfulOutcome->value.choice.RICserviceUpdateAcknowledge;
-
- for(arrIdx=0; arrIdx<ricServiceAck->protocolIEs.list.count; arrIdx++)
+ uint8_t ieIdx = 0, elementCnt = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ ResetResponseE2_t *resetResponse;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_LOG("\nINFO --> E2AP : Building E2 Reset Response Message\n");
+ do
{
- switch(ricServiceAck->protocolIEs.list.array[arrIdx]->id)
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse(): Memory allocation for E2AP-PDU failed");
+ break;
+ }
+ e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
+
+ DU_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ if(e2apMsg->choice.successfulOutcome == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse: Memory allocation failed for successfulOutcome");
+ break;
+ }
+
+ e2apMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_Reset;
+ e2apMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
+ e2apMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_ResetResponseE2;
+ resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;
+
+ elementCnt = 1;
+ resetResponse->protocolIEs.list.count = elementCnt;
+ resetResponse->protocolIEs.list.size = elementCnt * sizeof(ResetResponseIEs_t *);
+ DU_ALLOC(resetResponse->protocolIEs.list.array, resetResponse->protocolIEs.list.size);
+ if(!resetResponse->protocolIEs.list.array)
{
- case ProtocolIE_IDE2_id_TransactionID:
+ DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse: Memory allocation failed for protocol IE array");
+ break;
+ }
+
+ for(ieIdx=0; ieIdx < elementCnt; ieIdx++)
+ {
+ DU_ALLOC(resetResponse->protocolIEs.list.array[ieIdx], sizeof(ResetResponseIEs_t));
+ if(!resetResponse->protocolIEs.list.array[ieIdx])
{
- transId = ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
- (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else if((duCb.e2apDb.e2TransInfo.ricInitTransaction[transId].transactionId == transId) &&\
- (duCb.e2apDb.e2TransInfo.ricInitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
- {
- memset(&duCb.e2apDb.e2TransInfo.ricInitTransaction[transId], 0, sizeof(E2TransInfo));
- }
- else
- {
- DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
- return ;
- }
+ DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse: Memory allocation failed for protocol IE array element");
break;
}
-
- case ProtocolIE_IDE2_id_RANfunctionsAccepted:
- break;
+ }
+ if(ieIdx < elementCnt)
+ break;
- case ProtocolIE_IDE2_id_RANfunctionsRejected:
+ ieIdx = 0;
+ resetResponse->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ resetResponse->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ resetResponse->protocolIEs.list.array[ieIdx]->value.present = ResetResponseIEs__value_PR_TransactionID;
+ resetResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ 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 reset response structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for E2 Reset Response \n");
+ for(int i=0; i< encBufSize; i++)
{
- rejectedList= &ricServiceAck->protocolIEs.list.array[arrIdx]->value.choice.RANfunctionsIDcause_List;
- if(rejectedList->list.array)
- {
- for(ranFuncIdx=0;ranFuncIdx<rejectedList->list.count; ranFuncIdx++)
- {
- ranFuncRejectedItemIe = (RANfunctionIDcause_ItemIEs_t*)rejectedList->list.array[ranFuncIdx];
- id = ranFuncRejectedItemIe->value.choice.RANfunctionIDcause_Item.ranFunctionID;
- tmpIdx= serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded;
- serviceUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].id = duCb.e2apDb.ranFunction[id-1].id;
- serviceUpdate.recvRanFuncList.ranFunToBeAdded[tmpIdx].revisionCounter = duCb.e2apDb.ranFunction[id-1].revisionCounter;
- serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded++;
- }
- }
- break;
+ 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 Reset Response");
+ break;
}
- }
- if(serviceUpdate.recvRanFuncList.numOfRanFunToBeAdded)
- {
- serviceUpdate.dir = E2_NODE_INITIATED;
- BuildAndSendRicServiceUpdate(serviceUpdate);
- }
- freeAperDecodingOfRicServiceUpdateAck(ricServiceAck);
+ ret = ROK;
+ break;
+ }while(true);
+
+ FreeE2ResetResponse(e2apMsg);
+ return ret;
}
/******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for
- * RIC service update failure
+ * @brief Deallocation of memory allocated by aper decoder for reset req
*
* @details
*
- * Function : freeAperDecodingOfRicServiceUpdateFailure
+ * Function : freeAperDecodingOfE2ResetReq
*
- * Functionality: Deallocation of memory allocated by aper decoder
- * for RIC service update failure
+ * Functionality: Deallocation of memory allocated by aper decoder for
+ * reset req
*
- * @params[in] RICserviceUpdateFailure_t *ricServiceFailure;
+ * @params[in] Pointer to resetReq
* @return void
*
* ****************************************************************/
-
-void freeAperDecodingOfRicServiceUpdateFailure(RICserviceUpdateFailure_t *ricServiceFailure)
+void freeAperDecodingOfE2ResetReq(ResetRequestE2_t *resetReq)
{
uint8_t arrIdx=0;
- if(ricServiceFailure)
+ if(resetReq)
{
- if(ricServiceFailure->protocolIEs.list.array)
+ if(resetReq->protocolIEs.list.array)
{
- for(arrIdx=0; arrIdx<ricServiceFailure->protocolIEs.list.count; arrIdx++)
+ for(arrIdx=0; arrIdx<resetReq->protocolIEs.list.count; arrIdx++)
{
- if(ricServiceFailure->protocolIEs.list.array[arrIdx])
+ if(resetReq->protocolIEs.list.array[arrIdx])
{
- free(ricServiceFailure->protocolIEs.list.array[arrIdx]);
+ free(resetReq->protocolIEs.list.array[arrIdx]);
}
}
- free(ricServiceFailure->protocolIEs.list.array);
+ free(resetReq->protocolIEs.list.array);
}
}
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Processes RIC service update failure sent by RIC
+ * @brief Process reset req received from RIC
*
* @details
*
- * Function : procRicServiceUpdateFailure
+ * Function : procE2ResetRequest
*
- * Functionality: Processes RIC service update failure sent by RIC
+ * Functionality: Process reset req received from RIC
*
- * @params[in] E2AP_PDU_t ASN decoded E2AP message
- * @return ROK - success
- * RFAILED - failure
+ * @param E2AP_PDU_t *e2apMsg
+ * @return void
*
- * ****************************************************************/
+ ******************************************************************/
-void procRicServiceUpdateFailure(E2AP_PDU_t *e2apMsg)
+void procE2ResetRequest(E2AP_PDU_t *e2apMsg)
{
- uint8_t arrIdx =0, timerValue=0;
- RICserviceUpdateFailure_t *ricServiceFailure=NULL;
+ uint16_t ranFuncIdx=0;
+ uint8_t arrIdx =0, transId =0;
+ ResetRequestE2_t *resetReq;
- DU_LOG("\nINFO --> E2AP : RIC service update failure received");
- ricServiceFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICserviceUpdateFailure;
+ DU_LOG("\nINFO --> E2AP : E2 Reset request received");
+ resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
- for(arrIdx=0; arrIdx<ricServiceFailure->protocolIEs.list.count; arrIdx++)
+ for(arrIdx=0; arrIdx<resetReq->protocolIEs.list.count; arrIdx++)
{
- switch(ricServiceFailure->protocolIEs.list.array[arrIdx]->id)
+ switch(resetReq->protocolIEs.list.array[arrIdx]->id)
{
case ProtocolIE_IDE2_id_TransactionID:
{
+ transId = resetReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
break;
}
- case ProtocolIE_IDE2_id_TimeToWaitE2:
+
+ case ProtocolIE_IDE2_id_CauseE2:
{
- timerValue = convertE2WaitTimerEnumToValue(ricServiceFailure->protocolIEs.list.array[arrIdx]->value.choice.TimeToWaitE2);
- if((duChkTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer), EVENT_RIC_SERVICE_UPDATE_TMR)) == FALSE)
- {
- duStartTmr((PTR)&(duCb.e2apDb.e2TimersInfo.e2Timers.ricServiceUpdateTimer), EVENT_RIC_SERVICE_UPDATE_TMR, timerValue);
- }
- else
+ for(ranFuncIdx=0; ranFuncIdx<MAX_RAN_FUNCTION; ranFuncIdx++)
{
- DU_LOG("\nERROR --> E2AP : EVENT_RIC_SERVICE_UPDATE_TMR timer is already running");
- return;
+ if(duCb.e2apDb.ranFunction[ranFuncIdx].id >0)
+ {
+ deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList));
+ memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo));
+ }
}
- break;
- }
- case ProtocolIE_IDE2_id_CauseE2:
- {
break;
}
}
}
-
- freeAperDecodingOfRicServiceUpdateFailure(ricServiceFailure);
+ if(BuildAndSendResetResponse(transId) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build and send reset response");
+ }
+ freeAperDecodingOfE2ResetReq(resetReq);
}
-/******************************************************************
+/*******************************************************************
*
- * @brief DU Send E2 Node Configuration Update
+ * @brief Free APER decoding of RIC Subscription Modification Refuse
*
* @details
*
- * Function : duSendE2NodeConfigurationUpdate
+ * Function : freeAperDecodingOfRicSubsModRefuse
*
- * Functionality: DU Send E2 Node Configuration Update
+ * Functionality: Free APER decoding of RIC Subscription
+ * Modification Refuse
*
- * @return ROK - success
- * RFAILED - failure
+ * @param E2AP Message PDU
+ * @return void
*
- * ****************************************************************/
-
-uint8_t duSendE2NodeConfigurationUpdate()
+ ******************************************************************/
+void freeAperDecodingOfRicSubsModRefuse(E2AP_PDU_t *e2apMsg)
{
- E2NodeConfigList e2NodeList;
- CmLList *node =NULL;
- E2NodeComponent *e2NodeComponentInfo=NULL;
+ uint8_t ieIdx =0;
+ RICsubscriptionModificationRefuse_t *ricSubsModRefuse = NULLP;
- memset(&e2NodeList, 0, sizeof(E2NodeConfigList));
- CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node);
- while(node)
+ if(e2apMsg && e2apMsg->choice.unsuccessfulOutcome)
{
- e2NodeComponentInfo = (E2NodeComponent*)node->node;
+ ricSubsModRefuse = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionModificationRefuse;
+ if(ricSubsModRefuse->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < ricSubsModRefuse->protocolIEs.list.count; ieIdx++)
+ {
+ if(ricSubsModRefuse->protocolIEs.list.array[ieIdx])
+ free(ricSubsModRefuse->protocolIEs.list.array[ieIdx]);
+ }
+ free(ricSubsModRefuse->protocolIEs.list.array);
+ }
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Process RIC Subscription Modification Refuse Message
+ *
+ * @details
+ *
+ * Function : procRicSubscriptionModificationRefuse
+ *
+ * Functionality: Process RIC Subscription Modification Refuse
+ * Message received from RIC.
+ *
+ * @param E2AP Message PDU
+ * @return void
+ *
+ ******************************************************************/
+void procRicSubscriptionModificationRefuse(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0;
+ uint16_t ranFuncId = 0;
+ RicRequestId ricReqId;
+ RICsubscriptionModificationRefuse_t *ricSubsModRefuse = NULLP;
+ RICsubscriptionModificationRefuse_IEs_t *ricSubsModRefuseIe = NULLP;
+ CauseE2_t *cause = NULLP;
+
+ DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Modification Refuse", __func__);
+
+ do{
+ if(!e2apMsg)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: E2AP Message is NULL", __func__);
+ break;
+ }
+
+ if(!e2apMsg->choice.unsuccessfulOutcome)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Unsuccessful Outcome in E2AP message is NULL", __func__);
+ break;
+ }
+
+ ricSubsModRefuse = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionModificationRefuse;
+ if(!ricSubsModRefuse->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Array conatining E2AP message IEs is null", __func__);
+ break;
+ }
- if(e2NodeComponentInfo->componentRequestPart && e2NodeComponentInfo->componentResponsePart)
+ for(ieIdx = 0; ieIdx < ricSubsModRefuse->protocolIEs.list.count; ieIdx++)
{
- switch(e2NodeComponentInfo->componentActionType)
+ if(!ricSubsModRefuse->protocolIEs.list.array[ieIdx])
+ {
+ DU_LOG("\nERROR --> E2AP : %s: IE at index [%d] in E2AP message IEs list is null", __func__, ieIdx);
+ break;
+ }
+
+ ricSubsModRefuseIe = ricSubsModRefuse->protocolIEs.list.array[ieIdx];
+ switch(ricSubsModRefuseIe->id)
{
- case E2_NODE_COMPONENT_ADD:
+ case ProtocolIE_IDE2_id_RICrequestID:
{
- e2NodeList.addE2Node[e2NodeList.addE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
- e2NodeList.addE2Node[e2NodeList.addE2NodeCount].actionType = e2NodeComponentInfo->componentActionType;
- e2NodeList.removeE2NodeCount++;
+ memset(&ricReqId, 0, sizeof(RicRequestId));
+ ricReqId.requestorId = ricSubsModRefuseIe->value.choice.RICrequestID.ricRequestorID;
+ ricReqId.instanceId = ricSubsModRefuseIe->value.choice.RICrequestID.ricInstanceID;
break;
}
- case E2_NODE_COMPONENT_UPDATE:
+
+ case ProtocolIE_IDE2_id_RANfunctionID:
{
- e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
- e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].actionType = e2NodeComponentInfo->componentActionType;
- e2NodeList.updateE2NodeCount++;
+ ranFuncId = ricSubsModRefuseIe->value.choice.RANfunctionID;
break;
-
}
- case E2_NODE_COMPONENT_DEL:
+
+ case ProtocolIE_IDE2_id_CauseE2:
{
- e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].interface = e2NodeComponentInfo->interfaceType;
- e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].actionType = e2NodeComponentInfo->componentActionType;
- e2NodeList.removeE2NodeCount++;
- break;
+ DU_LOG("\nDEBUG --> E2AP : %s: RIC subscriptiom modification refused for RIC_Requestor_ID [%d] \
+ RIC_Instance_ID [%d] RAN_Function_ID [%d] ", __func__, ricReqId.requestorId, \
+ ricReqId.instanceId, ranFuncId);
+
+ cause = &ricSubsModRefuseIe->value.choice.CauseE2;
+ printE2ErrorCause(cause);
}
- }
- }
- node = node->next;
- }
- if(BuildAndSendE2NodeConfigUpdate(&e2NodeList) !=ROK)
- {
- DU_LOG("\nERROR --> E2AP : Failed to build and send e2 node config update message to RIC_stub");
- return RFAILED;
- }
- return ROK;
+ default:
+ break;
+ } /* End of switch for Protocol IE Id */
+ } /* End of for loop for Protocol IE list */
+
+ break;
+ }while(true);
+
+ freeAperDecodingOfRicSubsModRefuse(e2apMsg);
+ return;
}
/*******************************************************************
*
- * @brief Free RIC Subscription Modification Required
+ * @brief Free RIC Subscription Delete Required Message
*
* @details
*
- * Function : FreeRicSubsModRequired
+ * Function : FreeRicSubscriptionDeleteRequired
*
- * Functionality: Freqq RIC Subscription Modification required
+ * Functionality: Free RIC Subscription Delete Required
*
- * @param E2AP Message PDU to be freed
+ * @param E2AP Message PDU
* @return void
*
******************************************************************/
-void FreeRicSubsModRequired(E2AP_PDU_t *e2apMsg)
+void FreeRicSubscriptionDeleteRequired(E2AP_PDU_t *e2apMsg, CmLListCp *ricSubsToBeDelList)
{
uint8_t ieIdx = 0, arrIdx = 0;
- RICsubscriptionModificationRequired_t *ricSubsModReqd = NULLP;
- RICsubscriptionModificationRequired_IEs_t *ricSubsModReqdIe = NULLP;
- RICactions_RequiredToBeModified_List_t *actionToBeModList = NULLP;
- RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList = NULLP;
+ RICsubscriptionDeleteRequired_t *ricSubsDelRqd = NULLP;
+ RICsubscriptionDeleteRequired_IEs_t *ricSubsDelRqdIe = NULLP;
+ RICsubscription_List_withCause_t *ricSubsList = NULLP;
+ CmLList *subsNode = NULLP;
if(e2apMsg)
{
if(e2apMsg->choice.initiatingMessage)
{
- ricSubsModReqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionModificationRequired;
- if(ricSubsModReqd->protocolIEs.list.array)
+ ricSubsDelRqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequired;
+ if(ricSubsDelRqd->protocolIEs.list.array)
{
- for(ieIdx = 0; ieIdx < ricSubsModReqd->protocolIEs.list.count; ieIdx++)
+ for(ieIdx = 0; ieIdx < ricSubsDelRqd->protocolIEs.list.count; ieIdx++)
{
- if(ricSubsModReqd->protocolIEs.list.array[ieIdx])
+ if(ricSubsDelRqd->protocolIEs.list.array[ieIdx])
{
- ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
- switch(ricSubsModReqdIe->id)
+ ricSubsDelRqdIe = ricSubsDelRqd->protocolIEs.list.array[ieIdx];
+ switch(ricSubsDelRqdIe->id)
{
- case ProtocolIE_IDE2_id_RICactionsRequiredToBeModified_List:
- {
- actionToBeModList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeModified_List;
- if(actionToBeModList->list.array)
- {
- for(arrIdx = 0; arrIdx < actionToBeModList->list.count; arrIdx++)
- {
- DU_FREE(actionToBeModList->list.array[arrIdx], \
- sizeof(RICaction_RequiredToBeModified_ItemIEs_t));
- }
- DU_FREE(actionToBeModList->list.array, actionToBeModList->list.size);
- }
- break;
- }
-
- case ProtocolIE_IDE2_id_RICactionsRequiredToBeRemoved_List:
+ case ProtocolIE_IDE2_id_RICsubscriptionToBeRemoved:
{
- actionToBeRmvList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeRemoved_List;
- if(actionToBeRmvList->list.array)
+ ricSubsList = &ricSubsDelRqdIe->value.choice.RICsubscription_List_withCause;
+ if(ricSubsList->list.array)
{
- for(arrIdx = 0; arrIdx < actionToBeRmvList->list.count; arrIdx++)
- {
- DU_FREE(actionToBeRmvList->list.array[arrIdx], \
- sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t));
+ for(arrIdx = 0; arrIdx < ricSubsList->list.count; arrIdx++)
+ {
+ DU_FREE(ricSubsList->list.array[ieIdx], sizeof(RICsubscription_withCause_ItemIEs_t));
}
- DU_FREE(actionToBeRmvList->list.array, actionToBeRmvList->list.size);
+ DU_FREE(ricSubsList->list.array, ricSubsList->list.size);
}
break;
}
-
- default:
- break;
}
- DU_FREE(ricSubsModReqd->protocolIEs.list.array[ieIdx], \
- sizeof(RICsubscriptionModificationRequired_IEs_t));
+ DU_FREE(ricSubsDelRqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionDeleteRequired_IEs_t));
}
}
- DU_FREE(ricSubsModReqd->protocolIEs.list.array, ricSubsModReqd->protocolIEs.list.size);
+ DU_FREE(ricSubsDelRqd->protocolIEs.list.array, ricSubsDelRqd->protocolIEs.list.size);
}
DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
- }
-}
-
-/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
- * However, E2SM-KPM supports only RIC Report service.
- * Hence there is no subsequent action in RIC subscription that may require modification.
- * So commenting the action-modification IEs for the time being
- */
-#if 0
-/*******************************************************************
- *
- * @brief Fill Action required to be modified list
- *
- * @details
- *
- * Function : FillActionReqdToBeModList
- *
- * Functionality: Fill Action required to be modified list
- *
- * @param RIC Actions Required To Be Modified List to be filled
- * Number of actions to be modified
- * RIC Subscription DB
- * @return ROK - success
- * RFAILED - failure
- *
- ******************************************************************/
-uint8_t FillActionReqdToBeModList(RICactions_RequiredToBeModified_List_t *actionToBeModList, uint8_t numActionsMod, \
- RicSubscription *ricSubscription)
-{
- uint8_t arrIdx = 0, actionIdx = 0;
- RICaction_RequiredToBeModified_ItemIEs_t *actionToBeMod = NULL;
-
- actionToBeModList->list.count = numActionsMod;
- actionToBeModList->list.size = numActionsMod * sizeof(RICaction_RequiredToBeModified_ItemIEs_t *);
- DU_ALLOC(actionToBeModList->list.array, actionToBeModList->list.size);
- if(!actionToBeModList->list.array)
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
- return RFAILED;
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));;
}
- arrIdx = 0;
- for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ if(ricSubsToBeDelList)
{
- if(ricSubscription->actionSequence[actionIdx].action == CONFIG_MOD)
+ CM_LLIST_FIRST_NODE(ricSubsToBeDelList, subsNode);
+ while(subsNode)
{
- DU_ALLOC(actionToBeModList->list.array[arrIdx], sizeof(RICaction_RequiredToBeModified_ItemIEs_t));
- if(!actionToBeModList->list.array[arrIdx])
- {
- DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
- return RFAILED;
- }
- actionToBeMod = (RICaction_RequiredToBeModified_ItemIEs_t *)actionToBeModList->list.array[arrIdx];
-
- actionToBeMod->id = ProtocolIE_IDE2_id_RICaction_RequiredToBeModified_Item;
- actionToBeMod->criticality = CriticalityE2_reject;
- actionToBeMod->value.present = \
- RICaction_RequiredToBeModified_ItemIEs__value_PR_RICaction_RequiredToBeModified_Item;
- actionToBeMod->value.choice.RICaction_RequiredToBeModified_Item.ricActionID = \
- ricSubscription->actionSequence[actionIdx].actionId;
- actionToBeMod->value.choice.RICaction_RequiredToBeModified_Item.ricTimeToWait = RICtimeToWait_w5ms;
-
- arrIdx++;
+ cmLListDelFrm(ricSubsToBeDelList, subsNode);
+ DU_FREE(subsNode, sizeof(CmLList));
+ CM_LLIST_FIRST_NODE(ricSubsToBeDelList, subsNode);
}
}
-
- return ROK;
}
-#endif
/*******************************************************************
*
- * @brief Fill Action required to be removed list
+ * @brief Fill list of RIC subscriptions required to be deleted
+ * with the cause of deletion
*
* @details
*
- * Function : FillActionReqdToBeRmvList
+ * Function : fillRicSubsListWithCause
*
- * Functionality: Fill Action required to be removed list
+ * Functionality: Fill list of RIC subscriptions required to be
+ * deleted with the cause of deletion
*
- * @param RIC Actions Required To Be Removed List to be filled
- * Number of actions to be removed
- * RIC Subscription DB
- * @return ROK - success
- * RFAILED - failure
+ * @param E2AP Message PDU
+ * @return void
*
******************************************************************/
-uint8_t FillActionReqdToBeRmvList(RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList, uint8_t numActionsRmv, \
- RicSubscription *ricSubscription)
+uint8_t fillRicSubsListWithCause(RICsubscription_List_withCause_t *ricSubsList, CmLListCp ricSubsToBeDelList)
{
- uint8_t arrIdx = 0, actionIdx = 0;
- RICaction_RequiredToBeRemoved_ItemIEs_t *actionToBeRmv = NULL;
+ uint16_t ieIdx = 0;
+ CmLList *subsNode = NULLP;
+ RicSubscription *subsInfo = NULLP;
+ RICsubscription_withCause_ItemIEs_t *subsItemIe = NULLP;
+ RICsubscription_withCause_Item_t *subsItem = NULLP;
- actionToBeRmvList->list.count = numActionsRmv;
- actionToBeRmvList->list.size = numActionsRmv * sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t *);
- DU_ALLOC(actionToBeRmvList->list.array, actionToBeRmvList->list.size);
- if(!actionToBeRmvList->list.array)
+ ricSubsList->list.count = ricSubsToBeDelList.count;
+ ricSubsList->list.size = ricSubsList->list.count * sizeof(RICsubscription_withCause_ItemIEs_t *);
+ DU_ALLOC(ricSubsList->list.array, ricSubsList->list.size);
+ if(!ricSubsList->list.array)
{
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
return RFAILED;
}
- arrIdx = 0;
- for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ CM_LLIST_FIRST_NODE(&ricSubsToBeDelList, subsNode);
+ while(subsNode && (ieIdx < ricSubsList->list.count))
{
- if(ricSubscription->actionSequence[actionIdx].action == CONFIG_DEL)
+ subsInfo = (RicSubscription *)subsNode->node;
+ DU_ALLOC(ricSubsList->list.array[ieIdx], sizeof(RICsubscription_withCause_ItemIEs_t));
+ if(!ricSubsList->list.array[ieIdx])
{
- DU_ALLOC(actionToBeRmvList->list.array[arrIdx], sizeof(RICaction_RequiredToBeRemoved_ItemIEs_t));
- if(!actionToBeRmvList->list.array[arrIdx])
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
- return RFAILED;
- }
- actionToBeRmv = (RICaction_RequiredToBeRemoved_ItemIEs_t *)actionToBeRmvList->list.array[arrIdx];
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
+ return RFAILED;
+ }
- actionToBeRmv->id = ProtocolIE_IDE2_id_RICaction_RequiredToBeRemoved_Item;
- actionToBeRmv->criticality = CriticalityE2_reject;
- actionToBeRmv->value.present = \
- RICaction_RequiredToBeRemoved_ItemIEs__value_PR_RICaction_RequiredToBeRemoved_Item;
- actionToBeRmv->value.choice.RICaction_RequiredToBeRemoved_Item.ricActionID = \
- ricSubscription->actionSequence[actionIdx].actionId;
- fillE2Cause(&actionToBeRmv->value.choice.RICaction_RequiredToBeRemoved_Item.cause, \
- ricSubscription->actionSequence[actionIdx].failureCause);
+ subsItemIe = (RICsubscription_withCause_ItemIEs_t *)ricSubsList->list.array[ieIdx];
+ subsItemIe->id = ProtocolIE_IDE2_id_RICsubscription_withCause_Item;
+ subsItemIe->criticality = CriticalityE2_ignore;
+ subsItemIe->value.present = RICsubscription_withCause_ItemIEs__value_PR_RICsubscription_withCause_Item;
+
+ subsItem = & subsItemIe->value.choice.RICsubscription_withCause_Item;
+ subsItem->ricRequestID.ricRequestorID = subsInfo->requestId.requestorId;
+ subsItem->ricRequestID.ricInstanceID = subsInfo->requestId.instanceId;
+ subsItem->ranFunctionID = subsInfo->ranFuncId;
+ fillE2Cause(&subsItem->cause, subsInfo->failureCause);
- arrIdx++;
- }
+ ieIdx++;
+ subsNode = subsNode->next;
}
- return ROK;
+ return ROK;
}
/*******************************************************************
*
- * @brief Fill RIC Subscription Modification Required IEs
+ * @brief Builds and Send RIC Subscription delete required
*
* @details
*
- * Function : FillRicSubsModRequired
+ * Function : BuildAndSendRicSubscriptionDeleteRequired
*
- * Functionality: Fill RIC Subscription Modification Required IEs
+ * Functionality: Build and send RIC subscription delete required.
+ * There can be 2 approaches to trigger following. One of these
+ * approaches may/may not be implemented in future:
+ * 1. It can be triggerred immediately when a RIC subscription's
+ * End Time has expired. In this case, only this subscription's
+ * info will be sent in this message.
+ * Since we have not yet added support to execute RIC
+ * Subscription based on Start Time and End Timer, this message is
+ * not triggered anywhere from DU APP yet.
+ * 2. Another approach is to have a periodic timer to check subscription
+ * status running in background.
+ * When RIC Subscription End Time expires, this subscription is
+ * marked to be deleted. Later when this background timer expires,
+ * a RIC Subscription delete required is sent with all the
+ * subscription's info which is marked to be deleted.
+ * The following function is implemented keeping in mind the second
+ * approach.
*
- * @param RIC Subscription Modification Required IEs to be filled
- * RIC Subscription DB
+ * @params[in]
* @return ROK - success
* RFAILED - failure
*
******************************************************************/
-uint8_t FillRicSubsModRequired(RICsubscriptionModificationRequired_t *ricSubsModReqd, RicSubscription *ricSubscription)
+uint8_t BuildAndSendRicSubscriptionDeleteRequired()
{
- uint8_t ieIdx = 0, elementCnt=0, actionIdx = 0;
- uint8_t numActionsMod = 0, numActionsRmv = 0;
- RICsubscriptionModificationRequired_IEs_t *ricSubsModReqdIe = NULLP;
- RICactions_RequiredToBeRemoved_List_t *actionToBeRmvList = NULLP;
-
-/* Unused in case of E2SM-KPM */
-#if 0
- RICactions_RequiredToBeModified_List_t *actionToBeModList = NULLP;
-#endif
+ uint8_t elementCnt = 0, ieIdx = 0, ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ RICsubscriptionDeleteRequired_t *ricSubsDelRqd = NULLP;
+ RICsubscriptionDeleteRequired_IEs_t *ricSubsDelRqdIe = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+ CmLListCp ricSubsToBeDelList;
- /* Count number of Actions to be modified or deleted */
- for(actionIdx = 0; actionIdx < MAX_RIC_ACTION; actionIdx++)
+ while(true)
{
- if(ricSubscription->actionSequence[actionIdx].action == CONFIG_MOD)
- numActionsMod++;
- else if(ricSubscription->actionSequence[actionIdx].action == CONFIG_DEL)
- numActionsRmv++;
- }
+ /* Check if there are any RIC subscriptions to be deleted */
+ cmLListInit(&ricSubsToBeDelList);
+ fetchRicSubsToBeDeleted(&ricSubsToBeDelList);
+ if(ricSubsToBeDelList.count == 0)
+ {
+ DU_LOG("\nDEBUG --> E2AP : %s: No RIC subscriptions are required to be deleted", __func__);
+ return ROK;
+ }
- /* Count number of IEs to be added to messages */
- elementCnt = 2;
- if(numActionsMod)
- elementCnt++;
- if(numActionsRmv)
- elementCnt++;
+ DU_LOG("\nINFO --> E2AP : Building RIC Subscription Delete Required Message\n");
- ricSubsModReqd->protocolIEs.list.count = elementCnt;
- ricSubsModReqd->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionModificationRequired_IEs_t *);
- DU_ALLOC(ricSubsModReqd->protocolIEs.list.array, ricSubsModReqd->protocolIEs.list.size);
- if(!ricSubsModReqd->protocolIEs.list.array)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
- return RFAILED;
- }
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
+ break;
+ }
- for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
- {
- DU_ALLOC(ricSubsModReqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionModificationRequired_IEs_t));
- if(!ricSubsModReqd->protocolIEs.list.array[ieIdx])
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
+ break;
}
- }
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICsubscriptionDeleteRequired;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICsubscriptionDeleteRequired;
- /* RIC Request ID */
- ieIdx = 0;
- ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
- ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICrequestID;
- ricSubsModReqdIe->criticality = CriticalityE2_reject;
- ricSubsModReqdIe->value.present = RICsubscriptionModificationRequired_IEs__value_PR_RICrequestID;
- ricSubsModReqdIe->value.choice.RICrequestID.ricRequestorID = ricSubscription->requestId.requestorId;
- ricSubsModReqdIe->value.choice.RICrequestID.ricInstanceID = ricSubscription->requestId.instanceId;
+ ricSubsDelRqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequired;
+
+ elementCnt = 1;
+ ricSubsDelRqd->protocolIEs.list.count = elementCnt;
+ ricSubsDelRqd->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionDeleteRequired_IEs_t *);
- /* RAN Function ID */
- ieIdx++;
- ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
- ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RANfunctionID;
- ricSubsModReqdIe->criticality = CriticalityE2_reject;
- ricSubsModReqdIe->value.present = RICsubscriptionModificationRequired_IEs__value_PR_RANfunctionID;
- ricSubsModReqdIe->value.choice.RANfunctionID = ricSubscription->ranFuncId;
+ DU_ALLOC(ricSubsDelRqd->protocolIEs.list.array, ricSubsDelRqd->protocolIEs.list.size);
+ if(ricSubsDelRqd->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed for array elements at line %d",__func__, __LINE__);
+ break;
+ }
+
+ for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
+ {
+ DU_ALLOC(ricSubsDelRqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionDeleteRequired_IEs_t));
+ if(ricSubsDelRqd->protocolIEs.list.array[ieIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed for index [%d] at line %d", \
+ __func__, ieIdx, __LINE__);
+ break;
+ }
+ }
+ if(ieIdx < elementCnt)
+ break;
-/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
- * However, E2SM-KPM supports only RIC Report service.
- * Hence there is no subsequent action in RIC subscription that may require modification.
- * So commenting the action-modification IEs for the time being
- */
-#if 0
- /* RIC Actions Required to be Modified */
- if(numActionsMod)
- {
- ieIdx++;
- ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
- ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICactionsRequiredToBeModified_List;
- ricSubsModReqdIe->criticality = CriticalityE2_reject;
- ricSubsModReqdIe->value.present = \
- RICsubscriptionModificationRequired_IEs__value_PR_RICactions_RequiredToBeModified_List;
- actionToBeModList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeModified_List;
+ ieIdx = 0;
+ ricSubsDelRqdIe = ricSubsDelRqd->protocolIEs.list.array[ieIdx];
+ ricSubsDelRqdIe->id = ProtocolIE_IDE2_id_RICsubscriptionToBeRemoved;
+ ricSubsDelRqdIe->criticality = CriticalityE2_ignore;
+ ricSubsDelRqdIe->value.present = RICsubscriptionDeleteRequired_IEs__value_PR_RICsubscription_List_withCause;
+ if(fillRicSubsListWithCause(&ricSubsDelRqdIe->value.choice.RICsubscription_List_withCause, ricSubsToBeDelList)\
+ != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: Failed to fill RIC Subscription list with cause", __func__);
+ break;
+ }
- if(FillActionReqdToBeModList(actionToBeModList, numActionsMod, ricSubscription) != ROK)
+ /* Prints the Msg formed */
+ 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 : %s: Failed to fill actions required to be modified list", __func__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Could not encode RIC Subscription Delete Required Message (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
}
- }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Delete Required Message \n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x",encBuf[i]);
+ }
#endif
+ }
- /* RIC Actions Required to be removed */
- if(numActionsRmv)
- {
- ieIdx++;
- ricSubsModReqdIe = ricSubsModReqd->protocolIEs.list.array[ieIdx];
- ricSubsModReqdIe->id = ProtocolIE_IDE2_id_RICactionsRequiredToBeRemoved_List;
- ricSubsModReqdIe->criticality = CriticalityE2_reject;
- ricSubsModReqdIe->value.present = \
- RICsubscriptionModificationRequired_IEs__value_PR_RICactions_RequiredToBeRemoved_List;
- actionToBeRmvList = &ricSubsModReqdIe->value.choice.RICactions_RequiredToBeRemoved_List;
-
- if(FillActionReqdToBeRmvList(actionToBeRmvList, numActionsRmv, ricSubscription) != ROK)
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
{
- DU_LOG("\nERROR --> E2AP : %s: Failed to fill actions required to be removed list", __func__);
- return RFAILED;
+ DU_LOG("\nERROR --> E2AP : Failed to send RIC Susbcription Delete Required Message");
+
}
+ ret = ROK;
+ break;
}
- return ROK;
+ FreeRicSubscriptionDeleteRequired(e2apMsg, &ricSubsToBeDelList);
+ return ret;
}
/*******************************************************************
*
- * @brief Builds and Send RIC Subscription Modification Required
- * message
+ * @brief Free RIC Subscription Delete Request Message
*
* @details
*
- * Function : BuildAndSendRicSubsModRequired
+ * Function : freeAperDecodingOfRicSubsDeleteReq
*
- * Functionality: Builds and Send RIC Subscription Modification
- * Required message
+ * Functionality: Free RIC Subscription Delete Request
*
- * @param RIC Subscription DB
- * @return ROK - success
- * RFAILED - failure
+ * @param E2AP Message PDU
+ * @return void
*
******************************************************************/
-uint8_t BuildAndSendRicSubsModRequired(RicSubscription *ricSubscription)
+void freeAperDecodingOfRicSubsDeleteReq(E2AP_PDU_t *e2apMsg)
{
- uint8_t ret = RFAILED;
- E2AP_PDU_t *e2apMsg = NULLP;
- RICsubscriptionModificationRequired_t *ricSubsModReqd = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
+ uint8_t ieIdx = 0;
+ RICsubscriptionDeleteRequest_t *ricSubsDelReq = NULLP;
+
+ if(e2apMsg)
+ {
+ if(e2apMsg->choice.initiatingMessage)
+ {
+ ricSubsDelReq = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequest;
+ if(ricSubsDelReq->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < ricSubsDelReq->protocolIEs.list.count; ieIdx++)
+ {
+ if(ricSubsDelReq->protocolIEs.list.array[ieIdx])
+ {
+ free(ricSubsDelReq->protocolIEs.list.array[ieIdx]);
+ }
+ }
+ free(ricSubsDelReq->protocolIEs.list.array);
+ }
+ }
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Process RIC Subscription delete request
+ *
+ * @details
+ *
+ * Function : procRicSubscriptionDeleteRequest
+ *
+ * Functionality: Process RIC subscription delete request.
+ * Fetch RAN Function and RIC subscription to be deleted.
+ * Send statistics delete request to MAC for all action sequence
+ * within this RIC subscription.
+ *
+ * @params[in] E2AP PDU
+ * @return void
+ *
+ ******************************************************************/
+void procRicSubscriptionDeleteRequest(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0;
+ uint16_t ranFuncId = 0;
+ bool procFailure = false;
+ RicRequestId ricReqId;
+ RanFunction *ranFuncDb = NULLP;
+ CmLList *ricSubsNode = NULLP;
+ RicSubscription *ricSubsDb = NULLP;
+ RICsubscriptionDeleteRequest_t *ricSubsDelReq = NULLP;
+ RICsubscriptionDeleteRequest_IEs_t *ricSubsDelReqIe = NULLP;
- DU_LOG("\nINFO --> E2AP : Building RIC Subscription Modification Required \n");
- while(true)
- {
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
- break;
- }
+ DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Delete Request", __func__);
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
+ do{
+ if(!e2apMsg)
{
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed at line %d", __func__, __LINE__);
+ DU_LOG("\nERROR --> E2AP : %s: E2AP Message is NULL", __func__);
break;
}
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICsubscriptionModificationRequired;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICsubscriptionModificationRequired;
-
- ricSubsModReqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionModificationRequired;
- if(FillRicSubsModRequired(ricSubsModReqd, ricSubscription) != ROK)
+ if(!e2apMsg->choice.initiatingMessage)
{
- DU_LOG("\nERROR --> E2AP : %s: Failed to fill RIC Subscription Modification Required IEs", __func__);
+ DU_LOG("\nERROR --> E2AP : %s: Initiating Message in E2AP PDU is NULL", __func__);
break;
}
-
- /* Encode */
- 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)
+ ricSubsDelReq = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequest;
+ if(!ricSubsDelReq->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : Could not encode RIC Subscription Modifiction Required structure (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ DU_LOG("\nERROR --> E2AP : %s: Array conatining E2AP message IEs is null", __func__);
break;
}
- else
+
+ for(ieIdx = 0; ieIdx < ricSubsDelReq->protocolIEs.list.count; ieIdx++)
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Modification Required \n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
+ if(!ricSubsDelReq->protocolIEs.list.array[ieIdx])
{
- printf("%x",encBuf[i]);
+ DU_LOG("\nERROR --> E2AP : %s: IE at index [%d] in E2AP message IEs list is null", __func__, ieIdx);
+ break;
}
-#endif
- }
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
- {
- DU_LOG("\nERROR --> E2AP : Sending RIC Subscription Modification Required failed");
- }
- ret = ROK;
+ ricSubsDelReqIe = ricSubsDelReq->protocolIEs.list.array[ieIdx];
+ switch(ricSubsDelReqIe->id)
+ {
+ case ProtocolIE_IDE2_id_RICrequestID:
+ {
+ memset(&ricReqId, 0, sizeof(RicRequestId));
+ ricReqId.requestorId = ricSubsDelReqIe->value.choice.RICrequestID.ricRequestorID;
+ ricReqId.instanceId = ricSubsDelReqIe->value.choice.RICrequestID.ricInstanceID;
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_RANfunctionID:
+ {
+ ranFuncId = ricSubsDelReqIe->value.choice.RANfunctionID;
+ ranFuncDb = fetchRanFuncFromRanFuncId(ranFuncId);
+ if(!ranFuncDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: RAN Function ID [%d] not found", __func__, ranFuncId);
+ procFailure = true;
+ break;
+ }
+
+ ricSubsDb = fetchSubsInfoFromRicReqId(ricReqId, ranFuncDb, &ricSubsNode);
+ if(!ricSubsDb)
+ {
+ DU_LOG("\nERROR --> E2AP : %s: RIC Subscription not found for Requestor_ID [%d] Instance_ID [%d]",\
+ __func__, ricReqId.requestorId, ricReqId.instanceId);
+ procFailure = true;
+ break;
+ }
+
+ if(BuildAndSendStatsDeleteReq(ricSubsDb) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to build and send ric subscription delete req to du layers");
+ }
+ break;
+ }
+
+ default:
+ break;
+ } /* End of switch for Protocol IE Id */
+
+ if(procFailure)
+ break;
+ } /* End of for loop for Protocol IE list */
+
break;
- }
+ }while(true);
- /* Free RIC Subscription modification required */
- FreeRicSubsModRequired(e2apMsg);
- return ret;
+ freeAperDecodingOfRicSubsDeleteReq(e2apMsg);
+ return;
}
/*******************************************************************
*
- * @brief Free APER decoding of RIC Subscription Modification Confirm
+ * @brief Deallocate the memory allocated for E2 node configuration
+ * update ack msg by aper decoder
*
* @details
*
- * Function : freeAperDecodingOfRicSubsModConfirm
+ * Function : freeAperDecodingOfE2NodeConfigUpdateAck
*
- * Functionality: Free APER decoding of RIC Subscription
- * Modification Confirm
+ * Functionality:
+ * - Deallocate the memory allocated for E2 node configuration
+ * update ack msg by aper decoder
*
- * @param E2AP Message PDU
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void freeAperDecodingOfRicSubsModConfirm(E2AP_PDU_t *e2apMsg)
+ * ****************************************************************/
+
+void freeAperDecodingOfE2NodeConfigUpdateAck(E2nodeConfigurationUpdateAcknowledge_t *updateAckMsg)
{
- uint8_t ieIdx = 0, arrIdx=0;
- RICsubscriptionModificationConfirm_t *ricSubsModCfm = NULLP;
- RICsubscriptionModificationConfirm_IEs_t *ricSubsModCfmIe = NULLP;
- RICactions_ConfirmedForModification_List_t *modCfmList = NULLP;
- RICactions_RefusedToBeModified_List_t *modRefusedList = NULLP;
- RICactions_ConfirmedForRemoval_List_t *rmvCfmList = NULLP;
- RICactions_RefusedToBeRemoved_List_t *rmvFailList = NULLP;
+ uint8_t arrIdx =0, e2NodeConfigIdx=0;
+ E2nodeComponentConfigUpdateAck_ItemIEs_t *updateAckItemIe=NULL;
+ E2nodeComponentConfigUpdateAck_List_t *updateAckList=NULL;
+ E2nodeComponentConfigRemovalAck_ItemIEs_t *removalAckItemIe=NULL;
+ E2nodeComponentConfigRemovalAck_List_t *removalAckList=NULL;
+ E2nodeComponentConfigAdditionAck_ItemIEs_t *additionAckItemIte=NULL;
+ E2nodeComponentConfigAdditionAck_List_t *additionAckList=NULL;
- if(e2apMsg && e2apMsg->choice.successfulOutcome)
+ E2nodeComponentInterfaceF1_t *f1InterfaceInfo=NULLP;
+ if(updateAckMsg->protocolIEs.list.array != NULLP)
{
- ricSubsModCfm = &e2apMsg->choice.successfulOutcome->value.choice.RICsubscriptionModificationConfirm;
- if(ricSubsModCfm->protocolIEs.list.array)
+ for(arrIdx = 0; arrIdx < updateAckMsg->protocolIEs.list.count; arrIdx++)
{
- for(ieIdx = 0; ieIdx < ricSubsModCfm->protocolIEs.list.count; ieIdx++)
+ if(updateAckMsg->protocolIEs.list.array[arrIdx])
{
- if(ricSubsModCfm->protocolIEs.list.array[ieIdx])
+ switch(updateAckMsg->protocolIEs.list.array[arrIdx]->id)
{
- ricSubsModCfmIe = ricSubsModCfm->protocolIEs.list.array[ieIdx];
- switch(ricSubsModCfmIe->id)
- {
- case ProtocolIE_IDE2_id_RICactionsConfirmedForModification_List:
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ additionAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
+ if(additionAckList->list.array)
{
- modCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForModification_List;
- if(modCfmList->list.array)
+ for(e2NodeConfigIdx=0; e2NodeConfigIdx<additionAckList->list.count; e2NodeConfigIdx++)
{
- for(arrIdx = 0; arrIdx < modCfmList->list.count; arrIdx++)
+ additionAckItemIte = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) additionAckList->list.array[e2NodeConfigIdx];
+ if(additionAckItemIte)
{
- if(modCfmList->list.array[arrIdx])
- free(modCfmList->list.array[arrIdx]);
+ switch(additionAckItemIte->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.present)
+ {
+ case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1:
+ {
+ f1InterfaceInfo = additionAckItemIte->value.choice.E2nodeComponentConfigAdditionAck_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1;
+ free(f1InterfaceInfo->gNB_DU_ID.buf);
+ free(f1InterfaceInfo);
+ break;
+ }
+ default:
+ break;
+ }
+ free(additionAckItemIte);
}
- free(modCfmList->list.array);
+ free(additionAckList->list.array);
}
break;
}
-
- case ProtocolIE_IDE2_id_RICactionsRefusedToBeModified_List:
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck:
+ {
+ updateAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdateAck_List;
+ if(updateAckList->list.array)
{
- modRefusedList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeModified_List;
- if(modRefusedList->list.array)
+ for(e2NodeConfigIdx=0; e2NodeConfigIdx<updateAckList->list.count; e2NodeConfigIdx++)
{
- for(arrIdx = 0; arrIdx < modRefusedList->list.count; arrIdx++)
+ updateAckItemIe = (E2nodeComponentConfigUpdateAck_ItemIEs_t*) updateAckList->list.array[e2NodeConfigIdx];
+ if(updateAckItemIe)
{
- if(modRefusedList->list.array[arrIdx])
- free(modRefusedList->list.array[arrIdx]);
+ switch(updateAckItemIe->value.choice.E2nodeComponentConfigUpdateAck_Item.e2nodeComponentID.present)
+ {
+ case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1:
+ {
+ f1InterfaceInfo = updateAckItemIe->value.choice.E2nodeComponentConfigUpdateAck_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1;
+ free(f1InterfaceInfo->gNB_DU_ID.buf);
+ free(f1InterfaceInfo);
+ break;
+ }
+ default:
+ break;
+ }
+ free(updateAckItemIe);
}
- free(modRefusedList->list.array);
}
- break;
+ free(updateAckList->list.array);
}
-
- case ProtocolIE_IDE2_id_RICactionsConfirmedForRemoval_List:
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck:
+ {
+ removalAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemovalAck_List;
+ if(removalAckList->list.array)
{
- rmvCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForRemoval_List;
- if(rmvCfmList->list.array)
+ for(e2NodeConfigIdx=0; e2NodeConfigIdx<removalAckList->list.count; e2NodeConfigIdx++)
{
- for(arrIdx = 0; arrIdx < rmvCfmList->list.count; arrIdx++)
+ removalAckItemIe = (E2nodeComponentConfigRemovalAck_ItemIEs_t*) removalAckList->list.array[e2NodeConfigIdx];
+ if(removalAckItemIe)
{
- if(rmvCfmList->list.array[arrIdx])
- free(rmvCfmList->list.array[arrIdx]);
+ switch(removalAckItemIe->value.choice.E2nodeComponentConfigRemovalAck_Item.e2nodeComponentID.present)
+ {
+ case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1:
+ {
+ f1InterfaceInfo = removalAckItemIe->value.choice.E2nodeComponentConfigRemovalAck_Item.e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1;
+ free(f1InterfaceInfo->gNB_DU_ID.buf);
+ free(f1InterfaceInfo);
+ break;
+ }
+ default:
+ break;
+ }
+ free(removalAckItemIe);
}
- free(rmvCfmList->list.array);
}
- break;
+ free(removalAckList->list.array);
}
+ break;
+ }
+ }
+ free(updateAckMsg->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(updateAckMsg->protocolIEs.list.array);
+ }
+}
- case ProtocolIE_IDE2_id_RICactionsRefusedToBeRemoved_List:
+/******************************************************************
+ *
+ * @brief Processes the E2 node config update ack msg
+ *
+ * @details
+ *
+ * Function :procE2NodeConfigUpdateAck
+ *
+ * Functionality: Processes the E2 node config update ack msg
+ *
+ * @params[in] E2AP_PDU_t ASN decoded E2AP message
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+
+void procE2NodeConfigUpdateAck(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0;
+ uint16_t e2CfgIdx =0;
+ E2nodeConfigurationUpdateAcknowledge_t *e2NodeConfigUpdateAck =NULLP;
+ E2nodeComponentConfigUpdateAck_List_t *e2NodeConfigUpdateAckList=NULLP;
+ E2nodeComponentConfigUpdateAck_ItemIEs_t *e2NodeUpdateAckItem=NULLP;
+ E2nodeComponentConfigRemovalAck_List_t *e2NodeConfigRemovalAckList=NULLP;
+ E2nodeComponentConfigRemovalAck_ItemIEs_t *e2NodeRemovalAckItem=NULLP;
+ E2nodeComponentConfigAdditionAck_List_t *e2NodeConfigAdditionAckList=NULLP;
+ E2nodeComponentConfigAdditionAck_ItemIEs_t *e2NodeAdditionAckItem=NULLP;
+
+ e2NodeConfigUpdateAck = &e2apMsg->choice.successfulOutcome->value.choice.E2nodeConfigurationUpdateAcknowledge;
+
+ if(e2NodeConfigUpdateAck->protocolIEs.list.array)
+ {
+ for(arrIdx =0; arrIdx<e2NodeConfigUpdateAck->protocolIEs.list.count; arrIdx++)
+ {
+ switch(e2NodeConfigUpdateAck->protocolIEs.list.array[arrIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck:
+ {
+ e2NodeConfigAdditionAckList = &e2NodeConfigUpdateAck->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List;
+ if(e2NodeConfigAdditionAckList->list.array)
+ {
+ for(e2CfgIdx = 0; e2CfgIdx< e2NodeConfigAdditionAckList->list.count; e2CfgIdx++)
{
- rmvFailList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeRemoved_List;
- if(rmvFailList->list.array)
- {
- for(arrIdx = 0; arrIdx < rmvFailList->list.count; arrIdx++)
- {
- if(rmvFailList->list.array[arrIdx])
- free(rmvFailList->list.array[arrIdx]);
- }
- free(rmvFailList->list.array);
- }
- break;
+ e2NodeAdditionAckItem = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) e2NodeConfigAdditionAckList->list.array[e2CfgIdx];
+ handleE2NodeConfigUpdateAckIes((PTR)&e2NodeAdditionAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item,\
+ ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck);
+ }
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck:
+ {
+ e2NodeConfigUpdateAckList = &e2NodeConfigUpdateAck->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdateAck_List;
+ if(e2NodeConfigUpdateAckList->list.array)
+ {
+ for(e2CfgIdx = 0; e2CfgIdx< e2NodeConfigUpdateAckList->list.count; e2CfgIdx++)
+ {
+ e2NodeUpdateAckItem = (E2nodeComponentConfigUpdateAck_ItemIEs_t*) e2NodeConfigUpdateAckList->list.array[e2CfgIdx];
+ handleE2NodeConfigUpdateAckIes((PTR)&e2NodeUpdateAckItem->value.choice.E2nodeComponentConfigUpdateAck_Item,\
+ ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck);
+ }
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck:
+ {
+ e2NodeConfigRemovalAckList = &e2NodeConfigUpdateAck->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemovalAck_List;
+ if(e2NodeConfigRemovalAckList->list.array)
+ {
+ for(e2CfgIdx = 0; e2CfgIdx< e2NodeConfigRemovalAckList->list.count; e2CfgIdx++)
+ {
+ e2NodeRemovalAckItem = (E2nodeComponentConfigRemovalAck_ItemIEs_t*) e2NodeConfigRemovalAckList->list.array[e2CfgIdx];
+ handleE2NodeConfigUpdateAckIes((PTR)&e2NodeRemovalAckItem->value.choice.E2nodeComponentConfigRemovalAck_Item,\
+ ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck);
}
+ }
+ break;
+ }
+ }
+ }
+ }
- default:
- break;
+ freeAperDecodingOfE2NodeConfigUpdateAck(e2NodeConfigUpdateAck);
+}
- }
- free(ricSubsModCfmIe);
+/*******************************************************************
+ *
+ * @brief Deallocate the memory allocated for RemovalRequest msg
+ *
+ * @details
+ *
+ * Function : FreeRemovalRequest
+ *
+ * Functionality:
+ * - freeing the memory allocated for RemovalRequest
+ *
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void FreeRemovalRequest(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx =0;
+ E2RemovalRequest_t *removalReq = NULLP;
+
+ if(e2apMsg != NULLP)
+ {
+ if(e2apMsg->choice.initiatingMessage != NULLP)
+ {
+ removalReq = &e2apMsg->choice.initiatingMessage->value.choice.E2RemovalRequest;
+ if(removalReq->protocolIEs.list.array)
+ {
+ for(ieIdx = 0; ieIdx < removalReq->protocolIEs.list.count; ieIdx++)
+ {
+ DU_FREE(removalReq->protocolIEs.list.array[ieIdx], sizeof(E2RemovalRequestIEs_t));
}
+ DU_FREE(removalReq->protocolIEs.list.array, removalReq->protocolIEs.list.size);
}
- free(ricSubsModCfm->protocolIEs.list.array);
+ DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
/*******************************************************************
*
- * @brief Process RIC Subscription Modification Confirm Message
+ * @brief Build and send the removal request msg
*
* @details
*
- * Function : procRicSubscriptionModificationConfirm
+ * Function : BuildAndSendRemovalRequest
*
- * Functionality: Process RIC Subscription Modification Confirm
- * Message received from RIC.
+ * Functionality:
+ * - Buld and send the removal request msg to E2 node
*
- * @param E2AP Message PDU
- * @return void
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void procRicSubscriptionModificationConfirm(E2AP_PDU_t *e2apMsg)
-{
- uint8_t actionId = 0, ieIdx = 0, arrIdx = 0;
- uint16_t ranFuncId = 0;
- bool procFailure = false;
- RicRequestId ricReqId;
- RanFunction *ranFuncDb = NULLP;
- CmLList *ricSubsNode = NULLP;
- RicSubscription *ricSubsDb = NULLP;
- ActionInfo *actionDb = NULLP;
-
- RICsubscriptionModificationConfirm_t *ricSubsModCfm = NULLP;
- RICsubscriptionModificationConfirm_IEs_t *ricSubsModCfmIe = NULLP;
-
-/* Not used in case of E2SM-KPM */
-#if 0
- RICactions_ConfirmedForModification_List_t *modCfmList = NULLP;
- RICaction_ConfirmedForModification_ItemIEs_t *modCfmListItem = NULLP;
-
- RICactions_RefusedToBeModified_List_t *modRefusedList = NULLP;
- RICaction_RefusedToBeModified_ItemIEs_t *modRefusedListItem = NULLP;
-#endif
-
- RICactions_ConfirmedForRemoval_List_t *rmvCfmList = NULLP;
- RICaction_ConfirmedForRemoval_ItemIEs_t *rmvCfmListItem = NULLP;
+ * ****************************************************************/
- RICactions_RefusedToBeRemoved_List_t *rmvFailList = NULLP;
- RICaction_RefusedToBeRemoved_ItemIEs_t *rmvFailListItem = NULLP;
+uint8_t BuildAndSendRemovalRequest()
+{
+ uint8_t ieIdx = 0, elementCnt = 0, transId = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ E2RemovalRequest_t *removalReq = NULLP;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
- DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Modification Confirm", __func__);
+ DU_LOG("\nINFO --> E2AP : Building Removal Request\n");
- do{
- if(!e2apMsg)
+ do
+ {
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : %s: E2AP Message is NULL", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- if(!e2apMsg->choice.successfulOutcome)
+ e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
+ DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
+ if(e2apMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nERROR --> E2AP : %s: Successful Outcome in E2AP message is NULL", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- ricSubsModCfm = &e2apMsg->choice.successfulOutcome->value.choice.RICsubscriptionModificationConfirm;
- if(!ricSubsModCfm->protocolIEs.list.array)
+ e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_E2removal;
+ e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
+ e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_E2RemovalRequest;
+ removalReq = &e2apMsg->choice.initiatingMessage->value.choice.E2RemovalRequest;
+
+ elementCnt = 1;
+ removalReq->protocolIEs.list.count = elementCnt;
+ removalReq->protocolIEs.list.size = elementCnt * sizeof(E2RemovalRequestIEs_t *);
+
+ DU_ALLOC(removalReq->protocolIEs.list.array, removalReq->protocolIEs.list.size);
+ if(!removalReq->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : %s: Array conatining E2AP message IEs is null", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- for(ieIdx = 0; ieIdx < ricSubsModCfm->protocolIEs.list.count; ieIdx++)
+ for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
{
- if(!ricSubsModCfm->protocolIEs.list.array[ieIdx])
+ DU_ALLOC(removalReq->protocolIEs.list.array[ieIdx], sizeof(E2RemovalRequestIEs_t));
+ if(!removalReq->protocolIEs.list.array[ieIdx])
{
- DU_LOG("\nERROR --> E2AP : %s: IE at index [%d] in E2AP message IEs list is null", __func__, ieIdx);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
+ }
- ricSubsModCfmIe = ricSubsModCfm->protocolIEs.list.array[ieIdx];
- switch(ricSubsModCfmIe->id)
+ /* In case of failure */
+ if(ieIdx < elementCnt)
+ break;
+
+ ieIdx = 0;
+ removalReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ removalReq->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ removalReq->protocolIEs.list.array[ieIdx]->value.present = E2RemovalRequestIEs__value_PR_TransactionID;
+ transId = assignTransactionId();
+ removalReq->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ /* Prints the Msg formed */
+ 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 removal request structure (at %s)\n",\
+ encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ break;
+ }
+ else
+ {
+ DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for removal request\n");
+#ifdef DEBUG_ASN_PRINT
+ for(int i=0; i< encBufSize; i++)
{
- case ProtocolIE_IDE2_id_RICrequestID:
- {
- memset(&ricReqId, 0, sizeof(RicRequestId));
- ricReqId.requestorId = ricSubsModCfmIe->value.choice.RICrequestID.ricRequestorID;
- ricReqId.instanceId = ricSubsModCfmIe->value.choice.RICrequestID.ricInstanceID;
- break;
- }
+ printf("%x",encBuf[i]);
+ }
+#endif
+ }
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Sending removal request failed");
+ break;
+ }
- case ProtocolIE_IDE2_id_RANfunctionID:
- {
- ranFuncId = ricSubsModCfmIe->value.choice.RANfunctionID;
- ranFuncDb = fetchRanFuncFromRanFuncId(ranFuncId);
- if(!ranFuncDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: RAN Function ID [%d] not found", __func__, ranFuncId);
- procFailure = true;
- break;
- }
- ricSubsDb = fetchSubsInfoFromRicReqId(ricReqId, ranFuncDb, &ricSubsNode);
- if(!ricSubsDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: RIC Subscription not found for Requestor_ID [%d] Instance_ID [%d]",\
- __func__, ricReqId.requestorId, ricReqId.instanceId);
- procFailure = true;
- break;
- }
+ ret = ROK;
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId = transId;
+ duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode = e2apMsg->choice.initiatingMessage->procedureCode;
+ break;
+ }while(true);
- break;
- }
+ /* Free all memory */
+ FreeRemovalRequest(e2apMsg);
+
+ return ret;
+}
-/* A RIC Subscription includes RIC subsequent action only for RIC Insert service.
- * However, E2SM-KPM supports only RIC Report service.
- * Hence there is no subsequent action in RIC subscription that may require modification.
- * So commenting the action-modification IEs for the time being
- */
-#if 0
- case ProtocolIE_IDE2_id_RICactionsConfirmedForModification_List:
- {
- modCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForModification_List;
- for(arrIdx = 0; arrIdx < modCfmList->list.count; arrIdx++)
- {
- modCfmListItem = (RICaction_ConfirmedForModification_ItemIEs_t *)modCfmList->list.array[arrIdx];
- actionId = modCfmListItem->value.choice.RICaction_ConfirmedForModification_Item.ricActionID;
+/******************************************************************
+ *
+ * @brief Deallocation of memory allocated by aper decoder
+ * for Removal failure
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfE2RemovalFailure
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder
+ * for Removal failure
+ *
+ * @params[in] Pointer to removalFailure
+ * @return void
+ *
+ * ****************************************************************/
+void freeAperDecodingOfE2RemovalFailure(E2RemovalFailure_t *removalFailure)
+{
+ uint8_t arrIdx=0;
- actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
- if(!actionDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
- }
- else
- {
- actionDb->action = CONFIG_UNKNOWN;
- /* Further handling can be added here in future once the
- * use case of this procedure is identified */
- }
- actionDb = NULLP;
- }
- break;
- }
+ if(removalFailure)
+ {
+ if(removalFailure->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<removalFailure->protocolIEs.list.count; arrIdx++)
+ {
+ if(removalFailure->protocolIEs.list.array[arrIdx])
+ {
+ free(removalFailure->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(removalFailure->protocolIEs.list.array);
+ }
+ }
+}
- case ProtocolIE_IDE2_id_RICactionsRefusedToBeModified_List:
+/******************************************************************
+ *
+ * @brief Processes the E2 removal failure msg
+ *
+ * @details
+ *
+ * Function : procE2RemovalFailure
+ *
+ * Functionality: Processes the E2 removal failure msg
+ *
+ * @params[in]
+ * E2AP_PDU_t *e2apMsg
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void ProcE2RemovalFailure(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0, transId=0;
+ CauseE2_t *cause = NULLP;
+ E2RemovalFailure_t *e2RemovalFailure=NULLP;
+
+ e2RemovalFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2RemovalFailure;
+
+ if(!e2RemovalFailure->protocolIEs.list.array)
+ {
+ DU_LOG("\nERROR --> E2AP : e2RemovalFailure array pointer is null");
+ return;
+ }
+
+ for(ieIdx=0; ieIdx < e2RemovalFailure->protocolIEs.list.count; ieIdx++)
+ {
+ if(e2RemovalFailure->protocolIEs.list.array[ieIdx])
+ {
+ switch(e2RemovalFailure->protocolIEs.list.array[ieIdx]->id)
+ {
+ case ProtocolIE_IDE2_id_TransactionID:
{
- modRefusedList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeModified_List;
- for(arrIdx = 0; arrIdx < modRefusedList->list.count; arrIdx++)
+ transId = e2RemovalFailure->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
{
- modRefusedListItem = (RICaction_RefusedToBeModified_ItemIEs_t *)modRefusedList->list.array[arrIdx];
- actionId = modRefusedListItem->value.choice.RICaction_RefusedToBeModified_Item.ricActionID;
- actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
- if(!actionDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
- }
- else
- {
- /* Spec doesnt mention if in case of failure, DU should retry for modify action
- * Hence, chaging the action from CONFIG_MOD to CONFIG_UNKNOWN
- */
- actionDb->action = CONFIG_UNKNOWN;
- }
- actionDb = NULLP;
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
}
break;
}
-#endif
-
- case ProtocolIE_IDE2_id_RICactionsConfirmedForRemoval_List:
+ case ProtocolIE_IDE2_id_CauseE2:
{
- rmvCfmList = &ricSubsModCfmIe->value.choice.RICactions_ConfirmedForRemoval_List;
- for(arrIdx = 0; arrIdx < rmvCfmList->list.count; arrIdx++)
- {
- rmvCfmListItem = (RICaction_ConfirmedForRemoval_ItemIEs_t *)rmvCfmList->list.array[arrIdx];
- actionId = rmvCfmListItem->value.choice.RICaction_ConfirmedForRemoval_Item.ricActionID;
- actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
- if(!actionDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
- }
- else
- {
- deleteActionSequence(actionDb);
- actionDb =NULLP;
- ricSubsDb->numOfActions--;
- /* Further handling can include :
- * Deletion of this action from all DU layers
- */
- }
- actionDb = NULLP;
- }
+ cause = &e2RemovalFailure->protocolIEs.list.array[ieIdx]->value.choice.CauseE2;
+ printE2ErrorCause(cause);
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", e2RemovalFailure->protocolIEs.list.array[ieIdx]->id);
break;
}
+ }
+ }
+ }
+ freeAperDecodingOfE2RemovalFailure(e2RemovalFailure);
+}
- case ProtocolIE_IDE2_id_RICactionsRefusedToBeRemoved_List:
+ /******************************************************************
+ *
+ * @brief Deallocation of memory allocated by aper decoder
+ * for Removal failure
+ *
+ * @details
+ *
+ * Function : freeAperDecodingOfE2RemovalResponse
+ *
+ * Functionality: Deallocation of memory allocated by aper decoder
+ * for Removal failure
+ *
+ * @params[in] Pointer to removalResponse
+ * @return void
+ *
+ * ****************************************************************/
+ void freeAperDecodingOfE2RemovalResponse(E2RemovalResponse_t *removalResponse)
+ {
+ uint8_t arrIdx=0;
+
+ if(removalResponse)
+ {
+ if(removalResponse->protocolIEs.list.array)
+ {
+ for(arrIdx=0; arrIdx<removalResponse->protocolIEs.list.count; arrIdx++)
+ {
+ if(removalResponse->protocolIEs.list.array[arrIdx])
+ {
+ free(removalResponse->protocolIEs.list.array[arrIdx]);
+ }
+ }
+ free(removalResponse->protocolIEs.list.array);
+ }
+ }
+ }
+
+/*******************************************************************
+ *
+ * @brief process the E2 Removal Response
+ *
+ * @details
+ *
+ * Function : ProcE2RemovalResponse
+ *
+ * Functionality: Process E2 Removal Response
+ *
+ * @params[in]
+ * E2AP_PDU_t *e2apMsg
+ * @return void
+ *
+ ******************************************************************/
+
+void ProcE2RemovalResponse(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t ieIdx = 0, transId=0;
+ E2RemovalResponse_t *removalRsp = NULLP;
+
+ removalRsp = &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse;
+
+ 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:
{
- rmvFailList = &ricSubsModCfmIe->value.choice.RICactions_RefusedToBeRemoved_List;
- for(arrIdx = 0; arrIdx < rmvFailList->list.count; arrIdx++)
+ transId = removalRsp->protocolIEs.list.array[ieIdx]->value.choice.TransactionID;
+ if((duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].transactionId == transId) &&\
+ (duCb.e2apDb.e2TransInfo.e2InitTransaction[transId].procedureCode == e2apMsg->choice.unsuccessfulOutcome->procedureCode))
{
- rmvFailListItem = (RICaction_RefusedToBeRemoved_ItemIEs_t *)rmvFailList->list.array[arrIdx];
- actionId = rmvFailListItem->value.choice.RICaction_RefusedToBeRemoved_Item.ricActionID;
- actionDb = fetchActionInfoFromActionId(actionId, ricSubsDb);
- if(!actionDb)
- {
- DU_LOG("\nERROR --> E2AP : %s: Action ID [%d] not found", __func__, actionId);
- }
- else
- {
- actionDb->action = CONFIG_UNKNOWN;
- }
- actionDb = NULLP;
+ DU_LOG("\nINFO --> E2AP : Sending request to close the sctp connection");
+ cmInetClose(&ricParams.sockFd);
+ memset(&duCb.e2apDb.e2TransInfo.e2InitTransaction[transId], 0, sizeof(E2TransInfo));
+ removeE2NodeInformation();
+ }
+ else
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid transaction id [%d]", transId);
}
break;
}
-
default:
- break;
- } /* End of switch for Protocol IE Id */
-
- if(procFailure)
- break;
- } /* End of for loop for Protocol IE list */
-
- break;
- }while(true);
-
- freeAperDecodingOfRicSubsModConfirm(e2apMsg);
- return;
+ {
+ DU_LOG("\nERROR --> E2AP : Received Invalid Ie [%ld]", removalRsp->protocolIEs.list.array[ieIdx]->id);
+ break;
+ }
+ }
+ }
+ }
+
+ freeAperDecodingOfE2RemovalResponse(removalRsp);
}
-/******************************************************************
-* @brief Deallocate the memory allocated for E2 Reset Response
-*
-* @details
-*
-* Function : FreeE2ResetResponse
-*
-* Functionality:
-* - freeing the memory allocated for E2ResetResponse
-*
-* @params[in] E2AP_PDU_t *e2apMsg
-* @return ROK - success
-* RFAILED - failure
-*
-* ****************************************************************/
-void FreeE2ResetResponse(E2AP_PDU_t *e2apMsg)
+/*******************************************************************
+ *
+ * @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;
- ResetResponseE2_t *resetResponse;
+ E2connectionUpdateFailure_t *e2ConnectionUpdateFailure=NULLP;
if(e2apMsg != NULLP)
{
- if(e2apMsg->choice.successfulOutcome != NULLP)
+ if(e2apMsg->choice.unsuccessfulOutcome != NULLP)
{
- resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;
- if(resetResponse->protocolIEs.list.array)
+ e2ConnectionUpdateFailure = &e2apMsg->choice.unsuccessfulOutcome->value.choice.E2connectionUpdateFailure;
+ if(e2ConnectionUpdateFailure->protocolIEs.list.array)
{
- for(ieIdx=0; ieIdx < resetResponse->protocolIEs.list.count; ieIdx++)
+ for(ieIdx=0; ieIdx < e2ConnectionUpdateFailure->protocolIEs.list.count; ieIdx++)
{
- if(resetResponse->protocolIEs.list.array[ieIdx])
- {
- DU_FREE(resetResponse->protocolIEs.list.array[ieIdx], sizeof(ResetResponseIEs_t));
- }
+ DU_FREE(e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateFailure_IEs_t));
}
- DU_FREE(resetResponse->protocolIEs.list.array, resetResponse->protocolIEs.list.size);
+ DU_FREE(e2ConnectionUpdateFailure->protocolIEs.list.array, e2ConnectionUpdateFailure->protocolIEs.list.size);
}
-
- DU_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ DU_FREE(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
}
DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
/*******************************************************************
*
- * @brief Buld and send the E2 Reset Response msg
+ * @brief Buld and send the E2 Connection Update Failure msg
*
* @details
*
- * Function : BuildAndSendE2ResetResponse
+ * Function : BuildAndSendE2ConnectionUpdateFailure
*
* Functionality:
- * - Buld and send the E2 Reset Response Message
- *
- * @params[in] Trans Id
+ * - Buld and send the E2 Connection Update Failure Message
+ * @params[in]
+ * Trans Id
+ * Failure Cause
* @return ROK - success
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendResetResponse(uint8_t transId)
+
+uint8_t BuildAndSendE2ConnectionUpdateFailure(uint16_t transId, E2FailureCause failureCause)
{
uint8_t ieIdx = 0, elementCnt = 0;
uint8_t ret = RFAILED;
E2AP_PDU_t *e2apMsg = NULLP;
- ResetResponseE2_t *resetResponse;
+ E2connectionUpdateFailure_t *e2ConnectionUpdateFailure=NULLP;
asn_enc_rval_t encRetVal; /* Encoder return value */
- DU_LOG("\nINFO --> E2AP : Building E2 Reset Response Message\n");
+ 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 : BuildAndSendResetResponse(): Memory allocation for E2AP-PDU failed");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
+ e2apMsg->present = E2AP_PDU_PR_unsuccessfulOutcome;
- DU_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
- if(e2apMsg->choice.successfulOutcome == NULLP)
+ DU_ALLOC(e2apMsg->choice.unsuccessfulOutcome, sizeof(UnsuccessfulOutcomeE2_t));
+ if(e2apMsg->choice.unsuccessfulOutcome == NULLP)
{
- DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse: Memory allocation failed for successfulOutcome");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- e2apMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_Reset;
- e2apMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
- e2apMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_ResetResponseE2;
- resetResponse = &e2apMsg->choice.successfulOutcome->value.choice.ResetResponseE2;
+ 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 = 1;
- resetResponse->protocolIEs.list.count = elementCnt;
- resetResponse->protocolIEs.list.size = elementCnt * sizeof(ResetResponseIEs_t *);
- DU_ALLOC(resetResponse->protocolIEs.list.array, resetResponse->protocolIEs.list.size);
- if(!resetResponse->protocolIEs.list.array)
+ 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 : BuildAndSendResetResponse: Memory allocation failed for protocol IE array");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
for(ieIdx=0; ieIdx < elementCnt; ieIdx++)
{
- DU_ALLOC(resetResponse->protocolIEs.list.array[ieIdx], sizeof(ResetResponseIEs_t));
- if(!resetResponse->protocolIEs.list.array[ieIdx])
+ DU_ALLOC(e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateFailure_IEs_t));
+ if(!e2ConnectionUpdateFailure->protocolIEs.list.array[ieIdx])
{
- DU_LOG("\nERROR --> E2AP : BuildAndSendResetResponse: Memory allocation failed for protocol IE array element");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
}
break;
ieIdx = 0;
- resetResponse->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
- resetResponse->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
- resetResponse->protocolIEs.list.array[ieIdx]->value.present = ResetResponseIEs__value_PR_TransactionID;
- resetResponse->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+ 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);
encRetVal = aper_encode(&asn_DEF_E2AP_PDU, 0, e2apMsg, PrepFinalEncBuf, encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nERROR --> E2AP : Could not encode E2 reset response structure (at %s)\n",\
+ 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 Reset Response \n");
+ 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 Reset Response");
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection Update Failure");
break;
}
break;
}while(true);
- FreeE2ResetResponse(e2apMsg);
+ FreeE2ConnectionUpdateFailure(e2apMsg);
return ret;
}
-/******************************************************************
+/*******************************************************************
*
- * @brief Deallocation of memory allocated by aper decoder for reset req
+ * @brief fill E2 connection update item
*
* @details
*
- * Function : freeAperDecodingOfE2ResetReq
- *
- * Functionality: Deallocation of memory allocated by aper decoder for
- * reset req
+ * Function : fillE2connectionUpdateItem
*
- * @params[in] Pointer to resetReq
- * @return void
+ * Functionality: fill E2 connection update item
*
+ * @params[in]
+ * E2connectionUpdate Item to be filled
+ * Protocol Id
+ * IP Address
+ * Usage
+ * @return ROK - success
+ * RFAILED - failure
* ****************************************************************/
-void freeAperDecodingOfE2ResetReq(ResetRequestE2_t *resetReq)
+
+uint8_t fillE2connectionUpdateItem(PTR connectionInfo, uint8_t protocolId, uint32_t ipAddress, AssocUsage usage)
{
- uint8_t arrIdx=0;
+ CauseE2_t *cause=NULLP;
+ TNLusage_t *tnlUsage=NULLP;
+ E2FailureCause failureCause;
+ TNLinformation_t *tnlInformation = NULLP;
+ E2connectionUpdate_Item_t *connectionModifyItem=NULLP;
+ E2connectionSetupFailed_Item_t *connectionRemoveITem=NULLP;
- if(resetReq)
+ switch(protocolId)
{
- if(resetReq->protocolIEs.list.array)
+ case ProtocolIE_IDE2_id_E2connectionUpdate_Item:
{
- for(arrIdx=0; arrIdx<resetReq->protocolIEs.list.count; arrIdx++)
+ connectionModifyItem = (E2connectionUpdate_Item_t*)connectionInfo;
+ tnlInformation = &connectionModifyItem->tnlInformation;
+ tnlUsage = &connectionModifyItem->tnlUsage;
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2connectionSetupFailed_Item:
+ {
+ connectionRemoveITem = (E2connectionSetupFailed_Item_t*)connectionInfo;
+ tnlInformation= &connectionRemoveITem->tnlInformation;
+ cause = &connectionRemoveITem->cause;
+ break;
+ }
+ default:
+ return RFAILED;
+ }
+
+ tnlInformation->tnlAddress.size = 4*sizeof(uint8_t);
+ DU_ALLOC(tnlInformation->tnlAddress.buf, tnlInformation->tnlAddress.size);
+ if(!tnlInformation->tnlAddress.buf)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+
+ tnlInformation->tnlAddress.buf[3] = ipAddress & 0xFF;
+ tnlInformation->tnlAddress.buf[2] = (ipAddress>> 8) & 0xFF;
+ tnlInformation->tnlAddress.buf[1] = (ipAddress>> 16) & 0xFF;
+ tnlInformation->tnlAddress.buf[0] = (ipAddress>> 24) & 0xFF;
+ tnlInformation->tnlAddress.bits_unused = 0;
+
+ switch(protocolId)
+ {
+ case ProtocolIE_IDE2_id_E2connectionUpdate_Item:
{
- if(resetReq->protocolIEs.list.array[arrIdx])
- {
- free(resetReq->protocolIEs.list.array[arrIdx]);
- }
+ *tnlUsage = usage;
+ break;
}
- free(resetReq->protocolIEs.list.array);
- }
+ case ProtocolIE_IDE2_id_E2connectionSetupFailed_Item:
+ {
+ failureCause.causeType = E2_TRANSPORT;
+ failureCause.cause = E2_TRANSPORT_CAUSE_UNSPECIFIED;
+ fillE2Cause(cause, failureCause);
+ break;
+ }
+ default:
+ return RFAILED;
}
+ return ROK;
}
+
/*******************************************************************
*
- * @brief Process reset req received from RIC
+ * @brief Build E2 connection modification list
*
* @details
*
- * Function : procE2ResetRequest
+ * Function :BuildE2ConnectionUpdateList
*
- * Functionality: Process reset req received from RIC
+ * Functionality: Build E2 connection modification list
*
- * @param E2AP_PDU_t *e2apMsg
- * @return void
+ * @params[in]
+ * E2 connection update list to be filled
+ * Count of E2 connection to be added in the list
+ * Received list of E2 connection
*
- ******************************************************************/
+ * @return ROK - success
+ * RFAILED - failure
+ * ****************************************************************/
-void procE2ResetRequest(E2AP_PDU_t *e2apMsg)
+uint8_t BuildE2ConnectionUpdateList(E2connectionUpdate_List_t *connectionSetupList, uint8_t count, E2ConnectionItem *tmpConnectionList)
{
- uint16_t ranFuncIdx=0;
- uint8_t arrIdx =0, transId =0;
- ResetRequestE2_t *resetReq;
+ uint8_t arrIdx = 0;
+ E2connectionUpdate_ItemIEs_t *connectionSetupItem=NULLP;
- DU_LOG("\nINFO --> E2AP : E2 Reset request received");
- resetReq = &e2apMsg->choice.initiatingMessage->value.choice.ResetRequestE2;
+ connectionSetupList->list.count = count;
- for(arrIdx=0; arrIdx<resetReq->protocolIEs.list.count; arrIdx++)
+ connectionSetupList->list.size = connectionSetupList->list.count*sizeof(E2connectionUpdate_ItemIEs_t*);
+ DU_ALLOC(connectionSetupList->list.array, connectionSetupList->list.size);
+ if(connectionSetupList->list.array)
{
- switch(resetReq->protocolIEs.list.array[arrIdx]->id)
+ for(arrIdx = 0; arrIdx< connectionSetupList->list.count; arrIdx++)
{
- case ProtocolIE_IDE2_id_TransactionID:
- {
- transId = resetReq->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
- break;
- }
+ DU_ALLOC(connectionSetupList->list.array[arrIdx], sizeof(E2connectionUpdate_ItemIEs_t));
+ if(connectionSetupList->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+ connectionSetupItem = (E2connectionUpdate_ItemIEs_t*)connectionSetupList->list.array[arrIdx];
+ connectionSetupItem->id = ProtocolIE_IDE2_id_E2connectionUpdate_Item;
+ connectionSetupItem->criticality= CriticalityE2_ignore;
+ connectionSetupItem->value.present = E2connectionUpdate_ItemIEs__value_PR_E2connectionUpdate_Item;
+ if(fillE2connectionUpdateItem((PTR)&connectionSetupItem->value.choice.E2connectionUpdate_Item, ProtocolIE_IDE2_id_E2connectionUpdate_Item,\
+ tmpConnectionList[arrIdx].ipV4Addr, tmpConnectionList[arrIdx].usage) != 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 Build E2 connection setup failed list
+ *
+ * @details
+ *
+ * Function : BuildE2ConnectionSetupFailedList
+ *
+ * Functionality: Build E2 connection setup failed list
+ *
+ * @params[in]
+ * E2 connection setup failed list to be filled
+ * Count of E2 connection to be added in the list
+ * Received list of E2 connection
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ * ****************************************************************/
+
+uint8_t BuildE2ConnectionSetupFailedList(E2connectionSetupFailed_List_t *setupFailedList, uint8_t count, E2ConnectionItem *tmpConnectionList)
+{
+ uint8_t arrIdx = 0;
+ E2connectionSetupFailed_ItemIEs_t *setupFailedItem=NULLP;
+
+ setupFailedList->list.count = 1;
+
+ setupFailedList->list.size = setupFailedList->list.count*sizeof(E2connectionSetupFailed_ItemIEs_t *);
+ DU_ALLOC(setupFailedList->list.array, setupFailedList->list.size);
+ if(setupFailedList->list.array)
+ {
+ for(arrIdx = 0; arrIdx< setupFailedList->list.count; arrIdx++)
+ {
+ DU_ALLOC(setupFailedList->list.array[arrIdx], sizeof(E2connectionSetupFailed_ItemIEs_t));
+ if(setupFailedList->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
+ }
+ setupFailedItem = (E2connectionSetupFailed_ItemIEs_t*)setupFailedList->list.array[arrIdx];
+ setupFailedItem->id = ProtocolIE_IDE2_id_E2connectionSetupFailed_Item;
+ setupFailedItem->criticality= CriticalityE2_ignore;
+ setupFailedItem->value.present = E2connectionSetupFailed_ItemIEs__value_PR_E2connectionSetupFailed_Item;
+ if(fillE2connectionUpdateItem((PTR)&setupFailedItem->value.choice.E2connectionSetupFailed_Item, ProtocolIE_IDE2_id_E2connectionSetupFailed_Item,\
+ tmpConnectionList[arrIdx].ipV4Addr, tmpConnectionList[arrIdx].usage) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to fill E2 connection failed to update item");
+ return RFAILED;
+ }
- case ProtocolIE_IDE2_id_CauseE2:
- {
- for(ranFuncIdx=0; ranFuncIdx<MAX_RAN_FUNCTION; ranFuncIdx++)
- {
- if(duCb.e2apDb.ranFunction[ranFuncIdx].id >0)
- {
- deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList));
- memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo));
- }
- }
- break;
- }
}
}
- if(BuildAndSendResetResponse(transId) != ROK)
+ else
{
- DU_LOG("\nERROR --> E2AP : Failed to build and send reset response");
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
+ return RFAILED;
}
- freeAperDecodingOfE2ResetReq(resetReq);
+ return ROK;
}
/*******************************************************************
*
- * @brief Free APER decoding of RIC Subscription Modification Refuse
+ * @brief Deallocate the memory allocated for E2 Connection
+ * Update ack msg
*
* @details
*
- * Function : freeAperDecodingOfRicSubsModRefuse
+ * Function :FreeE2ConnectionUpdateAcknowledge
*
- * Functionality: Free APER decoding of RIC Subscription
- * Modification Refuse
+ * Functionality:
+ * - freeing the memory allocated for E2 Connection
+ * Update ack msg
*
- * @param E2AP Message PDU
- * @return void
+ * @params[in] E2AP_PDU_t *e2apMsg
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void freeAperDecodingOfRicSubsModRefuse(E2AP_PDU_t *e2apMsg)
+ * ****************************************************************/
+
+void FreeE2ConnectionUpdateAcknowledge(E2AP_PDU_t *e2apMsg)
{
- uint8_t ieIdx =0;
- RICsubscriptionModificationRefuse_t *ricSubsModRefuse = NULLP;
+ uint8_t ieIdx =0, arrIdx=0;
+ E2connectionUpdateAcknowledge_t *connectionUpdate = NULLP;
+ E2connectionUpdate_List_t *connectionSetupList = NULLP;
+ E2connectionSetupFailed_List_t *setupFailedList = NULLP;
- if(e2apMsg && e2apMsg->choice.unsuccessfulOutcome)
+ if(e2apMsg != NULLP)
{
- ricSubsModRefuse = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionModificationRefuse;
- if(ricSubsModRefuse->protocolIEs.list.array)
+ if(e2apMsg->choice.successfulOutcome != NULLP)
{
- for(ieIdx = 0; ieIdx < ricSubsModRefuse->protocolIEs.list.count; ieIdx++)
+ connectionUpdate = &e2apMsg->choice.successfulOutcome->value.choice.E2connectionUpdateAcknowledge;
+ if(connectionUpdate->protocolIEs.list.array)
{
- if(ricSubsModRefuse->protocolIEs.list.array[ieIdx])
- free(ricSubsModRefuse->protocolIEs.list.array[ieIdx]);
+ 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_E2connectionSetup:
+ {
+ connectionSetupList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List;
+ if(connectionSetupList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < connectionSetupList->list.count; arrIdx++)
+ {
+ DU_FREE(connectionSetupList->list.array[arrIdx], sizeof(E2connectionUpdate_ItemIEs_t));
+ }
+ DU_FREE(connectionSetupList->list.array, connectionSetupList->list.size);
+ }
+ break;
+ }
+
+ case ProtocolIE_IDE2_id_E2connectionSetupFailed:
+ {
+ setupFailedList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionSetupFailed_List;
+ if(setupFailedList->list.array)
+ {
+ for(arrIdx = 0; arrIdx < setupFailedList->list.count; arrIdx++)
+ {
+ DU_FREE(setupFailedList->list.array[arrIdx], sizeof(E2connectionSetupFailed_ItemIEs_t));
+ }
+ DU_FREE(setupFailedList->list.array, setupFailedList->list.size);
+ }
+ break;
+ }
+ }
+ DU_FREE(connectionUpdate->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateAck_IEs_t));
+ }
+ }
+ DU_FREE(connectionUpdate->protocolIEs.list.array, connectionUpdate->protocolIEs.list.size);
}
- free(ricSubsModRefuse->protocolIEs.list.array);
+ DU_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
}
+ DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));
}
}
/*******************************************************************
*
- * @brief Process RIC Subscription Modification Refuse Message
+ * @brief Buld and send the E2 Connection Update Acknowledge msg
*
* @details
*
- * Function : procRicSubscriptionModificationRefuse
- *
- * Functionality: Process RIC Subscription Modification Refuse
- * Message received from RIC.
+ * Function : BuildAndSendE2ConnectionUpdateAcknowledge
*
- * @param E2AP Message PDU
- * @return void
+ * Functionality:
+ * - Buld and send the E2 Connection Update Acknowledge Message
+ * @params[in]
+ * Trans Id
+ * List of E2 connection needs to fill in IE
+ * @return ROK - success
+ * RFAILED - failure
*
- ******************************************************************/
-void procRicSubscriptionModificationRefuse(E2AP_PDU_t *e2apMsg)
-{
- uint8_t ieIdx = 0;
- uint16_t ranFuncId = 0;
- RicRequestId ricReqId;
- RICsubscriptionModificationRefuse_t *ricSubsModRefuse = NULLP;
- RICsubscriptionModificationRefuse_IEs_t *ricSubsModRefuseIe = NULLP;
- CauseE2_t *cause = NULLP;
+ * ****************************************************************/
- DU_LOG("\nINFO --> E2AP : %s: Received RIC Subscription Modification Refuse", __func__);
+uint8_t BuildAndSendE2ConnectionUpdateAcknowledge(uint16_t transId, E2ConnectionList connectionInfoList)
+{
+ uint8_t ieIdx = 0, elementCnt = 0;
+ uint8_t ret = RFAILED;
+ E2AP_PDU_t *e2apMsg = NULLP;
+ asn_enc_rval_t encRetVal;
+ E2connectionUpdateAcknowledge_t *e2ConnectionUpdateAcknowledge=NULLP;
- do{
- if(!e2apMsg)
+ DU_LOG("\nINFO --> E2AP : Building E2 Connection Update Acknowledge Message\n");
+ do
+ {
+ DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
+ if(e2apMsg == NULLP)
{
- DU_LOG("\nERROR --> E2AP : %s: E2AP Message is NULL", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
+ e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
- if(!e2apMsg->choice.unsuccessfulOutcome)
+ DU_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
+ if(e2apMsg->choice.successfulOutcome == NULLP)
{
- DU_LOG("\nERROR --> E2AP : %s: Unsuccessful Outcome in E2AP message is NULL", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- ricSubsModRefuse = &e2apMsg->choice.unsuccessfulOutcome->value.choice.RICsubscriptionModificationRefuse;
- if(!ricSubsModRefuse->protocolIEs.list.array)
+ e2apMsg->choice.successfulOutcome->procedureCode = ProcedureCodeE2_id_E2connectionUpdate;
+ e2apMsg->choice.successfulOutcome->criticality = CriticalityE2_reject;
+ e2apMsg->choice.successfulOutcome->value.present = SuccessfulOutcomeE2__value_PR_E2connectionUpdateAcknowledge;
+ e2ConnectionUpdateAcknowledge = &e2apMsg->choice.successfulOutcome->value.choice.E2connectionUpdateAcknowledge;
+
+ elementCnt = 1;
+ if(connectionInfoList.numOfE2ConnectionSetup)
+ elementCnt++;
+ if(connectionInfoList.numOfE2ConnectionFailedToSetup)
+ elementCnt++;
+
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.count = elementCnt;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.size = elementCnt * sizeof(E2connectionUpdateAck_IEs_t*);
+ DU_ALLOC(e2ConnectionUpdateAcknowledge->protocolIEs.list.array, e2ConnectionUpdateAcknowledge->protocolIEs.list.size);
+ if(!e2ConnectionUpdateAcknowledge->protocolIEs.list.array)
{
- DU_LOG("\nERROR --> E2AP : %s: Array conatining E2AP message IEs is null", __func__);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
- for(ieIdx = 0; ieIdx < ricSubsModRefuse->protocolIEs.list.count; ieIdx++)
+ for(ieIdx=0; ieIdx < elementCnt; ieIdx++)
{
- if(!ricSubsModRefuse->protocolIEs.list.array[ieIdx])
+ DU_ALLOC(e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx], sizeof(E2connectionUpdateAck_IEs_t));
+ if(!e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx])
{
- DU_LOG("\nERROR --> E2AP : %s: IE at index [%d] in E2AP message IEs list is null", __func__, ieIdx);
+ DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at line %d", __func__, __LINE__);
break;
}
+ }
+ if(ieIdx < elementCnt)
+ break;
- ricSubsModRefuseIe = ricSubsModRefuse->protocolIEs.list.array[ieIdx];
- switch(ricSubsModRefuseIe->id)
+ ieIdx = 0;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_TransactionID;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdateAck_IEs__value_PR_TransactionID;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.choice.TransactionID = transId;
+
+ if(connectionInfoList.numOfE2ConnectionSetup)
+ {
+ ieIdx++;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_E2connectionSetup;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdateAck_IEs__value_PR_E2connectionUpdate_List;
+ if(BuildE2ConnectionUpdateList(&e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List, \
+ connectionInfoList.numOfE2ConnectionSetup, connectionInfoList.setupE2Connection) != ROK)
{
- case ProtocolIE_IDE2_id_RICrequestID:
- {
- memset(&ricReqId, 0, sizeof(RicRequestId));
- ricReqId.requestorId = ricSubsModRefuseIe->value.choice.RICrequestID.ricRequestorID;
- ricReqId.instanceId = ricSubsModRefuseIe->value.choice.RICrequestID.ricInstanceID;
- break;
- }
-
- case ProtocolIE_IDE2_id_RANfunctionID:
- {
- ranFuncId = ricSubsModRefuseIe->value.choice.RANfunctionID;
- break;
- }
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection setup list");
+ break;
+ }
+ }
+
+ if(connectionInfoList.numOfE2ConnectionFailedToSetup)
+ {
+ ieIdx++;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->id = ProtocolIE_IDE2_id_E2connectionSetupFailed;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->criticality = CriticalityE2_reject;
+ e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.present = E2connectionUpdateAck_IEs__value_PR_E2connectionSetupFailed_List;
+ if(BuildE2ConnectionSetupFailedList(&e2ConnectionUpdateAcknowledge->protocolIEs.list.array[ieIdx]->value.choice.E2connectionSetupFailed_List, \
+ connectionInfoList.numOfE2ConnectionFailedToSetup, connectionInfoList.failedToSetupE2Connection) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection failed to setup list");
+ break;
+ }
+ }
- case ProtocolIE_IDE2_id_CauseE2:
- {
- DU_LOG("\nDEBUG --> E2AP : %s: RIC subscriptiom modification refused for RIC_Requestor_ID [%d] \
- RIC_Instance_ID [%d] RAN_Function_ID [%d] ", __func__, ricReqId.requestorId, \
- ricReqId.instanceId, ranFuncId);
+ xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
- cause = &ricSubsModRefuseIe->value.choice.CauseE2;
- printE2ErrorCause(cause);
- }
+ 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 acknowledge 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 Acknowledge \n");
+ for(int i=0; i< encBufSize; i++)
+ {
+ DU_LOG("%x",encBuf[i]);
+ }
+ }
- default:
- break;
- } /* End of switch for Protocol IE Id */
- } /* End of for loop for Protocol IE list */
+ /* Sending msg */
+ if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ {
+ DU_LOG("\nERROR --> E2AP : Failed to send E2 Connection Update Acknowledge");
+ break;
+ }
+ ret = ROK;
break;
}while(true);
- freeAperDecodingOfRicSubsModRefuse(e2apMsg);
- return;
+ FreeE2ConnectionUpdateAcknowledge(e2apMsg);
+ return ret;
}
-/*******************************************************************
+/******************************************************************
*
- * @brief Free RIC Subscription Delete Required Message
+ * @brief Deallocation of memory allocated by aper decoder for
+ * E2 Connection Update
*
* @details
*
- * Function : FreeRicSubscriptionDeleteRequired
+ * Function :freeAperDecodingOfE2ConnectionUpdate
*
- * Functionality: Free RIC Subscription Delete Required
+ * Functionality: Deallocation of memory allocated by aper decoder for
+ * E2 Connection Update
*
- * @param E2AP Message PDU
+ * @params[in] Pointer to connectionUpdate
* @return void
*
- ******************************************************************/
-void FreeRicSubscriptionDeleteRequired(E2AP_PDU_t *e2apMsg, CmLListCp *ricSubsToBeDelList)
+ * ****************************************************************/
+
+void freeAperDecodingOfE2ConnectionUpdate(E2connectionUpdate_t *connectionUpdate)
{
- uint8_t ieIdx = 0, arrIdx = 0;
- RICsubscriptionDeleteRequired_t *ricSubsDelRqd = NULLP;
- RICsubscriptionDeleteRequired_IEs_t *ricSubsDelRqdIe = NULLP;
- RICsubscription_List_withCause_t *ricSubsList = NULLP;
- CmLList *subsNode = NULLP;
+ uint8_t ieIdx =0, arrIdx=0;
+ E2connectionUpdate_List_t *connectionToBeModifyList = NULLP;
+ E2connectionUpdateRemove_List_t *connectionToBeRemoveList = NULLP;
- if(e2apMsg)
+ if(connectionUpdate->protocolIEs.list.array)
{
- if(e2apMsg->choice.initiatingMessage)
+ for(ieIdx = 0; ieIdx < connectionUpdate->protocolIEs.list.count; ieIdx++)
{
- ricSubsDelRqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequired;
- if(ricSubsDelRqd->protocolIEs.list.array)
+ if(connectionUpdate->protocolIEs.list.array[ieIdx])
{
- for(ieIdx = 0; ieIdx < ricSubsDelRqd->protocolIEs.list.count; ieIdx++)
+ switch(connectionUpdate->protocolIEs.list.array[ieIdx]->id)
{
- if(ricSubsDelRqd->protocolIEs.list.array[ieIdx])
- {
- ricSubsDelRqdIe = ricSubsDelRqd->protocolIEs.list.array[ieIdx];
- switch(ricSubsDelRqdIe->id)
+ case ProtocolIE_IDE2_id_TransactionID:
+ break;
+
+ case ProtocolIE_IDE2_id_E2connectionUpdateModify:
{
- case ProtocolIE_IDE2_id_RICsubscriptionToBeRemoved:
+ connectionToBeModifyList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdate_List;
+ if(connectionToBeModifyList->list.array)
+ {
+ for(arrIdx= 0; arrIdx< connectionToBeModifyList->list.count; arrIdx++)
{
- ricSubsList = &ricSubsDelRqdIe->value.choice.RICsubscription_List_withCause;
- if(ricSubsList->list.array)
- {
- for(arrIdx = 0; arrIdx < ricSubsList->list.count; arrIdx++)
- {
- DU_FREE(ricSubsList->list.array[ieIdx], sizeof(RICsubscription_withCause_ItemIEs_t));
- }
- DU_FREE(ricSubsList->list.array, ricSubsList->list.size);
- }
- break;
+ free(connectionToBeModifyList->list.array[arrIdx]);
}
- }
- DU_FREE(ricSubsDelRqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionDeleteRequired_IEs_t));
- }
- }
- DU_FREE(ricSubsDelRqd->protocolIEs.list.array, ricSubsDelRqd->protocolIEs.list.size);
- }
- DU_FREE(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- }
- DU_FREE(e2apMsg, sizeof(E2AP_PDU_t));;
- }
-
- if(ricSubsToBeDelList)
- {
- CM_LLIST_FIRST_NODE(ricSubsToBeDelList, subsNode);
- while(subsNode)
- {
- cmLListDelFrm(ricSubsToBeDelList, subsNode);
- DU_FREE(subsNode, sizeof(CmLList));
- CM_LLIST_FIRST_NODE(ricSubsToBeDelList, subsNode);
+ free(connectionToBeModifyList->list.array);
+ }
+ break;
+ }
+ case ProtocolIE_IDE2_id_E2connectionUpdateRemove:
+ {
+ connectionToBeRemoveList = &connectionUpdate->protocolIEs.list.array[ieIdx]->value.choice.E2connectionUpdateRemove_List;
+ if(connectionToBeRemoveList->list.array)
+ {
+ for(arrIdx= 0; arrIdx< connectionToBeRemoveList->list.count; arrIdx++)
+ {
+ free(connectionToBeRemoveList->list.array[arrIdx]);
+ }
+ free(connectionToBeRemoveList->list.array);
+ }
+ break;
+ }
+ }
+ free(connectionUpdate->protocolIEs.list.array[ieIdx]);
+ }
}
+ free(connectionUpdate->protocolIEs.list.array);
}
}
/*******************************************************************
*
- * @brief Fill list of RIC subscriptions required to be deleted
- * with the cause of deletion
+ * @brief Handling of E2 connection modification Ie
*
* @details
*
- * Function : fillRicSubsListWithCause
+ * Function : handleE2ConnectionModification
*
- * Functionality: Fill list of RIC subscriptions required to be
- * deleted with the cause of deletion
+ * Functionality: Handling of E2 connection modification Ie
*
- * @param E2AP Message PDU
+ * @param
+ * E2 Connection update list
+ * E2 connection list which needs to be filled
* @return void
*
******************************************************************/
-uint8_t fillRicSubsListWithCause(RICsubscription_List_withCause_t *ricSubsList, CmLListCp ricSubsToBeDelList)
-{
- uint16_t ieIdx = 0;
- CmLList *subsNode = NULLP;
- RicSubscription *subsInfo = NULLP;
- RICsubscription_withCause_ItemIEs_t *subsItemIe = NULLP;
- RICsubscription_withCause_Item_t *subsItem = NULLP;
- ricSubsList->list.count = ricSubsToBeDelList.count;
- ricSubsList->list.size = ricSubsList->list.count * sizeof(RICsubscription_withCause_ItemIEs_t *);
- DU_ALLOC(ricSubsList->list.array, ricSubsList->list.size);
- if(!ricSubsList->list.array)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
- return RFAILED;
- }
+void handleE2ConnectionModification(E2connectionUpdate_List_t *connectionUpdateList, E2ConnectionList *connectionInfoList)
+{
+ uint32_t ipAddress=0;
+ bool infoFound = false;
+ uint8_t arrIdx=0,idx=0, count =0;
+ E2connectionUpdate_ItemIEs_t *connectionModifyItem=NULLP;
- CM_LLIST_FIRST_NODE(&ricSubsToBeDelList, subsNode);
- while(subsNode && (ieIdx < ricSubsList->list.count))
+ if(connectionUpdateList->list.array)
{
- subsInfo = (RicSubscription *)subsNode->node;
- DU_ALLOC(ricSubsList->list.array[ieIdx], sizeof(RICsubscription_withCause_ItemIEs_t));
- if(!ricSubsList->list.array[ieIdx])
+ for(arrIdx = 0; arrIdx < connectionUpdateList->list.count; arrIdx++)
{
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
- return RFAILED;
+ connectionModifyItem= (E2connectionUpdate_ItemIEs_t*)connectionUpdateList->list.array[arrIdx];
+ bitStringToInt(&connectionModifyItem->value.choice.E2connectionUpdate_Item.tnlInformation.tnlAddress, &ipAddress);
+ for(idx=0; idx<duCb.e2apDb.numOfTNLAssoc; idx++)
+ {
+ /* If the TNL information is found in the data base, update the
+ * information in the database */
+ if(duCb.e2apDb.tnlAssoc[idx].destIpAddress.ipV4Addr == ipAddress)
+ {
+ duCb.e2apDb.tnlAssoc[idx].usage = connectionModifyItem->value.choice.E2connectionUpdate_Item.tnlUsage;
+ infoFound = true;
+ break;
+ }
+ }
+
+ /* If the TNL information is found in the data base, then add the
+ * information in setupE2Connection array else add in failedToSetupE2Connection array */
+ if(infoFound == true)
+ {
+ count =connectionInfoList->numOfE2ConnectionSetup;
+ connectionInfoList->setupE2Connection[count].ipV4Addr = duCb.e2apDb.tnlAssoc[idx].destIpAddress.ipV4Addr;
+ connectionInfoList->setupE2Connection[count].usage = duCb.e2apDb.tnlAssoc[idx].usage;
+ connectionInfoList->numOfE2ConnectionSetup++;
+ }
+ else
+ {
+ count = connectionInfoList->numOfE2ConnectionFailedToSetup;
+ connectionInfoList->failedToSetupE2Connection[count].ipV4Addr = ipAddress;
+ connectionInfoList->failedToSetupE2Connection[count].usage = connectionModifyItem->value.choice.E2connectionUpdate_Item.tnlUsage;
+ connectionInfoList->numOfE2ConnectionFailedToSetup++;
+ }
}
- subsItemIe = (RICsubscription_withCause_ItemIEs_t *)ricSubsList->list.array[ieIdx];
- subsItemIe->id = ProtocolIE_IDE2_id_RICsubscription_withCause_Item;
- subsItemIe->criticality = CriticalityE2_ignore;
- subsItemIe->value.present = RICsubscription_withCause_ItemIEs__value_PR_RICsubscription_withCause_Item;
-
- subsItem = & subsItemIe->value.choice.RICsubscription_withCause_Item;
- subsItem->ricRequestID.ricRequestorID = subsInfo->requestId.requestorId;
- subsItem->ricRequestID.ricInstanceID = subsInfo->requestId.instanceId;
- subsItem->ranFunctionID = subsInfo->ranFuncId;
- fillE2Cause(&subsItem->cause, subsInfo->failureCause);
-
- ieIdx++;
- subsNode = subsNode->next;
}
-
- return ROK;
}
/*******************************************************************
*
- * @brief Builds and Send RIC Subscription delete required
+ * @brief Handling of E2 connection removal Ie
*
* @details
*
- * Function : BuildAndSendRicSubscriptionDeleteRequired
+ * Function : handleE2ConnectionRemoval
*
- * Functionality: Build and send RIC subscription delete required.
- * There can be 2 approaches to trigger following. One of these
- * approaches may/may not be implemented in future:
- * 1. It can be triggerred immediately when a RIC subscription's
- * End Time has expired. In this case, only this subscription's
- * info will be sent in this message.
- * Since we have not yet added support to execute RIC
- * Subscription based on Start Time and End Timer, this message is
- * not triggered anywhere from DU APP yet.
- * 2. Another approach is to have a periodic timer to check subscription
- * status running in background.
- * When RIC Subscription End Time expires, this subscription is
- * marked to be deleted. Later when this background timer expires,
- * a RIC Subscription delete required is sent with all the
- * subscription's info which is marked to be deleted.
- * The following function is implemented keeping in mind the second
- * approach.
+ * Functionality: Handling of E2 connection removal Ie
*
- * @params[in]
- * @return ROK - success
- * RFAILED - failure
+ * @param
+ * E2 Connection removal List
+ * @return void
*
******************************************************************/
-uint8_t BuildAndSendRicSubscriptionDeleteRequired()
+
+void handleE2ConnectionRemoval(E2connectionUpdateRemove_List_t *connectionRemovalList)
{
- uint8_t elementCnt = 0, ieIdx = 0, ret = RFAILED;
- E2AP_PDU_t *e2apMsg = NULLP;
- RICsubscriptionDeleteRequired_t *ricSubsDelRqd = NULLP;
- RICsubscriptionDeleteRequired_IEs_t *ricSubsDelRqdIe = NULLP;
- asn_enc_rval_t encRetVal; /* Encoder return value */
- CmLListCp ricSubsToBeDelList;
+ uint32_t ipAddress=0;
+ uint8_t arrIdx=0,idx=0;
+ E2connectionUpdateRemove_ItemIEs_t *connectionRemovalItem=NULLP;
- while(true)
+ if(connectionRemovalList->list.array)
{
- /* Check if there are any RIC subscriptions to be deleted */
- cmLListInit(&ricSubsToBeDelList);
- fetchRicSubsToBeDeleted(&ricSubsToBeDelList);
- if(ricSubsToBeDelList.count == 0)
+ for(arrIdx = 0; arrIdx < connectionRemovalList->list.count; arrIdx++)
{
- DU_LOG("\nDEBUG --> E2AP : %s: No RIC subscriptions are required to be deleted", __func__);
- return ROK;
+ connectionRemovalItem= (E2connectionUpdateRemove_ItemIEs_t*)connectionRemovalList->list.array[arrIdx];
+ bitStringToInt(&connectionRemovalItem->value.choice.E2connectionUpdateRemove_Item.tnlInformation.tnlAddress, &ipAddress);
+ for(idx=0; idx<duCb.e2apDb.numOfTNLAssoc; idx++)
+ {
+ if(duCb.e2apDb.tnlAssoc[idx].destIpAddress.ipV4Addr == ipAddress)
+ {
+ cmInetClose(&ricParams.sockFd);
+ removeE2NodeInformation();
+ break;
+ }
+ }
+
}
+ }
+}
- DU_LOG("\nINFO --> E2AP : Building RIC Subscription Delete Required Message\n");
+/*******************************************************************
+ *
+ * @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
+ *
+ ******************************************************************/
- DU_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
- if(e2apMsg == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
- break;
- }
+void procE2ConnectionUpdate(E2AP_PDU_t *e2apMsg)
+{
+ uint8_t arrIdx =0, transId =0;
+ bool invalidTransId = false, connectionFailedToUpdate=false;
+ E2FailureCause failureCause;
+ E2ConnectionList connectionInfoList;
+ E2connectionUpdate_t *connectionUpdate=NULLP;
- e2apMsg->present = E2AP_PDU_PR_initiatingMessage;
- DU_ALLOC(e2apMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
- if(e2apMsg->choice.initiatingMessage == NULLP)
+ DU_LOG("\nINFO --> E2AP : E2 connection update received");
+ connectionUpdate = &e2apMsg->choice.initiatingMessage->value.choice.E2connectionUpdate;
+
+ memset(&connectionInfoList, 0, sizeof(E2ConnectionList));
+ for(arrIdx=0; arrIdx<connectionUpdate->protocolIEs.list.count; arrIdx++)
+ {
+ switch(connectionUpdate->protocolIEs.list.array[arrIdx]->id)
{
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation for E2AP-PDU failed at line %d",__func__, __LINE__);
- break;
- }
- e2apMsg->choice.initiatingMessage->procedureCode = ProcedureCodeE2_id_RICsubscriptionDeleteRequired;
- e2apMsg->choice.initiatingMessage->criticality = CriticalityE2_reject;
- e2apMsg->choice.initiatingMessage->value.present = InitiatingMessageE2__value_PR_RICsubscriptionDeleteRequired;
+ case ProtocolIE_IDE2_id_TransactionID:
+ {
+ transId = connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.TransactionID;
+ if(transId>255)
+ {
+ failureCause.causeType = E2_PROTOCOL;
+ failureCause.cause = E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE;
+ invalidTransId = true;
+ }
+ break;
+ }
- ricSubsDelRqd = &e2apMsg->choice.initiatingMessage->value.choice.RICsubscriptionDeleteRequired;
-
- elementCnt = 1;
- ricSubsDelRqd->protocolIEs.list.count = elementCnt;
- ricSubsDelRqd->protocolIEs.list.size = elementCnt * sizeof(RICsubscriptionDeleteRequired_IEs_t *);
+ case ProtocolIE_IDE2_id_E2connectionUpdateModify:
+ {
+ handleE2ConnectionModification(&connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2connectionUpdate_List,\
+ &connectionInfoList);
+ if((connectionInfoList.numOfE2ConnectionSetup == 0) && (connectionInfoList.numOfE2ConnectionFailedToSetup > 0))
+ {
+ failureCause.causeType = E2_TRANSPORT;
+ failureCause.cause = E2_TRANSPORT_CAUSE_UNSPECIFIED;
+ connectionFailedToUpdate =true;
+ }
- DU_ALLOC(ricSubsDelRqd->protocolIEs.list.array, ricSubsDelRqd->protocolIEs.list.size);
- if(ricSubsDelRqd->protocolIEs.list.array == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed for array elements at line %d",__func__, __LINE__);
- break;
- }
-
- for(ieIdx = 0; ieIdx < elementCnt; ieIdx++)
- {
- DU_ALLOC(ricSubsDelRqd->protocolIEs.list.array[ieIdx], sizeof(RICsubscriptionDeleteRequired_IEs_t));
- if(ricSubsDelRqd->protocolIEs.list.array[ieIdx] == NULLP)
- {
- DU_LOG("\nERROR --> E2AP : %s: Memory allocation failed for index [%d] at line %d", \
- __func__, ieIdx, __LINE__);
- break;
- }
- }
- if(ieIdx < elementCnt)
- break;
+ break;
+ }
- ieIdx = 0;
- ricSubsDelRqdIe = ricSubsDelRqd->protocolIEs.list.array[ieIdx];
- ricSubsDelRqdIe->id = ProtocolIE_IDE2_id_RICsubscriptionToBeRemoved;
- ricSubsDelRqdIe->criticality = CriticalityE2_ignore;
- ricSubsDelRqdIe->value.present = RICsubscriptionDeleteRequired_IEs__value_PR_RICsubscription_List_withCause;
- if(fillRicSubsListWithCause(&ricSubsDelRqdIe->value.choice.RICsubscription_List_withCause, ricSubsToBeDelList)\
- != ROK)
- {
- DU_LOG("\nERROR --> E2AP : %s: Failed to fill RIC Subscription list with cause", __func__);
- break;
+ case ProtocolIE_IDE2_id_E2connectionUpdateRemove:
+ {
+ handleE2ConnectionRemoval(&connectionUpdate->protocolIEs.list.array[arrIdx]->value.choice.E2connectionUpdateRemove_List);
+ break;
+ }
+
+ default:
+ {
+ DU_LOG("\nERROR --> E2AP : Invalid IE received[%ld]",connectionUpdate->protocolIEs.list.array[arrIdx]->id);
+ break;
+ }
}
- /* Prints the Msg formed */
- 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 RIC Subscription Delete Required Message (at %s)\n",\
- encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+ if(invalidTransId == true || connectionFailedToUpdate ==true)
break;
- }
- else
+ }
+
+ if(invalidTransId == true || connectionFailedToUpdate == true)
+ {
+ if(BuildAndSendE2ConnectionUpdateFailure(transId, failureCause) != ROK)
{
- DU_LOG("\nDEBUG --> E2AP : Created APER encoded buffer for RIC Subscription Delete Required Message \n");
-#ifdef DEBUG_ASN_PRINT
- for(int i=0; i< encBufSize; i++)
- {
- printf("%x",encBuf[i]);
- }
-#endif
+ DU_LOG("\nERROR --> E2AP : Failed to build and send E2 connection update failure");
}
-
- if(SendE2APMsg(DU_APP_MEM_REGION, DU_POOL, encBuf, encBufSize) != ROK)
+ }
+ else
+ {
+ if(BuildAndSendE2ConnectionUpdateAcknowledge(transId, connectionInfoList) != ROK)
{
- DU_LOG("\nERROR --> E2AP : Failed to send RIC Susbcription Delete Required Message");
-
+ DU_LOG("\nERROR --> E2AP : Failed to build and send E2 connection update ack");
}
- ret = ROK;
- break;
}
- FreeRicSubscriptionDeleteRequired(e2apMsg, &ricSubsToBeDelList);
- return ret;
+ freeAperDecodingOfE2ConnectionUpdate(connectionUpdate);
}
/*******************************************************************
procRicSubscriptionModificationRefuse(e2apMsg);
break;
}
+ case UnsuccessfulOutcomeE2__value_PR_E2RemovalFailure:
+ {
+ ProcE2RemovalFailure(e2apMsg);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_unsuccessfulOutcome [%d]",\
}
break;
}
- case SuccessfulOutcomeE2__value_PR_E2nodeConfigurationUpdateAcknowledge:
- {
- DU_LOG("\nDEBUG --> E2AP : E2 node Config update ack message recevied");
- break;
- }
case SuccessfulOutcomeE2__value_PR_ResetResponseE2:
{
procResetResponse(e2apMsg);
procRicSubscriptionModificationConfirm(e2apMsg);
break;
}
-
+ case SuccessfulOutcomeE2__value_PR_E2nodeConfigurationUpdateAcknowledge:
+ {
+ procE2NodeConfigUpdateAck(e2apMsg);
+ break;
+ }
+ case SuccessfulOutcomeE2__value_PR_E2RemovalResponse:
+ {
+ ProcE2RemovalResponse(e2apMsg);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_successfulOutcome [%d]",\
}
case InitiatingMessageE2__value_PR_ResetRequestE2:
{
- DU_LOG("\nINFO --> E2AP : Error indication received");
+ DU_LOG("\nINFO --> E2AP : Reset request received");
procE2ResetRequest(e2apMsg);
break;
}
+ case InitiatingMessageE2__value_PR_RICsubscriptionDeleteRequest:
+ {
+ DU_LOG("\nINFO --> E2AP : RIC Subscription Delete Request received");
+ procRicSubscriptionDeleteRequest(e2apMsg);
+ break;
+ }
+ case InitiatingMessageE2__value_PR_E2RemovalRequest:
+ {
+ DU_LOG("\nINFO --> E2AP : E2 Removal request received");
+ 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]",\