From: pborla Date: Wed, 18 Oct 2023 08:02:48 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-527] Modifying DU's E2 node configurations X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=203a75d30fe226a5496af4a0bc50ea0671e32df3;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-527] Modifying DU's E2 node configurations Change-Id: Iab356b9d9851b9060e9c8adbe481f1e1e673f228 Signed-off-by: pborla --- diff --git a/src/du_app/du_e2ap_mgr.c b/src/du_app/du_e2ap_mgr.c index f813ef098..e003e2ffd 100644 --- a/src/du_app/du_e2ap_mgr.c +++ b/src/du_app/du_e2ap_mgr.c @@ -896,13 +896,13 @@ void E2apHdlRicSubsReportTmrExp(RicSubscription *ricSubscription) * * @params[in] * Type of interface - * Component action type + * Component Id * Pointer to E2 component node to be searched * @return CmLList * * ****************************************************************/ -E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t componentActionType, CmLList **e2ComponentNode) +E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint64_t componentId, CmLList **e2ComponentNode) { E2NodeComponent *e2NodeComponentInfo=NULLP; @@ -912,9 +912,8 @@ E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t c while(*e2ComponentNode) { e2NodeComponentInfo = (E2NodeComponent*)((*e2ComponentNode)->node); - if((e2NodeComponentInfo->interfaceType == interfaceType) && (e2NodeComponentInfo->componentActionType == componentActionType)) + if((e2NodeComponentInfo->interfaceType == interfaceType) && (e2NodeComponentInfo->componentId == componentId)) { - break; } @@ -927,18 +926,86 @@ E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t c /******************************************************************* * - * @brief add or modify E2NodeComponent list + * @brief fill E2 node component rsp info + * + * @details + * + * Function : fillE2NodeComponentRspInfo + * + * Functionality: fill E2 Node Component rsp info + * + * @parameter + * Type of interface + * Component action type + * Size of buffer which needs to be store + * buffer string which needs to be store + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t fillE2NodeComponentRspInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString) +{ + E2NodeConfig *configInfo=NULLP; + E2NodeComponent *e2NodeComponentInfo= NULLP; + CmLList *node = NULLP; + + e2NodeComponentInfo = fetchE2NodeComponentInfo(interfaceType, componentId, &node); + if(!e2NodeComponentInfo) + { + DU_LOG("\nERROR --> E2AP : Unable to find the node"); + return RFAILED; + } + + switch(action) + { + case E2_NODE_COMPONENT_ADD: + { + configInfo = e2NodeComponentInfo->addConfiguration; + break; + } + case E2_NODE_COMPONENT_UPDATE: + { + configInfo = e2NodeComponentInfo->updateConfiguration; + break; + } + default: + { + DU_LOG("\nERROR --> E2AP : Invalid action %d received",action); + return RFAILED; + } + } + + if(configInfo->componentRequestPart== NULLP) + { + DU_LOG("\nERROR --> E2AP : E2 node Component request part is not present"); + return RFAILED; + } + + configInfo->rspBufSize = bufSize; + DU_ALLOC(configInfo->componentResponsePart, bufSize); + if(configInfo->componentResponsePart == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed to store the encoding of rsp"); + return RFAILED; + } + memcpy(configInfo->componentResponsePart, bufString, configInfo->rspBufSize); + return ROK; +} + +/******************************************************************* + * + * @brief add E2 node component req info * * @details * - * Function : addOrModifyE2NodeComponent + * Function : addE2NodeComponent * - * Functionality: add or modify E2NodeComponent list + * Functionality: add E2 node component req info * * @parameter * Type of interface * Component action type - * boolean variable to check req or rsp msg type * Size of buffer which needs to be store * buffer string which needs to be store * @return ROK - success @@ -946,73 +1013,201 @@ E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t c * ******************************************************************/ -uint8_t addOrModifyE2NodeComponent(InterfaceType interfaceType, uint8_t action, bool reqPart, uint8_t bufSize, char *bufString) +uint8_t addE2NodeComponent(InterfaceType interfaceType, uint64_t componentId, uint8_t bufSize, char *bufString) { - E2NodeComponent *e2NodeComponentInfo= NULL; + E2NodeComponent *e2NodeComponentInfo= NULLP; CmLList *node = NULLP; - if(reqPart == true) + DU_ALLOC(e2NodeComponentInfo, sizeof(E2NodeComponent)); + if(!e2NodeComponentInfo) { - DU_ALLOC(e2NodeComponentInfo, sizeof(E2NodeComponent)); - if(!e2NodeComponentInfo) - { - DU_LOG("\nERROR --> E2AP : Memory allocation failed for e2NodeComponentInfo in %s",__func__); - return RFAILED; - } - e2NodeComponentInfo->interfaceType =interfaceType; - e2NodeComponentInfo->componentId=duCfgParam.duId; - e2NodeComponentInfo->componentActionType = action; - e2NodeComponentInfo->reqBufSize = bufSize; + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + return RFAILED; + } + e2NodeComponentInfo->interfaceType =interfaceType; + e2NodeComponentInfo->componentId=componentId; - DU_ALLOC(e2NodeComponentInfo->componentRequestPart, bufSize); - if(e2NodeComponentInfo->componentRequestPart == NULLP) - { - DU_LOG("\nERROR --> E2AP : Memory allocation failed for componentRequestPart"); - DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent)); - return RFAILED; - } - memcpy(e2NodeComponentInfo->componentRequestPart, bufString, e2NodeComponentInfo->reqBufSize); - DU_ALLOC(node, sizeof(CmLList)); - if(node) - { - node->node = (PTR) e2NodeComponentInfo; - cmLListAdd2Tail(&duCb.e2apDb.e2NodeComponentList, node); - } - else - { - DU_LOG("\nERROR --> E2AP : Memory allocation failed for e2NodeComponentList node"); - DU_FREE(e2NodeComponentInfo->componentRequestPart, bufSize); - DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent)); - return RFAILED; - } + DU_ALLOC(e2NodeComponentInfo->addConfiguration, sizeof(E2NodeConfig)); + if(!e2NodeComponentInfo->addConfiguration) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + return RFAILED; + } + + e2NodeComponentInfo->addConfiguration->reqBufSize = bufSize; + + DU_ALLOC(e2NodeComponentInfo->addConfiguration->componentRequestPart, bufSize); + if(e2NodeComponentInfo->addConfiguration->componentRequestPart == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent)); + return RFAILED; + } + memcpy(e2NodeComponentInfo->addConfiguration->componentRequestPart, bufString,\ + e2NodeComponentInfo->addConfiguration->reqBufSize); + + DU_ALLOC(node, sizeof(CmLList)); + if(node) + { + node->node = (PTR) e2NodeComponentInfo; + cmLListAdd2Tail(&duCb.e2apDb.e2NodeComponentList, node); } else { - if(duCb.e2apDb.e2NodeComponentList.count) - { - e2NodeComponentInfo = fetchE2NodeComponentInfo(interfaceType, action, &node); - if(e2NodeComponentInfo->componentRequestPart== NULLP) + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + DU_FREE(e2NodeComponentInfo->addConfiguration->componentRequestPart, bufSize); + DU_FREE(e2NodeComponentInfo->addConfiguration, sizeof(E2NodeConfig)); + DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent)); + return RFAILED; + } + return ROK; +} + +/******************************************************************* + * + * @brief update E2 node component req info + * + * @details + * + * Function : updateE2NodeComponent + * + * Functionality: update E2 node component req info + * + * @parameter + * Type of interface + * Size of buffer which needs to be store + * buffer string which needs to be store + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +uint8_t updateE2NodeComponent(InterfaceType interfaceType, uint64_t componentId, uint8_t bufSize, char *bufString) +{ + E2NodeComponent *e2NodeComponentInfo= NULLP; + CmLList *node = NULLP; + + e2NodeComponentInfo = fetchE2NodeComponentInfo(interfaceType, componentId, &node); + if(!e2NodeComponentInfo) + { + DU_LOG("\nERROR --> E2AP : Received null information in %s",__func__); + return RFAILED; + } + + DU_ALLOC(e2NodeComponentInfo->updateConfiguration, sizeof(E2NodeConfig)); + if(!e2NodeComponentInfo->updateConfiguration) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + return RFAILED; + } + + e2NodeComponentInfo->updateConfiguration->reqBufSize = bufSize; + + DU_ALLOC(e2NodeComponentInfo->updateConfiguration->componentRequestPart, bufSize); + if(e2NodeComponentInfo->updateConfiguration->componentRequestPart == NULLP) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed in %s at %d",__func__,__LINE__); + DU_FREE(e2NodeComponentInfo->updateConfiguration, sizeof(E2NodeConfig)); + return RFAILED; + } + + memcpy(e2NodeComponentInfo->updateConfiguration->componentRequestPart, bufString,\ + e2NodeComponentInfo->updateConfiguration->reqBufSize); + return ROK; + +} + +/******************************************************************* + * + * @brief delete E2 node component req info + * + * @details + * + * Function : deleteE2NodeComponent + * + * Functionality: delete E2 node component req info + * + * @parameter + * Type of interface + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +uint8_t deleteE2NodeComponent(InterfaceType interfaceType, uint64_t componentId) +{ + E2NodeComponent *e2NodeComponentInfo= NULLP; + CmLList *node = NULLP; + + e2NodeComponentInfo = fetchE2NodeComponentInfo(interfaceType, componentId, &node); + if(!e2NodeComponentInfo) + { + DU_LOG("\nERROR --> E2AP : Received null information in %s",__func__); + return RFAILED; + } + + e2NodeComponentInfo->deleteConfiguration = true; + return ROK; +} + +/******************************************************************* + * + * @brief fill E2 node component req info + * + * @details + * + * Function : fillE2NodeComponentReqInfo + * + * Functionality: fill E2 node component req info + * + * @parameter + * Type of interface + * Component action type + * Size of buffer which needs to be store + * buffer string which needs to be store + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ + +uint8_t fillE2NodeComponentReqInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString) +{ + switch(action) + { + case E2_NODE_COMPONENT_ADD: { - DU_LOG("\nERROR --> E2AP : E2 node Component request part is not present"); - return RFAILED; + if(addE2NodeComponent(interfaceType, componentId, bufSize, bufString) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to add e2 node component"); + return RFAILED; + } + break; } - - e2NodeComponentInfo->rspBufSize = bufSize; - DU_ALLOC(e2NodeComponentInfo->componentResponsePart, bufSize); - if(e2NodeComponentInfo->componentResponsePart == NULLP) + case E2_NODE_COMPONENT_UPDATE: + { + if(updateE2NodeComponent(interfaceType, componentId, bufSize, bufString) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to update e2 node component"); + return RFAILED; + } + break; + } + case E2_NODE_COMPONENT_DEL: + { + if(deleteE2NodeComponent(interfaceType, componentId) != ROK) + { + DU_LOG("\nERROR --> E2AP : Failed to delete e2 node component"); + return RFAILED; + } + break; + } + default: { - DU_LOG("\nERROR --> E2AP : Memory allocation failed to store the encoding of rsp"); + DU_LOG("\nERROR --> E2AP : Invalid action %d received",action); return RFAILED; } - memcpy(e2NodeComponentInfo->componentResponsePart, bufString, e2NodeComponentInfo->rspBufSize); - return ROK; - } - else - { - DU_LOG("\nERROR --> E2AP : Unable to find the node"); - return RFAILED; - } - } + } + return ROK; } diff --git a/src/du_app/du_e2ap_mgr.h b/src/du_app/du_e2ap_mgr.h index 3102c0131..a4d05f9ca 100644 --- a/src/du_app/du_e2ap_mgr.h +++ b/src/du_app/du_e2ap_mgr.h @@ -223,7 +223,7 @@ typedef struct typedef struct e2NodeCfgItem { InterfaceType interface; - ComponentActionType actionType; + uint64_t componentId; }E2NodeConfigItem; typedef struct e2NodeCfgList @@ -444,13 +444,19 @@ typedef struct /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26-9.2.27 */ typedef struct { - InterfaceType interfaceType; - uint64_t componentId; - ComponentActionType componentActionType; - uint8_t reqBufSize; - uint8_t *componentRequestPart; - uint8_t rspBufSize; - uint8_t *componentResponsePart; + uint8_t reqBufSize; + uint8_t *componentRequestPart; + uint8_t rspBufSize; + uint8_t *componentResponsePart; +}E2NodeConfig; + +typedef struct +{ + InterfaceType interfaceType; + uint64_t componentId; + E2NodeConfig *addConfiguration; + E2NodeConfig *updateConfiguration; + bool deleteConfiguration; }E2NodeComponent; /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.29 */ @@ -504,8 +510,9 @@ void E2apHdlRicSubsReportTmrExp(RicSubscription *ricSubscription); uint8_t ResetE2Request(E2ProcedureDirection dir, E2FailureCause resetCause); uint8_t SendE2APMsg(Region region, Pool pool, char *encBuf, int encBufSize); -E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t componentActionType, CmLList **e2ComponentNode); -uint8_t addOrModifyE2NodeComponent(InterfaceType interfaceType, uint8_t action, bool reqPart, uint8_t bufSize, char *bufString); +E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint64_t componentId, CmLList **e2ComponentNode); +uint8_t fillE2NodeComponentReqInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString); +uint8_t fillE2NodeComponentRspInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString); void deleteRicSubscriptionList(CmLListCp *subscriptionList); void deleteRicSubscriptionNode(CmLList *ricSubscriptionInfo); void deleteMeasurementInfoList(CmLListCp *measInfoList); diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index a038d75c3..876c83bed 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -566,6 +566,7 @@ uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId) uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, ConfigType configType) { + E2NodeConfig *e2NodeConfig=NULLP; E2nodeComponentInterfaceType_t *interfaceType=NULLP; E2nodeComponentID_t *componentID =NULLP; E2nodeComponentConfiguration_t *configuration=NULLP; @@ -581,6 +582,7 @@ uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, Co interfaceType = &e2NodeAddItem->e2nodeComponentInterfaceType; componentID = &e2NodeAddItem->e2nodeComponentID; configuration = &e2NodeAddItem->e2nodeComponentConfiguration; + e2NodeConfig = e2NodeComponentInfo->addConfiguration; break; } case CONFIG_MOD: @@ -589,6 +591,7 @@ uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, Co interfaceType = &e2NodeUpdateItem->e2nodeComponentInterfaceType; componentID = &e2NodeUpdateItem->e2nodeComponentID; configuration = &e2NodeUpdateItem->e2nodeComponentConfiguration; + e2NodeConfig = e2NodeComponentInfo->updateConfiguration; break; } case CONFIG_DEL: @@ -641,9 +644,9 @@ uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, Co } /* E2 Node Component Request Part */ - if(e2NodeComponentInfo->componentRequestPart) + if(e2NodeConfig->componentRequestPart) { - configuration->e2nodeComponentRequestPart.size = e2NodeComponentInfo->reqBufSize ; + configuration->e2nodeComponentRequestPart.size = e2NodeConfig->reqBufSize ; DU_ALLOC(configuration->e2nodeComponentRequestPart.buf,\ configuration->e2nodeComponentRequestPart.size); if(configuration->e2nodeComponentRequestPart.buf == NULLP) @@ -653,7 +656,7 @@ uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, Co } memcpy(configuration->e2nodeComponentRequestPart.buf,\ - e2NodeComponentInfo->componentRequestPart, configuration->\ + e2NodeConfig->componentRequestPart, configuration->\ e2nodeComponentRequestPart.size); } else @@ -663,16 +666,16 @@ uint8_t fillE2NodeConfig(PTR e2NodeCfg, E2NodeComponent *e2NodeComponentInfo, Co } /* E2 Node Component Response Part */ - if(e2NodeComponentInfo->componentResponsePart) + if(e2NodeConfig->componentResponsePart) { - configuration->e2nodeComponentResponsePart.size = e2NodeComponentInfo->rspBufSize; + 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 line %d",__func__,__LINE__); return RFAILED; } - memcpy(configuration->e2nodeComponentResponsePart.buf, e2NodeComponentInfo->componentResponsePart, configuration->\ + memcpy(configuration->e2nodeComponentResponsePart.buf, e2NodeConfig->componentResponsePart, configuration->\ e2nodeComponentResponsePart.size); } else @@ -763,7 +766,7 @@ uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAdd { /* 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); + e2NodeComponentInfo = fetchE2NodeComponentInfo(e2NodeList[arrIdx].interface, e2NodeList[arrIdx].componentId, &node); } if(!e2NodeComponentInfo) @@ -832,7 +835,7 @@ uint8_t BuildE2NodeConfigUpdateList(E2nodeComponentConfigUpdate_List_t *e2NodeUp return RFAILED; } - e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].actionType, &node); + e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].componentId, &node); if(!e2NodeComponentInfo) { DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__); @@ -902,7 +905,7 @@ uint8_t BuildE2NodeConfigRemoveList(E2nodeComponentConfigRemoval_List_t *e2NodeR return RFAILED; } - e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface, updateE2Node[arrIdx].actionType, &node); + e2NodeComponentInfo= fetchE2NodeComponentInfo(updateE2Node[arrIdx].interface,updateE2Node[arrIdx].componentId, &node); if(!e2NodeComponentInfo) { DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__); @@ -1580,8 +1583,8 @@ void FreeE2SetupReq(E2AP_PDU_t *e2apMsg) uint8_t BuildAndSendE2SetupReq() { uint8_t arrIdx = 0, elementCnt=0; - uint8_t transId = 0, ret = ROK; - bool memAllocFailed; + 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 */ @@ -2171,6 +2174,107 @@ void freeAperDecodingOfE2SetupRsp(E2setupResponse_t *e2SetRspMsg) } } } + +/****************************************************************** + * + * @brief handling of e2 noe config update ack ies + * + * @details + * + * Function :handleE2NodeConfigUpdateAckIes + * + * Functionality: handling of e2 noe config update ack ies + * + * @params[in] + * Pointer to the E2 Node cfg + * Procedure code + * @return void +******************************************************************/ + +void handleE2NodeConfigUpdateAckIes(PTR e2NodeCfg, uint8_t procedureCode) +{ + 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; + + switch(procedureCode) + { + case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck: + { + additionAckItem = (E2nodeComponentConfigAdditionAck_Item_t *)e2NodeCfg; + e2nodeComponentID = &additionAckItem->e2nodeComponentID; + break; + } + case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck: + { + updateAckItem = (E2nodeComponentConfigUpdateAck_Item_t*) e2NodeCfg; + e2nodeComponentID = &updateAckItem->e2nodeComponentID; + break; + } + case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck: + { + removalAckItem= (E2nodeComponentConfigRemovalAck_Item_t*)e2NodeCfg; + e2nodeComponentID = &removalAckItem->e2nodeComponentID; + break; + } + } + + switch(e2nodeComponentID->present) + { + case E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1: + { + e2NodeComponentInfo = fetchE2NodeComponentInfo(F1, e2nodeComponentID->choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf[0], &node); + if(!e2NodeComponentInfo) + { + DU_LOG("\nERROR --> E2AP : Received null e2NodeComponentInfo at line number %d",__LINE__); + return; + } + break; + } + default: + break; + } + + 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 Processes E2 Setup Response sent by RIC @@ -2192,8 +2296,6 @@ void procE2SetupRsp(E2AP_PDU_t *e2apMsg) 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; @@ -2239,28 +2341,8 @@ void procE2SetupRsp(E2AP_PDU_t *e2apMsg) for(idx =0; idx 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; - } + handleE2NodeConfigUpdateAckIes((PTR)&e2NodeAddAckItem->value.choice.E2nodeComponentConfigAdditionAck_Item,\ + ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck); } break; } @@ -5580,33 +5662,26 @@ uint8_t duSendE2NodeConfigurationUpdate() { e2NodeComponentInfo = (E2NodeComponent*)node->node; - if(e2NodeComponentInfo->componentRequestPart && e2NodeComponentInfo->componentResponsePart) + if(e2NodeComponentInfo->addConfiguration) { - switch(e2NodeComponentInfo->componentActionType) - { - case E2_NODE_COMPONENT_ADD: - { - e2NodeList.addE2Node[e2NodeList.addE2NodeCount].interface = e2NodeComponentInfo->interfaceType; - e2NodeList.addE2Node[e2NodeList.addE2NodeCount].actionType = e2NodeComponentInfo->componentActionType; - e2NodeList.removeE2NodeCount++; - break; - } - case E2_NODE_COMPONENT_UPDATE: - { - e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].interface = e2NodeComponentInfo->interfaceType; - e2NodeList.updateE2Node[e2NodeList.updateE2NodeCount].actionType = e2NodeComponentInfo->componentActionType; - e2NodeList.updateE2NodeCount++; - break; - - } - case E2_NODE_COMPONENT_DEL: - { - e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].interface = e2NodeComponentInfo->interfaceType; - e2NodeList.removeE2Node[e2NodeList.removeE2NodeCount].actionType = e2NodeComponentInfo->componentActionType; - e2NodeList.removeE2NodeCount++; - break; - } - } + 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; } @@ -7174,6 +7249,228 @@ void procRicSubscriptionDeleteRequest(E2AP_PDU_t *e2apMsg) return; } +/******************************************************************* + * + * @brief Deallocate the memory allocated for E2 node configuration + * update ack msg by aper decoder + * + * @details + * + * Function : freeAperDecodingOfE2NodeConfigUpdateAck + * + * Functionality: + * - Deallocate the memory allocated for E2 node configuration + * update ack msg by aper decoder + * + * @params[in] E2AP_PDU_t *e2apMsg + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +void freeAperDecodingOfE2NodeConfigUpdateAck(E2nodeConfigurationUpdateAcknowledge_t *updateAckMsg) +{ + 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; + + E2nodeComponentInterfaceF1_t *f1InterfaceInfo=NULLP; + if(updateAckMsg->protocolIEs.list.array != NULLP) + { + for(arrIdx = 0; arrIdx < updateAckMsg->protocolIEs.list.count; arrIdx++) + { + if(updateAckMsg->protocolIEs.list.array[arrIdx]) + { + switch(updateAckMsg->protocolIEs.list.array[arrIdx]->id) + { + case ProtocolIE_IDE2_id_E2nodeComponentConfigAdditionAck: + { + additionAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigAdditionAck_List; + if(additionAckList->list.array) + { + for(e2NodeConfigIdx=0; e2NodeConfigIdxlist.count; e2NodeConfigIdx++) + { + additionAckItemIte = (E2nodeComponentConfigAdditionAck_ItemIEs_t*) additionAckList->list.array[e2NodeConfigIdx]; + if(additionAckItemIte) + { + 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(additionAckList->list.array); + } + break; + } + } + case ProtocolIE_IDE2_id_E2nodeComponentConfigUpdateAck: + { + updateAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigUpdateAck_List; + if(updateAckList->list.array) + { + for(e2NodeConfigIdx=0; e2NodeConfigIdxlist.count; e2NodeConfigIdx++) + { + updateAckItemIe = (E2nodeComponentConfigUpdateAck_ItemIEs_t*) updateAckList->list.array[e2NodeConfigIdx]; + if(updateAckItemIe) + { + 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(updateAckList->list.array); + } + break; + } + case ProtocolIE_IDE2_id_E2nodeComponentConfigRemovalAck: + { + removalAckList =&updateAckMsg->protocolIEs.list.array[arrIdx]->value.choice.E2nodeComponentConfigRemovalAck_List; + if(removalAckList->list.array) + { + for(e2NodeConfigIdx=0; e2NodeConfigIdxlist.count; e2NodeConfigIdx++) + { + removalAckItemIe = (E2nodeComponentConfigRemovalAck_ItemIEs_t*) removalAckList->list.array[e2NodeConfigIdx]; + if(removalAckItemIe) + { + 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(removalAckList->list.array); + } + break; + } + } + free(updateAckMsg->protocolIEs.list.array[arrIdx]); + } + } + free(updateAckMsg->protocolIEs.list.array); + } +} + +/****************************************************************** + * + * @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; arrIdxprotocolIEs.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++) + { + 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; + } + } + } + } + + freeAperDecodingOfE2NodeConfigUpdateAck(e2NodeConfigUpdateAck); +} + /******************************************************************* * * @brief Handles received E2AP message and sends back response @@ -7290,11 +7587,6 @@ void E2APMsgHdlr(Buffer *mBuf) } 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); @@ -7310,7 +7602,11 @@ void E2APMsgHdlr(Buffer *mBuf) procRicSubscriptionModificationConfirm(e2apMsg); break; } - + case SuccessfulOutcomeE2__value_PR_E2nodeConfigurationUpdateAcknowledge: + { + procE2NodeConfigUpdateAck(e2apMsg); + break; + } default: { DU_LOG("\nERROR --> E2AP : Invalid type of E2AP_PDU_PR_successfulOutcome [%d]",\ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index c263e5292..d9b5022d7 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -1759,17 +1759,19 @@ uint8_t BuildAndSendF1SetupReq() } - if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_ADD, true, encBufSize, encBuf) !=ROK) - { - DU_LOG("\nERROR --> F1AP : Failed to add the e2 node in the list"); - break; - } + /* Sending msg */ if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending F1 Setup request failed"); break; } + + if(fillE2NodeComponentReqInfo(F1, duCfgParam.duId, E2_NODE_COMPONENT_ADD, encBufSize, encBuf) !=ROK) + { + DU_LOG("\nERROR --> F1AP : Failed to add the e2 node in the list"); + break; + } ret=ROK; break; @@ -2762,17 +2764,19 @@ uint8_t BuildAndSendDUConfigUpdate(ServCellAction servCellAction) } #endif } - if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_UPDATE, true, encBufSize, encBuf)!=ROK) - { - DU_LOG("\nERROR --> F1AP : Failed to update the e2 node in the list"); - break; - } + /* Sending msg */ if(sendF1APMsg() != ROK) { DU_LOG("\nERROR --> F1AP : Sending GNB-DU Config Update failed"); break; } + + if(fillE2NodeComponentReqInfo(F1, duCfgParam.duId, E2_NODE_COMPONENT_UPDATE, encBufSize, encBuf)!=ROK) + { + DU_LOG("\nERROR --> F1AP : Failed to update the e2 node in the list"); + break; + } ret = ROK; break; @@ -15552,7 +15556,7 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf) duProcF1SetupRsp(); freeAperDecodeF1SetupRsp(f1SetRspMsg); - if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_ADD, false, recvBufLen, recvBuf) !=ROK) + if(fillE2NodeComponentRspInfo(F1, duCfgParam.duId, E2_NODE_COMPONENT_ADD, recvBufLen, recvBuf) !=ROK) { DU_LOG("\nERROR --> F1AP : Failed to add the e2 node in the list"); return RFAILED; @@ -15781,13 +15785,14 @@ uint8_t procF1GNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvB } #endif - if(addOrModifyE2NodeComponent(F1, E2_NODE_COMPONENT_UPDATE, false, recvBufLen, recvBuf) !=ROK) + freeAperDecodeGnbDuAck(gnbDuAck); + + if(fillE2NodeComponentRspInfo(F1,duCfgParam.duId, E2_NODE_COMPONENT_UPDATE, recvBufLen, recvBuf) !=ROK) { DU_LOG("\nERROR --> F1AP : Failed to update the e2 node in the list"); return RFAILED; } - freeAperDecodeGnbDuAck(gnbDuAck); return ROK; } /******************************************************************