Replace deprecated SDL APIs
[ric-plt/submgr.git] / pkg / control / types.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 control
21
22 import (
23         "time"
24
25         "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
26 )
27
28 //-----------------------------------------------------------------------------
29 //
30 //-----------------------------------------------------------------------------
31 type RequestId struct {
32         e2ap.RequestId
33 }
34
35 func (rid *RequestId) String() string {
36         return "reqid(" + rid.RequestId.String() + ")"
37 }
38
39 type Sdlnterface interface {
40         Set(ns string, pairs ...interface{}) error
41         Get(ns string, keys []string) (map[string]interface{}, error)
42         GetAll(ns string) ([]string, error)
43         Remove(ns string, keys []string) error
44         RemoveAll(ns string) error
45 }
46
47 type E2SubscriptionDirectives struct {
48         // How many times E2 subscription request is retried
49         // Required: true
50         // Maximum: 10
51         // Minimum: 0
52         E2MaxTryCount int64
53
54         // How long time response is waited from E2 node
55         // Maximum: 10s
56         // Minimum: 1s
57         E2TimeoutTimerValue time.Duration
58
59         // Subscription needs RMR route from E2Term to xApp
60         CreateRMRRoute bool
61 }
62
63 type ErrorInfo struct {
64         ErrorCause  string
65         ErrorSource string
66         TimeoutType string
67 }
68
69 func (e *ErrorInfo) SetInfo(errorCause string, errorSource string, timeoutType string) {
70         e.ErrorCause = errorCause
71         e.ErrorSource = errorSource
72         e.TimeoutType = timeoutType
73 }