descriptor

package
v2.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

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")
)

A list of non-retriable errors:

Functions

This section is empty.

Types

type InterfaceDescriptor

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

InterfaceDescriptor teaches KVScheduler how to configure Linux interfaces.

func NewInterfaceDescriptor

func NewInterfaceDescriptor(
	scheduler scheduler.KVScheduler, serviceLabel servicelabel.ReaderAPI, nsPlugin nsplugin.API,
	vppIfPlugin VPPIfPluginAPI, ifHandler iflinuxcalls.NetlinkAPI, log logging.PluginLogger) *InterfaceDescriptor

NewInterfaceDescriptor creates a new instance of the Interface descriptor.

func (*InterfaceDescriptor) Add

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

Add creates VETH or configures TAP interface.

func (*InterfaceDescriptor) Delete

Delete removes VETH or unconfigures TAP interface.

func (*InterfaceDescriptor) Dependencies

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

Dependencies lists dependencies for a Linux interface.

func (*InterfaceDescriptor) DerivedValues

func (d *InterfaceDescriptor) DerivedValues(key string, linuxIf *interfaces.LinuxInterface) (derValues []scheduler.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) Dump

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

func (*InterfaceDescriptor) EquivalentInterfaces

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

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

func (*InterfaceDescriptor) GetDescriptor

func (d *InterfaceDescriptor) GetDescriptor() *adapter.InterfaceDescriptor

GetDescriptor returns descriptor suitable for registration (via adapter) with the KVScheduler.

func (*InterfaceDescriptor) InterfaceNameFromKey

func (d *InterfaceDescriptor) InterfaceNameFromKey(key string) string

InterfaceNameFromKey returns Linux interface name from the key.

func (*InterfaceDescriptor) IsInterfaceKey

func (d *InterfaceDescriptor) IsInterfaceKey(key string) bool

IsInterfaceKey returns true if the key is identifying Linux interface configuration.

func (*InterfaceDescriptor) IsRetriableFailure

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

IsRetriableFailure returns <false> for errors related to invalid configuration.

func (*InterfaceDescriptor) MetadataFactory

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

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

func (*InterfaceDescriptor) Modify

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

Modify is able to change Type-unspecific attributes.

func (*InterfaceDescriptor) ModifyWithRecreate

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

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

type InterfaceWatcher

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

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

func NewInterfaceWatcher

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

NewInterfaceWatcher creates a new instance of the Interface Watcher.

func (*InterfaceWatcher) Dump

func (w *InterfaceWatcher) Dump(correlate []scheduler.KVWithMetadata) (dump []scheduler.KVWithMetadata, err error)

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

func (*InterfaceWatcher) GetDescriptor

func (w *InterfaceWatcher) GetDescriptor() *scheduler.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) 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