Skip to content

Commit 93bf6a0

Browse files
committed
feat: Extend GatewayStatus with BGP status info
Signed-off-by: Sergey Matov <[email protected]>
1 parent a9e8682 commit 93bf6a0

File tree

4 files changed

+439
-0
lines changed

4 files changed

+439
-0
lines changed

api/gwint/v1alpha1/gatewayagent_types.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ type GatewayState struct {
6363
VPCs map[string]VPCStatus `json:"vpcs,omitempty"`
6464
// Peerings is the status of the VPCs peerings where key is VPC1->VPC2 and data is for one direction only
6565
Peerings map[string]PeeringStatus `json:"peerings,omitempty"`
66+
// BGP is BGP status derived from BMP/FRR, keyed by VRF
67+
BGP BGPStatus `json:"bgp,omitempty"`
6668
}
6769

6870
// DataplaneStatus represents the status of the dataplane
@@ -99,6 +101,67 @@ type PeeringStatus struct {
99101
PktsPerSecond float64 `json:"pps,omitempty"`
100102
}
101103

104+
// BGPStatus represents BGP status across VRFs, derived from BMP/FRR.
105+
type BGPStatus struct {
106+
// VRFs keyed by VRF name (e.g. "default", "vrfVvpc-1")
107+
VRFs map[string]BGPVRFStatus `json:"vrfs,omitempty"`
108+
}
109+
110+
type BGPVRFStatus struct {
111+
// Neighbors keyed by an ip address string
112+
Neighbors map[string]BGPNeighborStatus `json:"neighbors,omitempty"`
113+
}
114+
115+
// BGPNeighborSessionState represents the BGP FSM state for a neighbor.
116+
// +kubebuilder:validation:Enum=unset;idle;connect;active;open;established
117+
type BGPNeighborSessionState string
118+
119+
const (
120+
BGPStateUnset BGPNeighborSessionState = "unset"
121+
BGPStateIdle BGPNeighborSessionState = "idle"
122+
BGPStateConnect BGPNeighborSessionState = "connect"
123+
BGPStateActive BGPNeighborSessionState = "active"
124+
BGPStateOpen BGPNeighborSessionState = "open"
125+
BGPStateEstablished BGPNeighborSessionState = "established"
126+
)
127+
128+
type BGPNeighborStatus struct {
129+
Enabled bool `json:"enabled,omitempty"`
130+
LocalAS uint32 `json:"localAs,omitempty"`
131+
PeerAS uint32 `json:"peerAs,omitempty"`
132+
RemoteRouterID string `json:"remoteRouterId,omitempty"`
133+
134+
SessionState BGPNeighborSessionState `json:"sessionState,omitempty"`
135+
ConnectionsDropped uint64 `json:"connectionsDropped,omitempty"`
136+
EstablishedTransitions uint64 `json:"establishedTransitions,omitempty"`
137+
LastResetReason string `json:"lastResetReason,omitempty"`
138+
139+
Messages BGPMessages `json:"messages,omitempty"`
140+
IPv4UnicastPrefixes BGPNeighborPrefixes `json:"ipv4UnicastPrefixes,omitempty"`
141+
IPv6UnicastPrefixes BGPNeighborPrefixes `json:"ipv6UnicastPrefixes,omitempty"`
142+
L2VPNEVPNPrefixes BGPNeighborPrefixes `json:"l2vpnEvpnPrefixes,omitempty"`
143+
}
144+
145+
type BGPMessages struct {
146+
Received BGPMessageCounters `json:"received,omitempty"`
147+
Sent BGPMessageCounters `json:"sent,omitempty"`
148+
}
149+
150+
type BGPMessageCounters struct {
151+
Capability uint64 `json:"capability,omitempty"`
152+
Keepalive uint64 `json:"keepalive,omitempty"`
153+
Notification uint64 `json:"notification,omitempty"`
154+
Open uint64 `json:"open,omitempty"`
155+
RouteRefresh uint64 `json:"routeRefresh,omitempty"`
156+
Update uint64 `json:"update,omitempty"`
157+
}
158+
159+
type BGPNeighborPrefixes struct {
160+
Received uint32 `json:"received,omitempty"`
161+
ReceivedPrePolicy uint32 `json:"receivedPrePolicy,omitempty"`
162+
Sent uint32 `json:"sent,omitempty"`
163+
}
164+
102165
// +kubebuilder:object:root=true
103166
// +kubebuilder:subresource:status
104167
// +kubebuilder:resource:categories=hedgehog;hedgehog-gateway,shortName=gwag

api/gwint/v1alpha1/zz_generated.deepcopy.go

Lines changed: 111 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gwint.githedgehog.com_gatewayagents.yaml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,133 @@ spec:
324324
description: State represents collected data from the dataplane API
325325
that includes FRR as well
326326
properties:
327+
bgp:
328+
description: BGP is BGP status derived from BMP/FRR, keyed by
329+
VRF
330+
properties:
331+
vrfs:
332+
additionalProperties:
333+
properties:
334+
neighbors:
335+
additionalProperties:
336+
properties:
337+
connectionsDropped:
338+
format: int64
339+
type: integer
340+
enabled:
341+
type: boolean
342+
establishedTransitions:
343+
format: int64
344+
type: integer
345+
ipv4UnicastPrefixes:
346+
properties:
347+
received:
348+
format: int32
349+
type: integer
350+
receivedPrePolicy:
351+
format: int32
352+
type: integer
353+
sent:
354+
format: int32
355+
type: integer
356+
type: object
357+
ipv6UnicastPrefixes:
358+
properties:
359+
received:
360+
format: int32
361+
type: integer
362+
receivedPrePolicy:
363+
format: int32
364+
type: integer
365+
sent:
366+
format: int32
367+
type: integer
368+
type: object
369+
l2vpnEvpnPrefixes:
370+
properties:
371+
received:
372+
format: int32
373+
type: integer
374+
receivedPrePolicy:
375+
format: int32
376+
type: integer
377+
sent:
378+
format: int32
379+
type: integer
380+
type: object
381+
lastResetReason:
382+
type: string
383+
localAs:
384+
format: int32
385+
type: integer
386+
messages:
387+
properties:
388+
received:
389+
properties:
390+
capability:
391+
format: int64
392+
type: integer
393+
keepalive:
394+
format: int64
395+
type: integer
396+
notification:
397+
format: int64
398+
type: integer
399+
open:
400+
format: int64
401+
type: integer
402+
routeRefresh:
403+
format: int64
404+
type: integer
405+
update:
406+
format: int64
407+
type: integer
408+
type: object
409+
sent:
410+
properties:
411+
capability:
412+
format: int64
413+
type: integer
414+
keepalive:
415+
format: int64
416+
type: integer
417+
notification:
418+
format: int64
419+
type: integer
420+
open:
421+
format: int64
422+
type: integer
423+
routeRefresh:
424+
format: int64
425+
type: integer
426+
update:
427+
format: int64
428+
type: integer
429+
type: object
430+
type: object
431+
peerAs:
432+
format: int32
433+
type: integer
434+
remoteRouterId:
435+
type: string
436+
sessionState:
437+
description: BGPNeighborSessionState represents
438+
the BGP FSM state for a neighbor.
439+
enum:
440+
- unset
441+
- idle
442+
- connect
443+
- active
444+
- open
445+
- established
446+
type: string
447+
type: object
448+
description: Neighbors keyed by an ip address string
449+
type: object
450+
type: object
451+
description: VRFs keyed by VRF name (e.g. "default", "vrfVvpc-1")
452+
type: object
453+
type: object
327454
dataplane:
328455
description: Dataplane is the status of the dataplane
329456
properties:

0 commit comments

Comments
 (0)