types

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 6 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

This section is empty.

Types

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) FromString

func (a *Afi) FromString(s string) error

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
	UUID           []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.

func NewPathForPrefix

func NewPathForPrefix(prefix netip.Prefix) (path *Path)

NewPathForPrefix returns a Path that can be used to advertise the provided IP prefix by the underlying BGP implementation.

The prefix can be either IPv4 or IPv6 and this function will handle the differences between MP BGP and BGP.

The next hop of the path will always be set to "0.0.0.0" for IPv4 and "::" for IPv6, so the underlying BGP implementation selects appropriate actual nexthop address when advertising it.

type PathRequest

type PathRequest struct {
	Path *Path
}

PathRequest contains parameters for advertising or withdrawing a Path

type PathResponse

type PathResponse struct {
	Path *Path
}

PathResponse contains response after advertising the Path, the returned Path can be used for withdrawing the Path (based on UUID set by the underlying implementation)

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 Path to all configured peers
	AdvertisePath(ctx context.Context, p PathRequest) (PathResponse, error)

	// WithdrawPath  removes BGP Path 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) FromString

func (s *Safi) FromString(safi string) error

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