switches

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const LLDPCapabilityStation metalv1alpha4.LLDPCapabilities = "Station"

Variables

View Source
var (
	// fixme: SONiC switches consider nic's ipv6 address to be a subnet if it is the first (index 0)
	//	 address if nic's subnet, which cause an issue with ip address removal. Hence ipv6 address
	//	 index should be configurable (cmd flag, spec field and whatnot)
	BaseIPv4AddressIndex int = 1
	BaseIPv6AddressIndex int = 0
)

Functions

func AddressFamiliesMatchConfig

func AddressFamiliesMatchConfig(ipv4, ipv6 bool, flag int) (int, bool)

func AlignInterfacesWithParams

func AlignInterfacesWithParams(obj *metalv1alpha4.NetworkSwitch)

func ApplyInterfaceParams

func ApplyInterfaceParams(obj *metalv1alpha4.NetworkSwitch, config *metalv1alpha4.SwitchConfig)

func ApplyInterfacesFromInventory

func ApplyInterfacesFromInventory(obj *metalv1alpha4.NetworkSwitch, inventory *metalv1alpha4.Inventory)

func CalculateASN

func CalculateASN(loopbacks []*metalv1alpha4.IPAddressSpec) (uint32, error)

func ComputeAFFlag added in v0.11.2

func ComputeAFFlag(ipv4, ipv6 bool, flag int) int

func CreateSampleObject

func CreateSampleObject(ctx context.Context, c client.Client, obj client.Object, raw []byte) error

func GetCrdPath

func GetCrdPath(crdPackageScheme interface{}) (string, error)

func GetPeerData

func GetPeerData(
	interfaces map[string]*metalv1alpha4.InterfaceSpec, portDesc, portID string) *metalv1alpha4.InterfaceSpec

func GetTestSamples

func GetTestSamples(path string) ([]string, error)

func GetWebhookPath

func GetWebhookPath(crdPackageScheme interface{}) (string, error)

func IPAMSelectorMatchLabels added in v0.11.2

func IPAMSelectorMatchLabels(
	obj *metalv1alpha4.NetworkSwitch,
	sel *metalv1alpha4.IPAMSelectionSpec,
	lbl map[string]string,
) bool

func MetadataChanged

func MetadataChanged(objOld, objNew *metalv1alpha4.NetworkSwitch) bool

func NeighborIsSwitch

func NeighborIsSwitch(nicData *metalv1alpha4.InterfaceSpec) bool

func ObjectChanged

func ObjectChanged(objOld, objNew *metalv1alpha4.NetworkSwitch) bool

func ParseInterfaceNameFromSubnet

func ParseInterfaceNameFromSubnet(name string) string

func RequestIPs

func RequestIPs(peerNICData *metalv1alpha4.InterfaceSpec) []*metalv1alpha4.IPAddressSpec

func ResultingLabels

func ResultingLabels(
	obj *metalv1alpha4.NetworkSwitch,
	objectSelectors, globalSelectors *metalv1alpha4.IPAMSelectionSpec,
) (map[string]string, error)

func SetRole

func SetRole(in *metalv1alpha4.NetworkSwitch)

func SpecChanged

func SpecChanged(objOld, objNew *metalv1alpha4.NetworkSwitch) bool

func StatusChanged

func StatusChanged(objOld, objNew *metalv1alpha4.NetworkSwitch) bool

func SwitchConfigSelectorInvalid

func SwitchConfigSelectorInvalid(obj *metalv1alpha4.NetworkSwitch) bool

func UpdateSwitchConfigSelector

func UpdateSwitchConfigSelector(obj *metalv1alpha4.NetworkSwitch)

Types

type StateUpdateEvent

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

func NewStateUpdateEvent

func NewStateUpdateEvent(eventType, reason, message string) *StateUpdateEvent

func (*StateUpdateEvent) Unwrap

func (in *StateUpdateEvent) Unwrap() (string, string, string)

type StateUpdateResult

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

func NewStateUpdateResult

func NewStateUpdateResult() *StateUpdateResult

func (*StateUpdateResult) SetCondition

func (in *StateUpdateResult) SetCondition(value string) *StateUpdateResult

func (*StateUpdateResult) SetError

func (in *StateUpdateResult) SetError(value error) *StateUpdateResult

func (*StateUpdateResult) SetMessage

func (in *StateUpdateResult) SetMessage(value string) *StateUpdateResult

func (*StateUpdateResult) SetReason

func (in *StateUpdateResult) SetReason(value string) *StateUpdateResult

func (*StateUpdateResult) ToEvent

func (in *StateUpdateResult) ToEvent() auxiliary.Event

func (*StateUpdateResult) Unwrap

func (in *StateUpdateResult) Unwrap() (string, string, string, error)

type SwitchEnvironment

type SwitchEnvironment struct {
	Inventory         *metalv1alpha4.Inventory
	Switches          *metalv1alpha4.NetworkSwitchList
	Config            *metalv1alpha4.SwitchConfig
	LoopbackIPs       *ipamv1alpha1.IPList
	SouthSubnets      *ipamv1alpha1.SubnetList
	SwitchPortSubnets *ipamv1alpha1.SubnetList
}

type SwitchEnvironmentSvc

type SwitchEnvironmentSvc struct {
	client.Client
	Log logr.Logger
	Env *SwitchEnvironment
}

func NewSwitchEnvironmentSvc

func NewSwitchEnvironmentSvc(cl client.Client, log logr.Logger) *SwitchEnvironmentSvc

func (*SwitchEnvironmentSvc) GetEnvironment

func (*SwitchEnvironmentSvc) GetInventory

func (*SwitchEnvironmentSvc) GetLoopbacks

func (*SwitchEnvironmentSvc) GetSubnets

func (*SwitchEnvironmentSvc) GetSwitchConfig

func (*SwitchEnvironmentSvc) GetSwitchPortsSubnets

func (*SwitchEnvironmentSvc) GetSwitches

func (*SwitchEnvironmentSvc) ListIPAMObjects

type SwitchStateWriter

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

func NewSwitchStateWriter

func NewSwitchStateWriter(
	rec record.EventRecorder,
) *SwitchStateWriter

func (*SwitchStateWriter) Environment

func (in *SwitchStateWriter) Environment() *SwitchEnvironment

func (*SwitchStateWriter) RegisterStateFunc

func (in *SwitchStateWriter) RegisterStateFunc(f StateUpdateFunction) *SwitchStateWriter

func (*SwitchStateWriter) SetEnvironment

func (in *SwitchStateWriter) SetEnvironment(env *SwitchEnvironment) *SwitchStateWriter

func (*SwitchStateWriter) WriteCondition

func (*SwitchStateWriter) WriteEvent

func (in *SwitchStateWriter) WriteEvent(src runtime.Object, e auxiliary.Event)

func (*SwitchStateWriter) WriteState

func (in *SwitchStateWriter) WriteState(o client.Object) auxiliary.Result

Jump to

Keyboard shortcuts

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