2784a2c7c455a2176fa40ed415abedcc83afd1e5
[ric-plt/submgr.git] / e2ap / pkg / e2ap / msg_e2ap.go
1 /*
2 ==================================================================================
3   Copyright (c) 2019 AT&T Intellectual Property.
4   Copyright (c) 2019 Nokia
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 */
19
20 package e2ap
21
22 import (
23         "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/conv"
24         "strconv"
25 )
26
27 //-----------------------------------------------------------------------------
28 //
29 //-----------------------------------------------------------------------------
30 const (
31         E2AP_InitiatingMessage   uint64 = 1
32         E2AP_SuccessfulOutcome   uint64 = 2
33         E2AP_UnsuccessfulOutcome uint64 = 3
34 )
35
36 //-----------------------------------------------------------------------------
37 //
38 //-----------------------------------------------------------------------------
39 // E2AP messages
40 // Initiating message
41 const (
42         E2AP_RICSubscriptionRequest       uint64 = 1
43         E2AP_RICSubscriptionDeleteRequest uint64 = 2
44
45         // E2AP_RICServiceUpdate uint64 = 3
46         // E2AP_RICControlRequest uint64 = 4
47         //
48         // //E2AP_X2SetupRequest uint64 = 5;
49         // E2AP_ENDCX2SetupRequest uint64 = 6
50         // E2AP_ResourceStatusRequest uint64 = 7
51         // E2AP_ENBConfigurationUpdate uint64 = 8
52         // E2AP_ENDCConfigurationUpdate uint64 = 9
53         // E2AP_ResetRequest uint64 = 10
54         // E2AP_RICIndication uint64 = 11
55
56         // E2AP_RICServiceQuery uint64 = 12
57         // E2AP_LoadInformation uint64 = 13
58         // E2AP_GNBStatusIndication uint64 = 14
59         // E2AP_ResourceStatusUpdate uint64 = 15
60         // E2AP_ErrorIndication uint64 = 16
61         //
62 )
63
64 // E2AP messages
65 // Successful outcome
66 const (
67         E2AP_RICSubscriptionResponse       uint64 = 1
68         E2AP_RICSubscriptionDeleteResponse uint64 = 2
69
70         // E2AP_RICserviceUpdateAcknowledge uint64 = 3
71         // E2AP_RICcontrolAcknowledge uint64 = 4
72         //
73         // //E2AP_X2SetupResponse uint64 = 5;
74         // E2AP_ENDCX2SetupResponse uint64 = 6
75         // E2AP_ResourceStatusResponse uint64 = 7
76         // E2AP_ENBConfigurationUpdateAcknowledge uint64 = 8
77         // E2AP_ENDCConfigurationUpdateAcknowledge uint64 = 9
78         // E2AP_ResetResponse uint64 = 10
79         //
80 )
81
82 // E2AP messages
83 // Unsuccessful outcome
84 const (
85         E2AP_RICSubscriptionFailure       uint64 = 1
86         E2AP_RICSubscriptionDeleteFailure uint64 = 2
87
88         // E2AP_RICserviceUpdateFailure uint64 = 3
89         // E2AP_RICcontrolFailure uint64 = 4
90         //
91         // //E2AP_X2SetupFailure uint64 = 5;
92         // E2AP_ENDCX2SetupFailure uint64 = 6
93         // E2AP_ResourceStatusFailure uint64 = 7
94         // E2AP_ENBConfigurationUpdateFailure uint64 = 8
95         // E2AP_ENDCConfigurationUpdateFailure uint64 = 9
96         //
97 )
98
99 //-----------------------------------------------------------------------------
100 //
101 //-----------------------------------------------------------------------------
102 const (
103         E2AP_IndicationTypeReport uint64 = 0
104         E2AP_IndicationTypeInsert uint64 = 1
105 )
106
107 //-----------------------------------------------------------------------------
108 //
109 //-----------------------------------------------------------------------------
110 const (
111         E2AP_ActionTypeReport  uint64 = 0
112         E2AP_ActionTypeInsert  uint64 = 1
113         E2AP_ActionTypePolicy  uint64 = 2
114         E2AP_ActionTypeInvalid uint64 = 99 // For RIC internal usage only
115 )
116
117 //-----------------------------------------------------------------------------
118 //
119 //-----------------------------------------------------------------------------
120 const (
121         E2AP_SubSeqActionTypeContinue uint64 = 0
122         E2AP_SubSeqActionTypeWait     uint64 = 1
123 )
124
125 //-----------------------------------------------------------------------------
126 //
127 //-----------------------------------------------------------------------------
128 const (
129         E2AP_TimeToWaitZero   uint64 = 0
130         E2AP_TimeToWaitW1ms   uint64 = 1
131         E2AP_TimeToWaitW2ms   uint64 = 2
132         E2AP_TimeToWaitW5ms   uint64 = 3
133         E2AP_TimeToWaitW10ms  uint64 = 4
134         E2AP_TimeToWaitW20ms  uint64 = 4
135         E2AP_TimeToWaitW30ms  uint64 = 5
136         E2AP_TimeToWaitW40ms  uint64 = 6
137         E2AP_TimeToWaitW50ms  uint64 = 7
138         E2AP_TimeToWaitW100ms uint64 = 8
139         E2AP_TimeToWaitW200ms uint64 = 9
140         E2AP_TimeToWaitW500ms uint64 = 10
141         E2AP_TimeToWaitW1s    uint64 = 11
142         E2AP_TimeToWaitW2s    uint64 = 12
143         E2AP_TimeToWaitW5s    uint64 = 13
144         E2AP_TimeToWaitW10s   uint64 = 14
145         E2AP_TimeToWaitW20s   uint64 = 15
146         E2AP_TimeToWaitW60    uint64 = 16
147 )
148
149 //-----------------------------------------------------------------------------
150 //
151 //-----------------------------------------------------------------------------
152 const (
153         E2AP_InterfaceDirectionIncoming uint32 = 0
154         E2AP_InterfaceDirectionOutgoing uint32 = 1
155 )
156
157 //-----------------------------------------------------------------------------
158 //
159 //-----------------------------------------------------------------------------
160 const (
161         E2AP_CriticalityReject uint8 = 0
162         E2AP_CriticalityIgnore uint8 = 1
163         E2AP_CriticalityNotify uint8 = 2
164 )
165
166 //-----------------------------------------------------------------------------
167 //
168 //-----------------------------------------------------------------------------
169 const (
170         E2AP_ENBIDMacroPBits20    uint8 = 20
171         E2AP_ENBIDHomeBits28      uint8 = 28
172         E2AP_ENBIDShortMacroits18 uint8 = 18
173         E2AP_ENBIDlongMacroBits21 uint8 = 21
174 )
175
176 //-----------------------------------------------------------------------------
177 //
178 //-----------------------------------------------------------------------------
179 type PackedData struct {
180         Buf []byte
181 }
182
183 //-----------------------------------------------------------------------------
184 //
185 //-----------------------------------------------------------------------------
186 type MessageInfo struct {
187         MsgType uint64
188         MsgId   uint64
189 }
190
191 func (msgInfo *MessageInfo) String() string {
192         return "msginfo(" + strconv.FormatUint((uint64)(msgInfo.MsgType), 10) + string(":") + strconv.FormatUint((uint64)(msgInfo.MsgId), 10) + ")"
193 }
194
195 //-----------------------------------------------------------------------------
196 //
197 //-----------------------------------------------------------------------------
198 type RequestId struct {
199         Id  uint32
200         Seq uint32
201 }
202
203 func (rid *RequestId) String() string {
204         return strconv.FormatUint((uint64)(rid.Id), 10) + string(":") + strconv.FormatUint((uint64)(rid.Seq), 10)
205 }
206
207 //-----------------------------------------------------------------------------
208 //
209 //-----------------------------------------------------------------------------
210 type FunctionId uint16
211
212 //-----------------------------------------------------------------------------
213 //
214 //-----------------------------------------------------------------------------
215 type NodeId struct {
216         Bits uint8
217         Id   uint32
218 }
219
220 func (nid *NodeId) String() string {
221         return strconv.FormatUint((uint64)(nid.Id), 10)
222 }
223
224 //-----------------------------------------------------------------------------
225 //
226 //-----------------------------------------------------------------------------
227 type GlobalNodeId struct {
228         Present      bool
229         PlmnIdentity conv.PlmnIdentityTbcd
230         NodeId       NodeId
231 }
232
233 func (gnid *GlobalNodeId) String() string {
234         return gnid.PlmnIdentity.String() + string(":") + gnid.NodeId.String()
235 }
236
237 //-----------------------------------------------------------------------------
238 //
239 //-----------------------------------------------------------------------------
240 type InterfaceId struct {
241         GlobalEnbId GlobalNodeId
242         GlobalGnbId GlobalNodeId
243 }
244
245 //-----------------------------------------------------------------------------
246 //
247 //-----------------------------------------------------------------------------
248 type EventTriggerDefinition struct {
249         InterfaceId
250         InterfaceDirection uint32
251         ProcedureCode      uint32
252         TypeOfMessage      uint64
253 }
254
255 /*
256 //-----------------------------------------------------------------------------
257 //
258 //-----------------------------------------------------------------------------
259 type CallProcessId struct {
260   CallProcessIDVal uint32
261 }
262 */
263
264 //-----------------------------------------------------------------------------
265 //
266 //-----------------------------------------------------------------------------
267 type ActionDefinition struct {
268         Present bool
269         StyleId uint64
270         ParamId uint32
271         //ParamValue
272 }
273
274 //-----------------------------------------------------------------------------
275 //
276 //-----------------------------------------------------------------------------
277 type SubsequentAction struct {
278         Present    bool
279         Type       uint64
280         TimetoWait uint64
281 }
282
283 //-----------------------------------------------------------------------------
284 //
285 //-----------------------------------------------------------------------------
286 type ActionToBeSetupItem struct {
287         ActionId   uint64
288         ActionType uint64
289         ActionDefinition
290         SubsequentAction
291 }
292
293 //-----------------------------------------------------------------------------
294 //
295 //-----------------------------------------------------------------------------
296 type Cause struct {
297         Content  uint8
298         CauseVal uint8
299 }
300
301 //-----------------------------------------------------------------------------
302 //
303 //-----------------------------------------------------------------------------
304 type ActionAdmittedItem struct {
305         ActionId uint64
306 }
307
308 //-----------------------------------------------------------------------------
309 //
310 //-----------------------------------------------------------------------------
311 type ActionAdmittedList struct {
312         Items []ActionAdmittedItem //16
313 }
314
315 //-----------------------------------------------------------------------------
316 //
317 //-----------------------------------------------------------------------------
318 type ActionNotAdmittedItem struct {
319         ActionId uint64
320         Cause    Cause
321 }
322
323 //-----------------------------------------------------------------------------
324 //
325 //-----------------------------------------------------------------------------
326 type ActionNotAdmittedList struct {
327         Items []ActionNotAdmittedItem //16
328 }
329
330 //-----------------------------------------------------------------------------
331 //
332 //-----------------------------------------------------------------------------
333 type CriticalityDiagnosticsIEListItem struct {
334         IeCriticality uint8 //Crit
335         IeID          uint32
336         TypeOfError   uint8
337 }
338
339 //-----------------------------------------------------------------------------
340 //
341 //-----------------------------------------------------------------------------
342 type CriticalityDiagnosticsIEList struct {
343         Items []CriticalityDiagnosticsIEListItem //256
344 }
345
346 //-----------------------------------------------------------------------------
347 //
348 //-----------------------------------------------------------------------------
349 type CriticalityDiagnostics struct {
350         Present         bool
351         ProcCodePresent bool
352         ProcCode        uint64
353         TrigMsgPresent  bool
354         TrigMsg         uint64
355         ProcCritPresent bool
356         ProcCrit        uint8 //Crit
357         CriticalityDiagnosticsIEList
358 }