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