Documentation ¶
Index ¶
- Constants
- Variables
- func CanImportToVrf(v *Vrf, path *Path) bool
- func CidrToRadixkey(cidr string) string
- func CreateUpdateMsgFromPaths(pathList []*Path) []*bgp.BGPMessage
- func IpToRadixkey(b []byte, max uint8) string
- func NewSingleAsPathMatch(arg string) *singleAsPathMatch
- func ParseCommunity(arg string) (uint32, error)
- func ParseCommunityRegexp(arg string) (*regexp.Regexp, error)
- func ParseExtCommunity(arg string) (bgp.ExtendedCommunityInterface, error)
- func ParseExtCommunityRegexp(arg string) (bgp.ExtendedCommunityAttrSubType, *regexp.Regexp, error)
- func PoliciesToString(ps []*api.Policy) []string
- func RegexpRemoveCommunities(path *Path, exps []*regexp.Regexp)
- func RegexpRemoveExtCommunities(path *Path, exps []*regexp.Regexp, subtypes []bgp.ExtendedCommunityAttrSubType)
- func UpdatePathAttrs2ByteAs(msg *bgp.BGPUpdate) error
- func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error
- type Action
- type ActionType
- type AdjRib
- func (adj *AdjRib) DropIn(rfList []bgp.RouteFamily)
- func (adj *AdjRib) DropOut(rfList []bgp.RouteFamily)
- func (adj *AdjRib) GetInCount(rfList []bgp.RouteFamily) int
- func (adj *AdjRib) GetInPathList(rfList []bgp.RouteFamily) []*Path
- func (adj *AdjRib) GetOutCount(rfList []bgp.RouteFamily) int
- func (adj *AdjRib) GetOutPathList(rfList []bgp.RouteFamily) []*Path
- func (adj *AdjRib) UpdateIn(pathList []*Path)
- func (adj *AdjRib) UpdateOut(pathList []*Path)
- type AsPathCondition
- type AsPathLengthCondition
- type AsPathPrependAction
- type AsPathSet
- type AttributeComparison
- type CommunityAction
- type CommunityCondition
- type CommunitySet
- type Condition
- type ConditionType
- type DefinedSet
- type DefinedSetMap
- type DefinedType
- type Destination
- func (dest *Destination) Calculate() (*Path, string, error)
- func (dd *Destination) GetBestPath() *Path
- func (dd *Destination) GetKnownPathList() []*Path
- func (dd *Destination) GetNlri() bgp.AddrPrefixInterface
- func (dd *Destination) MarshalJSON() ([]byte, error)
- func (dest *Destination) String() string
- func (dd *Destination) ToApiStruct() *api.Destination
- type ExtCommunityAction
- type ExtCommunityCondition
- type ExtCommunitySet
- func (lhs *ExtCommunitySet) Append(arg DefinedSet) error
- func (s *ExtCommunitySet) Name() string
- func (lhs *ExtCommunitySet) Remove(arg DefinedSet) error
- func (lhs *ExtCommunitySet) Replace(arg DefinedSet) error
- func (s *ExtCommunitySet) ToApiStruct() *api.DefinedSet
- func (s *ExtCommunitySet) Type() DefinedType
- type MatchOption
- type MedAction
- type MedActionType
- type NeighborCondition
- type NeighborSet
- type Path
- func (path *Path) ClearCommunities()
- func (path *Path) Clone(owner net.IP, isWithdraw bool) *Path
- func (lhs *Path) Equal(rhs *Path) bool
- func (path *Path) GetAsList() []uint32
- func (path *Path) GetAsPath() *bgp.PathAttributeAsPath
- func (path *Path) GetAsPathLen() int
- func (path *Path) GetAsSeqList() []uint32
- func (path *Path) GetAsString() string
- func (path *Path) GetClusterList() []net.IP
- func (path *Path) GetCommunities() []uint32
- func (path *Path) GetExtCommunities() []bgp.ExtendedCommunityInterface
- func (path *Path) GetMed() (uint32, error)
- func (path *Path) GetNexthop() net.IP
- func (path *Path) GetNlri() bgp.AddrPrefixInterface
- func (path *Path) GetOriginatorID() net.IP
- func (path *Path) GetPathAttrs() []bgp.PathAttributeInterface
- func (path *Path) GetRouteFamily() bgp.RouteFamily
- func (path *Path) GetSource() *PeerInfo
- func (path *Path) GetSourceAs() uint32
- func (path *Path) GetTimestamp() time.Time
- func (path *Path) IsIBGP() bool
- func (path *Path) IsLocal() bool
- func (path *Path) MarshalJSON() ([]byte, error)
- func (path *Path) PrependAsn(asn uint32, repeat uint8)
- func (path *Path) RemoveCommunities(communities []uint32) int
- func (path *Path) SetCommunities(communities []uint32, doReplace bool)
- func (path *Path) SetExtCommunities(exts []bgp.ExtendedCommunityInterface, doReplace bool)
- func (path *Path) SetMed(med int64, doReplace bool) error
- func (path *Path) SetNexthop(nexthop net.IP)
- func (path *Path) String() string
- func (path *Path) ToApiStruct() *api.Path
- func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor)
- type PeerInfo
- type Policy
- func (lhs *Policy) Add(rhs *Policy) error
- func (p *Policy) Apply(path *Path) (RouteType, *Path)
- func (p *Policy) FillUp(m map[string]*Statement) error
- func (p *Policy) Name() string
- func (lhs *Policy) Remove(rhs *Policy) error
- func (lhs *Policy) Replace(rhs *Policy) error
- func (p *Policy) ToApiStruct() *api.Policy
- type PolicyDirection
- type Prefix
- type PrefixCondition
- type PrefixSet
- type RouteType
- type RoutingAction
- type RoutingPolicy
- type RpkiValidationCondition
- type Statement
- type Table
- type TableManager
- func (manager *TableManager) AddVrf(name string, rd bgp.RouteDistinguisherInterface, ...) ([]*Path, error)
- func (manager *TableManager) ApplyPolicy(d PolicyDirection, paths []*Path) []*Path
- func (manager *TableManager) DeletePathsforPeer(peerInfo *PeerInfo, rf bgp.RouteFamily) ([]*Path, error)
- func (manager *TableManager) DeleteVrf(name string) ([]*Path, error)
- func (manager *TableManager) GetBestPathList(rfList []bgp.RouteFamily) []*Path
- func (manager *TableManager) GetDefaultPolicy(d PolicyDirection) RouteType
- func (manager *TableManager) GetNextLabel(name, nexthop string, isWithdraw bool) (uint32, error)
- func (manager *TableManager) GetPathList(rf bgp.RouteFamily) []*Path
- func (manager *TableManager) GetPolicy(d PolicyDirection) []*Policy
- func (manager *TableManager) GetRFlist() []bgp.RouteFamily
- func (manager *TableManager) OwnerName() string
- func (manager *TableManager) ProcessPaths(pathList []*Path) ([]*Path, error)
- func (manager *TableManager) ProcessUpdate(fromPeer *PeerInfo, message *bgp.BGPMessage) ([]*Path, error)
- func (manager *TableManager) SetDefaultPolicy(d PolicyDirection, typ RouteType) error
- func (manager *TableManager) SetPolicy(d PolicyDirection, policies []*Policy) error
- type Vrf
Constants ¶
const ( BPR_UNKNOWN = "Unknown" BPR_ONLY_PATH = "Only Path" BPR_REACHABLE_NEXT_HOP = "Reachable Next Hop" BPR_HIGHEST_WEIGHT = "Highest Weight" BPR_LOCAL_PREF = "Local Pref" BPR_LOCAL_ORIGIN = "Local Origin" BPR_ASPATH = "AS Path" BPR_ORIGIN = "Origin" BPR_MED = "MED" BPR_ASN = "ASN" BPR_IGP_COST = "IGP Cost" BPR_ROUTER_ID = "Router ID" )
const ( INCLUDE singleAsPathMatchMode = iota LEFT_MOST ORIGIN )
const ( ADD opType = iota REMOVE REPLACE )
const (
ASPATH_REGEXP_MAGIC = "(^|[,{}() ]|$)"
)
Variables ¶
var CommunityOptionNameMap = map[config.BgpSetCommunityOptionType]string{ config.BGP_SET_COMMUNITY_OPTION_TYPE_ADD: "add", config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE: "remove", config.BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE: "replace", }
var CommunityOptionValueMap = map[string]config.BgpSetCommunityOptionType{ CommunityOptionNameMap[config.BGP_SET_COMMUNITY_OPTION_TYPE_ADD]: config.BGP_SET_COMMUNITY_OPTION_TYPE_ADD, CommunityOptionNameMap[config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE]: config.BGP_SET_COMMUNITY_OPTION_TYPE_REMOVE, CommunityOptionNameMap[config.BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE]: config.BGP_SET_COMMUNITY_OPTION_TYPE_REPLACE, }
Functions ¶
func CanImportToVrf ¶
func CidrToRadixkey ¶
func CreateUpdateMsgFromPaths ¶
func CreateUpdateMsgFromPaths(pathList []*Path) []*bgp.BGPMessage
func IpToRadixkey ¶
func NewSingleAsPathMatch ¶
func NewSingleAsPathMatch(arg string) *singleAsPathMatch
func ParseCommunity ¶
func ParseExtCommunity ¶
func ParseExtCommunityRegexp ¶
func PoliciesToString ¶
func RegexpRemoveCommunities ¶
func UpdatePathAttrs2ByteAs ¶
func UpdatePathAttrs2ByteAs(msg *bgp.BGPUpdate) error
func UpdatePathAttrs4ByteAs ¶
func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error
Types ¶
type Action ¶
type Action interface { Type() ActionType Apply(*Path) *Path }
type ActionType ¶
type ActionType int
const ( ACTION_ROUTING ActionType = iota ACTION_COMMUNITY ACTION_EXT_COMMUNITY ACTION_MED ACTION_AS_PATH_PREPEND )
type AdjRib ¶
type AdjRib struct {
// contains filtered or unexported fields
}
func (*AdjRib) GetInCount ¶
func (*AdjRib) GetInPathList ¶
func (*AdjRib) GetOutCount ¶
func (*AdjRib) GetOutPathList ¶
type AsPathCondition ¶
type AsPathCondition struct {
// contains filtered or unexported fields
}
func NewAsPathCondition ¶
func NewAsPathCondition(c config.MatchAsPathSet, m map[string]DefinedSet) (*AsPathCondition, error)
func NewAsPathConditionFromApiStruct ¶
func NewAsPathConditionFromApiStruct(a *api.MatchSet, m map[string]DefinedSet) (*AsPathCondition, error)
func (*AsPathCondition) Evaluate ¶
func (c *AsPathCondition) Evaluate(path *Path) bool
func (*AsPathCondition) Option ¶
func (c *AsPathCondition) Option() MatchOption
func (*AsPathCondition) Set ¶
func (c *AsPathCondition) Set() DefinedSet
func (*AsPathCondition) ToApiStruct ¶
func (c *AsPathCondition) ToApiStruct() *api.MatchSet
func (*AsPathCondition) Type ¶
func (c *AsPathCondition) Type() ConditionType
type AsPathLengthCondition ¶
type AsPathLengthCondition struct {
// contains filtered or unexported fields
}
func NewAsPathLengthCondition ¶
func NewAsPathLengthCondition(c config.AsPathLength) (*AsPathLengthCondition, error)
func NewAsPathLengthConditionFromApiStruct ¶
func NewAsPathLengthConditionFromApiStruct(a *api.AsPathLength) (*AsPathLengthCondition, error)
func (*AsPathLengthCondition) Evaluate ¶
func (c *AsPathLengthCondition) Evaluate(path *Path) bool
compare AS_PATH length in the message's AS_PATH attribute with the one in condition.
func (*AsPathLengthCondition) Set ¶
func (c *AsPathLengthCondition) Set() DefinedSet
func (*AsPathLengthCondition) ToApiStruct ¶
func (c *AsPathLengthCondition) ToApiStruct() *api.AsPathLength
func (*AsPathLengthCondition) Type ¶
func (c *AsPathLengthCondition) Type() ConditionType
type AsPathPrependAction ¶
type AsPathPrependAction struct {
// contains filtered or unexported fields
}
func NewAsPathPrependAction ¶
func NewAsPathPrependAction(action config.SetAsPathPrepend) (*AsPathPrependAction, error)
NewAsPathPrependAction creates AsPathPrependAction object. If ASN cannot be parsed, nil will be returned.
func NewAsPathPrependActionFromApiStruct ¶
func NewAsPathPrependActionFromApiStruct(a *api.AsPrependAction) (*AsPathPrependAction, error)
func (*AsPathPrependAction) Apply ¶
func (a *AsPathPrependAction) Apply(path *Path) *Path
func (*AsPathPrependAction) ToApiStruct ¶
func (a *AsPathPrependAction) ToApiStruct() *api.AsPrependAction
func (*AsPathPrependAction) Type ¶
func (a *AsPathPrependAction) Type() ActionType
type AsPathSet ¶
type AsPathSet struct {
// contains filtered or unexported fields
}
func NewAsPathSetFromApiStruct ¶
func NewAsPathSetFromApiStruct(a *api.DefinedSet) (*AsPathSet, error)
func (*AsPathSet) Append ¶
func (lhs *AsPathSet) Append(arg DefinedSet) error
func (*AsPathSet) Remove ¶
func (lhs *AsPathSet) Remove(arg DefinedSet) error
func (*AsPathSet) Replace ¶
func (lhs *AsPathSet) Replace(arg DefinedSet) error
func (*AsPathSet) ToApiStruct ¶
func (s *AsPathSet) ToApiStruct() *api.DefinedSet
func (*AsPathSet) Type ¶
func (s *AsPathSet) Type() DefinedType
type AttributeComparison ¶
type AttributeComparison int
const ( // "== comparison" ATTRIBUTE_EQ AttributeComparison = iota // ">= comparison" ATTRIBUTE_GE // "<= comparison" ATTRIBUTE_LE )
type CommunityAction ¶
type CommunityAction struct {
// contains filtered or unexported fields
}
func NewCommunityAction ¶
func NewCommunityAction(c config.SetCommunity) (*CommunityAction, error)
func NewCommunityActionFromApiStruct ¶
func NewCommunityActionFromApiStruct(a *api.CommunityAction) (*CommunityAction, error)
func (*CommunityAction) Apply ¶
func (a *CommunityAction) Apply(path *Path) *Path
func (*CommunityAction) ToApiStruct ¶
func (a *CommunityAction) ToApiStruct() *api.CommunityAction
func (*CommunityAction) Type ¶
func (a *CommunityAction) Type() ActionType
type CommunityCondition ¶
type CommunityCondition struct {
// contains filtered or unexported fields
}
func NewCommunityCondition ¶
func NewCommunityCondition(c config.MatchCommunitySet, m map[string]DefinedSet) (*CommunityCondition, error)
func NewCommunityConditionFromApiStruct ¶
func NewCommunityConditionFromApiStruct(a *api.MatchSet, m map[string]DefinedSet) (*CommunityCondition, error)
func (*CommunityCondition) Evaluate ¶
func (c *CommunityCondition) Evaluate(path *Path) bool
func (*CommunityCondition) Option ¶
func (c *CommunityCondition) Option() MatchOption
func (*CommunityCondition) Set ¶
func (c *CommunityCondition) Set() DefinedSet
func (*CommunityCondition) ToApiStruct ¶
func (c *CommunityCondition) ToApiStruct() *api.MatchSet
func (*CommunityCondition) Type ¶
func (c *CommunityCondition) Type() ConditionType
type CommunitySet ¶
type CommunitySet struct {
// contains filtered or unexported fields
}
func NewCommunitySet ¶
func NewCommunitySet(c config.CommunitySet) (*CommunitySet, error)
func NewCommunitySetFromApiStruct ¶
func NewCommunitySetFromApiStruct(a *api.DefinedSet) (*CommunitySet, error)
func (*CommunitySet) Append ¶
func (lhs *CommunitySet) Append(arg DefinedSet) error
func (*CommunitySet) Remove ¶
func (lhs *CommunitySet) Remove(arg DefinedSet) error
func (*CommunitySet) Replace ¶
func (lhs *CommunitySet) Replace(arg DefinedSet) error
func (*CommunitySet) ToApiStruct ¶
func (s *CommunitySet) ToApiStruct() *api.DefinedSet
func (*CommunitySet) Type ¶
func (s *CommunitySet) Type() DefinedType
type Condition ¶
type Condition interface { Type() ConditionType Evaluate(*Path) bool Set() DefinedSet }
type ConditionType ¶
type ConditionType int
const ( CONDITION_PREFIX ConditionType = iota CONDITION_NEIGHBOR CONDITION_AS_PATH CONDITION_COMMUNITY CONDITION_EXT_COMMUNITY CONDITION_AS_PATH_LENGTH CONDITION_RPKI )
type DefinedSet ¶
type DefinedSet interface { Type() DefinedType Name() string ToApiStruct() *api.DefinedSet Append(DefinedSet) error Remove(DefinedSet) error Replace(DefinedSet) error }
func NewDefinedSetFromApiStruct ¶
func NewDefinedSetFromApiStruct(a *api.DefinedSet) (DefinedSet, error)
type DefinedSetMap ¶
type DefinedSetMap map[DefinedType]map[string]DefinedSet
type DefinedType ¶
type DefinedType int
const ( DEFINED_TYPE_PREFIX DefinedType = iota DEFINED_TYPE_NEIGHBOR DEFINED_TYPE_TAG DEFINED_TYPE_AS_PATH DEFINED_TYPE_COMMUNITY DEFINED_TYPE_EXT_COMMUNITY )
type Destination ¶
type Destination struct { RadixKey string // contains filtered or unexported fields }
func NewDestination ¶
func NewDestination(nlri bgp.AddrPrefixInterface) *Destination
func (*Destination) Calculate ¶
func (dest *Destination) Calculate() (*Path, string, error)
Calculates best-path among known paths for this destination.
Returns: - Best path
Modifies destination's state related to stored paths. Removes withdrawn paths from known paths. Also, adds new paths to known paths.
func (*Destination) GetBestPath ¶
func (dd *Destination) GetBestPath() *Path
func (*Destination) GetKnownPathList ¶
func (dd *Destination) GetKnownPathList() []*Path
func (*Destination) GetNlri ¶
func (dd *Destination) GetNlri() bgp.AddrPrefixInterface
func (*Destination) MarshalJSON ¶
func (dd *Destination) MarshalJSON() ([]byte, error)
func (*Destination) String ¶
func (dest *Destination) String() string
func (*Destination) ToApiStruct ¶
func (dd *Destination) ToApiStruct() *api.Destination
type ExtCommunityAction ¶
type ExtCommunityAction struct {
// contains filtered or unexported fields
}
func NewExtCommunityAction ¶
func NewExtCommunityAction(c config.SetExtCommunity) (*ExtCommunityAction, error)
func NewExtCommunityActionFromApiStruct ¶
func NewExtCommunityActionFromApiStruct(a *api.CommunityAction) (*ExtCommunityAction, error)
func (*ExtCommunityAction) Apply ¶
func (a *ExtCommunityAction) Apply(path *Path) *Path
func (*ExtCommunityAction) ToApiStruct ¶
func (a *ExtCommunityAction) ToApiStruct() *api.CommunityAction
func (*ExtCommunityAction) Type ¶
func (a *ExtCommunityAction) Type() ActionType
type ExtCommunityCondition ¶
type ExtCommunityCondition struct {
// contains filtered or unexported fields
}
func NewExtCommunityCondition ¶
func NewExtCommunityCondition(c config.MatchExtCommunitySet, m map[string]DefinedSet) (*ExtCommunityCondition, error)
func NewExtCommunityConditionFromApiStruct ¶
func NewExtCommunityConditionFromApiStruct(a *api.MatchSet, m map[string]DefinedSet) (*ExtCommunityCondition, error)
func (*ExtCommunityCondition) Evaluate ¶
func (c *ExtCommunityCondition) Evaluate(path *Path) bool
func (*ExtCommunityCondition) Option ¶
func (c *ExtCommunityCondition) Option() MatchOption
func (*ExtCommunityCondition) Set ¶
func (c *ExtCommunityCondition) Set() DefinedSet
func (*ExtCommunityCondition) ToApiStruct ¶
func (c *ExtCommunityCondition) ToApiStruct() *api.MatchSet
func (*ExtCommunityCondition) Type ¶
func (c *ExtCommunityCondition) Type() ConditionType
type ExtCommunitySet ¶
type ExtCommunitySet struct {
// contains filtered or unexported fields
}
func NewExtCommunitySet ¶
func NewExtCommunitySet(c config.ExtCommunitySet) (*ExtCommunitySet, error)
func NewExtCommunitySetFromApiStruct ¶
func NewExtCommunitySetFromApiStruct(a *api.DefinedSet) (*ExtCommunitySet, error)
func (*ExtCommunitySet) Append ¶
func (lhs *ExtCommunitySet) Append(arg DefinedSet) error
func (*ExtCommunitySet) Remove ¶
func (lhs *ExtCommunitySet) Remove(arg DefinedSet) error
func (*ExtCommunitySet) Replace ¶
func (lhs *ExtCommunitySet) Replace(arg DefinedSet) error
func (*ExtCommunitySet) ToApiStruct ¶
func (s *ExtCommunitySet) ToApiStruct() *api.DefinedSet
func (*ExtCommunitySet) Type ¶
func (s *ExtCommunitySet) Type() DefinedType
type MatchOption ¶
type MatchOption int
const ( MATCH_OPTION_ANY MatchOption = iota MATCH_OPTION_ALL MATCH_OPTION_INVERT )
func NewMatchOption ¶
func NewMatchOption(c interface{}) (MatchOption, error)
func (MatchOption) String ¶
func (o MatchOption) String() string
type MedAction ¶
type MedAction struct {
// contains filtered or unexported fields
}
func NewMedAction ¶
func NewMedAction(c config.BgpSetMedType) (*MedAction, error)
func (*MedAction) ToApiStruct ¶
func (*MedAction) Type ¶
func (a *MedAction) Type() ActionType
type MedActionType ¶
type MedActionType int
const ( MED_ACTION_MOD MedActionType = iota MED_ACTION_REPLACE )
type NeighborCondition ¶
type NeighborCondition struct {
// contains filtered or unexported fields
}
func NewNeighborCondition ¶
func NewNeighborCondition(c config.MatchNeighborSet, m map[string]DefinedSet) (*NeighborCondition, error)
func NewNeighborConditionFromApiStruct ¶
func NewNeighborConditionFromApiStruct(a *api.MatchSet, m map[string]DefinedSet) (*NeighborCondition, error)
func (*NeighborCondition) Evaluate ¶
func (c *NeighborCondition) Evaluate(path *Path) bool
compare neighbor ipaddress of this condition and source address of path and, subsequent comparisons are skipped if that matches the conditions. If NeighborList's length is zero, return true.
func (*NeighborCondition) Option ¶
func (c *NeighborCondition) Option() MatchOption
func (*NeighborCondition) Set ¶
func (c *NeighborCondition) Set() DefinedSet
func (*NeighborCondition) ToApiStruct ¶
func (c *NeighborCondition) ToApiStruct() *api.MatchSet
func (*NeighborCondition) Type ¶
func (c *NeighborCondition) Type() ConditionType
type NeighborSet ¶
type NeighborSet struct {
// contains filtered or unexported fields
}
func NewNeighborSet ¶
func NewNeighborSet(c config.NeighborSet) (*NeighborSet, error)
func NewNeighborSetFromApiStruct ¶
func NewNeighborSetFromApiStruct(a *api.DefinedSet) (*NeighborSet, error)
func (*NeighborSet) Append ¶
func (lhs *NeighborSet) Append(arg DefinedSet) error
func (*NeighborSet) Name ¶
func (s *NeighborSet) Name() string
func (*NeighborSet) Remove ¶
func (lhs *NeighborSet) Remove(arg DefinedSet) error
func (*NeighborSet) Replace ¶
func (lhs *NeighborSet) Replace(arg DefinedSet) error
func (*NeighborSet) ToApiStruct ¶
func (s *NeighborSet) ToApiStruct() *api.DefinedSet
func (*NeighborSet) Type ¶
func (s *NeighborSet) Type() DefinedType
type Path ¶
type Path struct { IsWithdraw bool NoImplicitWithdraw bool Validation config.RpkiValidationResultType IsFromZebra bool Filtered bool Owner net.IP // contains filtered or unexported fields }
func ProcessMessage ¶
func (*Path) ClearCommunities ¶
func (path *Path) ClearCommunities()
ClearCommunities removes Communities path attribute.
func (*Path) GetAsPathLen ¶
GetAsPathLen returns the number of AS_PATH
func (*Path) GetAsSeqList ¶
func (*Path) GetAsString ¶
func (*Path) GetClusterList ¶
func (*Path) GetCommunities ¶
func (*Path) GetExtCommunities ¶
func (path *Path) GetExtCommunities() []bgp.ExtendedCommunityInterface
func (*Path) GetNexthop ¶
func (*Path) GetOriginatorID ¶
func (*Path) GetPathAttrs ¶
func (path *Path) GetPathAttrs() []bgp.PathAttributeInterface
func (*Path) GetRouteFamily ¶
func (path *Path) GetRouteFamily() bgp.RouteFamily
func (*Path) GetSourceAs ¶
func (*Path) GetTimestamp ¶
func (*Path) MarshalJSON ¶
func (*Path) PrependAsn ¶
PrependAsn prepends AS number. This function updates the AS_PATH attribute as follows.
if the first path segment of the AS_PATH is of type AS_SEQUENCE, the local system prepends the specified AS num as the last element of the sequence (put it in the left-most position with respect to the position of octets in the protocol message) the specified number of times. If the act of prepending will cause an overflow in the AS_PATH segment (i.e., more than 255 ASes), it SHOULD prepend a new segment of type AS_SEQUENCE and prepend its own AS number to this new segment.
if the first path segment of the AS_PATH is of other than type AS_SEQUENCE, the local system prepends a new path segment of type AS_SEQUENCE to the AS_PATH, including the specified AS number in that segment.
if the AS_PATH is empty, the local system creates a path segment of type AS_SEQUENCE, places the specified AS number into that segment, and places that segment into the AS_PATH.
func (*Path) RemoveCommunities ¶
RemoveCommunities removes specific communities. If the length of communites is 0, it does nothing. If all communities are removed, it removes Communities path attribute itself.
func (*Path) SetCommunities ¶
SetCommunities adds or replaces communities with new ones. If the length of communities is 0 and doReplace is true, it clears communities.
func (*Path) SetExtCommunities ¶
func (*Path) SetNexthop ¶
func (*Path) ToApiStruct ¶
type PeerInfo ¶
type Policy ¶
type Policy struct { Statements []*Statement // contains filtered or unexported fields }
func NewPolicy ¶
func NewPolicy(c config.PolicyDefinition, dmap DefinedSetMap) (*Policy, error)
func NewPolicyFromApiStruct ¶
func NewPolicyFromApiStruct(a *api.Policy, dmap DefinedSetMap) (*Policy, error)
func (*Policy) Apply ¶
Compare path with a policy's condition in stored order in the policy. If a condition match, then this function stops evaluation and subsequent conditions are skipped.
func (*Policy) ToApiStruct ¶
type PolicyDirection ¶
type PolicyDirection int
const ( POLICY_DIRECTION_NONE PolicyDirection = iota POLICY_DIRECTION_IMPORT POLICY_DIRECTION_EXPORT POLICY_DIRECTION_IN )
type Prefix ¶
type Prefix struct { Prefix *net.IPNet AddressFamily bgp.RouteFamily MasklengthRangeMax uint8 MasklengthRangeMin uint8 }
func (*Prefix) ToApiStruct ¶
type PrefixCondition ¶
type PrefixCondition struct {
// contains filtered or unexported fields
}
func NewPrefixCondition ¶
func NewPrefixCondition(c config.MatchPrefixSet, m map[string]DefinedSet) (*PrefixCondition, error)
func NewPrefixConditionFromApiStruct ¶
func NewPrefixConditionFromApiStruct(a *api.MatchSet, m map[string]DefinedSet) (*PrefixCondition, error)
func (*PrefixCondition) Evaluate ¶
func (c *PrefixCondition) Evaluate(path *Path) bool
compare prefixes in this condition and nlri of path and subsequent comparison is skipped if that matches the conditions. If PrefixList's length is zero, return true.
func (*PrefixCondition) Option ¶
func (c *PrefixCondition) Option() MatchOption
func (*PrefixCondition) Set ¶
func (c *PrefixCondition) Set() DefinedSet
func (*PrefixCondition) ToApiStruct ¶
func (c *PrefixCondition) ToApiStruct() *api.MatchSet
func (*PrefixCondition) Type ¶
func (c *PrefixCondition) Type() ConditionType
type PrefixSet ¶
type PrefixSet struct {
// contains filtered or unexported fields
}
func NewPrefixSetFromApiStruct ¶
func NewPrefixSetFromApiStruct(a *api.DefinedSet) (*PrefixSet, error)
func (*PrefixSet) Append ¶
func (lhs *PrefixSet) Append(arg DefinedSet) error
func (*PrefixSet) Remove ¶
func (lhs *PrefixSet) Remove(arg DefinedSet) error
func (*PrefixSet) Replace ¶
func (lhs *PrefixSet) Replace(arg DefinedSet) error
func (*PrefixSet) ToApiStruct ¶
func (s *PrefixSet) ToApiStruct() *api.DefinedSet
func (*PrefixSet) Type ¶
func (s *PrefixSet) Type() DefinedType
type RouteType ¶
type RouteType int
func (RouteType) ToApiStruct ¶
func (t RouteType) ToApiStruct() api.RouteAction
type RoutingAction ¶
type RoutingAction struct {
AcceptRoute bool
}
func NewRoutingAction ¶
func NewRoutingAction(c config.RouteDisposition) (*RoutingAction, error)
func NewRoutingActionFromApiStruct ¶
func NewRoutingActionFromApiStruct(a api.RouteAction) (*RoutingAction, error)
func (*RoutingAction) Apply ¶
func (a *RoutingAction) Apply(path *Path) *Path
func (*RoutingAction) ToApiStruct ¶
func (a *RoutingAction) ToApiStruct() api.RouteAction
func (*RoutingAction) Type ¶
func (a *RoutingAction) Type() ActionType
type RoutingPolicy ¶
type RoutingPolicy struct { DefinedSetMap DefinedSetMap PolicyMap map[string]*Policy StatementMap map[string]*Statement }
func NewRoutingPolicy ¶
func NewRoutingPolicy(c config.RoutingPolicy) (*RoutingPolicy, error)
func (*RoutingPolicy) GetAssignmentFromConfig ¶
func (r *RoutingPolicy) GetAssignmentFromConfig(dir PolicyDirection, a config.ApplyPolicy) ([]*Policy, RouteType, error)
func (*RoutingPolicy) InUse ¶
func (r *RoutingPolicy) InUse(d DefinedSet) bool
func (*RoutingPolicy) StatementInUse ¶
func (r *RoutingPolicy) StatementInUse(x *Statement) bool
type RpkiValidationCondition ¶
type RpkiValidationCondition struct {
// contains filtered or unexported fields
}
func NewRpkiValidationCondition ¶
func NewRpkiValidationCondition(c config.RpkiValidationResultType) (*RpkiValidationCondition, error)
func NewRpkiValidationConditionFromApiStruct ¶
func NewRpkiValidationConditionFromApiStruct(a int32) (*RpkiValidationCondition, error)
func (*RpkiValidationCondition) Evaluate ¶
func (c *RpkiValidationCondition) Evaluate(path *Path) bool
func (*RpkiValidationCondition) Set ¶
func (c *RpkiValidationCondition) Set() DefinedSet
func (*RpkiValidationCondition) Type ¶
func (c *RpkiValidationCondition) Type() ConditionType
type Statement ¶
func NewStatement ¶
func NewStatement(c config.Statement, dmap DefinedSetMap) (*Statement, error)
func NewStatementFromApiStruct ¶
func NewStatementFromApiStruct(a *api.Statement, dmap DefinedSetMap) (*Statement, error)
func (*Statement) ToApiStruct ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) DeleteDestByPeer ¶
func (t *Table) DeleteDestByPeer(peerInfo *PeerInfo) []*Destination
func (*Table) GetDestination ¶
func (t *Table) GetDestination(key string) *Destination
func (*Table) GetDestinations ¶
func (t *Table) GetDestinations() map[string]*Destination
func (*Table) GetRoutefamily ¶
func (t *Table) GetRoutefamily() bgp.RouteFamily
type TableManager ¶
type TableManager struct { Tables map[bgp.RouteFamily]*Table Vrfs map[string]*Vrf // contains filtered or unexported fields }
func NewTableManager ¶
func NewTableManager(owner string, rfList []bgp.RouteFamily, minLabel, maxLabel uint32) *TableManager
func (*TableManager) AddVrf ¶
func (manager *TableManager) AddVrf(name string, rd bgp.RouteDistinguisherInterface, importRt, exportRt []bgp.ExtendedCommunityInterface, info *PeerInfo) ([]*Path, error)
func (*TableManager) ApplyPolicy ¶
func (manager *TableManager) ApplyPolicy(d PolicyDirection, paths []*Path) []*Path
func (*TableManager) DeletePathsforPeer ¶
func (manager *TableManager) DeletePathsforPeer(peerInfo *PeerInfo, rf bgp.RouteFamily) ([]*Path, error)
func (*TableManager) DeleteVrf ¶
func (manager *TableManager) DeleteVrf(name string) ([]*Path, error)
func (*TableManager) GetBestPathList ¶
func (manager *TableManager) GetBestPathList(rfList []bgp.RouteFamily) []*Path
func (*TableManager) GetDefaultPolicy ¶
func (manager *TableManager) GetDefaultPolicy(d PolicyDirection) RouteType
func (*TableManager) GetNextLabel ¶
func (manager *TableManager) GetNextLabel(name, nexthop string, isWithdraw bool) (uint32, error)
func (*TableManager) GetPathList ¶
func (manager *TableManager) GetPathList(rf bgp.RouteFamily) []*Path
func (*TableManager) GetPolicy ¶
func (manager *TableManager) GetPolicy(d PolicyDirection) []*Policy
func (*TableManager) GetRFlist ¶
func (manager *TableManager) GetRFlist() []bgp.RouteFamily
func (*TableManager) OwnerName ¶
func (manager *TableManager) OwnerName() string
func (*TableManager) ProcessPaths ¶
func (manager *TableManager) ProcessPaths(pathList []*Path) ([]*Path, error)
func (*TableManager) ProcessUpdate ¶
func (manager *TableManager) ProcessUpdate(fromPeer *PeerInfo, message *bgp.BGPMessage) ([]*Path, error)
process BGPUpdate message this function processes only BGPUpdate
func (*TableManager) SetDefaultPolicy ¶
func (manager *TableManager) SetDefaultPolicy(d PolicyDirection, typ RouteType) error
func (*TableManager) SetPolicy ¶
func (manager *TableManager) SetPolicy(d PolicyDirection, policies []*Policy) error