From: lal.harshita Date: Wed, 2 Aug 2023 07:30:36 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-521] E2 Database Implementation and configuration X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=5b0a8c1ccec481f354d22c1dff57b35bf72a1622;p=o-du%2Fl2.git [Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-521] E2 Database Implementation and configuration Change-Id: I1cc189546efa9fa420370cf83ae5b2ce5f9a9436 Signed-off-by: lal.harshita --- diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index 4c7a1c591..34308d759 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -595,15 +595,19 @@ uint8_t fillServCellCfgCommSib(SrvCellCfgCommSib *srvCellCfgComm) uint8_t readCfg() { - uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx; + CmLList *node; + uint8_t srvdCellIdx, bandIdx, sliceIdx, plmnIdx, ranFuncIdx, eventTriggerStyleIdx, reportStyleIdx, tnlAssocIdx; uint8_t brdcstPlmnIdx, freqBandIdx, srvdPlmnIdx; uint32_t ipv4_du, ipv4_cu, ipv4_ric; MibParams mib; Sib1Params sib1; F1TaiSliceSuppLst *taiSliceSuppLst; - - duCb.e2apDb.e2TransInfo.transIdCounter = 0; - memset(duCb.e2apDb.e2TransInfo.onGoingTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo)); + uint8_t MeasurementInfoIdx =0, measurementInfoLen=0; + char shortName[] = SHORT_NAME; + char serviceModelOID[]= SERVICE_MODEL_OID; + char description[] = DESCRIPTION; + char event_trigger_style_name[]= EVENT_TRIGGER_STYLE_NAME; + char ric_report_style_name[]= REPORT_STYLE_NAME; #ifndef O1_ENABLE /* Note: Added these below variable for local testing*/ @@ -663,6 +667,74 @@ uint8_t readCfg() } strcpy((char*)duCfgParam.duName,DU_NAME); + memset(&duCb.e2apDb, 0, sizeof(E2apDb)); + duCb.e2apDb.e2NodeId = DU_ID; + duCb.e2apDb.e2TransInfo.transIdCounter = 0; + + duCb.e2apDb.numOfTNLAssoc = 1; + for(tnlAssocIdx =0; tnlAssocIdxmeasurementTypeId = MeasurementInfoIdx+1; + memcpy(measurementInfoForAction->measurementTypeName, MEASUREMENT_TYPE_NAME[MeasurementInfoIdx], measurementInfoLen+1); + } + DU_ALLOC(node, sizeof(CmLList)); + if(node) + { + node->node = (PTR) measurementInfoForAction; + cmLListAdd2Tail(&duCb.e2apDb.ranFunction[ranFuncIdx].reportStyleList[reportStyleIdx].measurementInfoList, node); + } + else + { + + DU_FREE(measurementInfoForAction, sizeof(MeasurementInfoForAction)); + } + } + } + + duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationHeaderFormat = RIC_INDICATION_HEADER_FORMAT; + duCb.e2apDb.ranFunction[ranFuncIdx].ricIndicationMessageFormat = RIC_INDICATION_MESSAGE_FORMAT; + } + memset(duCb.e2apDb.e2TransInfo.onGoingTransaction, 0, MAX_NUM_TRANSACTION * sizeof(E2TransInfo)); + /* Mib Params */ mib.sysFrmNum = SYS_FRAME_NUM; #ifdef NR_TDD @@ -1089,7 +1161,7 @@ uint8_t duReadCfg() pst.pool= DU_POOL; /* Initialize the timer blocks */ - cmInitTimers(&(duCb.e2apDb.e2Timers.e2SetupTimer), 1); + cmInitTimers(&(duCb.e2apDb.e2TimersInfo.e2Timers.e2SetupTimer), 1); /* Initialzie the timer queue */ memset(&(duCb.duTimersInfo.tmrTq), 0, sizeof(CmTqType) * DU_TQ_SIZE); diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 348b9d078..316a1e7f4 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -1262,15 +1262,6 @@ typedef struct duCfgParams MacSliceCfgReq tempSliceCfg; }DuCfgParams; -typedef struct f1SetupMsg -{ - uint8_t f1MsgReqBufSize; - char *f1MsgReqBuf; - uint8_t f1MsgRspBufSize; - char *f1MsgRspBuf; -}F1SetupMsg; - - #ifndef O1_ENABLE //RRM POLICY STRUCT diff --git a/src/du_app/du_e2ap_mgr.h b/src/du_app/du_e2ap_mgr.h index fc3652494..5004628ea 100644 --- a/src/du_app/du_e2ap_mgr.h +++ b/src/du_app/du_e2ap_mgr.h @@ -14,13 +14,74 @@ # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################ -*******************************************************************************/ + *******************************************************************************/ /* This file contains all E2AP message handler related functionality */ #define MAX_NUM_TRANSACTION 256 /* As per, O-RAN WG3 E2AP v3.0, section 9.2.33 */ #define MAX_E2_SETUP_TMR 1 #define EVENT_E2_SETUP_TMR 1 +#define MAX_RAN_FUNCTION 256 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofRANfunctionID */ +#define MAX_E2_NODE_COMPONENT 1024 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofE2nodeComponents */ +#define MAX_TNL_ASSOCIATION 32 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.11 : maxofTNLA */ +#define MAX_RIC_STYLES 64 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 : maxnoofRICstyle */ +#define MAX_MEASUREMENT_INFO 65535 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 : maxnoofMeasurementInfo */ +#define MAX_LABEL_INFO 2147483648 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 : maxnoofLabelInfo */ +#define MAX_RIC_ACTION 16 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */ +#define MAX_RIC_REQUEST 65535 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.7 */ + +#define STRING_SIZE_150_BYTES 150 +#define STRING_SIZE_1000_BYTES 1000 + +#define SHORT_NAME "ORAN-E2SM-KPM" +#define SERVICE_MODEL_OID "1.3.6.1.4.1.53148.1.2.2.2" +#define DESCRIPTION "KPM Monitor" +#define NUM_OF_EVENT_TRIGGER_STYLE_SUPPORTED 1 +#define EVENT_TRIGGER_STYLE_NAME "Periodic Report" +#define EVENT_TRIGGER_STYLE_TYPE 1 +#define EVENT_TRIGGER_STYLE_FORMAT_TYPE 1 +#define NUM_OF_RIC_REPORT_STYLE_SUPPORTED 1 +#define REPORT_STYLE_NAME "E2 Node Measurement" +#define REPORT_STYLE_TYPE 1 +#define REPORT_ACTION_FORMAT_TYPE 1 +#define NUM_OF_MEASUREMENT_INFO_SUPPORTED 2 +#define MEASUREMENT_TYPE_NAME (char*[]) {"RRU.PrbTotDl", "RRU.PrbTotUl"} +#define RIC_INDICATION_HEADER_FORMAT 1 +#define RIC_INDICATION_MESSAGE_FORMAT 1 + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26 */ +typedef enum +{ + NG, + XN, + E1, + F1, + W1, + S1, + X2 +}InterfaceType; + +typedef enum +{ + E2_NODE_COMPONENT_ADD, + E2_NODE_COMPONENT_UPDATE +}ComponentActionType; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.30 */ +typedef enum +{ + RIC_SERVICE, + SUPPORT_FUNCTIONS, + BOTH_FUNCTIONALITY +}AssocUsage; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.11 */ +typedef enum +{ + INSERT, + REPORT, + POLICY +}ActionType; typedef enum { @@ -113,7 +174,7 @@ typedef struct e2Transcation uint8_t transIdCounter; E2TransInfo onGoingTransaction[MAX_NUM_TRANSACTION]; /* Any new parameter for transaction handling can be added here in future */ -}E2Transcation; +}E2Transaction; typedef struct e2Timer { @@ -121,19 +182,210 @@ typedef struct e2Timer /* More timers can be added to this structure in future */ }E2Timer; -typedef struct e2apDb -{ - uint16_t ricId; - E2Transcation e2TransInfo; - uint8_t *plmn; - uint32_t ricReqId; - uint32_t ricInstanceId; - uint32_t ranFuncId; - uint8_t *ricEventTrigger; - uint32_t ricActionId; - uint32_t ricActionType; - E2Timer e2Timers; - uint8_t e2SetupTimerInterval; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.4 */ +typedef struct +{ + Plmn plmnId; + uint32_t nearRtRicId; +}GlobalRicId; + +/* O-RAN.WG3.E2SM-R003-v03.00 : Section 6.2.2.1 */ +typedef struct +{ + char shortName[STRING_SIZE_150_BYTES]; + char serviceModelOID[STRING_SIZE_1000_BYTES]; + char description[STRING_SIZE_150_BYTES]; +}RanFunctionName; + +/* O-RAN.WG3.E2SM-R003-v03.00 : Section 6.2.2.2-6.2.2.4 */ +typedef struct +{ + uint8_t styleType; + char name[STRING_SIZE_150_BYTES]; + uint8_t formatType; +}RicStyle; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 */ +typedef struct +{ + char measurementTypeName[STRING_SIZE_150_BYTES]; + uint16_t measurementTypeId; +}MeasurementInfoForAction; + +typedef struct +{ + RicStyle reportStyle; + CmLListCp measurementInfoList; +}RicReportStyle; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.7 */ +typedef struct +{ + uint16_t requestorId; + uint16_t instanceId; +}RicRequestId; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.1.1 */ +typedef struct +{ + uint32_t reportingPeriod; +}EventTriggerFormat1; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.1 */ +typedef struct +{ + uint8_t formatType; + union + { + EventTriggerFormat1 format1; + /* More formats can be added in future */ + }choice; +}EventTriggerDefinition; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.3.11 */ +typedef struct +{ + /* TODO : To be added when list of KPIs are finalised */ +}LabelInfo; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 */ +typedef struct +{ + union + { + char measurementTypeName[STRING_SIZE_150_BYTES]; + uint16_t measurementTypeId; + }choice; + uint32_t numOfLabels; + LabelInfo LabelInfoList[MAX_LABEL_INFO]; +}MeasurementInfo; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 */ +typedef struct +{ + uint16_t numOfMeasuermentInfo; + MeasurementInfo **measurementInfoList; + uint32_t granularityPeriod; /* In millisecond */ +}ActionDefFormat1; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.2 */ +typedef struct +{ + /* TODO : This format will be defined in future if required */ +}ActionDefFormat2; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.3 */ +typedef struct +{ + /* TODO : This format will be defined in future if required */ +}ActionDefFormat3; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.4 */ +typedef struct +{ + /* TODO : This format will be defined in future if required */ +}ActionDefFormat4; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.5 */ +typedef struct +{ + /* TODO : This format will be defined in future if required */ +}ActionDefFormat5; + +/* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2 */ +typedef struct +{ + uint8_t styleType; + union + { + ActionDefFormat1 format1; + ActionDefFormat2 format2; + ActionDefFormat3 format3; + ActionDefFormat4 format4; + ActionDefFormat5 format5; + }choice; +}ActionDefinition; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */ +typedef struct +{ + uint8_t id; + ActionType type; + ActionDefinition definition; +}ActionInfo; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */ +typedef struct +{ + RicRequestId requestId; + EventTriggerDefinition eventTriggerDefinition; + uint8_t numOfActions; + ActionInfo actionSequence[MAX_RIC_ACTION]; +}RicSubscription; + +typedef struct +{ + /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 */ + uint16_t id; + RanFunctionName name; + uint16_t revisionCounter; + uint8_t numOfEventTriggerStyleSupported; + RicStyle eventTriggerStyleList[MAX_RIC_STYLES]; + uint8_t numOfReportStyleSupported; + RicReportStyle reportStyleList[MAX_RIC_STYLES]; + uint8_t ricIndicationHeaderFormat; + uint8_t ricIndicationMessageFormat; + /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 */ + CmLListCp subscriptionList; +}RanFunction; + +/* 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; +}E2NodeComponent; + +/* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.29 */ + +typedef struct e2Ipaddr +{ + bool ipV4Pres; + uint32_t ipV4Addr; +}E2IpAddr; + +typedef struct +{ + E2IpAddr localIpAddress; + uint16_t localPort; + E2IpAddr destIpAddress; + uint16_t destPort; + AssocUsage usage; +}TNLAssociation; + +typedef struct e2TimersInfo +{ + E2Timer e2Timers; + uint8_t e2SetupTimerInterval; +}E2TimersInfo; + +typedef struct +{ + uint64_t e2NodeId; + GlobalRicId ricId; + E2Transaction e2TransInfo; + uint16_t numOfRanFunction; + RanFunction ranFunction[MAX_RAN_FUNCTION]; + CmLListCp e2NodeComponentList; + uint8_t numOfTNLAssoc; + TNLAssociation tnlAssoc[MAX_TNL_ASSOCIATION]; + E2TimersInfo e2TimersInfo; }E2apDb; uint8_t assignTransactionId(); diff --git a/src/du_app/du_e2ap_msg_hdl.c b/src/du_app/du_e2ap_msg_hdl.c index 926b32891..adedf73cd 100644 --- a/src/du_app/du_e2ap_msg_hdl.c +++ b/src/du_app/du_e2ap_msg_hdl.c @@ -97,6 +97,40 @@ uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId) return ret; } +/****************************************************************** + * + * @brief Search E2 node component with the help of action type + * + * @details + * + * Function : searchE2NodeComponentInfo + * + * Functionality: Search E2 node component with the help of action type + * + * @params[in] uint8_t componentActionType + * @return CmLList + * + * ****************************************************************/ + +CmLList *searchE2NodeComponentInfo(InterfaceType interfaceType, uint8_t componentActionType) +{ + E2NodeComponent *e2NodeComponentInfo; + CmLList *node; + + if(duCb.e2apDb.e2NodeComponentList.count) + { + CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node); + while(node) + { + e2NodeComponentInfo = (E2NodeComponent*)node->node; + if((e2NodeComponentInfo->interfaceType == interfaceType) && (e2NodeComponentInfo->componentActionType == componentActionType)) + break; + else + node = node->next; + } + } + return node; +} /******************************************************************* * * @brief Builds E2 node config addition list @@ -116,6 +150,8 @@ uint8_t BuildGlobalgNBId(GlobalE2node_gNB_ID_t *gNbId) uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAddList) { uint8_t arrIdx = 0; + CmLList *node; + E2NodeComponent *e2NodeComponentInfo; E2nodeComponentConfigAddition_ItemIEs_t *e2NodeAddItemIe; E2nodeComponentConfigAddition_Item_t *e2NodeAddItem; @@ -137,7 +173,15 @@ uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAdd return RFAILED; } } - + + node = searchE2NodeComponentInfo(F1, E2_NODE_COMPONENT_ADD); + if(!node) + { + DU_LOG("\nERROR --> E2AP : Received e2NodeComponentInfo is null"); + return RFAILED; + } + e2NodeComponentInfo = (E2NodeComponent*)node->node; + arrIdx = 0; e2NodeAddItemIe = (E2nodeComponentConfigAddition_ItemIEs_t *) e2NodeAddList->list.array[arrIdx]; e2NodeAddItemIe->id = ProtocolIE_IDE2_id_E2nodeComponentConfigAddition_Item; @@ -149,32 +193,49 @@ uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAdd e2NodeAddItem->e2nodeComponentInterfaceType = E2nodeComponentInterfaceType_f1; /* E2 Node Component Request Part */ - e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size = duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize; - DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\ - e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size); - if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf == NULLP) + if(e2NodeComponentInfo->componentRequestPart) + { + e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size = e2NodeComponentInfo->reqBufSize ; + DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\ + e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.size); + if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf == NULLP) + { + DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__); + return RFAILED; + } + + memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\ + e2NodeComponentInfo->componentRequestPart, e2NodeAddItem->e2nodeComponentConfiguration.\ + e2nodeComponentRequestPart.size); + } + else { - DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__); + DU_LOG("\nERROR --> E2AP: componentRequestPart is null "); return RFAILED; } - memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentRequestPart.buf,\ - duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, e2NodeAddItem->e2nodeComponentConfiguration.\ - e2nodeComponentRequestPart.size); - + /* E2 Node Component Response Part */ - e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size = duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize; - DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \ - e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size); - if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf == NULLP) + if(e2NodeComponentInfo->componentResponsePart) + { + e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size = e2NodeComponentInfo->rspBufSize; + DU_ALLOC(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \ + e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.size); + if(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf == NULLP) + { + DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__); + return RFAILED; + } + memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \ + e2NodeComponentInfo->componentResponsePart, e2NodeAddItem->e2nodeComponentConfiguration.\ + e2nodeComponentResponsePart.size); + } + else { - DU_LOG("\nERROR --> E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__); + DU_LOG("\nERROR --> E2AP: componentResponsePart is null"); return RFAILED; } - memcpy(e2NodeAddItem->e2nodeComponentConfiguration.e2nodeComponentResponsePart.buf, \ - duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, e2NodeAddItem->e2nodeComponentConfiguration.\ - e2nodeComponentResponsePart.size); - + /* E2 Node Component ID */ e2NodeAddItem->e2nodeComponentID.present = E2nodeComponentID_PR_e2nodeComponentInterfaceTypeF1; DU_ALLOC(e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1,\ @@ -193,7 +254,7 @@ uint8_t BuildE2NodeConfigAddList(E2nodeComponentConfigAddition_List_t *e2NodeAdd DU_LOG("\nERROR -->list. E2AP: Memory allocation failed for BuildE2NodeConfigAddList %d",__LINE__); return RFAILED; } - e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf[arrIdx] = duCfgParam.duId; + e2NodeAddItem->e2nodeComponentID.choice.e2nodeComponentInterfaceTypeF1->gNB_DU_ID.buf[arrIdx] = e2NodeComponentInfo->componentId; return ROK; } @@ -925,6 +986,8 @@ uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg) uint8_t arrIdx =0, transId=0; uint32_t recvBufLen; E2setupResponse_t *e2SetRspMsg; + CmLList *node; + E2NodeComponent *e2NodeComponentInfo; DU_LOG("\nINFO --> E2AP : E2 Setup Response received"); duCb.e2Status = TRUE; //Set E2 status as true @@ -953,15 +1016,10 @@ uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg) /* To store the Ric Id Params */ recvBufLen = sizeof(e2SetRspMsg->protocolIEs.list.array[arrIdx]->value\ .choice.GlobalRIC_ID.pLMN_Identity.size); - duCb.e2apDb.plmn = NULLP; - DU_ALLOC(duCb.e2apDb.plmn, recvBufLen); - if(duCb.e2apDb.plmn) - { - memcpy(duCb.e2apDb.plmn, e2SetRspMsg->protocolIEs.list.array[arrIdx]\ + 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.plmn memory to be deallocated after the usage */ + /*TODO : duCb.e2apDb.ricId.plmnId memory to be deallocated after the usage */ break; } @@ -976,9 +1034,22 @@ uint8_t procE2SetupRsp(E2AP_PDU_t *e2apMsg) } freeAperDecodingOfE2SetupRsp(e2SetRspMsg); - DU_FREE(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf,duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize); - DU_FREE(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize); - + node = searchE2NodeComponentInfo(F1, E2_NODE_COMPONENT_ADD); + if(!node) + { + DU_LOG("\nERROR --> E2AP : Received e2NodeComponentInfo is null"); + return RFAILED; + } + else + { + e2NodeComponentInfo = (E2NodeComponent*)node->node; + 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)); + } + BuildAndSendE2NodeConfigUpdate(); return ROK; } @@ -1004,8 +1075,9 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg) uint8_t idx; uint8_t ied; uint8_t ret = ROK; - uint32_t recvBufLen; + CmLList *ricSubscriptionNode = NULLP; RICsubscriptionRequest_t *ricSubsReq; + RicSubscription *ricSubscriptionInfo; RICaction_ToBeSetup_ItemIEs_t *actionItem; DU_LOG("\nINFO --> E2AP : RIC Subscription request received"); @@ -1019,33 +1091,33 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg) { case ProtocolIE_IDE2_id_RICrequestID: { - duCb.e2apDb.ricReqId = ricSubsReq->protocolIEs.list.array[idx]->\ - value.choice.RICrequestID.ricRequestorID; - duCb.e2apDb.ricInstanceId = ricSubsReq->protocolIEs.list.array[idx]-> \ - value.choice.RICrequestID.ricInstanceID; + /* TODO :- ricSubscriptionInfo details will be stored based on + * RAN function id, so first we need to search RAN function and then add + * subscription details to that ran function */ + DU_ALLOC(ricSubscriptionInfo, sizeof(RicSubscription)); + if(!ricSubscriptionInfo) + { + DU_LOG("\nERROR --> E2AP : Memory allocation failed for ricSubscriptionInfo"); + return RFAILED; + } + ricSubscriptionInfo->requestId.requestorId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID; + ricSubscriptionInfo->requestId.instanceId = ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID; + DU_ALLOC(ricSubscriptionNode, sizeof(CmLList)); + if(ricSubscriptionNode) + { + ricSubscriptionNode->node = (PTR) ricSubscriptionInfo; + cmLListAdd2Tail(&duCb.e2apDb.ranFunction[0].subscriptionList,ricSubscriptionNode); + } break; } case ProtocolIE_IDE2_id_RANfunctionID: { - duCb.e2apDb.ranFuncId = ricSubsReq->protocolIEs.list.array[idx]-> \ + duCb.e2apDb.ranFunction[0].id = ricSubsReq->protocolIEs.list.array[idx]-> \ value.choice.RANfunctionID; break; } case ProtocolIE_IDE2_id_RICsubscriptionDetails: { - recvBufLen = sizeof(ricSubsReq->protocolIEs.list.array[idx]->value\ - .choice.RICsubscriptionDetails.ricEventTriggerDefinition.size); - duCb.e2apDb.ricEventTrigger = NULLP; - DU_ALLOC(duCb.e2apDb.ricEventTrigger, recvBufLen); - /*TODO : duCb.e2apDb.ricEventTrigger memory to be deallocated after the usage */ - if(duCb.e2apDb.ricEventTrigger) - { - memcpy(duCb.e2apDb.ricEventTrigger, ricSubsReq->protocolIEs.list.array[idx]\ - ->value.choice.RICsubscriptionDetails.ricEventTriggerDefinition.buf, \ - recvBufLen); - free(ricSubsReq->protocolIEs.list.array[idx]->value.choice.\ - RICsubscriptionDetails.ricEventTriggerDefinition.buf); - } if(ricSubsReq->protocolIEs.list.array[idx]->value.choice.RICsubscriptionDetails.ricAction_ToBeSetup_List.\ list.array) { @@ -1060,8 +1132,8 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg) { case ProtocolIE_IDE2_id_RICaction_ToBeSetup_Item: { - duCb.e2apDb.ricActionId = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID; - duCb.e2apDb.ricActionType = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType; + ricSubscriptionInfo->actionSequence[0].id = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionID; + ricSubscriptionInfo->actionSequence[0].type = actionItem->value.choice.RICaction_ToBeSetup_Item.ricActionType; break; } default: @@ -1086,6 +1158,9 @@ uint8_t procRicSubsReq(E2AP_PDU_t *e2apMsg) } free(ricSubsReq->protocolIEs.list.array); ret = BuildAndSendRicSubscriptionRsp(); + { + BuildAndSendRicIndication(ricSubscriptionInfo); + } return ret; } @@ -1177,7 +1252,7 @@ void FreeRicIndication(E2AP_PDU_t *e2apMsg) * RFAILED - failure * ******************************************************************/ -uint8_t FillRicIndication(RICindication_t *ricIndicationMsg) +uint8_t FillRicIndication(RICindication_t *ricIndicationMsg, RicSubscription *ricSubscriptionInfo) { uint8_t elementCnt=0; uint8_t idx=0; @@ -1214,34 +1289,29 @@ uint8_t FillRicIndication(RICindication_t *ricIndicationMsg) 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 =\ - duCb.e2apDb.ricReqId; - ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID =\ - duCb.e2apDb.ricInstanceId; + ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricRequestorID =ricSubscriptionInfo->requestId.requestorId; + ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICrequestID.ricInstanceID = ricSubscriptionInfo->requestId.instanceId; 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 = - duCb.e2apDb.ranFuncId; + ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RANfunctionID = duCb.e2apDb.ranFunction[0].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 = - duCb.e2apDb.ricActionId; + ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICactionID = ricSubscriptionInfo->actionSequence[0].id; 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 = - duCb.e2apDb.ricActionType; + ricIndicationMsg->protocolIEs.list.array[idx]->value.choice.RICindicationType = ricSubscriptionInfo->actionSequence[0].type; idx++; ricIndicationMsg->protocolIEs.list.array[idx]->id = ProtocolIE_IDE2_id_RICindicationHeader; @@ -1303,7 +1373,7 @@ uint8_t FillRicIndication(RICindication_t *ricIndicationMsg) * ******************************************************************/ -uint8_t BuildAndSendRicIndication() +uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo) { E2AP_PDU_t *e2apMsg = NULLP; RICindication_t *ricIndicationMsg=NULLP; @@ -1335,7 +1405,7 @@ uint8_t BuildAndSendRicIndication() ricIndicationMsg = &e2apMsg->choice.initiatingMessage->value.choice.RICindication; - FillRicIndicationret = FillRicIndication(ricIndicationMsg); + FillRicIndicationret = FillRicIndication(ricIndicationMsg, ricSubscriptionInfo); if(FillRicIndicationret != ROK) { break; @@ -2044,10 +2114,7 @@ void E2APMsgHdlr(Buffer *mBuf) { case InitiatingMessageE2__value_PR_RICsubscriptionRequest: { - if(procRicSubsReq(e2apMsg) == ROK) - { - BuildAndSendRicIndication(); - } + procRicSubsReq(e2apMsg); break; } default: diff --git a/src/du_app/du_e2ap_msg_hdl.h b/src/du_app/du_e2ap_msg_hdl.h index 8e6a9b1e0..ed81ae077 100644 --- a/src/du_app/du_e2ap_msg_hdl.h +++ b/src/du_app/du_e2ap_msg_hdl.h @@ -24,6 +24,7 @@ uint8_t BuildAndSendE2SetupReq(); uint8_t BuildAndSendE2NodeConfigUpdate(); uint8_t BuildAndSendE2ResetRequest(E2CauseType failureType, E2Cause failureCause); void E2APMsgHdlr(Buffer *mBuf); +uint8_t BuildAndSendRicIndication(RicSubscription *ricSubscriptionInfo); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index b639f0767..b30f89d30 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -1588,6 +1588,91 @@ void FreeF1SetupReq(F1AP_PDU_t *f1apMsg) } } +/******************************************************************* + * + * @brief add or modify E2NodeComponent list + * + * @details + * + * Function : addOrModifyE2NodeComponent + * + * Functionality: add or modify E2NodeComponent list + * + * @parameter uint8_t componentactiontype, bool reqPart, uint8_t bufSize, char *bufString + * @return ROK - success + * RFAILED - failure + * + ******************************************************************/ +uint8_t addOrModifyE2NodeComponent(uint8_t action, bool reqPart, uint8_t bufSize, char *bufString) +{ + E2NodeComponent *e2NodeComponentInfo; + CmLList *node = NULLP; + + if(action == E2_NODE_COMPONENT_ADD) + { + if(reqPart == true) + { + DU_ALLOC(e2NodeComponentInfo, sizeof(E2NodeComponent)); + if(!e2NodeComponentInfo) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed for e2NodeComponentInfo in %s",__func__); + return RFAILED; + } + e2NodeComponentInfo->interfaceType =F1; + e2NodeComponentInfo->componentId=duCfgParam.duId; + e2NodeComponentInfo->componentActionType = action; + e2NodeComponentInfo->reqBufSize = bufSize; + + DU_ALLOC(e2NodeComponentInfo->componentRequestPart, bufSize); + if(e2NodeComponentInfo->componentRequestPart == NULLP) + { + DU_LOG("\nERROR --> F1AP : 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 --> F1AP : Memory allocation failed for e2NodeComponentList node"); + DU_FREE(e2NodeComponentInfo->componentRequestPart, bufSize); + DU_FREE(e2NodeComponentInfo, sizeof(E2NodeComponent)); + return RFAILED; + } + } + else + { + if(duCb.e2apDb.e2NodeComponentList.count) + { + CM_LLIST_FIRST_NODE(&duCb.e2apDb.e2NodeComponentList, node); + while(node) + { + e2NodeComponentInfo = (E2NodeComponent*)node->node; + if((e2NodeComponentInfo->interfaceType == F1) && (e2NodeComponentInfo->componentActionType == action)) + { + e2NodeComponentInfo->rspBufSize = bufSize; + + DU_ALLOC(e2NodeComponentInfo->componentResponsePart, bufSize); + if(e2NodeComponentInfo->componentResponsePart == NULLP) + { + DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup rsp"); + return RFAILED; + } + memcpy(e2NodeComponentInfo->componentResponsePart, bufString, e2NodeComponentInfo->rspBufSize); + break; + } + node = node->next; + } + } + } + } + return ROK; +} /******************************************************************* * * @brief Builds and Send the F1SetupRequest @@ -1756,17 +1841,10 @@ uint8_t BuildAndSendF1SetupReq() printf("%x",encBuf[ieIdx]); } #endif + - duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize = encBufSize; - DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, encBufSize); - if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP) - { - DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the encoding of f1setup req"); - return RFAILED; - } - memcpy(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf, &encBuf, duCb.f1SetupReqAndRspMsg.f1MsgReqBufSize); } - + addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, true, encBufSize, encBuf); /* Sending msg */ if(sendF1APMsg() != ROK) { @@ -15549,15 +15627,8 @@ uint8_t procF1SetupRsp(F1AP_PDU_t *f1apMsg, MsgLen recvBufLen, char *recvBuf) duProcF1SetupRsp(); freeAperDecodeF1SetupRsp(f1SetRspMsg); - - duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize = recvBufLen; - DU_ALLOC(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, duCb.f1SetupReqAndRspMsg.f1MsgRspBufSize); - if(duCb.f1SetupReqAndRspMsg.f1MsgReqBuf == NULLP) - { - DU_LOG("\nERROR --> F1AP : Memory allocation failed to store the buf of F1setup response"); - return RFAILED; - } - memcpy(duCb.f1SetupReqAndRspMsg.f1MsgRspBuf, recvBuf, recvBufLen); + + addOrModifyE2NodeComponent(E2_NODE_COMPONENT_ADD, false, recvBufLen, recvBuf); if(BuildAndSendE2SetupReq() != ROK) { diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index 4210106b6..9202092f4 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -349,7 +349,6 @@ typedef struct duCb UpTnlCfg* upTnlCfg[MAX_TEID]; /* tunnel info for every Drb */ CmLListCp reservedF1apPduList; /*storing F1AP pdu infomation and transId */ SliceCfgState sliceState; /* Slice status */ - F1SetupMsg f1SetupReqAndRspMsg; /* f1 Setup Req And Rsp Msg*/ DuTimers duTimersInfo; /* Du timers queue */ }DuCb; diff --git a/src/du_app/du_tmr.c b/src/du_app/du_tmr.c index d63583618..432a3d368 100644 --- a/src/du_app/du_tmr.c +++ b/src/du_app/du_tmr.c @@ -47,7 +47,7 @@ bool duChkTmr(PTR cb, int16_t tmrEvnt) { case EVENT_E2_SETUP_TMR: { - if(((E2apDb *)cb)->e2Timers.e2SetupTimer.tmrEvnt == EVENT_E2_SETUP_TMR) + if(((E2apDb *)cb)->e2TimersInfo.e2Timers.e2SetupTimer.tmrEvnt == EVENT_E2_SETUP_TMR) { DU_LOG("\nERROR --> DU_APP : duChkTmr: Invalid tmr Evnt [%d]", tmrEvnt); return TRUE; @@ -86,7 +86,7 @@ void duStartTmr(PTR cb, int16_t tmrEvnt, uint8_t timerValue) e2apDb = ((E2apDb *)cb); DU_TMR_CALCUATE_WAIT(arg.wait, timerValue, duCb.duTimersInfo.tmrRes); - arg.timers = &e2apDb->e2Timers.e2SetupTimer; + arg.timers = &e2apDb->e2TimersInfo.e2Timers.e2SetupTimer; arg.max = MAX_E2_SETUP_TMR; break; }