7aaad0c5649990ab1f12bd5bd2e9c80625602d15
[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 )
115
116 //-----------------------------------------------------------------------------
117 //
118 //-----------------------------------------------------------------------------
119 const (
120         E2AP_SubSeqActionTypeContinue uint64 = 0
121         E2AP_SubSeqActionTypeWait     uint64 = 1
122 )
123
124 //-----------------------------------------------------------------------------
125 //
126 //-----------------------------------------------------------------------------
127 const (
128         E2AP_TimeToWaitZero   uint64 = 0
129         E2AP_TimeToWaitW1ms   uint64 = 1
130         E2AP_TimeToWaitW2ms   uint64 = 2
131         E2AP_TimeToWaitW5ms   uint64 = 3
132         E2AP_TimeToWaitW10ms  uint64 = 4
133         E2AP_TimeToWaitW20ms  uint64 = 4
134         E2AP_TimeToWaitW30ms  uint64 = 5
135         E2AP_TimeToWaitW40ms  uint64 = 6
136         E2AP_TimeToWaitW50ms  uint64 = 7
137         E2AP_TimeToWaitW100ms uint64 = 8
138         E2AP_TimeToWaitW200ms uint64 = 9
139         E2AP_TimeToWaitW500ms uint64 = 10
140         E2AP_TimeToWaitW1s    uint64 = 11
141         E2AP_TimeToWaitW2s    uint64 = 12
142         E2AP_TimeToWaitW5s    uint64 = 13
143         E2AP_TimeToWaitW10s   uint64 = 14
144         E2AP_TimeToWaitW20s   uint64 = 15
145         E2AP_TimeToWaitW60    uint64 = 16
146 )
147
148 //-----------------------------------------------------------------------------
149 //
150 //-----------------------------------------------------------------------------
151 const (
152         E2AP_InterfaceDirectionIncoming uint32 = 0
153         E2AP_InterfaceDirectionOutgoing uint32 = 1
154 )
155
156 //-----------------------------------------------------------------------------
157 //
158 //-----------------------------------------------------------------------------
159 const (
160         E2AP_CriticalityReject uint8 = 0
161         E2AP_CriticalityIgnore uint8 = 1
162         E2AP_CriticalityNotify uint8 = 2
163 )
164
165 //-----------------------------------------------------------------------------
166 //
167 //-----------------------------------------------------------------------------
168 const (
169         E2AP_ENBIDMacroPBits20    uint8 = 20
170         E2AP_ENBIDHomeBits28      uint8 = 28
171         E2AP_ENBIDShortMacroits18 uint8 = 18
172         E2AP_ENBIDlongMacroBits21 uint8 = 21
173 )
174
175 //-----------------------------------------------------------------------------
176 //
177 //-----------------------------------------------------------------------------
178 type PackedData struct {
179         Buf []byte
180 }
181
182 //-----------------------------------------------------------------------------
183 //
184 //-----------------------------------------------------------------------------
185 type MessageInfo struct {
186         MsgType uint64
187         MsgId   uint64
188 }
189
190 func (msgInfo *MessageInfo) String() string {
191         return "msginfo(" + strconv.FormatUint((uint64)(msgInfo.MsgType), 10) + string(":") + strconv.FormatUint((uint64)(msgInfo.MsgId), 10) + ")"
192 }
193
194 //-----------------------------------------------------------------------------
195 //
196 //-----------------------------------------------------------------------------
197 type RequestId struct {
198         Id  uint32
199         Seq uint32
200 }
201
202 func (rid *RequestId) String() string {
203         return strconv.FormatUint((uint64)(rid.Id), 10) + string(":") + strconv.FormatUint((uint64)(rid.Seq), 10)
204 }
205
206 //-----------------------------------------------------------------------------
207 //
208 //-----------------------------------------------------------------------------
209 type FunctionId uint16
210
211 //-----------------------------------------------------------------------------
212 //
213 //-----------------------------------------------------------------------------
214 type NodeId struct {
215         Bits uint8
216         Id   uint32
217 }
218
219 func (nid *NodeId) String() string {
220         return strconv.FormatUint((uint64)(nid.Id), 10)
221 }
222
223 //-----------------------------------------------------------------------------
224 //
225 //-----------------------------------------------------------------------------
226 type GlobalNodeId struct {
227         Present      bool
228         PlmnIdentity conv.PlmnIdentity
229         NodeId       NodeId
230 }
231
232 func (gnid *GlobalNodeId) String() string {
233         return gnid.PlmnIdentity.String() + string(":") + gnid.NodeId.String()
234 }
235
236 //-----------------------------------------------------------------------------
237 //
238 //-----------------------------------------------------------------------------
239 type InterfaceId struct {
240         GlobalEnbId GlobalNodeId
241         GlobalGnbId GlobalNodeId
242 }
243
244 //-----------------------------------------------------------------------------
245 //
246 //-----------------------------------------------------------------------------
247 type EventTriggerDefinition struct {
248         InterfaceId
249         InterfaceDirection uint32
250         ProcedureCode      uint32
251         TypeOfMessage      uint64
252 }
253
254 /*
255 //-----------------------------------------------------------------------------
256 //
257 //-----------------------------------------------------------------------------
258 type CallProcessId struct {
259   CallProcessIDVal uint32
260 }
261 */
262
263 //-----------------------------------------------------------------------------
264 //
265 //-----------------------------------------------------------------------------
266 type ActionDefinition struct {
267         Present bool
268         StyleId uint64
269         ParamId uint32
270         //ParamValue
271 }
272
273 //-----------------------------------------------------------------------------
274 //
275 //-----------------------------------------------------------------------------
276 type SubsequentAction struct {
277         Present    bool
278         Type       uint64
279         TimetoWait uint64
280 }
281
282 //-----------------------------------------------------------------------------
283 //
284 //-----------------------------------------------------------------------------
285 type ActionToBeSetupItem struct {
286         ActionId   uint64
287         ActionType uint64
288         ActionDefinition
289         SubsequentAction
290 }
291
292 //-----------------------------------------------------------------------------
293 //
294 //-----------------------------------------------------------------------------
295 type Cause struct {
296         Content  uint8
297         CauseVal uint8
298 }
299
300 //-----------------------------------------------------------------------------
301 //
302 //-----------------------------------------------------------------------------
303 type ActionAdmittedItem struct {
304         ActionId uint64
305 }
306
307 //-----------------------------------------------------------------------------
308 //
309 //-----------------------------------------------------------------------------
310 type ActionAdmittedList struct {
311         Items []ActionAdmittedItem //16
312 }
313
314 //-----------------------------------------------------------------------------
315 //
316 //-----------------------------------------------------------------------------
317 type ActionNotAdmittedItem struct {
318         ActionId uint64
319         Cause    Cause
320 }
321
322 //-----------------------------------------------------------------------------
323 //
324 //-----------------------------------------------------------------------------
325 type ActionNotAdmittedList struct {
326         Items []ActionNotAdmittedItem //16
327 }
328
329 //-----------------------------------------------------------------------------
330 //
331 //-----------------------------------------------------------------------------
332 type CriticalityDiagnosticsIEListItem struct {
333         IeCriticality uint8 //Crit
334         IeID          uint32
335         TypeOfError   uint8
336 }
337
338 //-----------------------------------------------------------------------------
339 //
340 //-----------------------------------------------------------------------------
341 type CriticalityDiagnosticsIEList struct {
342         Items []CriticalityDiagnosticsIEListItem //256
343 }
344
345 //-----------------------------------------------------------------------------
346 //
347 //-----------------------------------------------------------------------------
348 type CriticalityDiagnostics struct {
349         Present         bool
350         ProcCodePresent bool
351         ProcCode        uint64
352         TrigMsgPresent  bool
353         TrigMsg         uint64
354         ProcCritPresent bool
355         ProcCrit        uint8 //Crit
356         CriticalityDiagnosticsIEList
357 }