table

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyDown    = PolicyState("down")
	PolicyUp      = PolicyState("up")
	PolicyActive  = PolicyState("active")
	PolicyUnknown = PolicyState("unknown")
)
View Source
const (
	BehaviorReserved uint16 = 0x0000
	BehaviorEND      uint16 = 0x0001
	BehaviorENDX     uint16 = 0x0005
	BehaviorUN       uint16 = 0x0030
	BehaviorUA       uint16 = 0x0039
)
View Source
const FirstSIDIndex = 0 // Index for first SID in Sids array
View Source
const SRv6SIDBitLength = 128

Variables

This section is empty.

Functions

func BehaviorToString

func BehaviorToString(behavior uint16) string

func SegmentsEqual

func SegmentsEqual(a, b Segment) bool

Helper function for Segment interface equality check

Types

type EndpointBehavior

type EndpointBehavior struct {
	Behavior  uint16
	Flags     uint8
	Algorithm uint8
}
type LsLink struct {
	LocalNode   *LsNode      // Primary key, in MP_REACH_NLRI Attr
	RemoteNode  *LsNode      // Primary key, in MP_REACH_NLRI Attr
	LocalIP     netip.Addr   // In MP_REACH_NLRI Attr
	RemoteIP    netip.Addr   // In MP_REACH_NLRI Attr
	Metrics     []*Metric    // In BGP-LS Attr
	AdjSid      uint32       // In BGP-LS Attr
	Srv6EndXSID *Srv6EndXSID // In BGP-LS Attr
}
func NewLsLink(localNode *LsNode, remoteNode *LsNode) *LsLink

func (*LsLink) Metric

func (l *LsLink) Metric(metricType MetricType) (uint32, error)

func (*LsLink) UpdateTED

func (l *LsLink) UpdateTED(ted *LsTED, cfgASN uint32)

type LsNode

type LsNode struct {
	ASN        uint32 // primary key, in MP_REACH_NLRI Attr
	RouterID   string // primary key, in MP_REACH_NLRI Attr
	IsisAreaID string // in BGP-LS Attr
	Hostname   string // in BGP-LS Attr
	SrgbBegin  uint32 // in BGP-LS Attr
	SrgbEnd    uint32 // in BGP-LS Attr
	Links      []*LsLink
	Prefixes   []*LsPrefix
	SRv6SIDs   []*LsSrv6SID
}

func NewLsNode

func NewLsNode(asn uint32, nodeID string) *LsNode
func (n *LsNode) AddLink(link *LsLink)

func (*LsNode) AddSrv6SID

func (n *LsNode) AddSrv6SID(s *LsSrv6SID)

func (*LsNode) LoopbackAddr

func (n *LsNode) LoopbackAddr() (netip.Addr, error)

func (*LsNode) NodeSegment

func (n *LsNode) NodeSegment() (Segment, error)

func (*LsNode) UpdateTED

func (n *LsNode) UpdateTED(ted *LsTED, cfgASN uint32)

type LsPrefix

type LsPrefix struct {
	LocalNode *LsNode      // primary key, in MP_REACH_NLRI Attr
	Prefix    netip.Prefix // in MP_REACH_NLRI Attr
	SidIndex  uint32       // in BGP-LS Attr (only for Lo Address Prefix)
}

func NewLsPrefix

func NewLsPrefix(localNode *LsNode) *LsPrefix

func (*LsPrefix) UpdateTED

func (lp *LsPrefix) UpdateTED(ted *LsTED, cfgASN uint32)

type LsSrv6SID

type LsSrv6SID struct {
	LocalNode        *LsNode          // primary key, in MP_REACH_NLRI Attr
	Sids             []string         // in LsSrv6SID Attr
	EndpointBehavior EndpointBehavior // in BGP-LS Attr
	SIDStructure     SIDStructure     // in BGP-LS Attr
	MultiTopoIDs     []uint32         // in LsSrv6SID Attr
}

func NewLsSrv6SID

func NewLsSrv6SID(node *LsNode) *LsSrv6SID

func (*LsSrv6SID) UpdateTED

func (s *LsSrv6SID) UpdateTED(ted *LsTED, cfgASN uint32)

type LsTED

type LsTED struct {
	Nodes map[string]*LsNode // {"NodeID1": node1, "NodeID2": node2}
}

func (*LsTED) Print

func (ted *LsTED) Print()

Print outputs the TED in a structured way with low cyclomatic complexity.

func (*LsTED) Update

func (ted *LsTED) Update(tedElems []TEDElem, asn uint32)

type Metric

type Metric struct {
	Type  MetricType
	Value uint32
}

func NewMetric

func NewMetric(metricType MetricType, value uint32) *Metric

type MetricType

type MetricType int
const (
	IGPMetric MetricType = iota
	TEMetric
	DelayMetric
	HopcountMetric
)

func (MetricType) String

func (m MetricType) String() string

type PolicyDiff

type PolicyDiff struct {
	Name        *string
	Color       *uint32
	Preference  *uint32
	SegmentList []Segment
	LSPID       uint16
	State       PolicyState
}

SR Policy parameter that can be changed

type PolicyState

type PolicyState string

sr-policy state

type SIDStructure

type SIDStructure struct {
	LocalBlock uint8
	LocalNode  uint8
	LocalFunc  uint8
	LocalArg   uint8
}

type SRPolicy

type SRPolicy struct {
	PlspID      uint32
	Name        string
	SegmentList []Segment
	SrcAddr     netip.Addr
	DstAddr     netip.Addr
	Color       uint32
	Preference  uint32
	LSPID       uint16
	State       PolicyState
}

func NewSRPolicy

func NewSRPolicy(
	plspID uint32,
	name string,
	segmentList []Segment,
	srcAddr netip.Addr,
	dstAddr netip.Addr,
	color uint32,
	preference uint32,
	lspID uint16,
	state PolicyState,
) *SRPolicy

func (*SRPolicy) Update

func (p *SRPolicy) Update(df PolicyDiff)

type Segment

type Segment interface {
	SidString() string
}

func NewSegment

func NewSegment(sid string) (Segment, error)

type SegmentSRMPLS

type SegmentSRMPLS struct {
	Sid uint32
}

func NewSegmentSRMPLS

func NewSegmentSRMPLS(sid uint32) SegmentSRMPLS

func (SegmentSRMPLS) Equal

func (seg SegmentSRMPLS) Equal(other SegmentSRMPLS) bool

Equal for SegmentSRMPLS

func (SegmentSRMPLS) SidString

func (seg SegmentSRMPLS) SidString() string

type SegmentSRv6

type SegmentSRv6 struct {
	Sid        netip.Addr
	LocalAddr  netip.Addr
	RemoteAddr netip.Addr
	Structure  []uint8
	USid       bool
}

func NewSegmentSRv6

func NewSegmentSRv6(sid netip.Addr) SegmentSRv6

func NewSegmentSRv6WithNodeInfo

func NewSegmentSRv6WithNodeInfo(sid netip.Addr, n *LsNode) (SegmentSRv6, error)

func (SegmentSRv6) Behavior

func (seg SegmentSRv6) Behavior() (uint16, error)

func (SegmentSRv6) Equal

func (seg SegmentSRv6) Equal(other SegmentSRv6) bool

Equal for SegmentSRv6

func (SegmentSRv6) SidString

func (seg SegmentSRv6) SidString() string

type Srv6EndXSID

type Srv6EndXSID struct {
	EndpointBehavior uint16
	Sids             []string
	Srv6SIDStructure SIDStructure
}

type TEDElem

type TEDElem interface {
	UpdateTED(ted *LsTED, cfgASN uint32)
}

type Waypoint

type Waypoint struct {
	RouterID string
	SID      string // optional: fixed SID override
}

Waypoint represents a loose hop for SR Policy computation. SID is optional: if empty, TED lookup will be used to find End SID for that router.

Jump to

Keyboard shortcuts

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