[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-531] RIC Subscription Modification Confirm
[o-du/l2.git] / src / ric_stub / ric_stub.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 #ifndef __RIC_MGR_MAIN_H__
20 #define __RIC_MGR_MAIN_H__
21
22 #define RIC_ID 1
23 #define RIC_NAME "ORAN_OAM_RIC"
24
25 #define DU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0001"
26 #define RIC_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011"
27
28 #ifndef O1_ENABLE
29 #define LOCAL_IP_RIC "192.168.130.80"
30
31 #define E2_SCTP_PORT 36421
32 #define NUM_E2_ASSOC 1 
33 #define REMOTE_IP_DU (char*[]){"192.168.130.81", "192.168.130.83"}
34 #endif
35
36 #define RRC_VER 0
37 #define EXT_RRC_VER 5
38 #define PLMN_MCC0 3
39 #define PLMN_MCC1 1
40 #define PLMN_MCC2 1
41 #define PLMN_MNC0 4
42 #define PLMN_MNC1 8
43 #define PLMN_MNC2 0
44
45 #define RIC_DU_NAME_LEN_MAX 30      /* Max length of RIC/DU name string */
46
47 #define RIC_APP_MEM_REG 1
48 #define RIC_POOL 1
49 #define MAX_RAN_FUNCTION 256        /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofRANfunctionID */
50 #define MAX_NUM_TRANSACTION 256     /* As per, O-RAN WG3 E2AP v3.0, section 9.2.33 */
51
52 #define MAX_RIC_ACTION  16          /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.1.1 : maxofRICActionID */
53 #define MAX_RIC_REQUEST 5           /* As per O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.7, max request is 65535. \
54                                      * But for our internal testing purpose, keeping it to 5 for now */
55
56 /* allocate and zero out a static buffer */
57 #define RIC_ALLOC(_datPtr, _size)                                \
58 {                                                               \
59    S16 _ret;                                                    \
60    _ret = SGetSBuf(RIC_APP_MEM_REG, RIC_POOL,                  \
61                      (Data **)&_datPtr, _size);                  \
62    if(_ret == ROK)                                              \
63       memset(_datPtr, 0, _size);                         \
64    else                                                         \
65       _datPtr = NULLP;                                          \
66 }
67  
68 /* free a static buffer */
69 #define RIC_FREE(_datPtr, _size)                                 \
70    SPutSBuf(RIC_APP_MEM_REG, RIC_POOL,                         \
71          (Data *)_datPtr, _size);
72
73 #define SEARCH_DU_DB(_duIdx, _duId, _duDb){\
74    _duDb = NULLP; \
75    for(_duIdx=0; _duIdx < ricCb.numDu; _duIdx++)\
76    {\
77       if(ricCb.duInfo[_duIdx].duId == _duId)\
78       {\
79          _duDb =  (&ricCb.duInfo[_duIdx]);\
80          break; \
81      }\
82    }\
83 }
84
85 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26 */
86 typedef enum
87 {
88    NG,
89    XN,
90    E1,
91    F1,
92    W1,
93    S1,
94    X2
95 }InterfaceType;
96
97 typedef struct
98 {
99    uint16_t requestorId;
100    uint16_t instanceId;
101 }RicRequestId;
102
103 typedef struct
104 {
105    int16_t         actionId;
106 }ActionInfo;
107
108 typedef struct ricSubscription
109 {
110    RicRequestId    requestId;
111    uint8_t         numOfActions;
112    ActionInfo      actionSequence[MAX_RIC_ACTION];
113 }RicSubscription;
114
115 typedef struct
116 {
117    uint16_t  id;
118    uint16_t  revisionCounter;
119    uint8_t   numOfSubscription;
120    RicSubscription subscriptionList[MAX_RIC_REQUEST];
121 }RanFunction;
122
123 typedef struct
124 {
125    InterfaceType   interfaceType;
126    uint64_t        componentId;
127 }E2NodeComponent;
128
129 typedef struct duDb
130 {
131    uint32_t        duId;
132    uint8_t         ricTransIdCounter;
133    uint16_t        numOfRanFunction;
134    RanFunction     ranFunction[MAX_RAN_FUNCTION];
135    E2NodeComponent e2NodeComponent;
136 }DuDb;
137
138 typedef struct ricCfgParams
139 {
140    uint32_t        ricId;
141    char            ricName[RIC_DU_NAME_LEN_MAX];
142    RicSctpParams   sctpParams;
143    Plmn            plmn;
144 }RicCfgParams;
145
146 typedef struct cuGlobalCb
147 {
148    RicCfgParams ricCfgParams;
149    uint8_t      numDu;
150    DuDb         duInfo[MAX_DU_SUPPORTED];
151 }RicGlobalCb;
152
153 RicGlobalCb ricCb;
154
155 typedef struct
156 {
157    uint8_t numOfRanFunAccepted;
158    RanFunction ranFunAcceptedList[MAX_RAN_FUNCTION];
159    uint8_t numOfRanFuneRejected;
160    RanFunction ranFunRejectedList[MAX_RAN_FUNCTION];
161 }RicTmpRanFunList;
162
163 typedef struct actionFailed
164 {
165    uint8_t actionId;
166    uint8_t failureType;
167    uint8_t cause;
168 }ActionFailed;
169
170 typedef struct
171 {
172    uint8_t numActionModified;
173    uint8_t actionModifiedList[MAX_RIC_ACTION];
174    uint8_t numActionModFailed;
175    ActionFailed actionModFailedList[MAX_RIC_ACTION];
176    uint8_t numActionRemoved;
177    uint8_t actionRemovedList[MAX_RIC_ACTION];
178    uint8_t numActionRemovalFailed;
179    ActionFailed actionRemovalFailedList[MAX_RIC_ACTION];
180 }RicTmpActionList;
181
182 void readRicCfg();
183 void cuAppInmsgHdlr(Buffer *mBuf);
184 void sctpNtfyInd(CmInetSctpNotification *ntfy);
185
186 #endif
187
188 /**********************************************************************
189          End of file
190 **********************************************************************/