Documentation ¶
Index ¶
- Constants
- type BGPPath
- func (b *BGPPath) ClusterListString() string
- func (b *BGPPath) CommunitiesString() string
- func (b *BGPPath) Compare(c *BGPPath) bool
- func (b *BGPPath) ComputeHash() string
- func (b *BGPPath) ComputeHashWithPathID() string
- func (b *BGPPath) Copy() *BGPPath
- func (b *BGPPath) Dedup() *BGPPath
- func (b *BGPPath) ECMP(c *BGPPath) bool
- func (b *BGPPath) Equal(c *BGPPath) bool
- func (b *BGPPath) LargeCommunitiesString() string
- func (b *BGPPath) Length() uint16
- func (b *BGPPath) Prepend(asn uint32, times uint16)
- func (b *BGPPath) Print() string
- func (b *BGPPath) Select(c *BGPPath) int8
- func (b *BGPPath) String() string
- func (b *BGPPath) ToProto() *api.BGPPath
- type BGPPathA
- type BGPPathCounter
- type BGPPathManager
- type FIBPath
- type Path
- type Route
- func (r *Route) AddPath(p *Path)
- func (r *Route) Addr() *net.IP
- func (r *Route) BestPath() *Path
- func (r *Route) Copy() *Route
- func (r *Route) ECMPPathCount() uint
- func (r *Route) ECMPPaths() []*Path
- func (r *Route) Equal(other *Route) bool
- func (r *Route) GetBGPOriginatingAS() *uint32
- func (r *Route) IsBGPOriginatedBy(asn uint32) bool
- func (r *Route) PathSelection()
- func (r *Route) Paths() []*Path
- func (r *Route) Pfxlen() uint8
- func (r *Route) Prefix() *net.Prefix
- func (r *Route) Print() string
- func (r *Route) RemovePath(p *Path) int
- func (r *Route) ReplacePath(old *Path, new *Path) error
- func (r *Route) ToProto() *api.Route
- type StaticPath
Constants ¶
const ( // StaticPathType indicators a path is a static path StaticPathType // BGPPathType indicates a path is a BGP path BGPPathType // OSPFPathType indicates a path is an OSPF path OSPFPathType // ISISPathType indicates a path is an ISIS path ISISPathType // FIBPathType indicates a path is a FIB path FIBPathType )
const (
ProtoBio = 45 // bio
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BGPPath ¶
type BGPPath struct { BGPPathA *BGPPathA ASPath *types.ASPath ClusterList *types.ClusterList Communities *types.Communities LargeCommunities *types.LargeCommunities UnknownAttributes []types.UnknownPathAttribute PathIdentifier uint32 ASPathLen uint16 }
BGPPath represents a set of BGP path attributes
func BGPPathFromProtoBGPPath ¶
BGPPathFromProtoBGPPath converts a proto BGPPath to BGPPath
func (*BGPPath) ClusterListString ¶
ClusterListString returns the formated ClusterList
func (*BGPPath) CommunitiesString ¶
CommunitiesString returns the formated communities
func (*BGPPath) ComputeHash ¶
ComputeHash computes an hash over all attributes of the path
func (*BGPPath) ComputeHashWithPathID ¶
ComputeHash computes an hash over all attributes of the path
func (*BGPPath) LargeCommunitiesString ¶
LargeCommunitiesString returns the formated communities
type BGPPathA ¶
type BGPPathA struct { NextHop *bnet.IP Source *bnet.IP LocalPref uint32 MED uint32 BGPIdentifier uint32 OriginatorID uint32 Aggregator *types.Aggregator EBGP bool AtomicAggregate bool Origin uint8 }
BGPPathA represents cachable BGP path attributes
type BGPPathCounter ¶
type BGPPathCounter struct {
// contains filtered or unexported fields
}
BGPPathCounter couples a counter to a particular path
type BGPPathManager ¶
type BGPPathManager struct {
// contains filtered or unexported fields
}
BGPPathManager is a component used to deduplicate BGP Path objects
func NewBGPPathManager ¶
func NewBGPPathManager() *BGPPathManager
NewBGPPathManager creates a new BGP Path Manager
func (*BGPPathManager) AddPath ¶
func (m *BGPPathManager) AddPath(p BGPPath) *BGPPath
AddPath adds a path to the cache if it doesn't exist. If it exist a pointer to the cached object is returned.
func (*BGPPathManager) RemovePath ¶
func (m *BGPPathManager) RemovePath(p BGPPath)
RemovePath notifies us that there is one user less for path p
type FIBPath ¶
type FIBPath struct { Src *bnet.IP NextHop *bnet.IP // GW Priority int Protocol int Type int Table int Kernel bool // True if the route is already installed in the kernel }
FIBPath represents a path learned via Netlink of a route
func NewNlPathFromBgpPath ¶
NewNlPathFromBgpPath creates a new FIBPath object from a BGPPath object
type Path ¶
type Path struct { Type uint8 PostPolicy bool // PostPolicy fields is a hack used in BMP to differentiate between pre/post policy routes (L flag of the per peer header) StaticPath *StaticPath BGPPath *BGPPath FIBPath *FIBPath }
Path represents a network path
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route links a prefix to paths
func NewRouteAddPath ¶
NewRouteAddPath generates a new route with paths p
func RouteFromProtoRoute ¶
RouteFromProtoRoute converts a proto Route to a Route
func (*Route) ECMPPathCount ¶
ECMPPathCount returns the count of ecmp paths for route r
func (*Route) GetBGPOriginatingAS ¶
func (*Route) IsBGPOriginatedBy ¶
func (*Route) PathSelection ¶
func (r *Route) PathSelection()
PathSelection recalculates the best path + active paths
func (*Route) RemovePath ¶
RemovePath removes path `p` from route `r`. Returns length of path list after removing path `p`
func (*Route) ReplacePath ¶
ReplacePath replace path old with new
type StaticPath ¶
StaticPath represents a static path of a route
func StaticPathFromProtoStaticPath ¶
func StaticPathFromProtoStaticPath(pb *api.StaticPath, dedup bool) *StaticPath
StaticPathFromProtoStaticPath converts a proto StaticPath to StaticPath
func (*StaticPath) Compare ¶
func (s *StaticPath) Compare(t *StaticPath) bool
Compare checks if paths a and t are the same
func (*StaticPath) Copy ¶
func (s *StaticPath) Copy() *StaticPath
func (*StaticPath) ECMP ¶
func (s *StaticPath) ECMP(t *StaticPath) bool
ECMP determines if path s and t are equal in terms of ECMP
func (*StaticPath) Equal ¶
func (s *StaticPath) Equal(t *StaticPath) bool
Equal returns true if s and t are euqal
func (*StaticPath) Select ¶
func (s *StaticPath) Select(t *StaticPath) int8
Select returns negative if s < t, 0 if paths are equal, positive if s > t
func (*StaticPath) ToProto ¶
func (s *StaticPath) ToProto() *api.StaticPath
ToProto converts StaticPath to proto static path