apiutil

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNativeNlri

func GetNativeNlri(p *api.Path) (bgp.NLRI, error)

func GetNativePathAttributes

func GetNativePathAttributes(p *api.Path) ([]bgp.PathAttributeInterface, error)

func MarshalCapabilities

func MarshalCapabilities(values []bgp.ParameterCapabilityInterface) ([]*api.Capability, error)

func MarshalCapability

func MarshalCapability(value bgp.ParameterCapabilityInterface) (*api.Capability, error)

func MarshalFlowSpecRules

func MarshalFlowSpecRules(values []bgp.FlowSpecComponentInterface) ([]*api.FlowSpecRule, error)

func MarshalLsBgpPeerSegmentSid

func MarshalLsBgpPeerSegmentSid(n *bgp.LsBgpPeerSegmentSID) (*api.LsBgpPeerSegmentSID, error)

func MarshalLsLinkDescriptor

func MarshalLsLinkDescriptor(n *bgp.LsLinkDescriptor) (*api.LsLinkDescriptor, error)

func MarshalLsLinkNLRI

func MarshalLsLinkNLRI(n *bgp.LsLinkNLRI) (*api.LsAddrPrefix_LsNLRI, error)

func MarshalLsNodeDescriptor

func MarshalLsNodeDescriptor(d *bgp.LsNodeDescriptor) (*api.LsNodeDescriptor, error)

func MarshalLsNodeNLRI

func MarshalLsNodeNLRI(n *bgp.LsNodeNLRI) (*api.LsAddrPrefix_LsNLRI, error)

func MarshalLsPrefixDescriptor

func MarshalLsPrefixDescriptor(d *bgp.LsPrefixDescriptor) (*api.LsPrefixDescriptor, error)

func MarshalLsPrefixV4NLRI

func MarshalLsPrefixV4NLRI(n *bgp.LsPrefixV4NLRI) (*api.LsAddrPrefix_LsNLRI, error)

func MarshalLsPrefixV6NLRI

func MarshalLsPrefixV6NLRI(n *bgp.LsPrefixV6NLRI) (*api.LsAddrPrefix_LsNLRI, error)

func MarshalLsSRv6SIDNLRI

func MarshalLsSRv6SIDNLRI(n *bgp.LsSrv6SIDNLRI) (*api.LsAddrPrefix_LsNLRI, error)

func MarshalLsTLVMultiTopoID

func MarshalLsTLVMultiTopoID(mti *bgp.LsTLVMultiTopoID) (*api.LsMultiTopologyIdentifier, error)

func MarshalLsTLVSrv6SIDInfo

func MarshalLsTLVSrv6SIDInfo(info *bgp.LsTLVSrv6SIDInfo) (*api.LsSrv6SIDInformation, error)

func MarshalNLRI

func MarshalNLRI(value bgp.NLRI) (*api.NLRI, error)

func MarshalNLRIs

func MarshalNLRIs(values []bgp.NLRI) ([]*api.NLRI, error)

func MarshalPathAttributes

func MarshalPathAttributes(attrList []bgp.PathAttributeInterface) ([]*api.Attribute, error)

func MarshalRTs

func MarshalRTs(values []bgp.ExtendedCommunityInterface) ([]*api.RouteTarget, error)

func MarshalSRBSID

func MarshalSRBSID(bsid *bgp.TunnelEncapSubTLVSRBSID) (*api.SRBindingSID, error)

MarshalSRBSID marshals SR Policy Binding SID Sub TLV structure

func MarshalSRSegments

MarshalSRSegments marshals a slice of SR Policy Segment List

func MarshalSRv6SubSubTLVs

func MarshalSRv6SubSubTLVs(tlvs []bgp.PrefixSIDTLVInterface) (map[uint32]*api.SRv6SubSubTLVs, error)

func MarshalSRv6SubTLVs

func MarshalSRv6SubTLVs(tlvs []bgp.PrefixSIDTLVInterface) (map[uint32]*api.SRv6SubTLVs, error)

func MarshalSRv6TLVs

func MarshalSRv6TLVs(tlvs []bgp.PrefixSIDTLVInterface) ([]*api.PrefixSID_TLV, error)

func NewAddPathCapability

func NewAddPathCapability(a *bgp.CapAddPath) *api.AddPathCapability

func NewAggregatorAttributeFromNative

func NewAggregatorAttributeFromNative(a *bgp.PathAttributeAggregator) (*api.AggregatorAttribute, error)

func NewAigpAttributeFromNative

func NewAigpAttributeFromNative(a *bgp.PathAttributeAigp) (*api.AigpAttribute, error)

func NewAs4PathAttributeFromNative

func NewAs4PathAttributeFromNative(a *bgp.PathAttributeAs4Path) (*api.As4PathAttribute, error)

func NewAsPathAttributeFromNative

func NewAsPathAttributeFromNative(a *bgp.PathAttributeAsPath) (*api.AsPathAttribute, error)

func NewClusterListAttributeFromNative

func NewClusterListAttributeFromNative(a *bgp.PathAttributeClusterList) (*api.ClusterListAttribute, error)

func NewCommunitiesAttributeFromNative

func NewCommunitiesAttributeFromNative(a *bgp.PathAttributeCommunities) (*api.CommunitiesAttribute, error)

func NewFQDNCapability

func NewFQDNCapability(a *bgp.CapFQDN) *api.FqdnCapability

func NewLocalPrefAttributeFromNative

func NewLocalPrefAttributeFromNative(a *bgp.PathAttributeLocalPref) (*api.LocalPrefAttribute, error)

func NewLsAttributeFromNative

func NewLsAttributeFromNative(a *bgp.PathAttributeLs) (*api.LsAttribute, error)

func NewMpReachNLRIAttributeFromNative

func NewMpReachNLRIAttributeFromNative(a *bgp.PathAttributeMpReachNLRI) (*api.MpReachNLRIAttribute, error)

func NewMultiProtocolCapability

func NewMultiProtocolCapability(a *bgp.CapMultiProtocol) *api.MultiProtocolCapability

func NewNextHopAttributeFromNative

func NewNextHopAttributeFromNative(a *bgp.PathAttributeNextHop) (*api.NextHopAttribute, error)

func NewOriginAttributeFromNative

func NewOriginAttributeFromNative(a *bgp.PathAttributeOrigin) (*api.OriginAttribute, error)

func NewPath

func NewPath(family bgp.Family, nlri bgp.NLRI, isWithdraw bool, attrs []bgp.PathAttributeInterface, age time.Time) (*api.Path, error)

func NewPmsiTunnelAttributeFromNative

func NewPmsiTunnelAttributeFromNative(a *bgp.PathAttributePmsiTunnel) (*api.PmsiTunnelAttribute, error)

func NewPrefixSIDAttributeFromNative

func NewPrefixSIDAttributeFromNative(a *bgp.PathAttributePrefixSID) (*api.PrefixSID, error)

func NewRouteRefreshCapability

func NewRouteRefreshCapability(a *bgp.CapRouteRefresh) *api.RouteRefreshCapability

func NewTunnelEncapAttributeFromNative

func NewTunnelEncapAttributeFromNative(a *bgp.PathAttributeTunnelEncap) (*api.TunnelEncapAttribute, error)

func NewUnknownAttributeFromNative

func NewUnknownAttributeFromNative(a *bgp.PathAttributeUnknown) (*api.UnknownAttribute, error)

func NewUnknownCapability

func NewUnknownCapability(a *bgp.CapUnknown) *api.UnknownCapability

func StringToNetIPLsTLVSrv6SIDInfo

func StringToNetIPLsTLVSrv6SIDInfo(s []string) ([]netip.Addr, uint16, error)

func ToApiFamily

func ToApiFamily(afi uint16, safi uint8) *api.Family

func ToFamily

func ToFamily(f *api.Family) bgp.Family

func UnmarshalAttribute

func UnmarshalAttribute(attr *api.Attribute) (bgp.PathAttributeInterface, error)

func UnmarshalCapabilities

func UnmarshalCapabilities(values []*api.Capability) ([]bgp.ParameterCapabilityInterface, error)

func UnmarshalFlowSpecRules

func UnmarshalFlowSpecRules(values []*api.FlowSpecRule) ([]bgp.FlowSpecComponentInterface, error)

func UnmarshalLsAttribute

func UnmarshalLsAttribute(a *api.LsAttribute) (*bgp.LsAttribute, error)

func UnmarshalLsBgpPeerSegmentSid

func UnmarshalLsBgpPeerSegmentSid(a *api.LsBgpPeerSegmentSID) (*bgp.LsBgpPeerSegmentSID, error)

func UnmarshalLsLinkDescriptor

func UnmarshalLsLinkDescriptor(ld *api.LsLinkDescriptor) (*bgp.LsLinkDescriptor, error)

func UnmarshalLsNodeDescriptor

func UnmarshalLsNodeDescriptor(nd *api.LsNodeDescriptor) (*bgp.LsNodeDescriptor, error)

func UnmarshalLsPrefixDescriptor

func UnmarshalLsPrefixDescriptor(*api.LsPrefixDescriptor) (*bgp.LsPrefixDescriptor, error)

func UnmarshalLsTLVMultiTopoID

func UnmarshalLsTLVMultiTopoID(mti *api.LsMultiTopologyIdentifier) (*bgp.LsTLVMultiTopoID, error)

func UnmarshalLsTLVSrv6SIDInfo

func UnmarshalLsTLVSrv6SIDInfo(ssi *api.LsSrv6SIDInformation) (*bgp.LsTLVSrv6SIDInfo, error)

func UnmarshalNLRI

func UnmarshalNLRI(rf bgp.Family, an *api.NLRI) (bgp.NLRI, error)

func UnmarshalNLRIs

func UnmarshalNLRIs(rf bgp.Family, values []*api.NLRI) ([]bgp.NLRI, error)

func UnmarshalPathAttributes

func UnmarshalPathAttributes(values []*api.Attribute) ([]bgp.PathAttributeInterface, error)

func UnmarshalPrefixDescriptor

func UnmarshalPrefixDescriptor(pd *api.LsPrefixDescriptor) (*bgp.LsPrefixDescriptor, error)

func UnmarshalPrefixSID

func UnmarshalPrefixSID(psid *api.PrefixSID) (*bgp.PathAttributePrefixSID, error)

func UnmarshalRTs

func UnmarshalRTs(values []*api.RouteTarget) ([]bgp.ExtendedCommunityInterface, error)

func UnmarshalSRBSID

UnmarshalSRBSID unmarshals SR Policy Binding SID Sub TLV and returns native TunnelEncapSubTLVInterface interface

func UnmarshalSRSegments

UnmarshalSRSegments unmarshals SR Policy Segments slice of structs

func UnmarshalSubSubTLVs

func UnmarshalSubSubTLVs(stlvs map[uint32]*api.SRv6SubSubTLVs) (uint16, []bgp.PrefixSIDTLVInterface, error)

func UnmarshalSubTLVs

func UnmarshalSubTLVs(stlvs map[uint32]*api.SRv6SubTLVs) (uint16, []bgp.PrefixSIDTLVInterface, error)

Types

type AddPathRequest

type AddPathRequest struct {
	VRFID string
	Paths []*Path
}

AddPathRequest is used by server.AddPath API

type AddPathResponse

type AddPathResponse struct {
	UUID  uuid.UUID
	Error error
}

AddPathResponse is used by server.AddPath API

type DeletePathRequest

type DeletePathRequest struct {
	VRFID        string
	UUIDs        []uuid.UUID
	DeleteAll    bool
	DeleteFamily *bgp.Family
	Paths        []*Path
}

type Destination

type Destination struct {
	Paths []*Path
}

func NewDestination

func NewDestination(dst *api.Destination) *Destination

func (*Destination) MarshalJSON

func (d *Destination) MarshalJSON() ([]byte, error)

type ListPathRequest

type ListPathRequest struct {
	TableType      api.TableType
	Name           string
	Family         bgp.Family
	Prefixes       []*LookupPrefix
	SortType       api.ListPathRequest_SortType
	EnableFiltered bool
}

ListPathRequest is used by server.ListPath API

type LookupOption

type LookupOption uint8
const (
	LOOKUP_EXACT LookupOption = iota
	LOOKUP_LONGER
	LOOKUP_SHORTER
)

type LookupPrefix

type LookupPrefix struct {
	Prefix string
	RD     string
	LookupOption
}

type Path

type Path struct {
	Family             bgp.Family
	Nlri               bgp.NLRI                     `json:"nlri"`
	Age                int64                        `json:"age"`
	Best               bool                         `json:"best"`
	Attrs              []bgp.PathAttributeInterface `json:"attrs"`
	Stale              bool                         `json:"stale"`
	Withdrawal         bool                         `json:"withdrawal,omitempty"`
	PeerASN            uint32                       `json:"peer-asn,omitempty"`
	PeerID             netip.Addr                   `json:"peer-id,omitzero"`
	PeerAddress        netip.Addr                   `json:"peer-address,omitzero"`
	IsFromExternal     bool                         `json:"is-from-external,omitempty"`
	NoImplicitWithdraw bool                         `json:"no-implicit-withdraw,omitempty"`
	IsNexthopInvalid   bool                         `json:"is-nexthop-invalid,omitempty"`
	// the following fields are used only repoted by GetList() API
	SendMaxFiltered bool            `json:"send-max-filtered,omitempty"` // true if the path has been filtered out due to max path count reached
	Filtered        bool            `json:"filtered,omitempty"`
	Validation      *api.Validation `json:"validation,omitempty"`
	RemoteID        uint32
	LocalID         uint32
}

used by server.WatchEventMessages API

type Peer

type Peer struct {
	Conf      PeerConf
	State     PeerState
	Transport Transport
}

type PeerConf

type PeerConf struct {
	PeerASN           uint32
	LocalASN          uint32
	NeighborAddress   netip.Addr
	NeighborInterface string
}

type PeerEventType

type PeerEventType uint32
const (
	PEER_EVENT_UNKNOWN     PeerEventType = 0
	PEER_EVENT_INIT        PeerEventType = 1
	PEER_EVENT_END_OF_INIT PeerEventType = 2
	PEER_EVENT_STATE       PeerEventType = 3
)

type PeerState

type PeerState struct {
	PeerASN           uint32
	LocalASN          uint32
	NeighborAddress   netip.Addr
	SessionState      bgp.FSMState
	AdminState        api.PeerState_AdminState
	RouterID          netip.Addr
	RemoteCap         []bgp.ParameterCapabilityInterface
	DisconnectReason  api.PeerState_DisconnectReason
	DisconnectMessage string
}

type Transport

type Transport struct {
	LocalAddress netip.Addr
	LocalPort    uint32
	RemotePort   uint32
}

type WatchEventMessage_PeerEvent

type WatchEventMessage_PeerEvent struct {
	Type PeerEventType
	Peer Peer
}

WatchEventMessages API type

Jump to

Keyboard shortcuts

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