types

package
v1.14.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CommonPaths contains common path structure values appearing in the agent code
	CommonPaths = []struct {
		Name string
		Path Path
	}{
		{
			Name: "IPv4 unicast advertisement",
			Path: Path{
				NLRI: prefixV4,
				PathAttributes: []bgp.PathAttributeInterface{
					originAttribute,
					nextHopAttribute,
				},
			},
		},
		{
			Name: "IPv6 unicast advertisement",
			Path: Path{
				NLRI: prefixV6,
				PathAttributes: []bgp.PathAttributeInterface{
					originAttribute,
					mpReachNLRIAttribute,
				},
			},
		},
	}
)

Functions

func CanAdvertisePodCIDR added in v1.14.9

func CanAdvertisePodCIDR(ipam string) bool

CanAdvertisePodCIDR returns true if the provided IPAM mode is supported for advertising PodCIDR

Types

type Advertisement struct {
	Prefix        netip.Prefix
	GoBGPPathUUID []byte // path identifier in underlying implementation
}

Advertisement is a container object which associates a netip.Prefix

The `Prefix` field makes comparing this Advertisement with another Prefix encoded prefixes simple.

The `GoBGPPathUUID` field is a gobgp.AddPathResponse.Uuid object which can be forwarded to gobgp's WithdrawPath method, making withdrawing an advertised route simple.

type Afi

type Afi uint32

Afi is address family identifier

const (
	AfiUnknown Afi = 0
	AfiIPv4    Afi = 1
	AfiIPv6    Afi = 2
	AfiL2VPN   Afi = 25
	AfiLS      Afi = 16388
	AfiOpaque  Afi = 16397
)

func (Afi) String

func (a Afi) String() string

type BGPGlobal

type BGPGlobal struct {
	ASN                   uint32
	RouterID              string
	ListenPort            int32 // When -1 gobgp won't listen on tcp:179
	RouteSelectionOptions *RouteSelectionOptions
}

BGPGlobal contains high level BGP configuration for given instance.

type Family

type Family struct {
	Afi  Afi
	Safi Safi
}

Family holds Address Family Indicator (AFI) and Subsequent Address Family Indicator for Multi-Protocol BGP

type GetBGPResponse

type GetBGPResponse struct {
	Global BGPGlobal
}

GetBGPResponse contains BGP global parameters

type GetPeerStateResponse

type GetPeerStateResponse struct {
	Peers []*models.BgpPeer
}

GetPeerStateResponse contains state of peers configured in given instance

type GetRoutesRequest

type GetRoutesRequest struct {
	// TableType specifies a table type to retrieve
	TableType TableType

	// Family specifies an address family of the table
	Family Family

	// Neighbor specifies which neighbor's table to retrieve. Must be
	// specified when TableTypeAdjRIBIn/Out is specified in TableType.
	Neighbor netip.Addr
}

GetRoutesRequest contains parameters for retrieving routes from the RIB of underlying router

type GetRoutesResponse

type GetRoutesResponse struct {
	Routes []*Route
}

GetRoutesResponse contains routes retrieved from the RIB of underlying router

type NeighborRequest

type NeighborRequest struct {
	Neighbor *v2alpha1api.CiliumBGPNeighbor
	VR       *v2alpha1api.CiliumBGPVirtualRouter
}

NeighborRequest contains neighbor parameters used when enabling or disabling peer

type Path

type Path struct {
	// read/write
	NLRI           bgp.AddrPrefixInterface
	PathAttributes []bgp.PathAttributeInterface

	// readonly
	AgeNanoseconds int64 // time duration in nanoseconds since the Path was created
	Best           bool
	GoBGPPathUUID  []byte // path identifier in underlying implementation
}

Path is an object representing a single routing Path. It is an analogue of GoBGP's Path object, but only contains minimal fields required for Cilium usecases.

type PathRequest

type PathRequest struct {
	Advert Advertisement
}

PathRequest contains parameters for advertising or withdrawing routes

type PathResponse

type PathResponse struct {
	Advert Advertisement
}

PathResponse contains response after advertising the route, underlying implementation will set UUID

type Route

type Route struct {
	Prefix string
	Paths  []*Path
}

Route represents a single route in the RIB of underlying router

type RouteSelectionOptions

type RouteSelectionOptions struct {
	// AdvertiseInactiveRoutes when set will advertise route even if it is not present in RIB
	AdvertiseInactiveRoutes bool
}

RouteSelectionOptions contains generic BGP route selection tuning parameters

type Router

type Router interface {
	Stop()

	// AddNeighbor configures BGP peer
	AddNeighbor(ctx context.Context, n NeighborRequest) error

	// UpdateNeighbor updates BGP peer
	UpdateNeighbor(ctx context.Context, n NeighborRequest) error

	// RemoveNeighbor removes BGP peer
	RemoveNeighbor(ctx context.Context, n NeighborRequest) error

	// AdvertisePath advertises BGP route to all configured peers
	AdvertisePath(ctx context.Context, p PathRequest) (PathResponse, error)

	// WithdrawPath  removes BGP route from all peers
	WithdrawPath(ctx context.Context, p PathRequest) error

	// GetPeerState returns status of BGP peers
	GetPeerState(ctx context.Context) (GetPeerStateResponse, error)

	// GetRoutes retrieves routes from the RIB of underlying router
	GetRoutes(ctx context.Context, r *GetRoutesRequest) (*GetRoutesResponse, error)

	// GetBGP returns configured BGP global parameters
	GetBGP(ctx context.Context) (GetBGPResponse, error)
}

Router is vendor-agnostic cilium bgp configuration layer. Parameters of this layer are standard BGP RFC complaint and not specific to any underlying implementation.

type Safi

type Safi uint32

Safi is subsequent address family identifier

const (
	SafiUnknown                Safi = 0
	SafiUnicast                Safi = 1
	SafiMulticast              Safi = 2
	SafiMplsLabel              Safi = 4
	SafiEncapsulation          Safi = 7
	SafiVpls                   Safi = 65
	SafiEvpn                   Safi = 70
	SafiLs                     Safi = 71
	SafiSrPolicy               Safi = 73
	SafiMup                    Safi = 85
	SafiMplsVpn                Safi = 128
	SafiMplsVpnMulticast       Safi = 129
	SafiRouteTargetConstraints Safi = 132
	SafiFlowSpecUnicast        Safi = 133
	SafiFlowSpecVpn            Safi = 134
	SafiKeyValue               Safi = 241
)

func (Safi) String

func (s Safi) String() string

type ServerParameters

type ServerParameters struct {
	Global BGPGlobal
}

ServerParameters contains information for underlying bgp implementation layer to initializing BGP process.

type SessionState

type SessionState uint32

SessionState as defined in rfc4271#section-8.2.2

const (
	SessionUnknown SessionState = iota
	SessionIdle
	SessionConnect
	SessionActive
	SessionOpenSent
	SessionOpenConfirm
	SessionEstablished
)

func (SessionState) String

func (s SessionState) String() string

type TableType

type TableType int

TableType specifies the routing table type of underlying router

const (
	TableTypeUnknown TableType = iota
	TableTypeLocRIB
	TableTypeAdjRIBIn
	TableTypeAdjRIBOut
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL