Documentation ¶
Index ¶
- Constants
- Variables
- func AddrToRadixkey(addr bgp.AddrPrefixInterface) string
- func CanImportToVrf(v *Vrf, path *Path) bool
- func CidrToRadixkey(cidr string) string
- func CreateUpdateMsgFromPaths(pathList []*Path, options ...*bgp.MarshallingOption) []*bgp.BGPMessage
- func IpToRadixkey(b []byte, max uint8) string
- func NewAPIPolicyAssignmentFromTableStruct(t *PolicyAssignment) *api.PolicyAssignment
- func NewAPIPolicyFromTableStruct(p *Policy) *api.Policy
- func NewAPIRoutingPolicyFromConfigStruct(c *config.RoutingPolicy) (*api.RoutingPolicy, error)
- 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 ParseLargeCommunityRegexp(arg string) (*regexp.Regexp, error)
- func RegexpRemoveCommunities(path *Path, exps []*regexp.Regexp)
- func RegexpRemoveExtCommunities(path *Path, exps []*regexp.Regexp, subtypes []bgp.ExtendedCommunityAttrSubType)
- func RegexpRemoveLargeCommunities(path *Path, exps []*regexp.Regexp)
- func ToPolicyApi(p *config.PolicyDefinition) *api.Policy
- func UpdatePathAggregator2ByteAs(msg *bgp.BGPUpdate)
- func UpdatePathAggregator4ByteAs(msg *bgp.BGPUpdate) error
- func UpdatePathAttrs2ByteAs(msg *bgp.BGPUpdate) error
- func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error
- type Action
- type ActionType
- type AdjRib
- func (adj *AdjRib) Accepted(rfList []bgp.RouteFamily) int
- func (adj *AdjRib) Count(rfList []bgp.RouteFamily) int
- func (adj *AdjRib) Drop(rfList []bgp.RouteFamily)
- func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path
- func (adj *AdjRib) PathList(rfList []bgp.RouteFamily, accepted bool) []*Path
- func (adj *AdjRib) Select(family bgp.RouteFamily, accepted bool, option ...TableSelectOption) (*Table, error)
- func (adj *AdjRib) StaleAll(rfList []bgp.RouteFamily) []*Path
- func (adj *AdjRib) TableInfo(family bgp.RouteFamily) (*TableInfo, error)
- func (adj *AdjRib) Update(pathList []*Path)
- type AfiSafiInCondition
- type AsPathCondition
- type AsPathLengthCondition
- type AsPathPrependAction
- type AsPathSet
- func (lhs *AsPathSet) Append(arg DefinedSet) error
- func (s *AsPathSet) List() []string
- func (s *AsPathSet) MarshalJSON() ([]byte, error)
- func (s *AsPathSet) Name() string
- func (lhs *AsPathSet) Remove(arg DefinedSet) error
- func (lhs *AsPathSet) Replace(arg DefinedSet) error
- func (s *AsPathSet) String() string
- func (s *AsPathSet) ToConfig() *config.AsPathSet
- func (s *AsPathSet) Type() DefinedType
- type Assignment
- type AttributeComparison
- type BestPathReason
- type Bitmap
- type CommunityAction
- type CommunityCondition
- type CommunitySet
- func (lhs *CommunitySet) Append(arg DefinedSet) error
- func (s *CommunitySet) List() []string
- func (s *CommunitySet) MarshalJSON() ([]byte, error)
- func (s *CommunitySet) Name() string
- func (lhs *CommunitySet) Remove(arg DefinedSet) error
- func (lhs *CommunitySet) Replace(arg DefinedSet) error
- func (s *CommunitySet) String() string
- func (s *CommunitySet) ToConfig() *config.CommunitySet
- func (s *CommunitySet) Type() DefinedType
- type Condition
- type ConditionType
- type DefinedSet
- type DefinedSetList
- type DefinedSetMap
- type DefinedType
- type Destination
- func (dest *Destination) Calculate(newPath *Path) *Update
- func (dd *Destination) Family() bgp.RouteFamily
- func (dd *Destination) GetAllKnownPathList() []*Path
- func (dd *Destination) GetBestPath(id string, as uint32) *Path
- func (dd *Destination) GetKnownPathList(id string, as uint32) []*Path
- func (dd *Destination) GetMultiBestPath(id string) []*Path
- func (dd *Destination) GetNlri() bgp.AddrPrefixInterface
- func (d *Destination) MarshalJSON() ([]byte, error)
- func (d *Destination) Select(option ...DestinationSelectOption) *Destination
- func (dest *Destination) String() string
- type DestinationSelectOption
- type ExtCommunityAction
- type ExtCommunityCondition
- type ExtCommunitySet
- func (s *ExtCommunitySet) Append(arg DefinedSet) error
- func (s *ExtCommunitySet) List() []string
- func (s *ExtCommunitySet) MarshalJSON() ([]byte, error)
- func (s *ExtCommunitySet) Name() string
- func (lhs *ExtCommunitySet) Remove(arg DefinedSet) error
- func (lhs *ExtCommunitySet) Replace(arg DefinedSet) error
- func (s *ExtCommunitySet) String() string
- func (s *ExtCommunitySet) ToConfig() *config.ExtCommunitySet
- func (s *ExtCommunitySet) Type() DefinedType
- type IPPrefix
- type LargeCommunityAction
- type LargeCommunityCondition
- type LargeCommunitySet
- func (lhs *LargeCommunitySet) Append(arg DefinedSet) error
- func (s *LargeCommunitySet) List() []string
- func (s *LargeCommunitySet) MarshalJSON() ([]byte, error)
- func (s *LargeCommunitySet) Name() string
- func (lhs *LargeCommunitySet) Remove(arg DefinedSet) error
- func (lhs *LargeCommunitySet) Replace(arg DefinedSet) error
- func (s *LargeCommunitySet) String() string
- func (s *LargeCommunitySet) ToConfig() *config.LargeCommunitySet
- func (s *LargeCommunitySet) Type() DefinedType
- type LocalPrefAction
- type LookupOption
- type LookupPrefix
- type MatchOption
- type MedAction
- type MedActionType
- type NeighborCondition
- type NeighborSet
- func (lhs *NeighborSet) Append(arg DefinedSet) error
- func (s *NeighborSet) List() []string
- func (s *NeighborSet) MarshalJSON() ([]byte, error)
- func (s *NeighborSet) Name() string
- func (lhs *NeighborSet) Remove(arg DefinedSet) error
- func (lhs *NeighborSet) Replace(arg DefinedSet) error
- func (s *NeighborSet) String() string
- func (s *NeighborSet) ToConfig() *config.NeighborSet
- func (s *NeighborSet) Type() DefinedType
- type NextHopCondition
- type NextHopSet
- func (lhs *NextHopSet) Append(arg DefinedSet) error
- func (s *NextHopSet) List() []string
- func (s *NextHopSet) MarshalJSON() ([]byte, error)
- func (s *NextHopSet) Name() string
- func (lhs *NextHopSet) Remove(arg DefinedSet) error
- func (lhs *NextHopSet) Replace(arg DefinedSet) error
- func (s *NextHopSet) String() string
- func (s *NextHopSet) ToConfig() []string
- func (s *NextHopSet) Type() DefinedType
- type NexthopAction
- type Path
- func NewEOR(family bgp.RouteFamily) *Path
- func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, ...) *Path
- func ProcessMessage(m *bgp.BGPMessage, peerInfo *PeerInfo, timestamp time.Time) []*Path
- func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInfo, original *Path) *Path
- func (path *Path) Clone(isWithdraw bool) *Path
- func (lhs *Path) Compare(rhs *Path) int
- 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 (p *Path) GetHash() uint32
- func (path *Path) GetLabelString() string
- func (path *Path) GetLargeCommunities() []*bgp.LargeCommunity
- func (path *Path) GetLocalPref() (uint32, error)
- func (path *Path) GetMed() (uint32, error)
- func (path *Path) GetNexthop() net.IP
- func (path *Path) GetNlri() bgp.AddrPrefixInterface
- func (path *Path) GetOrigin() (uint8, error)
- 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) IsAsLooped() bool
- func (path *Path) IsEOR() bool
- func (path *Path) IsFromExternal() bool
- func (path *Path) IsIBGP() bool
- func (path *Path) IsLLGRStale() bool
- func (path *Path) IsLocal() bool
- func (path *Path) IsStale() bool
- func (path *Path) MarkStale(s bool)
- func (path *Path) MarshalJSON() ([]byte, error)
- func (path *Path) NoImplicitWithdraw() bool
- func (path *Path) OriginInfo() *originInfo
- func (path *Path) PrependAsn(asn uint32, repeat uint8, confed bool)
- func (path *Path) RemoveCommunities(communities []uint32) int
- func (path *Path) RemoveLocalPref()
- func (path *Path) RemovePrivateAS(localAS uint32, option config.RemovePrivateAsOption)
- func (path *Path) ReplaceAS(localAS, peerAS uint32) *Path
- func (path *Path) SetAsLooped(y bool)
- func (path *Path) SetCommunities(communities []uint32, doReplace bool)
- func (path *Path) SetExtCommunities(exts []bgp.ExtendedCommunityInterface, doReplace bool)
- func (p *Path) SetHash(v uint32)
- func (path *Path) SetIsFromExternal(y bool)
- func (path *Path) SetLargeCommunities(cs []*bgp.LargeCommunity, doReplace bool)
- func (path *Path) SetMed(med int64, doReplace bool) error
- func (path *Path) SetNexthop(nexthop net.IP)
- func (path *Path) SetValidation(v *Validation)
- func (path *Path) String() string
- func (p *Path) ToGlobal(vrf *Vrf) *Path
- func (p *Path) ToLocal() *Path
- func (path *Path) Validation() *Validation
- func (path *Path) ValidationStatus() config.RpkiValidationResultType
- type PathAttrs
- type PeerInfo
- type Policies
- type Policy
- func (lhs *Policy) Add(rhs *Policy) error
- func (p *Policy) Apply(path *Path, options *PolicyOptions) (RouteType, *Path)
- func (p *Policy) FillUp(m map[string]*Statement) error
- func (p *Policy) MarshalJSON() ([]byte, error)
- func (lhs *Policy) Remove(rhs *Policy) error
- func (lhs *Policy) Replace(rhs *Policy) error
- func (p *Policy) ToConfig() *config.PolicyDefinition
- type PolicyAssignment
- type PolicyDirection
- type PolicyOptions
- type Prefix
- type PrefixCondition
- type PrefixSet
- func (lhs *PrefixSet) Append(arg DefinedSet) error
- func (s *PrefixSet) List() []string
- func (s *PrefixSet) MarshalJSON() ([]byte, error)
- func (s *PrefixSet) Name() string
- func (lhs *PrefixSet) Remove(arg DefinedSet) error
- func (lhs *PrefixSet) Replace(arg DefinedSet) error
- func (s *PrefixSet) String() string
- func (s *PrefixSet) ToConfig() *config.PrefixSet
- func (s *PrefixSet) Type() DefinedType
- type ROA
- type RouteType
- type RouteTypeCondition
- type RoutingAction
- type RoutingPolicy
- func (r *RoutingPolicy) AddDefinedSet(s DefinedSet) error
- func (r *RoutingPolicy) AddPolicy(x *Policy, refer bool) (err error)
- func (r *RoutingPolicy) AddPolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, ...) (err error)
- func (r *RoutingPolicy) AddStatement(st *Statement) (err error)
- func (r *RoutingPolicy) ApplyPolicy(id string, dir PolicyDirection, before *Path, options *PolicyOptions) *Path
- func (r *RoutingPolicy) DeleteDefinedSet(a DefinedSet, all bool) (err error)
- func (r *RoutingPolicy) DeletePolicy(x *Policy, all, preserve bool, activeId []string) (err error)
- func (r *RoutingPolicy) DeletePolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, all bool) (err error)
- func (r *RoutingPolicy) DeleteStatement(st *Statement, all bool) (err error)
- func (r *RoutingPolicy) GetDefinedSet(typ DefinedType, name string) (*config.DefinedSets, error)
- func (r *RoutingPolicy) GetPolicy(name string) []*config.PolicyDefinition
- func (r *RoutingPolicy) GetPolicyAssignment(id string, dir PolicyDirection) (RouteType, []*Policy, error)
- func (r *RoutingPolicy) GetStatement(name string) []*config.Statement
- func (r *RoutingPolicy) Reset(rp *config.RoutingPolicy, ap map[string]config.ApplyPolicy) error
- func (r *RoutingPolicy) SetPolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, ...) (err error)
- type RpkiValidationCondition
- type RpkiValidationReasonType
- type Statement
- func (lhs *Statement) Add(rhs *Statement) error
- func (s *Statement) Apply(path *Path, options *PolicyOptions) (RouteType, *Path)
- func (s *Statement) Evaluate(p *Path, options *PolicyOptions) bool
- func (s *Statement) MarshalJSON() ([]byte, error)
- func (lhs *Statement) Remove(rhs *Statement) error
- func (lhs *Statement) Replace(rhs *Statement) error
- func (s *Statement) ToConfig() *config.Statement
- type Table
- func (t *Table) Bests(id string, as uint32) []*Path
- func (t *Table) GetDestination(nlri bgp.AddrPrefixInterface) *Destination
- func (t *Table) GetDestinations() map[string]*Destination
- func (t *Table) GetEvpnDestinationsWithRouteType(typ string) ([]*Destination, error)
- func (t *Table) GetKnownPathList(id string, as uint32) []*Path
- func (t *Table) GetLongerPrefixDestinations(key string) ([]*Destination, error)
- func (t *Table) GetRoutefamily() bgp.RouteFamily
- func (t *Table) Info(id string, as uint32) *TableInfo
- func (t *Table) MultiBests(id string) [][]*Path
- func (t *Table) Select(option ...TableSelectOption) (*Table, error)
- type TableInfo
- type TableManager
- func (manager *TableManager) AddVrf(name string, id uint32, rd bgp.RouteDistinguisherInterface, ...) ([]*Path, error)
- func (manager *TableManager) DeleteVrf(name string) ([]*Path, error)
- func (manager *TableManager) GetBestMultiPathList(id string, rfList []bgp.RouteFamily) [][]*Path
- func (manager *TableManager) GetBestPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path
- func (manager *TableManager) GetDestination(path *Path) *Destination
- func (manager *TableManager) GetPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path
- func (manager *TableManager) GetPathListByPeer(info *PeerInfo, rf bgp.RouteFamily) []*Path
- func (manager *TableManager) GetPathListWithNexthop(id string, rfList []bgp.RouteFamily, nexthop net.IP) []*Path
- func (manager *TableManager) GetPathListWithSource(id string, rfList []bgp.RouteFamily, source *PeerInfo) []*Path
- func (manager *TableManager) GetRFlist() []bgp.RouteFamily
- func (manager *TableManager) TableInfo(id string, as uint32, family bgp.RouteFamily) (*TableInfo, error)
- func (manager *TableManager) Update(newPath *Path) []*Update
- type TableSelectOption
- type Update
- type Validation
- type Vrf
Constants ¶
const ( INCLUDE singleAsPathMatchMode = iota LEFT_MOST ORIGIN ONLY )
const ( ADD opType = iota REMOVE REPLACE )
const (
ASPATH_REGEXP_MAGIC = "(^|[,{}() ]|$)"
)
const (
DEFAULT_LOCAL_PREF = 100
)
const (
GLOBAL_RIB_NAME = "global"
)
Variables ¶
var BestPathReasonStringMap = map[BestPathReason]string{ BPR_UNKNOWN: "Unknown", BPR_DISABLED: "Bestpath selection disabled", 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", BPR_OLDER: "Older", BPR_NON_LLGR_STALE: "no LLGR Stale", }
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, }
var IntToRpkiValidationReasonTypeMap = map[int]RpkiValidationReasonType{ 0: RPKI_VALIDATION_REASON_TYPE_NONE, 1: RPKI_VALIDATION_REASON_TYPE_AS, 2: RPKI_VALIDATION_REASON_TYPE_LENGTH, }
var RpkiValidationReasonTypeToIntMap = map[RpkiValidationReasonType]int{ RPKI_VALIDATION_REASON_TYPE_NONE: 0, RPKI_VALIDATION_REASON_TYPE_AS: 1, RPKI_VALIDATION_REASON_TYPE_LENGTH: 2, }
var SelectionOptions config.RouteSelectionOptionsConfig
var UseMultiplePaths config.UseMultiplePathsConfig
Functions ¶
func AddrToRadixkey ¶
func AddrToRadixkey(addr bgp.AddrPrefixInterface) string
func CanImportToVrf ¶
func CidrToRadixkey ¶
func CreateUpdateMsgFromPaths ¶
func CreateUpdateMsgFromPaths(pathList []*Path, options ...*bgp.MarshallingOption) []*bgp.BGPMessage
func IpToRadixkey ¶
func NewAPIPolicyAssignmentFromTableStruct ¶
func NewAPIPolicyAssignmentFromTableStruct(t *PolicyAssignment) *api.PolicyAssignment
func NewAPIRoutingPolicyFromConfigStruct ¶
func NewAPIRoutingPolicyFromConfigStruct(c *config.RoutingPolicy) (*api.RoutingPolicy, error)
func NewSingleAsPathMatch ¶
func NewSingleAsPathMatch(arg string) *singleAsPathMatch
func ParseCommunity ¶
func ParseExtCommunity ¶
func ParseExtCommunity(arg string) (bgp.ExtendedCommunityInterface, error)
func ParseExtCommunityRegexp ¶
func RegexpRemoveCommunities ¶
func RegexpRemoveExtCommunities ¶
func RegexpRemoveExtCommunities(path *Path, exps []*regexp.Regexp, subtypes []bgp.ExtendedCommunityAttrSubType)
func ToPolicyApi ¶
func ToPolicyApi(p *config.PolicyDefinition) *api.Policy
func UpdatePathAttrs2ByteAs ¶
func UpdatePathAttrs4ByteAs ¶
Types ¶
type Action ¶
type Action interface { Type() ActionType Apply(*Path, *PolicyOptions) *Path String() string }
type ActionType ¶
type ActionType int
const ( ACTION_ROUTING ActionType = iota ACTION_COMMUNITY ACTION_EXT_COMMUNITY ACTION_MED ACTION_AS_PATH_PREPEND ACTION_NEXTHOP ACTION_LOCAL_PREF ACTION_LARGE_COMMUNITY )
type AdjRib ¶
type AdjRib struct {
// contains filtered or unexported fields
}
func NewAdjRib ¶
func NewAdjRib(rfList []bgp.RouteFamily) *AdjRib
func (*AdjRib) Drop ¶
func (adj *AdjRib) Drop(rfList []bgp.RouteFamily)
func (*AdjRib) PathList ¶
func (adj *AdjRib) PathList(rfList []bgp.RouteFamily, accepted bool) []*Path
func (*AdjRib) Select ¶
func (adj *AdjRib) Select(family bgp.RouteFamily, accepted bool, option ...TableSelectOption) (*Table, error)
type AfiSafiInCondition ¶
type AfiSafiInCondition struct {
// contains filtered or unexported fields
}
func NewAfiSafiInCondition ¶
func NewAfiSafiInCondition(afiSafInConfig []config.AfiSafiType) (*AfiSafiInCondition, error)
func (*AfiSafiInCondition) Evaluate ¶
func (c *AfiSafiInCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*AfiSafiInCondition) Name ¶
func (c *AfiSafiInCondition) Name() string
func (*AfiSafiInCondition) Set ¶
func (c *AfiSafiInCondition) Set() DefinedSet
func (*AfiSafiInCondition) String ¶
func (c *AfiSafiInCondition) String() string
func (*AfiSafiInCondition) Type ¶
func (c *AfiSafiInCondition) Type() ConditionType
type AsPathCondition ¶
type AsPathCondition struct {
// contains filtered or unexported fields
}
func NewAsPathCondition ¶
func NewAsPathCondition(c config.MatchAsPathSet) (*AsPathCondition, error)
func (*AsPathCondition) Evaluate ¶
func (c *AsPathCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*AsPathCondition) Name ¶
func (c *AsPathCondition) Name() string
func (*AsPathCondition) Option ¶
func (c *AsPathCondition) Option() MatchOption
func (*AsPathCondition) Set ¶
func (c *AsPathCondition) Set() DefinedSet
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 (*AsPathLengthCondition) Evaluate ¶
func (c *AsPathLengthCondition) Evaluate(path *Path, _ *PolicyOptions) bool
compare AS_PATH length in the message's AS_PATH attribute with the one in condition.
func (*AsPathLengthCondition) Name ¶
func (c *AsPathLengthCondition) Name() string
func (*AsPathLengthCondition) Set ¶
func (c *AsPathLengthCondition) Set() DefinedSet
func (*AsPathLengthCondition) String ¶
func (c *AsPathLengthCondition) String() string
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 (*AsPathPrependAction) Apply ¶
func (a *AsPathPrependAction) Apply(path *Path, option *PolicyOptions) *Path
func (*AsPathPrependAction) MarshalJSON ¶
func (a *AsPathPrependAction) MarshalJSON() ([]byte, error)
func (*AsPathPrependAction) String ¶
func (a *AsPathPrependAction) String() string
func (*AsPathPrependAction) ToConfig ¶
func (a *AsPathPrependAction) ToConfig() *config.SetAsPathPrepend
func (*AsPathPrependAction) Type ¶
func (a *AsPathPrependAction) Type() ActionType
type AsPathSet ¶
type AsPathSet struct {
// contains filtered or unexported fields
}
func (*AsPathSet) Append ¶
func (lhs *AsPathSet) Append(arg DefinedSet) error
func (*AsPathSet) MarshalJSON ¶
func (*AsPathSet) Remove ¶
func (lhs *AsPathSet) Remove(arg DefinedSet) error
func (*AsPathSet) Replace ¶
func (lhs *AsPathSet) Replace(arg DefinedSet) error
func (*AsPathSet) Type ¶
func (s *AsPathSet) Type() DefinedType
type Assignment ¶
type Assignment struct {
// contains filtered or unexported fields
}
type AttributeComparison ¶
type AttributeComparison int
const ( // "== comparison" ATTRIBUTE_EQ AttributeComparison = iota // ">= comparison" ATTRIBUTE_GE // "<= comparison" ATTRIBUTE_LE )
func (AttributeComparison) String ¶
func (c AttributeComparison) String() string
type BestPathReason ¶
type BestPathReason uint8
const ( BPR_UNKNOWN BestPathReason = iota BPR_DISABLED BPR_ONLY_PATH BPR_REACHABLE_NEXT_HOP BPR_HIGHEST_WEIGHT BPR_LOCAL_PREF BPR_LOCAL_ORIGIN BPR_ASPATH BPR_ORIGIN BPR_MED BPR_ASN BPR_IGP_COST BPR_ROUTER_ID BPR_OLDER BPR_NON_LLGR_STALE )
func (*BestPathReason) String ¶
func (r *BestPathReason) String() string
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
func (*Bitmap) FindandSetZeroBit ¶
type CommunityAction ¶
type CommunityAction struct {
// contains filtered or unexported fields
}
func NewCommunityAction ¶
func NewCommunityAction(c config.SetCommunity) (*CommunityAction, error)
func (*CommunityAction) Apply ¶
func (a *CommunityAction) Apply(path *Path, _ *PolicyOptions) *Path
func (*CommunityAction) MarshalJSON ¶
func (a *CommunityAction) MarshalJSON() ([]byte, error)
func (*CommunityAction) String ¶
func (a *CommunityAction) String() string
func (*CommunityAction) ToConfig ¶
func (a *CommunityAction) ToConfig() *config.SetCommunity
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) (*CommunityCondition, error)
func (*CommunityCondition) Evaluate ¶
func (c *CommunityCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*CommunityCondition) Name ¶
func (c *CommunityCondition) Name() string
func (*CommunityCondition) Option ¶
func (c *CommunityCondition) Option() MatchOption
func (*CommunityCondition) Set ¶
func (c *CommunityCondition) Set() DefinedSet
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 (*CommunitySet) Append ¶
func (lhs *CommunitySet) Append(arg DefinedSet) error
func (*CommunitySet) List ¶
func (s *CommunitySet) List() []string
func (*CommunitySet) MarshalJSON ¶
func (s *CommunitySet) MarshalJSON() ([]byte, error)
func (*CommunitySet) Remove ¶
func (lhs *CommunitySet) Remove(arg DefinedSet) error
func (*CommunitySet) Replace ¶
func (lhs *CommunitySet) Replace(arg DefinedSet) error
func (*CommunitySet) String ¶
func (s *CommunitySet) String() string
func (*CommunitySet) ToConfig ¶
func (s *CommunitySet) ToConfig() *config.CommunitySet
func (*CommunitySet) Type ¶
func (s *CommunitySet) Type() DefinedType
type Condition ¶
type Condition interface { Name() string Type() ConditionType Evaluate(*Path, *PolicyOptions) 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 CONDITION_ROUTE_TYPE CONDITION_LARGE_COMMUNITY CONDITION_NEXT_HOP CONDITION_AFI_SAFI_IN )
type DefinedSet ¶
type DefinedSet interface { Type() DefinedType Name() string Append(DefinedSet) error Remove(DefinedSet) error Replace(DefinedSet) error String() string List() []string }
type DefinedSetList ¶
type DefinedSetList []DefinedSet
func (DefinedSetList) Len ¶
func (l DefinedSetList) Len() int
func (DefinedSetList) Less ¶
func (l DefinedSetList) Less(i, j int) bool
func (DefinedSetList) Swap ¶
func (l DefinedSetList) Swap(i, j int)
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 DEFINED_TYPE_LARGE_COMMUNITY DEFINED_TYPE_NEXT_HOP )
type Destination ¶
type Destination struct {
// contains filtered or unexported fields
}
func NewDestination ¶
func NewDestination(nlri bgp.AddrPrefixInterface, mapSize int, known ...*Path) *Destination
func (*Destination) Calculate ¶
func (dest *Destination) Calculate(newPath *Path) *Update
Calculates best-path among known paths for this destination.
Modifies destination's state related to stored paths. Removes withdrawn paths from known paths. Also, adds new paths to known paths.
func (*Destination) Family ¶
func (dd *Destination) Family() bgp.RouteFamily
func (*Destination) GetAllKnownPathList ¶
func (dd *Destination) GetAllKnownPathList() []*Path
func (*Destination) GetBestPath ¶
func (dd *Destination) GetBestPath(id string, as uint32) *Path
func (*Destination) GetKnownPathList ¶
func (dd *Destination) GetKnownPathList(id string, as uint32) []*Path
func (*Destination) GetMultiBestPath ¶
func (dd *Destination) GetMultiBestPath(id string) []*Path
func (*Destination) GetNlri ¶
func (dd *Destination) GetNlri() bgp.AddrPrefixInterface
func (*Destination) MarshalJSON ¶
func (d *Destination) MarshalJSON() ([]byte, error)
func (*Destination) Select ¶
func (d *Destination) Select(option ...DestinationSelectOption) *Destination
func (*Destination) String ¶
func (dest *Destination) String() string
type DestinationSelectOption ¶
type ExtCommunityAction ¶
type ExtCommunityAction struct {
// contains filtered or unexported fields
}
func NewExtCommunityAction ¶
func NewExtCommunityAction(c config.SetExtCommunity) (*ExtCommunityAction, error)
func (*ExtCommunityAction) Apply ¶
func (a *ExtCommunityAction) Apply(path *Path, _ *PolicyOptions) *Path
func (*ExtCommunityAction) MarshalJSON ¶
func (a *ExtCommunityAction) MarshalJSON() ([]byte, error)
func (*ExtCommunityAction) String ¶
func (a *ExtCommunityAction) String() string
func (*ExtCommunityAction) ToConfig ¶
func (a *ExtCommunityAction) ToConfig() *config.SetExtCommunity
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) (*ExtCommunityCondition, error)
func (*ExtCommunityCondition) Evaluate ¶
func (c *ExtCommunityCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*ExtCommunityCondition) Name ¶
func (c *ExtCommunityCondition) Name() string
func (*ExtCommunityCondition) Option ¶
func (c *ExtCommunityCondition) Option() MatchOption
func (*ExtCommunityCondition) Set ¶
func (c *ExtCommunityCondition) Set() DefinedSet
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 (*ExtCommunitySet) Append ¶
func (s *ExtCommunitySet) Append(arg DefinedSet) error
func (*ExtCommunitySet) List ¶
func (s *ExtCommunitySet) List() []string
func (*ExtCommunitySet) MarshalJSON ¶
func (s *ExtCommunitySet) MarshalJSON() ([]byte, error)
func (*ExtCommunitySet) Remove ¶
func (lhs *ExtCommunitySet) Remove(arg DefinedSet) error
func (*ExtCommunitySet) Replace ¶
func (lhs *ExtCommunitySet) Replace(arg DefinedSet) error
func (*ExtCommunitySet) String ¶
func (s *ExtCommunitySet) String() string
func (*ExtCommunitySet) ToConfig ¶
func (s *ExtCommunitySet) ToConfig() *config.ExtCommunitySet
func (*ExtCommunitySet) Type ¶
func (s *ExtCommunitySet) Type() DefinedType
type LargeCommunityAction ¶
type LargeCommunityAction struct {
// contains filtered or unexported fields
}
func NewLargeCommunityAction ¶
func NewLargeCommunityAction(c config.SetLargeCommunity) (*LargeCommunityAction, error)
func (*LargeCommunityAction) Apply ¶
func (a *LargeCommunityAction) Apply(path *Path, _ *PolicyOptions) *Path
func (*LargeCommunityAction) MarshalJSON ¶
func (a *LargeCommunityAction) MarshalJSON() ([]byte, error)
func (*LargeCommunityAction) String ¶
func (a *LargeCommunityAction) String() string
func (*LargeCommunityAction) ToConfig ¶
func (a *LargeCommunityAction) ToConfig() *config.SetLargeCommunity
func (*LargeCommunityAction) Type ¶
func (a *LargeCommunityAction) Type() ActionType
type LargeCommunityCondition ¶
type LargeCommunityCondition struct {
// contains filtered or unexported fields
}
func NewLargeCommunityCondition ¶
func NewLargeCommunityCondition(c config.MatchLargeCommunitySet) (*LargeCommunityCondition, error)
func (*LargeCommunityCondition) Evaluate ¶
func (c *LargeCommunityCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*LargeCommunityCondition) Name ¶
func (c *LargeCommunityCondition) Name() string
func (*LargeCommunityCondition) Option ¶
func (c *LargeCommunityCondition) Option() MatchOption
func (*LargeCommunityCondition) Set ¶
func (c *LargeCommunityCondition) Set() DefinedSet
func (*LargeCommunityCondition) Type ¶
func (c *LargeCommunityCondition) Type() ConditionType
type LargeCommunitySet ¶
type LargeCommunitySet struct {
// contains filtered or unexported fields
}
func NewLargeCommunitySet ¶
func NewLargeCommunitySet(c config.LargeCommunitySet) (*LargeCommunitySet, error)
func (*LargeCommunitySet) Append ¶
func (lhs *LargeCommunitySet) Append(arg DefinedSet) error
func (*LargeCommunitySet) List ¶
func (s *LargeCommunitySet) List() []string
func (*LargeCommunitySet) MarshalJSON ¶
func (s *LargeCommunitySet) MarshalJSON() ([]byte, error)
func (*LargeCommunitySet) Remove ¶
func (lhs *LargeCommunitySet) Remove(arg DefinedSet) error
func (*LargeCommunitySet) Replace ¶
func (lhs *LargeCommunitySet) Replace(arg DefinedSet) error
func (*LargeCommunitySet) String ¶
func (s *LargeCommunitySet) String() string
func (*LargeCommunitySet) ToConfig ¶
func (s *LargeCommunitySet) ToConfig() *config.LargeCommunitySet
func (*LargeCommunitySet) Type ¶
func (s *LargeCommunitySet) Type() DefinedType
type LocalPrefAction ¶
type LocalPrefAction struct {
// contains filtered or unexported fields
}
func NewLocalPrefAction ¶
func NewLocalPrefAction(value uint32) (*LocalPrefAction, error)
func (*LocalPrefAction) Apply ¶
func (a *LocalPrefAction) Apply(path *Path, _ *PolicyOptions) *Path
func (*LocalPrefAction) MarshalJSON ¶
func (a *LocalPrefAction) MarshalJSON() ([]byte, error)
func (*LocalPrefAction) String ¶
func (a *LocalPrefAction) String() string
func (*LocalPrefAction) ToConfig ¶
func (a *LocalPrefAction) ToConfig() uint32
func (*LocalPrefAction) Type ¶
func (a *LocalPrefAction) Type() ActionType
type LookupOption ¶
type LookupOption uint8
const ( LOOKUP_EXACT LookupOption = iota LOOKUP_LONGER LOOKUP_SHORTER )
type LookupPrefix ¶
type LookupPrefix struct { Prefix string LookupOption }
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) ConvertToMatchSetOptionsRestrictedType ¶
func (o MatchOption) ConvertToMatchSetOptionsRestrictedType() config.MatchSetOptionsRestrictedType
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 NewMedActionFromApiStruct ¶
func NewMedActionFromApiStruct(action MedActionType, value int64) *MedAction
func (*MedAction) MarshalJSON ¶
func (*MedAction) ToConfig ¶
func (a *MedAction) ToConfig() config.BgpSetMedType
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) (*NeighborCondition, error)
func (*NeighborCondition) Evaluate ¶
func (c *NeighborCondition) Evaluate(path *Path, options *PolicyOptions) 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) Name ¶
func (c *NeighborCondition) Name() string
func (*NeighborCondition) Option ¶
func (c *NeighborCondition) Option() MatchOption
func (*NeighborCondition) Set ¶
func (c *NeighborCondition) Set() DefinedSet
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(name string, list []net.IPNet) (*NeighborSet, error)
func (*NeighborSet) Append ¶
func (lhs *NeighborSet) Append(arg DefinedSet) error
func (*NeighborSet) List ¶
func (s *NeighborSet) List() []string
func (*NeighborSet) MarshalJSON ¶
func (s *NeighborSet) MarshalJSON() ([]byte, 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) String ¶
func (s *NeighborSet) String() string
func (*NeighborSet) ToConfig ¶
func (s *NeighborSet) ToConfig() *config.NeighborSet
func (*NeighborSet) Type ¶
func (s *NeighborSet) Type() DefinedType
type NextHopCondition ¶
type NextHopCondition struct {
// contains filtered or unexported fields
}
func NewNextHopCondition ¶
func NewNextHopCondition(c []string) (*NextHopCondition, error)
func (*NextHopCondition) Evaluate ¶
func (c *NextHopCondition) Evaluate(path *Path, options *PolicyOptions) bool
compare next-hop ipaddress of this condition and source address of path and, subsequent comparisons are skipped if that matches the conditions. If NextHopSet's length is zero, return true.
func (*NextHopCondition) Name ¶
func (c *NextHopCondition) Name() string
func (*NextHopCondition) Set ¶
func (c *NextHopCondition) Set() DefinedSet
func (*NextHopCondition) String ¶
func (c *NextHopCondition) String() string
func (*NextHopCondition) Type ¶
func (c *NextHopCondition) Type() ConditionType
type NextHopSet ¶
type NextHopSet struct {
// contains filtered or unexported fields
}
func NewNextHopSet ¶
func NewNextHopSet(c []string) (*NextHopSet, error)
func NewNextHopSetFromApiStruct ¶
func NewNextHopSetFromApiStruct(name string, list []net.IPNet) (*NextHopSet, error)
func (*NextHopSet) Append ¶
func (lhs *NextHopSet) Append(arg DefinedSet) error
func (*NextHopSet) List ¶
func (s *NextHopSet) List() []string
func (*NextHopSet) MarshalJSON ¶
func (s *NextHopSet) MarshalJSON() ([]byte, error)
func (*NextHopSet) Name ¶
func (s *NextHopSet) Name() string
func (*NextHopSet) Remove ¶
func (lhs *NextHopSet) Remove(arg DefinedSet) error
func (*NextHopSet) Replace ¶
func (lhs *NextHopSet) Replace(arg DefinedSet) error
func (*NextHopSet) String ¶
func (s *NextHopSet) String() string
func (*NextHopSet) ToConfig ¶
func (s *NextHopSet) ToConfig() []string
func (*NextHopSet) Type ¶
func (s *NextHopSet) Type() DefinedType
type NexthopAction ¶
type NexthopAction struct {
// contains filtered or unexported fields
}
func NewNexthopAction ¶
func NewNexthopAction(c config.BgpNextHopType) (*NexthopAction, error)
func (*NexthopAction) Apply ¶
func (a *NexthopAction) Apply(path *Path, options *PolicyOptions) *Path
func (*NexthopAction) MarshalJSON ¶
func (a *NexthopAction) MarshalJSON() ([]byte, error)
func (*NexthopAction) String ¶
func (a *NexthopAction) String() string
func (*NexthopAction) ToConfig ¶
func (a *NexthopAction) ToConfig() config.BgpNextHopType
func (*NexthopAction) Type ¶
func (a *NexthopAction) Type() ActionType
type Path ¶
type Path struct { // For BGP Nexthop Tracking, this field shows if nexthop is invalidated by IGP. IsNexthopInvalid bool IsWithdraw bool // contains filtered or unexported fields }
func NewEOR ¶
func NewEOR(family bgp.RouteFamily) *Path
func NewPath ¶
func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pattrs []bgp.PathAttributeInterface, timestamp time.Time, noImplicitWithdraw bool) *Path
func ProcessMessage ¶
func UpdatePathAttrs ¶
func (*Path) GetAsPath ¶
func (path *Path) GetAsPath() *bgp.PathAttributeAsPath
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) GetLabelString ¶
func (*Path) GetLargeCommunities ¶
func (path *Path) GetLargeCommunities() []*bgp.LargeCommunity
func (*Path) GetLocalPref ¶
func (*Path) GetNexthop ¶
func (*Path) GetNlri ¶
func (path *Path) GetNlri() bgp.AddrPrefixInterface
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) IsAsLooped ¶
func (*Path) IsFromExternal ¶
func (*Path) IsLLGRStale ¶
func (*Path) MarshalJSON ¶
func (*Path) NoImplicitWithdraw ¶
func (*Path) OriginInfo ¶
func (path *Path) OriginInfo() *originInfo
func (*Path) PrependAsn ¶
PrependAsn prepends AS number. This function updates the AS_PATH attribute as follows. (If the peer is in the confederation member AS,
replace AS_SEQUENCE in the following sentence with AS_CONFED_SEQUENCE.) 1) 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. 2) 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. 3) 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 communities is 0, it does nothing. If all communities are removed, it removes Communities path attribute itself.
func (*Path) RemoveLocalPref ¶
func (path *Path) RemoveLocalPref()
func (*Path) RemovePrivateAS ¶
func (path *Path) RemovePrivateAS(localAS uint32, option config.RemovePrivateAsOption)
func (*Path) SetAsLooped ¶
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 *Path) SetExtCommunities(exts []bgp.ExtendedCommunityInterface, doReplace bool)
func (*Path) SetIsFromExternal ¶
func (*Path) SetLargeCommunities ¶
func (path *Path) SetLargeCommunities(cs []*bgp.LargeCommunity, doReplace bool)
func (*Path) SetNexthop ¶
func (*Path) SetValidation ¶
func (path *Path) SetValidation(v *Validation)
func (*Path) Validation ¶
func (path *Path) Validation() *Validation
func (*Path) ValidationStatus ¶
func (path *Path) ValidationStatus() config.RpkiValidationResultType
type PathAttrs ¶
type PathAttrs []bgp.PathAttributeInterface
type PeerInfo ¶
type Policy ¶
func (*Policy) Apply ¶
func (p *Policy) Apply(path *Path, options *PolicyOptions) (RouteType, *Path)
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) MarshalJSON ¶
func (*Policy) ToConfig ¶
func (p *Policy) ToConfig() *config.PolicyDefinition
type PolicyAssignment ¶
type PolicyAssignment struct { Name string Type PolicyDirection Policies []*Policy Default RouteType }
type PolicyDirection ¶
type PolicyDirection int
const ( POLICY_DIRECTION_NONE PolicyDirection = iota POLICY_DIRECTION_IMPORT POLICY_DIRECTION_EXPORT )
func (PolicyDirection) String ¶
func (d PolicyDirection) String() string
type PolicyOptions ¶
type PolicyOptions struct { Info *PeerInfo ValidationResult *Validation OldNextHop net.IP }
type Prefix ¶
type Prefix struct { Prefix *net.IPNet AddressFamily bgp.RouteFamily MasklengthRangeMax uint8 MasklengthRangeMin uint8 }
func (*Prefix) PrefixString ¶
type PrefixCondition ¶
type PrefixCondition struct {
// contains filtered or unexported fields
}
func NewPrefixCondition ¶
func NewPrefixCondition(c config.MatchPrefixSet) (*PrefixCondition, error)
func (*PrefixCondition) Evaluate ¶
func (c *PrefixCondition) Evaluate(path *Path, _ *PolicyOptions) 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) Name ¶
func (c *PrefixCondition) Name() string
func (*PrefixCondition) Option ¶
func (c *PrefixCondition) Option() MatchOption
func (*PrefixCondition) Set ¶
func (c *PrefixCondition) Set() DefinedSet
func (*PrefixCondition) Type ¶
func (c *PrefixCondition) Type() ConditionType
type PrefixSet ¶
type PrefixSet struct {
// contains filtered or unexported fields
}
func (*PrefixSet) Append ¶
func (lhs *PrefixSet) Append(arg DefinedSet) error
func (*PrefixSet) MarshalJSON ¶
func (*PrefixSet) Remove ¶
func (lhs *PrefixSet) Remove(arg DefinedSet) error
func (*PrefixSet) Replace ¶
func (lhs *PrefixSet) Replace(arg DefinedSet) error
func (*PrefixSet) Type ¶
func (s *PrefixSet) Type() DefinedType
type RouteTypeCondition ¶
type RouteTypeCondition struct {
// contains filtered or unexported fields
}
func NewRouteTypeCondition ¶
func NewRouteTypeCondition(c config.RouteType) (*RouteTypeCondition, error)
func (*RouteTypeCondition) Evaluate ¶
func (c *RouteTypeCondition) Evaluate(path *Path, _ *PolicyOptions) bool
func (*RouteTypeCondition) Name ¶
func (c *RouteTypeCondition) Name() string
func (*RouteTypeCondition) Set ¶
func (c *RouteTypeCondition) Set() DefinedSet
func (*RouteTypeCondition) String ¶
func (c *RouteTypeCondition) String() string
func (*RouteTypeCondition) Type ¶
func (c *RouteTypeCondition) Type() ConditionType
type RoutingAction ¶
type RoutingAction struct {
AcceptRoute bool
}
func NewRoutingAction ¶
func NewRoutingAction(c config.RouteDisposition) (*RoutingAction, error)
func (*RoutingAction) Apply ¶
func (a *RoutingAction) Apply(path *Path, _ *PolicyOptions) *Path
func (*RoutingAction) String ¶
func (a *RoutingAction) String() string
func (*RoutingAction) Type ¶
func (a *RoutingAction) Type() ActionType
type RoutingPolicy ¶
type RoutingPolicy struct {
// contains filtered or unexported fields
}
func NewRoutingPolicy ¶
func NewRoutingPolicy() *RoutingPolicy
func (*RoutingPolicy) AddDefinedSet ¶
func (r *RoutingPolicy) AddDefinedSet(s DefinedSet) error
func (*RoutingPolicy) AddPolicy ¶
func (r *RoutingPolicy) AddPolicy(x *Policy, refer bool) (err error)
func (*RoutingPolicy) AddPolicyAssignment ¶
func (r *RoutingPolicy) AddPolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, def RouteType) (err error)
func (*RoutingPolicy) AddStatement ¶
func (r *RoutingPolicy) AddStatement(st *Statement) (err error)
func (*RoutingPolicy) ApplyPolicy ¶
func (r *RoutingPolicy) ApplyPolicy(id string, dir PolicyDirection, before *Path, options *PolicyOptions) *Path
func (*RoutingPolicy) DeleteDefinedSet ¶
func (r *RoutingPolicy) DeleteDefinedSet(a DefinedSet, all bool) (err error)
func (*RoutingPolicy) DeletePolicy ¶
func (r *RoutingPolicy) DeletePolicy(x *Policy, all, preserve bool, activeId []string) (err error)
func (*RoutingPolicy) DeletePolicyAssignment ¶
func (r *RoutingPolicy) DeletePolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, all bool) (err error)
func (*RoutingPolicy) DeleteStatement ¶
func (r *RoutingPolicy) DeleteStatement(st *Statement, all bool) (err error)
func (*RoutingPolicy) GetDefinedSet ¶
func (r *RoutingPolicy) GetDefinedSet(typ DefinedType, name string) (*config.DefinedSets, error)
func (*RoutingPolicy) GetPolicy ¶
func (r *RoutingPolicy) GetPolicy(name string) []*config.PolicyDefinition
func (*RoutingPolicy) GetPolicyAssignment ¶
func (r *RoutingPolicy) GetPolicyAssignment(id string, dir PolicyDirection) (RouteType, []*Policy, error)
func (*RoutingPolicy) GetStatement ¶
func (r *RoutingPolicy) GetStatement(name string) []*config.Statement
func (*RoutingPolicy) Reset ¶
func (r *RoutingPolicy) Reset(rp *config.RoutingPolicy, ap map[string]config.ApplyPolicy) error
func (*RoutingPolicy) SetPolicyAssignment ¶
func (r *RoutingPolicy) SetPolicyAssignment(id string, dir PolicyDirection, policies []*config.PolicyDefinition, def RouteType) (err error)
type RpkiValidationCondition ¶
type RpkiValidationCondition struct {
// contains filtered or unexported fields
}
func NewRpkiValidationCondition ¶
func NewRpkiValidationCondition(c config.RpkiValidationResultType) (*RpkiValidationCondition, error)
func (*RpkiValidationCondition) Evaluate ¶
func (c *RpkiValidationCondition) Evaluate(path *Path, options *PolicyOptions) bool
func (*RpkiValidationCondition) Name ¶
func (c *RpkiValidationCondition) Name() string
func (*RpkiValidationCondition) Set ¶
func (c *RpkiValidationCondition) Set() DefinedSet
func (*RpkiValidationCondition) String ¶
func (c *RpkiValidationCondition) String() string
func (*RpkiValidationCondition) Type ¶
func (c *RpkiValidationCondition) Type() ConditionType
type RpkiValidationReasonType ¶
type RpkiValidationReasonType string
const ( RPKI_VALIDATION_REASON_TYPE_NONE RpkiValidationReasonType = "none" RPKI_VALIDATION_REASON_TYPE_AS RpkiValidationReasonType = "as" RPKI_VALIDATION_REASON_TYPE_LENGTH RpkiValidationReasonType = "length" )
func (RpkiValidationReasonType) ToInt ¶
func (v RpkiValidationReasonType) ToInt() int
type Statement ¶
func (*Statement) Apply ¶
func (s *Statement) Apply(path *Path, options *PolicyOptions) (RouteType, *Path)
func (*Statement) Evaluate ¶
func (s *Statement) Evaluate(p *Path, options *PolicyOptions) bool
evaluate each condition in the statement according to MatchSetOptions
func (*Statement) MarshalJSON ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func NewTable ¶
func NewTable(rf bgp.RouteFamily, dsts ...*Destination) *Table
func (*Table) GetDestination ¶
func (t *Table) GetDestination(nlri bgp.AddrPrefixInterface) *Destination
func (*Table) GetDestinations ¶
func (t *Table) GetDestinations() map[string]*Destination
func (*Table) GetEvpnDestinationsWithRouteType ¶
func (t *Table) GetEvpnDestinationsWithRouteType(typ string) ([]*Destination, error)
func (*Table) GetLongerPrefixDestinations ¶
func (t *Table) GetLongerPrefixDestinations(key string) ([]*Destination, error)
func (*Table) GetRoutefamily ¶
func (t *Table) GetRoutefamily() bgp.RouteFamily
func (*Table) MultiBests ¶
type TableManager ¶
type TableManager struct { Tables map[bgp.RouteFamily]*Table Vrfs map[string]*Vrf // contains filtered or unexported fields }
func NewTableManager ¶
func NewTableManager(rfList []bgp.RouteFamily) *TableManager
func (*TableManager) AddVrf ¶
func (manager *TableManager) AddVrf(name string, id uint32, rd bgp.RouteDistinguisherInterface, importRt, exportRt []bgp.ExtendedCommunityInterface, info *PeerInfo) ([]*Path, error)
func (*TableManager) DeleteVrf ¶
func (manager *TableManager) DeleteVrf(name string) ([]*Path, error)
func (*TableManager) GetBestMultiPathList ¶
func (manager *TableManager) GetBestMultiPathList(id string, rfList []bgp.RouteFamily) [][]*Path
func (*TableManager) GetBestPathList ¶
func (manager *TableManager) GetBestPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path
func (*TableManager) GetDestination ¶
func (manager *TableManager) GetDestination(path *Path) *Destination
func (*TableManager) GetPathList ¶
func (manager *TableManager) GetPathList(id string, as uint32, rfList []bgp.RouteFamily) []*Path
func (*TableManager) GetPathListByPeer ¶
func (manager *TableManager) GetPathListByPeer(info *PeerInfo, rf bgp.RouteFamily) []*Path
func (*TableManager) GetPathListWithNexthop ¶
func (manager *TableManager) GetPathListWithNexthop(id string, rfList []bgp.RouteFamily, nexthop net.IP) []*Path
func (*TableManager) GetPathListWithSource ¶
func (manager *TableManager) GetPathListWithSource(id string, rfList []bgp.RouteFamily, source *PeerInfo) []*Path
func (*TableManager) GetRFlist ¶
func (manager *TableManager) GetRFlist() []bgp.RouteFamily
func (*TableManager) TableInfo ¶
func (manager *TableManager) TableInfo(id string, as uint32, family bgp.RouteFamily) (*TableInfo, error)
func (*TableManager) Update ¶
func (manager *TableManager) Update(newPath *Path) []*Update
type TableSelectOption ¶
type Validation ¶
type Validation struct { Status config.RpkiValidationResultType Reason RpkiValidationReasonType Matched []*ROA UnmatchedAs []*ROA UnmatchedLength []*ROA }
type Vrf ¶
type Vrf struct { Name string Id uint32 Rd bgp.RouteDistinguisherInterface ImportRt []bgp.ExtendedCommunityInterface ExportRt []bgp.ExtendedCommunityInterface }