[ Jira id - ODUHIGH-593 ] Pack and unpack function nomenclature correction
[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 #define MAX_E2_NODE_COMPONENT 1024     /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.1.2.2 : maxofE2nodeComponents */
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 typedef enum
86 {
87    ADD_CONNECTION,
88    MODIFY_CONNECTION,
89    REMOVE_CONNECTION
90 }E2Connection;
91
92 /* O-RAN.WG3.E2AP-R003-v03.00 : Section 9.2.26 */
93 typedef enum
94 {
95    NG,
96    XN,
97    E1,
98    F1,
99    W1,
100    S1,
101    X2
102 }InterfaceType;
103
104 typedef struct
105 {
106    uint16_t requestorId;
107    uint16_t instanceId;
108 }RicRequestId;
109
110 typedef struct
111 {
112    int16_t         actionId;
113 }ActionInfo;
114
115 typedef struct ricSubscription
116 {
117    RicRequestId    requestId;
118    uint16_t        ranFuncId;
119    CmLListCp       actionSequence;
120 }RicSubscription;
121
122 typedef struct
123 {
124    uint16_t  id;
125    uint16_t  revisionCounter;
126    CmLListCp  subscriptionList;
127 }RanFunction;
128
129 typedef struct
130 {
131    InterfaceType   interfaceType;
132    uint64_t        componentId;
133 }E2NodeComponent;
134
135 typedef struct duDb
136 {
137    uint32_t        duId;
138    uint8_t         ricTransIdCounter;
139    uint16_t        numOfRanFunction;
140    RanFunction     ranFunction[MAX_RAN_FUNCTION];
141    CmLListCp       e2NodeComponent;
142 }DuDb;
143
144 typedef struct ricCfgParams
145 {
146    uint32_t        ricId;
147    char            ricName[RIC_DU_NAME_LEN_MAX];
148    RicSctpParams   sctpParams;
149    Plmn            plmn;
150 }RicCfgParams;
151
152 typedef struct cuGlobalCb
153 {
154    RicCfgParams ricCfgParams;
155    uint8_t      numDu;
156    DuDb         duInfo[MAX_DU_SUPPORTED];
157 }RicGlobalCb;
158
159 extern RicGlobalCb ricCb;
160
161 typedef struct
162 {
163    uint8_t numOfRanFunAccepted;
164    RanFunction ranFunAcceptedList[MAX_RAN_FUNCTION];
165    uint8_t numOfRanFuneRejected;
166    RanFunction ranFunRejectedList[MAX_RAN_FUNCTION];
167 }RicTmpRanFunList;
168
169 typedef struct actionFailed
170 {
171    uint8_t actionId;
172    uint8_t failureType;
173    uint8_t cause;
174 }ActionFailed;
175
176 typedef struct
177 {
178    uint8_t numActionModified;
179    uint8_t actionModifiedList[MAX_RIC_ACTION];
180    uint8_t numActionModFailed;
181    ActionFailed actionModFailedList[MAX_RIC_ACTION];
182    uint8_t numActionRemoved;
183    uint8_t actionRemovedList[MAX_RIC_ACTION];
184    uint8_t numActionRemovalFailed;
185    ActionFailed actionRemovalFailedList[MAX_RIC_ACTION];
186 }RicTmpActionList;
187
188 typedef struct e2NodeCfgItem
189 {
190    E2NodeComponent componentInfo;
191    bool           isSuccessful;
192 }E2NodeConfigItem;
193
194 typedef struct e2NodeCfgList
195 {
196    uint16_t addedE2NodeCount;
197    E2NodeConfigItem addedE2Node[MAX_E2_NODE_COMPONENT];
198    uint16_t updatedE2NodeCount;
199    E2NodeConfigItem updatedE2Node[MAX_E2_NODE_COMPONENT];
200    uint16_t removedE2NodeCount;
201    E2NodeConfigItem removedE2Node[MAX_E2_NODE_COMPONENT];
202 }E2NodeConfigList;
203
204 typedef struct ricSubsActionInfo
205 {
206    ConfigType  configType; 
207    uint16_t    actionId;
208 }RicSubsActionInfo;
209
210 typedef struct ricSubsModReq
211
212     uint16_t   numOfActionToBeAdded;
213     ActionInfo actionToBeAdded[MAX_RIC_ACTION]; 
214     uint16_t   numOfActionToBeModify;
215     ActionInfo actionToBeModify[MAX_RIC_ACTION]; 
216     uint16_t   numOfActionToBeRemove;
217     ActionInfo actionToBeRemove[MAX_RIC_ACTION]; 
218 }RicSubsModReq;
219
220 void readRicCfg();
221 void cuAppInmsgHdlr(Buffer *mBuf);
222 void sctpNtfyInd(CmInetSctpNotification *ntfy);
223
224 #endif
225
226 /**********************************************************************
227          End of file
228 **********************************************************************/