frr

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ReloadSuccess = "success"

Variables

This section is empty.

Functions

func ParseRoutes

func ParseRoutes(vtyshRes string) (map[string]Route, error)

parseRoute takes the result of a show bgp ipv4 / ipv6 and parses the informations related to all the routes.

func ParseVRFs

func ParseVRFs(vtyshRes string) ([]string, error)

Types

type AllowedIn

type AllowedIn struct {
	All        bool
	PrefixesV4 []IncomingFilter
	PrefixesV6 []IncomingFilter
}

func (*AllowedIn) AllPrefixes

func (a *AllowedIn) AllPrefixes() []IncomingFilter

type AllowedOut

type AllowedOut struct {
	PrefixesV4 []OutgoingFilter
	PrefixesV6 []OutgoingFilter
}

func (*AllowedOut) AllPrefixes

func (a *AllowedOut) AllPrefixes() []OutgoingFilter

type BFDPeer

type BFDPeer struct {
	Multihop                  bool   `json:"multihop"`
	Peer                      string `json:"peer"`
	Local                     string `json:"local"`
	Vrf                       string `json:"vrf"`
	Interface                 string `json:"interface"`
	ID                        int    `json:"id"`
	RemoteID                  int64  `json:"remote-id"`
	PassiveMode               bool   `json:"passive-mode"`
	Status                    string `json:"status"`
	Uptime                    int    `json:"uptime"`
	Diagnostic                string `json:"diagnostic"`
	RemoteDiagnostic          string `json:"remote-diagnostic"`
	ReceiveInterval           int    `json:"receive-interval"`
	TransmitInterval          int    `json:"transmit-interval"`
	EchoReceiveInterval       int    `json:"echo-receive-interval"`
	EchoTransmitInterval      int    `json:"echo-transmit-interval"`
	DetectMultiplier          int    `json:"detect-multiplier"`
	RemoteReceiveInterval     int    `json:"remote-receive-interval"`
	RemoteTransmitInterval    int    `json:"remote-transmit-interval"`
	RemoteEchoInterval        int    `json:"remote-echo-interval"`
	RemoteEchoReceiveInterval int    `json:"remote-echo-receive-interval"`
	RemoteDetectMultiplier    int    `json:"remote-detect-multiplier"`
}

func ParseBFDPeers

func ParseBFDPeers(vtyshRes string) ([]BFDPeer, error)

type BFDProfile

type BFDProfile struct {
	Name             string
	ReceiveInterval  *uint32
	TransmitInterval *uint32
	DetectMultiplier *uint32
	EchoInterval     *uint32
	EchoMode         bool
	PassiveMode      bool
	MinimumTTL       *uint32
}

type Config

type Config struct {
	Loglevel    string
	Hostname    string
	Routers     []*RouterConfig
	BFDProfiles []BFDProfile
	ExtraConfig string
}

type ConfigHandler

type ConfigHandler interface {
	ApplyConfig(config *Config) error
}

type FRR

type FRR struct {
	Status Status

	sync.Mutex
	// contains filtered or unexported fields
}

func NewFRR

func NewFRR(ctx context.Context, onStatusChanged StatusChanged, logger log.Logger, logLevel logging.Level) *FRR

func (*FRR) ApplyConfig

func (f *FRR) ApplyConfig(config *Config) error

func (*FRR) GetStatus

func (f *FRR) GetStatus() Status

type FRRNeighbor

type FRRNeighbor struct {
	RemoteAs          int          `json:"remoteAs"`
	LocalAs           int          `json:"localAs"`
	RemoteRouterID    string       `json:"remoteRouterId"`
	BgpVersion        int          `json:"bgpVersion"`
	BgpState          string       `json:"bgpState"`
	PortForeign       int          `json:"portForeign"`
	MsgStats          MessageStats `json:"messageStats"`
	VRFName           string       `json:"vrf"`
	AddressFamilyInfo map[string]struct {
		SentPrefixCounter     int `json:"sentPrefixCounter"`
		AcceptedPrefixCounter int `json:"acceptedPrefixCounter"`
	} `json:"addressFamilyInfo"`
}

type FRRRoute

type FRRRoute struct {
	Valid     bool   `json:"valid"`
	PeerID    string `json:"peerId"`
	LocalPref uint32 `json:"locPrf"`
	Origin    string `json:"origin"`
	Nexthops  []struct {
		IP    string `json:"ip"`
		Scope string `json:"scope"`
	} `json:"nexthops"`
}

type IPInfo

type IPInfo struct {
	Routes map[string][]FRRRoute `json:"routes"`
}

type IncomingFilter

type IncomingFilter struct {
	IPFamily ipfamily.Family
	Prefix   string
	LE       uint32
	GE       uint32
}

func (IncomingFilter) LessThan

func (i IncomingFilter) LessThan(i1 IncomingFilter) bool

func (IncomingFilter) Matcher

func (i IncomingFilter) Matcher() string

type MessageStats

type MessageStats struct {
	OpensSent          int `json:"opensSent"`
	OpensReceived      int `json:"opensRecv"`
	NotificationsSent  int `json:"notificationsSent"`
	UpdatesSent        int `json:"updatesSent"`
	UpdatesReceived    int `json:"updatesRecv"`
	KeepalivesSent     int `json:"keepalivesSent"`
	KeepalivesReceived int `json:"keepalivesRecv"`
	RouteRefreshSent   int `json:"routeRefreshSent"`
	TotalSent          int `json:"totalSent"`
	TotalReceived      int `json:"totalRecv"`
}

type Neighbor

type Neighbor struct {
	IP             net.IP
	VRF            string
	Connected      bool
	LocalAS        string
	RemoteAS       string
	PrefixSent     int
	PrefixReceived int
	Port           int
	RemoteRouterID string
	MsgStats       MessageStats
}

func ParseNeighbour

func ParseNeighbour(vtyshRes string) (*Neighbor, error)

parseNeighbour takes the result of a show bgp neighbor x.y.w.z and parses the informations related to the neighbour.

func ParseNeighbours

func ParseNeighbours(vtyshRes string) ([]*Neighbor, error)

parseNeighbour takes the result of a show bgp neighbor and parses the informations related to all the neighbours.

type NeighborConfig

type NeighborConfig struct {
	IPFamily      ipfamily.Family
	Name          string
	ASN           uint32
	SrcAddr       string
	Addr          string
	Port          *uint16
	HoldTime      *uint64
	KeepaliveTime *uint64
	Password      string
	BFDProfile    string
	EBGPMultiHop  bool
	VRFName       string
	Incoming      AllowedIn
	Outgoing      AllowedOut
	AlwaysBlock   []IncomingFilter
}

func (*NeighborConfig) ID

func (n *NeighborConfig) ID() string

type OutgoingFilter

type OutgoingFilter struct {
	IPFamily         ipfamily.Family
	Prefix           string
	Communities      []string
	LargeCommunities []string
	LocalPref        uint32
}

type Route

type Route struct {
	Destination *net.IPNet
	NextHops    []net.IP
	LocalPref   uint32
	Origin      string
}

type RouterConfig

type RouterConfig struct {
	MyASN        uint32
	RouterID     string
	Neighbors    []*NeighborConfig
	VRF          string
	IPV4Prefixes []string
	IPV6Prefixes []string
}

type Status

type Status struct {
	Current          string
	LastReloadResult string
	// contains filtered or unexported fields
}

type StatusChanged

type StatusChanged func()

type StatusFetcher

type StatusFetcher interface {
	GetStatus() Status
}

Jump to

Keyboard shortcuts

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