Documentation
¶
Overview ¶
Package gobgp implements a three-tier BGP network stack using the GoBGP library as a pure-Go replacement for FRR.
Architecture:
- Tier 1 (Underlay): eBGP peering with leaf switches for VXLAN reachability
- Tier 2 (Overlay): EVPN Type-5 routes with VXLAN encapsulation
- Tier 3 (IPMI): Optional L3 path to the BMC (not yet implemented)
Supported BGP session modes (PeerMode):
- Unnumbered: link-local interface peers (IPv4 + L2VPN-EVPN)
- Dual: unnumbered underlay (IPv4) + numbered peers (L2VPN-EVPN)
- Numbered: explicit neighbor IPs only (IPv4 + L2VPN-EVPN), requires DHCP or static underlay for initial connectivity
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ASN uint32 // Local BGP autonomous system number
RouterID string // BGP router ID (underlay IP)
ListenPort int32 // BGP listen port (default: 179)
ProvisionVNI int // VXLAN VNI for provisioning network
ProvisionIP string // IP/mask for provision bridge
ProvisionGateway string // Gateway VTEP IP for VXLAN BUM flooding
DNSResolvers string // Comma-separated DNS servers
BridgeName string // Bridge device name (default: "br.provision")
VRFName string // VRF name (default: empty, same as FRR)
VRFTableID uint32 // Routing table ID for VRF (default: 1000)
MTU int // Physical interface MTU (default: 9000)
KeepaliveInterval uint64 // BGP keepalive seconds (default: 3)
HoldTime uint64 // BGP hold timer seconds (default: 9)
ConnectRetry uint64 // BGP connect retry seconds (default: 5)
OverlayIP string // Overlay loopback IP (derived or same as RouterID)
BridgeMAC string // Derived MAC for provision bridge
IPMIMAC string // IPMI MAC for bridge MAC derivation
PeerMode network.PeerMode // BGP session establishment mode
NeighborAddrs []string // Explicit numbered peer IPs (dual/numbered modes)
RemoteASN uint32 // Remote ASN for numbered peers (0 = same ASN → iBGP)
EnableL2 bool // Enable L2 EVPN overlay (gate Type-2/3 route handling)
}
Config holds GoBGP three-tier stack configuration.
func NewConfig ¶
NewConfig creates a GoBGP Config from network configuration. It derives addresses using the shared FRR address-derivation logic and applies GoBGP-specific defaults (aggressive hold timers, no BFD).
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults fills in default values for unset fields. GoBGP uses aggressive hold timers (3s/9s) instead of BFD for fast failover.
type OverlayTier ¶
type OverlayTier struct {
// contains filtered or unexported fields
}
OverlayTier manages EVPN Type-5 routes and VXLAN encapsulation. When EnableL2 is set, it also handles Type-2 (MAC/IP) and Type-3 (Inclusive Multicast) routes for L2 overlay use cases.
func NewOverlayTier ¶
func NewOverlayTier(cfg *Config) *OverlayTier
NewOverlayTier creates a new overlay tier.
func (*OverlayTier) CreateVRF ¶
func (o *OverlayTier) CreateVRF() error
CreateVRF creates the VRF interface if VRFName is configured. Called by Stack before underlay setup so that dummy/NICs can be assigned.
func (*OverlayTier) Ready ¶
Ready waits until the overlay is operational by checking EVPN route state.
func (*OverlayTier) SetBgpServer ¶
func (o *OverlayTier) SetBgpServer(s *server.BgpServer)
SetBgpServer sets the shared BGP server from the underlay tier.
func (*OverlayTier) Setup ¶
func (o *OverlayTier) Setup(ctx context.Context) error
Setup creates VXLAN, bridge, and advertises the provision subnet as an EVPN Type-5 (IP Prefix) route so the fabric can route to this node. Incoming Type-5 routes from the fabric are installed as kernel routes by watchRoutes. VRF creation is handled by the stack before setup.
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack composes underlay and overlay tiers into a network.Mode implementation.
func (*Stack) Setup ¶
Setup initializes the underlay and overlay tiers sequentially. The cfg parameter satisfies the network.Mode interface; the stack uses its own Config parsed at construction time.
type Tier ¶
type Tier interface {
// Setup configures the tier's networking resources.
Setup(ctx context.Context) error
// Ready waits for the tier to become operational.
Ready(ctx context.Context, timeout time.Duration) error
// Teardown removes the tier's networking resources.
Teardown(ctx context.Context) error
}
Tier represents a single concern in the network stack.
type UnderlayTier ¶
type UnderlayTier struct {
// contains filtered or unexported fields
}
UnderlayTier manages BGP peering for VXLAN reachability. Depending on PeerMode it establishes unnumbered (link-local), numbered (explicit IP), or a combination of both session types.
func NewUnderlayTier ¶
func NewUnderlayTier(cfg *Config) *UnderlayTier
NewUnderlayTier creates a new underlay tier.
func (*UnderlayTier) BgpServer ¶
func (u *UnderlayTier) BgpServer() *server.BgpServer
BgpServer returns the shared BGP server for the overlay tier.
func (*UnderlayTier) NICs ¶
func (u *UnderlayTier) NICs() []string
NICs returns the detected physical NICs.