common

package
v3.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVRFIndex = uint32(0)
	PuntTableId     = uint32(1)
	PodVRFIndex     = uint32(2)
)

Variables

View Source
var (
	ContainerSideMacAddress, _ = net.ParseMAC("02:00:00:00:00:01")
	VppManagerInfo             *config.VppManagerInfo
)
View Source
var (
	BgpFamilyUnicastIPv4VPN = bgpapi.Family{Afi: bgpapi.Family_AFI_IP, Safi: bgpapi.Family_SAFI_MPLS_VPN}
	BgpFamilyUnicastIPv6VPN = bgpapi.Family{Afi: bgpapi.Family_AFI_IP6, Safi: bgpapi.Family_SAFI_MPLS_VPN}
	BgpFamilyUnicastIPv4    = bgpapi.Family{Afi: bgpapi.Family_AFI_IP, Safi: bgpapi.Family_SAFI_UNICAST}
	BgpFamilySRv6IPv4       = bgpapi.Family{Afi: bgpapi.Family_AFI_IP, Safi: bgpapi.Family_SAFI_SR_POLICY}
	BgpFamilyUnicastIPv6    = bgpapi.Family{Afi: bgpapi.Family_AFI_IP6, Safi: bgpapi.Family_SAFI_UNICAST}
	BgpFamilySRv6IPv6       = bgpapi.Family{Afi: bgpapi.Family_AFI_IP6, Safi: bgpapi.Family_SAFI_SR_POLICY}
)

Functions

func CompareIPList

func CompareIPList(newIPList, oldIPList []net.IP) (added []net.IP, deleted []net.IP, changed bool)
func CreateVppLink(socket string, log *logrus.Entry) (vpp *vpplink.VppLink, err error)

CreateVppLink creates new link to VPP and waits for VPP to be up and running (by using simple VPP API call)

func CreateVppLinkInRetryLoop

func CreateVppLinkInRetryLoop(socket string, log *logrus.Entry, timeout time.Duration,
	retry time.Duration) (vpp *vpplink.VppLink, err error)

CreateVppLinkInRetryLoop creates new link to VPP and waits for VPP to be up and running (by using simple VPP API call). This process is retried in a loop and has a timeout limit.

func FetchNDataThreads

func FetchNDataThreads(vpp *vpplink.VppLink, log *logrus.Entry) int

func FormatBGPConfiguration added in v3.25.1

func FormatBGPConfiguration(conf *calicov3.BGPConfigurationSpec) string

func FormatSlice

func FormatSlice(lst []interface{ String() string }) string

func FullyQualified

func FullyQualified(addr net.IP) *net.IPNet

func GetAggPrefixSetName

func GetAggPrefixSetName(isv6 bool) string

func GetBGPSpecAddresses

func GetBGPSpecAddresses(nodeBGPSpec *LocalNodeSpec) (ip4 *net.IP, ip6 *net.IP)

func GetHostPrefixSetName

func GetHostPrefixSetName(isv6 bool) string

func GetMaxCIDRMask

func GetMaxCIDRMask(addr net.IP) net.IPMask

func GetPolicyName

func GetPolicyName(isv6 bool) string

func IsFullyQualified added in v3.25.1

func IsFullyQualified(cidr *net.IPNet) bool

func IsV6Cidr added in v3.25.1

func IsV6Cidr(cidr *net.IPNet) bool

func MakePath

func MakePath(prefix string, isWithdrawal bool, nodeIpv4 *net.IP, nodeIpv6 *net.IP, vni uint32, asNumber uint32) (*bgpapi.Path, error)

func MakePathSRv6Tunnel

func MakePathSRv6Tunnel(localSid net.IP, bSid net.IP, nodeIpv6 net.IP, trafficType int, isWithdrawal bool) (*bgpapi.Path, error)

func SafeFormat

func SafeFormat(e interface{ String() string }) string

func SendEvent

func SendEvent(event CalicoVppEvent)

func ToMaxLenCIDR

func ToMaxLenCIDR(addr net.IP) *net.IPNet

func WaitForVppManager

func WaitForVppManager() (*config.VppManagerInfo, error)

func WritePidToFile

func WritePidToFile() error

Types

type CalicoVppEvent

type CalicoVppEvent struct {
	Type CalicoVppEventType

	Old interface{}
	New interface{}
}

type CalicoVppEventType

type CalicoVppEventType string
const (
	ChanSize = 500

	PeerNodeStateChanged CalicoVppEventType = "PeerNodeStateChanged"
	FelixConfChanged     CalicoVppEventType = "FelixConfChanged"
	IpamConfChanged      CalicoVppEventType = "IpamConfChanged"
	BGPConfChanged       CalicoVppEventType = "BGPConfChanged"

	ConnectivityAdded   CalicoVppEventType = "ConnectivityAdded"
	ConnectivityDeleted CalicoVppEventType = "ConnectivityDeleted"

	SRv6PolicyAdded   CalicoVppEventType = "SRv6PolicyAdded"
	SRv6PolicyDeleted CalicoVppEventType = "SRv6PolicyDeleted"

	PodAdded   CalicoVppEventType = "PodAdded"
	PodDeleted CalicoVppEventType = "PodDeleted"

	LocalPodAddressAdded   CalicoVppEventType = "LocalPodAddressAdded"
	LocalPodAddressDeleted CalicoVppEventType = "LocalPodAddressDeleted"

	TunnelAdded   CalicoVppEventType = "TunnelAdded"
	TunnelDeleted CalicoVppEventType = "TunnelDeleted"

	BGPPeerAdded     CalicoVppEventType = "BGPPeerAdded"
	BGPPeerDeleted   CalicoVppEventType = "BGPPeerDeleted"
	BGPPeerUpdated   CalicoVppEventType = "BGPPeerUpdated"
	BGPSecretChanged CalicoVppEventType = "BGPSecretChanged"

	BGPFilterAddedOrUpdated CalicoVppEventType = "BGPFilterAddedOrUpdated"
	BGPFilterDeleted        CalicoVppEventType = "BGPFilterDeleted"

	BGPDefinedSetAdded   CalicoVppEventType = "BGPDefinedSetAdded"
	BGPDefinedSetDeleted CalicoVppEventType = "BGPDefinedSetDeleted"

	BGPPathAdded   CalicoVppEventType = "BGPPathAdded"
	BGPPathDeleted CalicoVppEventType = "BGPPathDeleted"

	NetAddedOrUpdated CalicoVppEventType = "NetAddedOrUpdated"
	NetDeleted        CalicoVppEventType = "NetDeleted"
	NetsSynced        CalicoVppEventType = "NetsSynced"

	IpamPoolUpdate CalicoVppEventType = "IpamPoolUpdate"
	IpamPoolRemove CalicoVppEventType = "IpamPoolRemove"

	WireguardPublicKeyChanged CalicoVppEventType = "WireguardPublicKeyChanged"
)

type ChangeType

type ChangeType int
const (
	ChangeSame    ChangeType = 0
	ChangeAdded   ChangeType = 1
	ChangeDeleted ChangeType = 2
	ChangeUpdated ChangeType = 4
)

*

  • Change types are flags so that you can check for multiple
  • fields changing with an OR

func GetIpNetChangeType added in v3.25.1

func GetIpNetChangeType(old, new *net.IPNet) ChangeType

func GetStringChangeType

func GetStringChangeType(old, new string) ChangeType

type LocalNodeSpec added in v3.25.1

type LocalNodeSpec struct {
	ASNumber    *numorstring.ASNumber
	Labels      map[string]string
	Name        string
	IPv4Address *net.IPNet
	IPv6Address *net.IPNet
}

type NodeConnectivity

type NodeConnectivity struct {
	Dst              net.IPNet
	NextHop          net.IP
	ResolvedProvider string
	Custom           interface{}
	Vni              uint32
}

func (*NodeConnectivity) String

func (cn *NodeConnectivity) String() string

type NodeWireguardPublicKey added in v3.25.1

type NodeWireguardPublicKey struct {
	Name               string
	WireguardPublicKey string
}

type PolicyServerIpam added in v3.25.1

type PolicyServerIpam interface {
	IPNetNeedsSNAT(prefix *net.IPNet) bool
	GetPrefixIPPool(prefix *net.IPNet) *proto.IPAMPool
}

type PubSub

type PubSub struct {
	// contains filtered or unexported fields
}
var (
	ThePubSub *PubSub
)

func NewPubSub

func NewPubSub(log *log.Entry) *PubSub

type PubSubHandlerRegistration

type PubSubHandlerRegistration struct {
	// contains filtered or unexported fields
}

func RegisterHandler

func RegisterHandler(channel chan CalicoVppEvent, name string) *PubSubHandlerRegistration

func (*PubSubHandlerRegistration) ExpectEvents

func (reg *PubSubHandlerRegistration) ExpectEvents(eventTypes ...CalicoVppEventType)

type SRv6Tunnel

type SRv6Tunnel struct {
	Dst      net.IP
	Bsid     net.IP
	Policy   *types.SrPolicy
	Sid      net.IP
	Behavior uint8
	Priority uint32
}

SRv6Tunnel contains info needed to create all SRv6 tunnel components (Steering, Policy, Localsids)

Jump to

Keyboard shortcuts

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