master
go 110 lines 2.77 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package cato_networks
4
5 type siteState struct {
6 ID string
7 Name string
8 Description string
9 ConnectivityStatus string
10 OperationalStatus string
11 PopName string
12 SiteType string
13 ConnectionType string
14 CountryCode string
15 CountryName string
16 Region string
17 LastConnected string
18 ConnectedSince string
19 HostCount int64
20
21 Metrics trafficMetrics
22 Interfaces map[string]*interfaceState
23 Devices []deviceState
24 BGPPeers []bgpPeerState
25 }
26
27 type deviceState struct {
28 ID string
29 Identifier string
30 Name string
31 Type string
32 Connected bool
33 HaRole string
34 SocketID string
35 SocketPlatform string
36 SocketSerial string
37 SocketVersion string
38 InternalIP string
39 LastPopName string
40 ConnectedSince string
41 }
42
43 type interfaceState struct {
44 ID string
45 Name string
46 DeviceID string
47 DeviceName string
48 DeviceSocketID string
49 DeviceSocketSerial string
50 Type string
51 DestType string
52 Connected bool
53 PopName string
54 TunnelRemoteIP string
55 TunnelUptime int64
56 UpstreamBandwidth int64
57 DownstreamBandwidth int64
58 PhysicalPort int64
59 LinkUp bool
60 Metrics trafficMetrics
61 }
62
63 type trafficMetricPresence uint16
64
65 const (
66 trafficMetricBytesUpstreamMax trafficMetricPresence = 1 << iota
67 trafficMetricBytesDownstreamMax
68 trafficMetricLostUpstreamPercent
69 trafficMetricLostDownstreamPercent
70 trafficMetricJitterUpstreamMS
71 trafficMetricJitterDownstreamMS
72 trafficMetricPacketsDiscardedUpstream
73 trafficMetricPacketsDiscardedDownstream
74 trafficMetricRTTMS
75 trafficMetricLastMileLatencyMS
76 trafficMetricLastMilePacketLossPercent
77 )
78
79 type trafficMetrics struct {
80 present trafficMetricPresence
81 BytesUpstreamMax float64
82 BytesDownstreamMax float64
83 LostUpstreamPercent float64
84 LostDownstreamPercent float64
85 JitterUpstreamMS float64
86 JitterDownstreamMS float64
87 PacketsDiscardedUpstream float64
88 PacketsDiscardedDownstream float64
89 RTTMS float64
90 LastMileLatencyMS float64
91 LastMilePacketLossPercent float64
92 }
93
94 func (m trafficMetrics) has(metric trafficMetricPresence) bool {
95 return m.present&metric != 0
96 }
97
98 type bgpPeerState struct {
99 RemoteIP string
100 RemoteASN string
101 LocalIP string
102 LocalASN string
103 BGPSession string
104 IncomingState string
105 OutgoingState string
106 RoutesCount int64
107 RoutesCountLimit int64
108 RoutesCountLimitExceeded bool
109 RIBOutRoutes int64
110 }