4501bb8ebe524172d820dfc39882923136ea9aeb
[ric-plt/rtmgr.git] / pkg / rtmgr / 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    This source code is part of the near-RT RIC (RAN Intelligent Controller)
19    platform project (RICP).
20
21 ==================================================================================
22 */
23 /*
24   Mnemonic:     rtmgr/types.go
25   Abstract:     Contains RTMGR (Routing Manager) specific types
26   Date:         12 March 2019
27 */
28
29 package rtmgr
30
31 type XApps struct {
32         XAppList []XApp
33 }
34
35 type RouteTable []RouteTableEntry
36 type EndpointList []Endpoint
37
38 type Endpoints map[string]*Endpoint
39
40 type SubscriptionList []Subscription
41
42 type MessageTypeList map[string]string
43
44 type ProcessMultipleRMR map[string]int
45
46 //TODO: uuid is not a real UUID but a string of "ip:port"
47 // this should be changed to real UUID later on which should come from xApp Manager // petszila
48 type Endpoint struct {
49         Uuid       string
50         Name       string
51         XAppType   string
52         Ip         string
53         Port       uint16
54         TxMessages []string
55         RxMessages []string
56         Policies   []int32
57         Socket     interface{}
58         IsReady    bool
59         Keepalive  bool
60         Whid       int
61 }
62
63 type RouteTableEntry struct {
64         MessageType string
65         TxList      EndpointList
66         RxGroups    []EndpointList
67         SubID       int32
68         RouteType   string
69 }
70
71 type XApp struct {
72         Name      string         `json:"name"`
73         Status    string         `json:"status"`
74         Version   string         `json:"version"`
75         Instances []XAppInstance `json:"instances"`
76 }
77
78 type XAppInstance struct {
79         Name       string   `json:"name"`
80         Status     string   `json:"status"`
81         Ip         string   `json:"ip"`
82         Port       uint16   `json:"port"`
83         TxMessages []string `json:"txMessages"`
84         RxMessages []string `json:"rxMessages"`
85         Policies   []int32  `json:"policies"`
86 }
87
88 type PlatformComponents []struct {
89         Name string `json:"name"`
90         Fqdn string `json:"fqdn"`
91         Port uint16 `json:"port"`
92 }
93
94 type E2TInstance struct {
95         Name string `json:"name"`
96         Fqdn string `json:"fqdn"`
97         Ranlist []string `json:"ranlist"`
98 }
99
100 type E2tIdentity struct {
101         E2taddress string `json:"e2tAddress"`
102         Rannames []string `json:"ranNames"`
103 }
104
105 type ConfigRtmgr struct {
106         Pcs PlatformComponents `json:"PlatformComponents"`
107 }
108
109
110 type MessageTypeIdentifier struct {
111         Mit []string `json:"messagetypes"`
112 }
113
114
115 type RicComponents struct {
116         XApps []XApp
117         E2Ts  map [string]E2TInstance
118         MeidMap  []string
119         Pcs   PlatformComponents
120 }
121
122 type Subscription struct {
123         SubID int32
124         Fqdn string
125         Port uint16
126 }
127
128 type PlatformRoutes []struct {
129        MessageType     string `json:"messagetype"`
130        SenderEndPoint  string `json:"senderendpoint"`
131        SubscriptionId  int32  `json:"subscriptionid"`
132        EndPoint        string `json:"endpoint"`
133        Meid            string `json:"meid"`
134 }
135
136 type RtmgrRoutes struct {
137        Prs PlatformRoutes      `json:"PlatformRoutes"`
138 }
139
140 type FqDn struct {
141         Address *string
142         Port *uint16
143 }
144
145 type XappList struct {
146         SubscriptionID  uint16
147         FqdnList []FqDn
148 }
149
150 var (
151         Rtmgr_ready bool
152 )