descriptor

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InterfaceAddressDescriptorName is the name of the descriptor for assigning
	// IP addresses to Linux interfaces.
	InterfaceAddressDescriptorName = "linux-interface-address"

	// DisableIPv6SysctlTemplate is used to enable ipv6 via sysctl.
	DisableIPv6SysctlTemplate = "net.ipv6.conf.%s.disable_ipv6"
)
View Source
const (
	// InterfaceDescriptorName is the name of the descriptor for Linux interfaces.
	InterfaceDescriptorName = "linux-interface"
)
View Source
const (
	// InterfaceWatcherName is the name of the descriptor watching Linux interfaces
	// in the default namespace.
	InterfaceWatcherName = "linux-interface-watcher"
)

Variables

View Source
var (
	// ErrUnsupportedLinuxInterfaceType is returned for Linux interfaces of unknown type.
	ErrUnsupportedLinuxInterfaceType = errors.New("unsupported Linux interface type")

	// ErrInterfaceWithoutName is returned when Linux interface configuration has undefined
	// Name attribute.
	ErrInterfaceWithoutName = errors.New("Linux interface defined without logical name")

	// ErrInterfaceWithoutType is returned when Linux interface configuration has undefined
	// Type attribute.
	ErrInterfaceWithoutType = errors.New("Linux interface defined without type")

	// ErrNamespaceWithoutReference is returned when namespace is missing reference.
	ErrInterfaceReferenceMismatch = errors.New("Linux interface reference does not match the interface type")

	// ErrVETHWithoutPeer is returned when VETH interface is missing peer interface
	// reference.
	ErrVETHWithoutPeer = errors.New("VETH interface defined without peer reference")

	// ErrTAPWithoutVPPReference is returned when TAP_TO_VPP interface is missing reference to VPP TAP.
	ErrTAPWithoutVPPReference = errors.New("TAP_TO_VPP interface defined without reference to VPP TAP")

	// ErrTAPRequiresVPPIfPlugin is returned when TAP_TO_VPP is supposed to be configured but VPP ifplugin
	// is not loaded.
	ErrTAPRequiresVPPIfPlugin = errors.New("TAP_TO_VPP interface requires VPP interface plugin to be loaded")

	// ErrNamespaceWithoutReference is returned when namespace is missing reference.
	ErrNamespaceWithoutReference = errors.New("namespace defined without name")

	// ErrExistingWithNamespace is returned when namespace is specified for
	// EXISTING interface.
	ErrExistingWithNamespace = errors.New("EXISTING interface defined with namespace")

	// ErrInvalidIPWithMask is returned when address is invalid or mask is missing
	ErrInvalidIPWithMask = errors.New("IP with mask is not valid")

	// ErrLoopbackAlreadyConfigured is returned when multiple logical NB interfaces tries to configure the same loopback
	ErrLoopbackAlreadyConfigured = errors.New("loopback already configured")

	// ErrLoopbackNotFound is returned if loopback interface can not be found
	ErrLoopbackNotFound = errors.New("loopback not found")
)

A list of non-retriable errors:

Functions

This section is empty.

Types

type InterfaceAddressDescriptor

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

InterfaceAddressDescriptor (un)assigns IP address to/from Linux interface.

func NewInterfaceAddressDescriptor

func NewInterfaceAddressDescriptor(nsPlugin nsplugin.API, addrAlloc netalloc.AddressAllocator,
	ifHandler iflinuxcalls.NetlinkAPI, log logging.PluginLogger) (descr *kvs.KVDescriptor, ctx *InterfaceAddressDescriptor)

NewInterfaceAddressDescriptor creates a new instance of InterfaceAddressDescriptor.

func (*InterfaceAddressDescriptor) Create

func (d *InterfaceAddressDescriptor) Create(key string, emptyVal proto.Message) (metadata kvs.Metadata, err error)

Create assigns IP address to an interface.

func (*InterfaceAddressDescriptor) Delete

func (d *InterfaceAddressDescriptor) Delete(key string, emptyVal proto.Message, metadata kvs.Metadata) (err error)

Delete unassigns IP address from an interface.

func (*InterfaceAddressDescriptor) Dependencies

func (d *InterfaceAddressDescriptor) Dependencies(key string, emptyVal proto.Message) (deps []kvs.Dependency)

Dependencies mentions potential allocation of the IP address as dependency.

func (*InterfaceAddressDescriptor) IsInterfaceAddressKey

func (d *InterfaceAddressDescriptor) IsInterfaceAddressKey(key string) bool

IsInterfaceVrfKey returns true if the key represents assignment of an IP address to a Linux interface (that needs to be applied). KVs representing addresses already allocated from netalloc plugin are excluded.

func (*InterfaceAddressDescriptor) SetInterfaceIndex

func (d *InterfaceAddressDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)

SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.

func (*InterfaceAddressDescriptor) Validate

func (d *InterfaceAddressDescriptor) Validate(key string, emptyVal proto.Message) (err error)

Validate validates IP address to be assigned to an interface.

type InterfaceDescriptor

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

InterfaceDescriptor teaches KVScheduler how to configure Linux interfaces.

func NewInterfaceDescriptor

func NewInterfaceDescriptor(
	scheduler kvs.KVScheduler, serviceLabel servicelabel.ReaderAPI, nsPlugin nsplugin.API,
	vppIfPlugin VPPIfPluginAPI, addrAlloc netalloc.AddressAllocator, ifHandler iflinuxcalls.NetlinkAPI,
	log logging.PluginLogger, goRoutinesCnt int) (descr *kvs.KVDescriptor, ctx *InterfaceDescriptor)

NewInterfaceDescriptor creates a new instance of the Interface descriptor.

func (*InterfaceDescriptor) Create

func (d *InterfaceDescriptor) Create(key string, linuxIf *interfaces.Interface) (metadata *ifaceidx.LinuxIfMetadata, err error)

Create creates VETH or configures TAP interface.

func (*InterfaceDescriptor) Delete

func (d *InterfaceDescriptor) Delete(key string, linuxIf *interfaces.Interface, metadata *ifaceidx.LinuxIfMetadata) error

Delete removes VETH or unconfigures TAP interface.

func (*InterfaceDescriptor) Dependencies

func (d *InterfaceDescriptor) Dependencies(key string, linuxIf *interfaces.Interface) []kvs.Dependency

Dependencies lists dependencies for a Linux interface.

func (*InterfaceDescriptor) DerivedValues

func (d *InterfaceDescriptor) DerivedValues(key string, linuxIf *interfaces.Interface) (derValues []kvs.KeyValuePair)

DerivedValues derives one empty value to represent interface state and also one empty value for every IP address assigned to the interface.

func (*InterfaceDescriptor) EquivalentInterfaces

func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf *interfaces.Interface) bool

EquivalentInterfaces is case-insensitive comparison function for interfaces.LinuxInterface, also ignoring the order of assigned IP addresses.

func (*InterfaceDescriptor) IsRetriableFailure

func (d *InterfaceDescriptor) IsRetriableFailure(err error) bool

func (*InterfaceDescriptor) MetadataFactory

func (d *InterfaceDescriptor) MetadataFactory() idxmap.NamedMappingRW

MetadataFactory is a factory for index-map customized for Linux interfaces.

func (*InterfaceDescriptor) Retrieve

Retrieve returns all Linux interfaces managed by this agent, attached to the default namespace or to one of the configured non-default namespaces.

func (*InterfaceDescriptor) SetInterfaceIndex

func (d *InterfaceDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)

SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.

func (*InterfaceDescriptor) Update

func (d *InterfaceDescriptor) Update(key string, oldLinuxIf, newLinuxIf *interfaces.Interface, oldMetadata *ifaceidx.LinuxIfMetadata) (newMetadata *ifaceidx.LinuxIfMetadata, err error)

Update is able to change Type-unspecific attributes.

func (*InterfaceDescriptor) UpdateWithRecreate

func (d *InterfaceDescriptor) UpdateWithRecreate(key string, oldLinuxIf, newLinuxIf *interfaces.Interface, metadata *ifaceidx.LinuxIfMetadata) bool

UpdateWithRecreate returns true if Type or Type-specific attributes are different.

func (*InterfaceDescriptor) Validate

func (d *InterfaceDescriptor) Validate(key string, linuxIf *interfaces.Interface) error

Validate validates Linux interface configuration.

type InterfaceWatcher

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

InterfaceWatcher watches default namespace for newly added/removed Linux interfaces.

func NewInterfaceWatcher

func NewInterfaceWatcher(kvscheduler kvs.KVScheduler, ifHandler linuxcalls.NetlinkAPI, log logging.PluginLogger) *InterfaceWatcher

NewInterfaceWatcher creates a new instance of the Interface Watcher.

func (*InterfaceWatcher) GetDescriptor

func (w *InterfaceWatcher) GetDescriptor() *kvs.KVDescriptor

GetDescriptor returns descriptor suitable for registration with the KVScheduler.

func (*InterfaceWatcher) IsLinuxInterfaceNotification

func (w *InterfaceWatcher) IsLinuxInterfaceNotification(key string) bool

IsLinuxInterfaceNotification returns <true> for keys representing notifications about Linux interfaces in the default network namespace.

func (*InterfaceWatcher) Retrieve

func (w *InterfaceWatcher) Retrieve(correlate []kvs.KVWithMetadata) (values []kvs.KVWithMetadata, err error)

Retrieve returns key with empty value for every currently existing Linux interface in the default network namespace.

func (*InterfaceWatcher) StartWatching

func (w *InterfaceWatcher) StartWatching() error

StartWatching starts interface watching.

func (*InterfaceWatcher) StopWatching

func (w *InterfaceWatcher) StopWatching()

StopWatching stops interface watching.

type VPPIfPluginAPI

type VPPIfPluginAPI interface {
	// GetInterfaceIndex gives read-only access to map with metadata of all configured
	// VPP interfaces.
	GetInterfaceIndex() vpp_ifaceidx.IfaceMetadataIndex
}

VPPIfPluginAPI is defined here to avoid import cycles.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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