1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains all E2AP message handler related functionality */
20 #define MAX_E2_SETUP_TMR 1
21 #define MAX_E2_NODE_CONFIG_UPDATE_TMR 1
22 #define MAX_RIC_SERVICE_UPDATE_TMR 1
23 #define MAX_RIC_SUBSCRIPTION_REPORTING_TMR 1
25 #define EVENT_E2_SETUP_TMR 1
26 #define EVENT_RIC_SERVICE_UPDATE_TMR 2
27 #define EVENT_E2_NODE_CONFIG_UPDATE_TMR 3
28 #define EVENT_RIC_SUBSCRIPTION_REPORTING_TMR 4
30 #define MAX_NUM_TRANSACTION 256 /* As per, O-RAN WG3 E2AP v3.0, section 9.2.33 */
31 #define MAX_RAN_FUNCTION 256 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofRANfunctionID */
32 #define MAX_E2_NODE_COMPONENT 1024 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofE2nodeComponents */
33 #define MAX_TNL_ASSOCIATION 32 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.11 : maxofTNLA */
34 #define MAX_RIC_STYLES 64 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 : maxnoofRICstyle */
35 #define MAX_MEASUREMENT_INFO 65535 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 : maxnoofMeasurementInfo */
36 #define MAX_LABEL_INFO 2147483648 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 : maxnoofLabelInfo */
37 #define MAX_RIC_ACTION 16 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */
38 #define MAX_RIC_REQUEST 65535 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.7 */
39 #define MAX_PENDING_SUBSCRIPTION_RSP 5 /* Number of statistics request in processing */
41 #define STRING_SIZE_150_BYTES 150
42 #define STRING_SIZE_1000_BYTES 1000
44 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26 */
58 E2_NODE_COMPONENT_ADD,
59 E2_NODE_COMPONENT_UPDATE,
64 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.30 */
72 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.11 */
84 }E2ProcedureDirection;
88 E2_RAN_FUNCTION_ID_INVALID,
89 E2_ACTION_NOT_SUPPORTED,
90 E2_EXECESSIVE_ACTIONS,
92 E2_DUPLICATE_EVENT_TRIGGER,
93 E2_FUNCTION_RESOURCE_LIMIT,
94 E2_REQUEST_ID_UNKNOWN,
95 E2_INCONSISTENT_ACTION_SUBSEQUENT_ACTION_SEQUENCE,
96 E2_CONTROL_MESSAGE_INVALID,
97 E2_RIC_CALL_PROCESS_ID_INVALID,
98 E2_CONTROL_TIMER_EXPIRED,
99 E2_CONTROL_FAILED_TO_EXECUTE,
101 E2_RIC_REQUEST_CAUSE_UNSPECIFIED,
102 E2_RIC_SUBSCRIPTION_END_TIME_EXPIRED,
103 E2_RIC_SUBSCRIPTION_END_TIME_INVALID,
104 E2_DUPLICATE_RIC_REQUEST_ID,
105 E2_EVENT_TRIGGER_NOT_SUPPORTED,
106 E2_REQUEST_INFORMATION_UNAVAILABLE,
107 E2_INVALID_INFORMATION_REQUEST
112 E2_RAN_FUNCTION_NOT_SUPPORTED,
113 E2_EXCESSIVE_FUNCTIONS,
114 E2_RIC_RESOURCE_LIMIT,
119 E2_NODE_COMPONENT_UNKNOWN
124 E2_TRANSPORT_CAUSE_UNSPECIFIED,
125 E2_TRANSPORT_RESOURCE_UNAVAILABLE
130 E2_TRANSFER_SYNTAX_ERROR,
131 E2_ABSTRACT_SYNTAX_ERROR_REJECT,
132 E2_ABSTRACT_SYNTAX_ERROR_IGNORE_AND_NOTIFY,
133 E2_MESSAGE_NOT_COMPATIBLE_WITH_RECEIVER_STATE,
135 E2_ABSTRACT_SYNTAX_ERROR_FALSELY_CONSTRUCTED_MESSAGE,
136 E2_PROTOCOL_CAUSE_UNSPECIFIED
141 E2_CONTROL_PROCESSING_OVERLOAD,
144 E2_MISCELLANEOUS_CAUSE_UNSPECIFIED
158 typedef uint8_t E2Cause;
160 typedef struct e2FailureCause
162 E2CauseType causeType;
168 uint8_t transactionId;
169 uint8_t procedureCode;
172 typedef struct e2Transcation
174 uint8_t transIdCounter; /* counting the total number of DU initiated transaction */
175 E2TransInfo e2InitTransaction[MAX_NUM_TRANSACTION]; /* Storing DU-initiated transactions information */
176 E2TransInfo ricInitTransaction[MAX_NUM_TRANSACTION]; /* Storing RIC-initiated transactions information */
182 uint16_t revisionCounter;
187 uint8_t numOfRanFunToBeAdded;
188 RanFuncInfo ranFunToBeAdded[MAX_RAN_FUNCTION];
189 uint8_t numOfRanFunToBeModified;
190 RanFuncInfo ranFunToBeModified[MAX_RAN_FUNCTION];
191 uint8_t numOfRanFunToBeDeleted;
192 RanFuncInfo ranFunToBeDeleted[MAX_RAN_FUNCTION];
195 typedef struct ricServiceUpdate
197 E2ProcedureDirection dir;
199 E2TmpRanFunList recvRanFuncList;
204 RicServiceUpdate ricService;
206 }RicServiceUpdateTimer;
208 typedef struct e2NodeCfgItem
210 InterfaceType interface;
211 uint64_t componentId;
214 typedef struct e2NodeCfgList
216 uint16_t addE2NodeCount;
217 E2NodeConfigItem addE2Node[MAX_E2_NODE_COMPONENT];
218 uint16_t updateE2NodeCount;
219 E2NodeConfigItem updateE2Node[MAX_E2_NODE_COMPONENT];
220 uint16_t removeE2NodeCount;
221 E2NodeConfigItem removeE2Node[MAX_E2_NODE_COMPONENT];
226 E2NodeConfigList configList;
228 }E2NodeConfigUpdateTimer;
230 typedef struct e2Timer
232 CmTimer e2SetupTimer;
233 RicServiceUpdateTimer ricServiceUpdateTimer;
234 E2NodeConfigUpdateTimer e2NodeConfigUpdate;
235 /* More timers can be added to this structure in future */
239 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.4 */
243 uint32_t nearRtRicId;
246 /* O-RAN.WG3.E2SM-R003-v03.00 : Section 6.2.2.1 */
249 char shortName[STRING_SIZE_150_BYTES];
250 char serviceModelOID[STRING_SIZE_1000_BYTES];
251 char description[STRING_SIZE_150_BYTES];
254 /* O-RAN.WG3.E2SM-R003-v03.00 : Section 6.2.2.2-6.2.2.4 */
258 char name[STRING_SIZE_150_BYTES];
262 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 */
265 char measurementTypeName[STRING_SIZE_150_BYTES];
266 uint16_t measurementTypeId;
267 }MeasurementInfoForAction;
271 RicStyle reportStyle;
272 CmLListCp measurementInfoList;
275 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.7 */
278 uint16_t requestorId;
282 typedef struct reportStartTime
285 uint32_t timeInMilliSec;
288 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.1.1 */
291 uint32_t reportingPeriod; /* In milliseconds */
292 ReportStartTime startTime;
293 }EventTriggerFormat1;
295 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.1 */
301 EventTriggerFormat1 format1;
302 /* More formats can be added in future */
304 }EventTriggerDefinition;
306 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.3.11 */
309 /* TODO : To be added in future when subcounters for any
310 * measurment type is required */
313 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 */
316 char measurementTypeName[STRING_SIZE_150_BYTES];
317 uint16_t measurementTypeId;
319 /* As of now Labels are not used, hence it is not implemented completely */
320 //uint32_t numOfLabels;
321 //LabelInfo LabelInfoList[MAX_LABEL_INFO];
323 CmLListCp measuredValue; /* To be filled when numOfLabels is 0, else values are calculated per Label */
326 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.1 */
329 CmLListCp measurementInfoList; /* Each node corresponds to MeasurementInfo */
330 uint32_t granularityPeriod; /* In millisecond */
333 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.2 */
336 /* TODO : This format will be defined in future if required */
339 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.3 */
342 /* TODO : This format will be defined in future if required */
345 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.4 */
348 /* TODO : This format will be defined in future if required */
351 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2.5 */
354 /* TODO : This format will be defined in future if required */
357 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.1.2 */
364 ActionDefFormat1 format1;
365 ActionDefFormat2 format2;
366 ActionDefFormat3 format3;
367 ActionDefFormat4 format4;
368 ActionDefFormat5 format5;
372 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */
375 int16_t actionId; /* O-RAN.WG3.E2AP-R003-v03.00 Section 9.2.10. Valid action id range = 0..255 */
377 ActionDefinition definition;
379 E2FailureCause failureCause; /* Used only when an action is required to be deleted */
382 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */
385 RicRequestId requestId;
387 EventTriggerDefinition eventTriggerDefinition;
388 CmLListCp actionSequence;
389 CmTimer ricSubsReportTimer;
391 E2FailureCause failureCause; /* Used only when a subscription is required to be deleted */
394 typedef struct rejectedAction
397 E2FailureCause failureCause;
400 typedef struct pendingSubsRspInfo
402 RicRequestId requestId;
404 uint8_t numOfAcceptedActions;
405 uint8_t acceptedActionList[MAX_RIC_ACTION];
406 uint8_t numOfRejectedActions;
407 RejectedAction rejectedActionList[MAX_RIC_ACTION];
410 typedef struct actionStatus
412 uint8_t numOfAcceptedActions;
413 uint8_t acceptedActionList[MAX_RIC_ACTION];
414 uint8_t numOfRejectedActions;
415 RejectedAction rejectedActionList[MAX_RIC_ACTION];
418 typedef struct pendingSubsModRspInfo
420 RicRequestId requestId;
422 bool addActionCompleted;
423 ActionStatus addActionStatus;
424 bool modActionCompleted;
425 ActionStatus modActionStatus;
426 bool removeActionCompleted;
427 ActionStatus removeActionStatus;
428 }PendingSubsModRspInfo;
432 /* O-RAN.WG3.E2SM-KPM-R003-v03.00 : Section 8.2.2.1 */
434 RanFunctionName name;
435 uint16_t revisionCounter;
436 uint8_t numOfEventTriggerStyleSupported;
437 RicStyle eventTriggerStyleList[MAX_RIC_STYLES];
438 uint8_t numOfReportStyleSupported;
439 RicReportStyle reportStyleList[MAX_RIC_STYLES];
440 uint8_t ricIndicationHeaderFormat;
441 uint8_t ricIndicationMessageFormat;
442 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 */
443 CmLListCp subscriptionList;
444 uint8_t numPendingSubsRsp;
445 PendingSubsRspInfo pendingSubsRspInfo[MAX_PENDING_SUBSCRIPTION_RSP];
446 uint8_t numPendingSubsModRsp;
447 PendingSubsModRspInfo pendingSubsModRspInfo[MAX_PENDING_SUBSCRIPTION_RSP];
450 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26-9.2.27 */
454 uint8_t *componentRequestPart;
456 uint8_t *componentResponsePart;
461 InterfaceType interfaceType;
462 uint64_t componentId;
463 E2NodeConfig *addConfiguration;
464 E2NodeConfig *updateConfiguration;
465 bool deleteConfiguration;
468 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.29 */
470 typedef struct e2Ipaddr
478 E2IpAddr localIpAddress;
480 E2IpAddr destIpAddress;
485 typedef struct e2TimersInfo
488 uint8_t e2SetupTimerInterval;
495 E2Transaction e2TransInfo;
496 uint16_t numOfRanFunction;
497 RanFunction ranFunction[MAX_RAN_FUNCTION];
498 CmLListCp e2NodeComponentList;
499 uint8_t numOfTNLAssoc;
500 TNLAssociation tnlAssoc[MAX_TNL_ASSOCIATION];
501 E2TimersInfo e2TimersInfo;
504 typedef struct e2ConnectionItem
510 typedef struct e2ConnectionList
512 uint8_t numOfE2ConnectionSetup;
513 E2ConnectionItem setupE2Connection[MAX_TNL_ASSOCIATION];
514 uint8_t numOfE2ConnectionFailedToSetup;
515 E2ConnectionItem failedToSetupE2Connection[MAX_TNL_ASSOCIATION];
518 uint8_t assignTransactionId();
519 ActionInfo *fetchActionInfoFromActionId(uint8_t actionId, RicSubscription *ricSubscriptionInfo, CmLList ** actionNode, ConfigType configType);
520 RicSubscription *fetchSubsInfoFromRicReqId(RicRequestId ricReqId, RanFunction *ranFuncDb, CmLList **ricSubscriptionNode);
521 RanFunction *fetchRanFuncFromRanFuncId(uint16_t ranFuncId);
522 uint8_t fetchSubsInfoFromSubsId(uint64_t subscriptionId, RanFunction **ranFuncDb, CmLList **ricSubscriptionNode, \
523 RicSubscription **ricSubscriptionInfo);
524 void fetchRicSubsToBeDeleted(CmLListCp *ricSubsToBeDelList);
526 uint8_t fillRicSubsInMacStatsReq(MacStatsReq *macStatsReq, RicSubscription* ricSubscriptionInfo);
527 uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp);
528 uint8_t e2ProcStatsInd(MacStatsInd *statsInd);
529 void E2apHdlRicSubsReportTmrExp(RicSubscription *ricSubscription);
531 uint8_t ResetE2Request(E2ProcedureDirection dir, E2FailureCause resetCause);
532 uint8_t SendE2APMsg(Region region, Pool pool, char *encBuf, int encBufSize);
533 E2NodeComponent *fetchE2NodeComponentInfo(InterfaceType interfaceType, uint64_t componentId, CmLList **e2ComponentNode);
534 uint8_t fillE2NodeComponentReqInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString);
535 uint8_t fillE2NodeComponentRspInfo(InterfaceType interfaceType, uint64_t componentId, uint8_t action, uint8_t bufSize, char *bufString);
536 void deleteRicSubscriptionList(CmLListCp *subscriptionList);
537 void deleteRicSubscriptionNode(CmLList *ricSubscriptionInfo);
538 void deleteMeasurementInfoList(CmLListCp *measInfoList);
539 void deleteActionSequence(CmLList *action);
540 void deleteMeasuredValueList(CmLListCp *measuredValueList);
541 void removeE2NodeInformation();
542 void encodeSubscriptionId(uint64_t *subscriptionId, uint16_t ranFuncId, RicRequestId ricReqId);
543 uint8_t e2ProcStatsDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp);
544 uint8_t fillRicSubsInMacStatsModificationReq(MacStatsModificationReq *macStatsModReq, RicSubscription* ricSubscriptionInfo);
545 uint8_t e2ProcActionDeleteRsp(MacStatsDeleteRsp *statsDeleteRsp);
546 uint8_t e2ProcStatsModificationRsp(MacStatsModificationRsp *statsModificationRsp);
547 uint8_t duProcPendingSubsModRsp(RicSubscription *ricSubscriptionInfo, PendingSubsModRspInfo *pendingSubsModRsp);
549 /**********************************************************************
551 **********************************************************************/