server

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 28 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// Administrative events
	ManualStart                               = 1
	ManualStop                                = 2
	AutomaticStart                            = 3
	ManualStartWithPassiveTcpEstablishment    = 4
	AutomaticStartWithPassiveTcpEstablishment = 5
	AutomaticStop                             = 8
	Cease                                     = 100
)
View Source
const (
	// BGP Role configuration, these values will be translated into values defined by the RFC on peer setup
	PeerConfigRoleOff      = 0
	PeerConfigRoleProvider = 1
	PeerConfigRoleRS       = 2
	PeerConfigRoleRSClient = 3
	PeerConfigRoleCustomer = 4
	PeerConfigRolePeer     = 5
)
View Source
const (
	BGPVersion            = 4
	DefaultLocaPreference = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressFamilyConfig

type AddressFamilyConfig struct {
	ImportFilterChain filter.Chain
	ExportFilterChain filter.Chain
	AddPathSend       routingtable.ClientOptions
	AddPathRecv       bool
}

AddressFamilyConfig represents all configuration parameters specific for an address family

type BGPAPIServer

type BGPAPIServer struct {
	api.UnimplementedBgpServiceServer
	// contains filtered or unexported fields
}

func NewBGPAPIServer

func NewBGPAPIServer(s BGPServer, vrfReg *vrf.VRFRegistry) *BGPAPIServer

NewBGPAPIServer creates a new BGP API Server

func (*BGPAPIServer) DumpRIBIn

DumpRIBIn dumps the RIB in of a peer for a given AFI/SAFI

func (*BGPAPIServer) DumpRIBOut

DumpRIBOut dumps the RIB out of a peer for a given AFI/SAFI

func (*BGPAPIServer) ListSessions

type BGPServer

type BGPServer interface {
	RouterID() uint32
	Start()
	AddPeer(PeerConfig) error
	GetPeerConfig(*vrf.VRF, *bnet.IP) *PeerConfig
	DisposePeer(*vrf.VRF, *bnet.IP)
	GetPeers() []PeerKey
	Metrics() (*metrics.BGPMetrics, error)
	GetRIBIn(vrf *vrf.VRF, peerIP *bnet.IP, afi uint16, safi uint8) *adjRIBIn.AdjRIBIn
	GetRIBOut(vrf *vrf.VRF, peerIP *bnet.IP, afi uint16, safi uint8) *adjRIBOut.AdjRIBOut
	ReplaceImportFilterChain(vrf *vrf.VRF, peer *bnet.IP, c filter.Chain) error
	ReplaceExportFilterChain(vrf *vrf.VRF, peer *bnet.IP, c filter.Chain) error
	GetDefaultVRF() *vrf.VRF
	SetListenerManager(lm tcp.ListenerManagerI)
}

func NewBGPServer

func NewBGPServer(config BGPServerConfig) BGPServer

NewBGPServer creates a new instance of BGPServer with the given BGPServerConfig

type BGPServerConfig added in v0.1.8

type BGPServerConfig struct {
	// Mandatory attributes
	RouterID         uint32
	ListenAddrsByVRF map[string][]string
	DefaultVRF       *vrf.VRF

	// Optional attributes
	DefaultLocalPreference *uint32
}

type BMPReceiver added in v0.1.6

type BMPReceiver struct {
	// contains filtered or unexported fields
}

BMPReceiver represents a BMP receiver

func NewBMPReceiver added in v0.1.6

func NewBMPReceiver(cfg BMPReceiverConfig) *BMPReceiver

NewBMPReceiver creates a new BMP receiver

func NewBMPReceiverWithAdjRIBInFactory added in v0.1.6

func NewBMPReceiverWithAdjRIBInFactory(cfg BMPReceiverConfig, adjRIBInFactory adjRIBInFactoryI) *BMPReceiver

func (*BMPReceiver) AddRouter added in v0.1.6

func (b *BMPReceiver) AddRouter(addr net.IP, port uint16, passive bool, dynamic bool) error

AddRouter adds a router to which we connect with BMP

func (*BMPReceiver) Close added in v0.1.6

func (b *BMPReceiver) Close() error

Close tears down all open connections

func (*BMPReceiver) GetRouter added in v0.1.6

func (b *BMPReceiver) GetRouter(name string) RouterInterface

GetRouter gets a router

func (*BMPReceiver) GetRouters added in v0.1.6

func (b *BMPReceiver) GetRouters() []RouterInterface

GetRouters gets all routers

func (*BMPReceiver) Listen added in v0.1.6

func (b *BMPReceiver) Listen(addr string) error

Listen starts a listener for routers to start the BMP connection the listener needs to be closed by calling Close() on the BMPReceiver

func (*BMPReceiver) LocalAddr added in v0.1.6

func (b *BMPReceiver) LocalAddr() net.Addr

LocalAddr returns the local address the receiver is listening to.

func (*BMPReceiver) Metrics added in v0.1.6

func (b *BMPReceiver) Metrics() (*metrics.BMPMetrics, error)

Metrics gets BMP receiver metrics

func (*BMPReceiver) RemoveRouter added in v0.1.6

func (b *BMPReceiver) RemoveRouter(addr net.IP)

RemoveRouter removes a BMP monitored router

func (*BMPReceiver) Serve added in v0.1.6

func (b *BMPReceiver) Serve() error

Serve accepts all incoming connections for the BMP receiver until Close() is called.

type BMPReceiverConfig added in v0.1.6

type BMPReceiverConfig struct {
	KeepalivePeriod  time.Duration
	AcceptAny        bool
	IgnorePeerASNs   []uint32
	IgnorePrePolicy  bool
	IgnorePostPolicy bool
}

type BMPReceiverInterface added in v0.1.6

type BMPReceiverInterface interface {
	GetRouter(rtr string) RouterInterface
	GetRouters() []RouterInterface
}

type FSM

type FSM struct {
	// contains filtered or unexported fields
}

FSM implements the BGP finite state machine (RFC4271)

func NewActiveFSM

func NewActiveFSM(peer *peer) *FSM

NewActiveFSM initiates a new active FSM

func NewPassiveFSM

func NewPassiveFSM(peer *peer, con *net.TCPConn) *FSM

NewPassiveFSM initiates a new passive FSM

type PeerConfig

type PeerConfig struct {
	AuthenticationKey          string
	AdminEnabled               bool
	ReconnectInterval          time.Duration
	KeepAlive                  time.Duration
	HoldTime                   time.Duration
	LocalAddress               *bnet.IP
	PeerAddress                *bnet.IP
	TTL                        uint8
	LocalAS                    uint32
	PeerAS                     uint32
	Passive                    bool
	RouterID                   uint32
	RouteServerClient          bool
	RouteReflectorClient       bool
	RouteReflectorClusterID    uint32
	AdvertiseIPv4MultiProtocol bool
	PeerRole                   uint8
	PeerRoleStrictMode         bool
	IPv4                       *AddressFamilyConfig
	IPv6                       *AddressFamilyConfig
	VRF                        *vrf.VRF
	Description                string
}

PeerConfig defines the configuration for a BGP session

func (*PeerConfig) NeedsRestart

func (pc *PeerConfig) NeedsRestart(x *PeerConfig) bool

NeedsRestart determines if the peer needs a restart on cfg change

type PeerKey added in v0.1.8

type PeerKey struct {
	// contains filtered or unexported fields
}

func (PeerKey) Addr added in v0.1.8

func (pk PeerKey) Addr() *bnet.IP

func (PeerKey) VRF added in v0.1.8

func (pk PeerKey) VRF() *vrf.VRF

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router represents a BMP enabled route in BMP context

func (*Router) Address

func (r *Router) Address() net.IP

Address gets a routers address

func (*Router) GetVRF

func (r *Router) GetVRF(rd uint64) *vrf.VRF

GetVRF get's a VRF

func (*Router) GetVRFs

func (r *Router) GetVRFs() []*vrf.VRF

GetVRFs gets all VRFs

func (*Router) Name

func (r *Router) Name() string

Name gets a routers name

func (*Router) Ready added in v0.1.2

func (r *Router) Ready(vrf uint64, afi uint16) (bool, error)

type RouterConfig added in v0.1.5

type RouterConfig struct {
	Passive          bool
	IgnorePeerASNs   []uint32
	IgnorePrePolicy  bool
	IgnorePostPolicy bool
}

RouterConfig represents the configuration required for BMP router

type RouterInterface

type RouterInterface interface {
	Name() string
	Address() net.IP
	GetVRF(vrfID uint64) *vrf.VRF
	GetVRFs() []*vrf.VRF
	Ready(vrf uint64, afi uint16) (bool, error)
}

type UpdateSender

type UpdateSender struct {
	// contains filtered or unexported fields
}

UpdateSender converts table changes into BGP update messages

func (*UpdateSender) AddPath

func (u *UpdateSender) AddPath(pfx *bnet.Prefix, p *route.Path) error

AddPath adds path p for pfx to toSend queue

func (*UpdateSender) AddPathInitialDump

func (u *UpdateSender) AddPathInitialDump(pfx *bnet.Prefix, p *route.Path) error

func (*UpdateSender) ClientCount

func (u *UpdateSender) ClientCount() uint64

ClientCount is here to satisfy an interface

func (*UpdateSender) Destroy

func (u *UpdateSender) Destroy()

Destroy destroys everything (with greetings to Hatebreed)

func (*UpdateSender) Dispose

func (u *UpdateSender) Dispose()

Dispose is here to fulfill an interface

func (*UpdateSender) Dump

func (u *UpdateSender) Dump() []*route.Route

Dump is here to fulfill an interface

func (*UpdateSender) EndOfRIB added in v0.1.1

func (u *UpdateSender) EndOfRIB()

func (*UpdateSender) RefreshRoute

func (a *UpdateSender) RefreshRoute(*bnet.Prefix, []*route.Path)

RefreshRoute is here to fultill an interface

func (*UpdateSender) Register

func (a *UpdateSender) Register(client routingtable.RouteTableClient)

Register registers a client for updates

func (*UpdateSender) RegisterWithOptions

func (a *UpdateSender) RegisterWithOptions(client routingtable.RouteTableClient, opt routingtable.ClientOptions)

RegisterWithOptions registers a client with options for updates

func (*UpdateSender) RemovePath

func (u *UpdateSender) RemovePath(pfx *bnet.Prefix, p *route.Path) bool

RemovePath withdraws prefix `pfx` from a peer

func (*UpdateSender) ReplaceFilterChain

func (a *UpdateSender) ReplaceFilterChain(c filter.Chain)

ReplaceFilterChain is here to fulfill an interface

func (*UpdateSender) ReplacePath

func (a *UpdateSender) ReplacePath(*bnet.Prefix, *route.Path, *route.Path)

ReplacePath is here to fulfill an interface

func (*UpdateSender) RouteCount

func (u *UpdateSender) RouteCount() int64

RouteCount returns the number of stored routes

func (*UpdateSender) Start

func (u *UpdateSender) Start(aggrTime time.Duration)

Start starts the update sender

func (*UpdateSender) Unregister

func (a *UpdateSender) Unregister(client routingtable.RouteTableClient)

Unregister unregisters a client

func (*UpdateSender) UpdateNewClient

func (u *UpdateSender) UpdateNewClient(client routingtable.RouteTableClient) error

UpdateNewClient does nothing

Jump to

Keyboard shortcuts

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