Skip to content

Commit b5193db

Browse files
committed
feat: Extend GatewayStatus with BGP status info
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
1 parent a9e8682 commit b5193db

File tree

4 files changed

+412
-0
lines changed

4 files changed

+412
-0
lines changed

api/gwint/v1alpha1/gatewayagent_types.go

Lines changed: 51 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,55 @@ 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+
type BGPNeighborStatus struct {
116+
Enabled bool `json:"enabled,omitempty"`
117+
LocalAS uint32 `json:"localAs,omitempty"`
118+
PeerAS uint32 `json:"peerAs,omitempty"`
119+
PeerPort uint32 `json:"peerPort,omitempty"`
120+
PeerGroup string `json:"peerGroup,omitempty"`
121+
RemoteRouterID string `json:"remoteRouterId,omitempty"`
122+
SessionState string `json:"sessionState,omitempty"` // "idle|connect|active|open|established|unset"
123+
ConnectionsDropped uint64 `json:"connectionsDropped,omitempty"`
124+
EstablishedTransitions uint64 `json:"establishedTransitions,omitempty"`
125+
LastResetReason string `json:"lastResetReason,omitempty"`
126+
127+
Messages *BGPMessages `json:"messages,omitempty"`
128+
Ipv4UnicastPrefixes *BGPNeighborPrefixes `json:"ipv4UnicastPrefixes,omitempty"`
129+
Ipv6UnicastPrefixes *BGPNeighborPrefixes `json:"ipv6UnicastPrefixes,omitempty"`
130+
L2vpnEvpnPrefixes *BGPNeighborPrefixes `json:"l2vpnEvpnPrefixes,omitempty"`
131+
}
132+
133+
type BGPMessages struct {
134+
Received *BGPMessageCounters `json:"received,omitempty"`
135+
Sent *BGPMessageCounters `json:"sent,omitempty"`
136+
}
137+
138+
type BGPMessageCounters struct {
139+
Capability uint64 `json:"capability,omitempty"`
140+
Keepalive uint64 `json:"keepalive,omitempty"`
141+
Notification uint64 `json:"notification,omitempty"`
142+
Open uint64 `json:"open,omitempty"`
143+
RouteRefresh uint64 `json:"routeRefresh,omitempty"`
144+
Update uint64 `json:"update,omitempty"`
145+
}
146+
147+
type BGPNeighborPrefixes struct {
148+
Received uint32 `json:"received,omitempty"`
149+
ReceivedPrePolicy uint32 `json:"receivedPrePolicy,omitempty"`
150+
Sent uint32 `json:"sent,omitempty"`
151+
}
152+
102153
// +kubebuilder:object:root=true
103154
// +kubebuilder:subresource:status
104155
// +kubebuilder:resource:categories=hedgehog;hedgehog-gateway,shortName=gwag

api/gwint/v1alpha1/zz_generated.deepcopy.go

Lines changed: 139 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: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,129 @@ 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+
peerGroup:
435+
type: string
436+
peerPort:
437+
format: int32
438+
type: integer
439+
remoteRouterId:
440+
type: string
441+
sessionState:
442+
type: string
443+
type: object
444+
description: Neighbors keyed by an ip address string
445+
type: object
446+
type: object
447+
description: VRFs keyed by VRF name (e.g. "default", "vrfVvpc-1")
448+
type: object
449+
type: object
327450
dataplane:
328451
description: Dataplane is the status of the dataplane
329452
properties:

0 commit comments

Comments
 (0)