Making Route Distribution Synchronous
[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 //TODO: uuid is not a real UUID but a string of "ip:port"
45 // this should be changed to real UUID later on which should come from xApp Manager // petszila
46 type Endpoint struct {
47         Uuid       string
48         Name       string
49         XAppType   string
50         Ip         string
51         Port       uint16
52         TxMessages []string
53         RxMessages []string
54         Policies   []int32
55         Socket     interface{}
56         IsReady    bool
57         Keepalive  bool
58         Whid       int
59 }
60
61 type RouteTableEntry struct {
62         MessageType string
63         TxList      EndpointList
64         RxGroups    []EndpointList
65         SubID       int32
66         RouteType   string
67 }
68
69 type XApp struct {
70         Name      string         `json:"name"`
71         Status    string         `json:"status"`
72         Version   string         `json:"version"`
73         Instances []XAppInstance `json:"instances"`
74 }
75
76 type XAppInstance struct {
77         Name       string   `json:"name"`
78         Status     string   `json:"status"`
79         Ip         string   `json:"ip"`
80         Port       uint16   `json:"port"`
81         TxMessages []string `json:"txMessages"`
82         RxMessages []string `json:"rxMessages"`
83         Policies   []int32  `json:"policies"`
84 }
85
86 type PlatformComponents []struct {
87         Name string `json:"name"`
88         Fqdn string `json:"fqdn"`
89         Port uint16 `json:"port"`
90 }
91
92 type E2TInstance struct {
93         Name string `json:"name"`
94         Fqdn string `json:"fqdn"`
95         Ranlist []string `json:"ranlist"`
96 }
97
98 type E2tIdentity struct {
99         E2taddress string `json:"e2tAddress"`
100         Rannames []string `json:"ranNames"`
101 }
102
103 type ConfigRtmgr struct {
104         Pcs PlatformComponents `json:"PlatformComponents"`
105 }
106
107
108 type MessageTypeIdentifier struct {
109         Mit []string `json:"messagetypes"`
110 }
111
112
113 type RicComponents struct {
114         XApps []XApp
115         E2Ts  map [string]E2TInstance
116         MeidMap  []string
117         Pcs   PlatformComponents
118 }
119
120 type Subscription struct {
121         SubID int32
122         Fqdn string
123         Port uint16
124 }
125
126 type PlatformRoutes []struct {
127        MessageType     string `json:"messagetype"`
128        SenderEndPoint  string `json:"senderendpoint"`
129        SubscriptionId  int32  `json:"subscriptionid"`
130        EndPoint        string `json:"endpoint"`
131        Meid            string `json:"meid"`
132 }
133
134 type RtmgrRoutes struct {
135        Prs PlatformRoutes      `json:"PlatformRoutes"`
136 }
137
138 type FqDn struct {
139         Address *string
140         Port *uint16
141 }
142
143 type XappList struct {
144         SubscriptionID  uint16
145         FqdnList []FqDn
146 }
147
148 var (
149         Rtmgr_ready bool
150 )