Skip to content

Commit df40292

Browse files
feat: Implement BFD for BGPPeers
Signed-off-by: Sven Rosenzweig <sven.rosenzweig@sap.com>
1 parent 5458745 commit df40292

17 files changed

Lines changed: 258 additions & 44 deletions

api/core/v1alpha1/bfd_types.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package v1alpha1
5+
6+
import (
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
)
9+
10+
// BFD defines the Bidirectional Forwarding Detection configuration for interfaces, bgp peerings and static routes.
11+
type BFD struct {
12+
// Enabled indicates whether BFD is enabled on the network object.
13+
// +required
14+
Enabled bool `json:"enabled"`
15+
16+
// DesiredMinimumTxInterval is the minimum interval between transmission of BFD control
17+
// packets that the operator desires. This value is advertised to the peer.
18+
// The actual interval used is the maximum of this value and the remote
19+
// required-minimum-receive interval value.
20+
// +optional
21+
// +kubebuilder:validation:Type=string
22+
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
23+
DesiredMinimumTxInterval *metav1.Duration `json:"desiredMinimumTxInterval,omitempty"`
24+
25+
// RequiredMinimumReceive is the minimum interval between received BFD control packets
26+
// that this system should support. This value is advertised to the remote peer to
27+
// indicate the maximum frequency between BFD control packets that is acceptable
28+
// to the local system.
29+
// +optional
30+
// +kubebuilder:validation:Type=string
31+
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
32+
RequiredMinimumReceive *metav1.Duration `json:"requiredMinimumReceive,omitempty"`
33+
34+
// DetectionMultiplier is the number of packets that must be missed to declare
35+
// this session as down. The detection interval for the BFD session is calculated
36+
// by multiplying the value of the negotiated transmission interval by this value.
37+
// +optional
38+
// +kubebuilder:validation:Minimum=1
39+
// +kubebuilder:validation:Maximum=255
40+
DetectionMultiplier *int32 `json:"detectionMultiplier,omitempty"`
41+
}

api/core/v1alpha1/bgp_peer_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ type BGPPeerSpec struct {
6464
// LocalAS configures the local AS number and how it factors into BGP announcements for this peer.
6565
// +optional
6666
LocalAS *LocalAS `json:"localAS,omitempty"`
67+
68+
// BFD defines the Bidirectional Forwarding Detection configuration for the interface.
69+
// BFD is only applicable for Layer 3 interfaces.
70+
// +optional
71+
BFD *BFD `json:"bfd,omitempty"`
6772
}
6873

6974
// LocalAS defines the local AS configuration and how it factors in BGP announcements.

api/core/v1alpha1/interface_types.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -266,39 +266,6 @@ type InterfaceIPv4Unnumbered struct {
266266
InterfaceRef LocalObjectReference `json:"interfaceRef"`
267267
}
268268

269-
// BFD defines the Bidirectional Forwarding Detection configuration for an interface.
270-
type BFD struct {
271-
// Enabled indicates whether BFD is enabled on the interface.
272-
// +required
273-
Enabled bool `json:"enabled"`
274-
275-
// DesiredMinimumTxInterval is the minimum interval between transmission of BFD control
276-
// packets that the operator desires. This value is advertised to the peer.
277-
// The actual interval used is the maximum of this value and the remote
278-
// required-minimum-receive interval value.
279-
// +optional
280-
// +kubebuilder:validation:Type=string
281-
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
282-
DesiredMinimumTxInterval *metav1.Duration `json:"desiredMinimumTxInterval,omitempty"`
283-
284-
// RequiredMinimumReceive is the minimum interval between received BFD control packets
285-
// that this system should support. This value is advertised to the remote peer to
286-
// indicate the maximum frequency between BFD control packets that is acceptable
287-
// to the local system.
288-
// +optional
289-
// +kubebuilder:validation:Type=string
290-
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
291-
RequiredMinimumReceive *metav1.Duration `json:"requiredMinimumReceive,omitempty"`
292-
293-
// DetectionMultiplier is the number of packets that must be missed to declare
294-
// this session as down. The detection interval for the BFD session is calculated
295-
// by multiplying the value of the negotiated transmission interval by this value.
296-
// +optional
297-
// +kubebuilder:validation:Minimum=1
298-
// +kubebuilder:validation:Maximum=255
299-
DetectionMultiplier *int32 `json:"detectionMultiplier,omitempty"`
300-
}
301-
302269
// Ethernet defines the ethernet-specific configuration for physical interfaces.
303270
type Ethernet struct {
304271
// FECMode specifies the Forward Error Correction mode for the interface.

api/core/v1alpha1/zz_generated.deepcopy.go

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

charts/network-operator/templates/crd/bgppeers.networking.metal.ironcore.dev.yaml

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

charts/network-operator/templates/crd/interfaces.networking.metal.ironcore.dev.yaml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/networking.metal.ironcore.dev_bgppeers.yaml

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

config/crd/bases/networking.metal.ironcore.dev_interfaces.yaml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api-reference/index.md

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

internal/provider/cisco/iosxr/bgp_peer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ type BGPPeer struct {
7171
Name string `json:"vrf-name"`
7272
RD RouteDistinguisher `json:"rd,omitzero"`
7373
Neighbors NeighborList `json:"neighbors,omitzero"`
74+
BFD *BFD `json:"bfd,omitzero"`
75+
}
76+
77+
type BFD struct {
78+
MinInterval uint32 `json:"minimum-interval,omitempty"`
79+
Multiplier uint32 `json:"multiplier,omitempty"`
7480
}
7581

7682
// ActivatedAddressFamilies is required for IOS XR to activate the Address-Family under the BGP process

0 commit comments

Comments
 (0)