E2 restart handling added
[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         "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
27 )
28
29 //-----------------------------------------------------------------------------
30 //
31 //-----------------------------------------------------------------------------
32 type RequestId struct {
33         e2ap.RequestId
34 }
35
36 func (rid *RequestId) String() string {
37         return "reqid(" + rid.RequestId.String() + ")"
38 }
39
40 type Sdlnterface interface {
41         Set(ns string, pairs ...interface{}) error
42         Get(ns string, keys []string) (map[string]interface{}, error)
43         GetAll(ns string) ([]string, error)
44         Remove(ns string, keys []string) error
45         RemoveAll(ns string) error
46 }
47
48 type E2SubscriptionDirectives struct {
49         // How many times E2 subscription request is retried
50         // Required: true
51         // Maximum: 10
52         // Minimum: 0
53         E2MaxTryCount int64
54
55         // How long time response is waited from E2 node
56         // Maximum: 10s
57         // Minimum: 1s
58         E2TimeoutTimerValue time.Duration
59
60         // Subscription needs RMR route from E2Term to xApp
61         CreateRMRRoute bool
62 }
63
64 type ErrorInfo struct {
65         ErrorCause  string
66         ErrorSource string
67         TimeoutType string
68 }
69
70 func (e *ErrorInfo) SetInfo(errorCause string, errorSource string, timeoutType string) {
71         e.ErrorCause = errorCause
72         e.ErrorSource = errorSource
73         e.TimeoutType = timeoutType
74 }
75
76 type XappRnibInterface interface {
77         XappRnibSubscribe(cb func(string, ...string), channel string) error
78         XappRnibGetListGnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError)
79         XappRnibStoreAndPublish(channel string, event string, pairs ...interface{}) error
80         XappRnibGetNodeb(inventoryName string) (*xapp.RNIBNodebInfo, xapp.RNIBIRNibError)
81 }