Documentation ¶
Index ¶
- Constants
- Variables
- type InterfaceAddressDescriptor
- func (d *InterfaceAddressDescriptor) Create(key string, _ *interfaces.Interface) (metadata interface{}, err error)
- func (d *InterfaceAddressDescriptor) Delete(key string, _ *interfaces.Interface, metadata interface{}) (err error)
- func (d *InterfaceAddressDescriptor) Dependencies(key string, iface *interfaces.Interface) (deps []kvs.Dependency)
- func (d *InterfaceAddressDescriptor) IsInterfaceAddressKey(key string) bool
- func (d *InterfaceAddressDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)
- func (d *InterfaceAddressDescriptor) Validate(key string, _ *interfaces.Interface) (err error)
- type InterfaceDescriptor
- func (d *InterfaceDescriptor) Create(key string, linuxIf *interfaces.Interface) (metadata *ifaceidx.LinuxIfMetadata, err error)
- func (d *InterfaceDescriptor) Delete(key string, linuxIf *interfaces.Interface, metadata *ifaceidx.LinuxIfMetadata) error
- func (d *InterfaceDescriptor) Dependencies(key string, linuxIf *interfaces.Interface) []kvs.Dependency
- func (d *InterfaceDescriptor) DerivedValues(key string, linuxIf *interfaces.Interface) (derValues []kvs.KeyValuePair)
- func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf *interfaces.Interface) bool
- func (d *InterfaceDescriptor) IsRetriableFailure(err error) bool
- func (d *InterfaceDescriptor) MetadataFactory() idxmap.NamedMappingRW
- func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetadata) ([]adapter.InterfaceKVWithMetadata, error)
- func (d *InterfaceDescriptor) SetInterfaceHandler(ifHandler iflinuxcalls.NetlinkAPI)
- func (d *InterfaceDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)
- func (d *InterfaceDescriptor) Update(key string, oldLinuxIf, newLinuxIf *interfaces.Interface, ...) (newMetadata *ifaceidx.LinuxIfMetadata, err error)
- func (d *InterfaceDescriptor) UpdateWithRecreate(key string, oldLinuxIf, newLinuxIf *interfaces.Interface, ...) bool
- func (d *InterfaceDescriptor) Validate(key string, linuxIf *interfaces.Interface) error
- type InterfaceVrfDescriptor
- func (d *InterfaceVrfDescriptor) Create(key string, iface *interfaces.Interface) (metadata interface{}, err error)
- func (d *InterfaceVrfDescriptor) Delete(key string, iface *interfaces.Interface, metadata interface{}) (err error)
- func (d *InterfaceVrfDescriptor) Dependencies(key string, iface *interfaces.Interface) (deps []kvs.Dependency)
- func (d *InterfaceVrfDescriptor) IsInterfaceVrfKey(key string) bool
- func (d *InterfaceVrfDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)
- func (d *InterfaceVrfDescriptor) Validate(key string, emptyVal proto.Message) (err error)
- type InterfaceWatcher
- func (w *InterfaceWatcher) GetDescriptor() *kvs.KVDescriptor
- func (w *InterfaceWatcher) IsLinuxInterfaceNotification(key string) bool
- func (w *InterfaceWatcher) Retrieve(correlate []kvs.KVWithMetadata) (values []kvs.KVWithMetadata, err error)
- func (w *InterfaceWatcher) StartWatching() error
- func (w *InterfaceWatcher) StopWatching()
- type VPPIfPluginAPI
Constants ¶
const ( // InterfaceDescriptorName is the name of the descriptor for Linux interfaces. InterfaceDescriptorName = "linux-interface" // DefaultVrfDevLegacyMTU is ETH_MAX_MTU value used as the default for the linux VRF Dev DefaultVrfDevLegacyMTU = 65536 // DefaultVrfDevMTU is the ETH_MAX_MTU increased by the size of the IPv6 header, used // as the default for VRF Dev in latest linux kernels DefaultVrfDevMTU = 65575 )
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" )
const (
// InterfaceVrfDescriptorName is the name of the descriptor for assigning Linux interfaces into a VRF.
InterfaceVrfDescriptorName = "linux-interface-vrf"
)
const ( // InterfaceWatcherName is the name of the descriptor watching Linux interfaces // in the default namespace. InterfaceWatcherName = "linux-interface-watcher" )
Variables ¶
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") // ErrExistingIpWithNetalloc is returned when netalloc and EXISTING-IP features are combined, // which is currently not supported. ErrExistingIpWithNetalloc = errors.New("it is not supported to reference EXISTING-IP via netalloc") // 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") // ErrVRFDevWithMACAddr is returned when VRF device is configured with a MAC address. ErrVRFDevWithMACAddr = errors.New("it is unsupported to set MAC address to a VRF device") // ErrVRFDevInsideVrf is returned when VRF device is configured to be inside another VRF. ErrVRFDevInsideVrf = errors.New("VRF device cannot be inside another VRF") )
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, _ *interfaces.Interface) (metadata interface{}, err error)
Create assigns IP address to an interface.
func (*InterfaceAddressDescriptor) Delete ¶
func (d *InterfaceAddressDescriptor) Delete(key string, _ *interfaces.Interface, metadata interface{}) (err error)
Delete unassigns IP address from an interface.
func (*InterfaceAddressDescriptor) Dependencies ¶
func (d *InterfaceAddressDescriptor) Dependencies(key string, iface *interfaces.Interface) (deps []kvs.Dependency)
Dependencies mentions (non-default) VRF and a potential allocation of the IP address as dependencies.
func (*InterfaceAddressDescriptor) IsInterfaceAddressKey ¶
func (d *InterfaceAddressDescriptor) IsInterfaceAddressKey(key string) bool
IsInterfaceAddressKey returns true if the key represents assignment of an IP address to a Linux interface (that needs to be applied or is expected to exist). 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, _ *interfaces.Interface) (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( serviceLabel servicelabel.ReaderAPI, nsPlugin nsplugin.API, vppIfPlugin VPPIfPluginAPI, addrAlloc netalloc.AddressAllocator, log logging.PluginLogger) (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 Linux interface.
func (*InterfaceDescriptor) Delete ¶
func (d *InterfaceDescriptor) Delete(key string, linuxIf *interfaces.Interface, metadata *ifaceidx.LinuxIfMetadata) error
Delete removes Linux 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
- one empty value to represent assignment of the interface to a (non-default) VRF
- 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.
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 ¶
func (d *InterfaceDescriptor) Retrieve(correlate []adapter.InterfaceKVWithMetadata) ([]adapter.InterfaceKVWithMetadata, error)
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) SetInterfaceHandler ¶
func (d *InterfaceDescriptor) SetInterfaceHandler(ifHandler iflinuxcalls.NetlinkAPI)
SetInterfaceHandler provides interface handler to the descriptor immediately after the registration.
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 InterfaceVrfDescriptor ¶ added in v3.2.0
type InterfaceVrfDescriptor struct {
// contains filtered or unexported fields
}
InterfaceVrfDescriptor (un)assigns Linux interface to/from VRF.
func NewInterfaceVrfDescriptor ¶ added in v3.2.0
func NewInterfaceVrfDescriptor(nsPlugin nsplugin.API, ifHandler iflinuxcalls.NetlinkAPI, log logging.PluginLogger) (descr *kvs.KVDescriptor, ctx *InterfaceVrfDescriptor)
NewInterfaceVrfDescriptor creates a new instance of InterfaceVrfDescriptor.
func (*InterfaceVrfDescriptor) Create ¶ added in v3.2.0
func (d *InterfaceVrfDescriptor) Create(key string, iface *interfaces.Interface) (metadata interface{}, err error)
Create puts interface into a VRF.
func (*InterfaceVrfDescriptor) Delete ¶ added in v3.2.0
func (d *InterfaceVrfDescriptor) Delete(key string, iface *interfaces.Interface, metadata interface{}) (err error)
Delete removes interface from VRF.
func (*InterfaceVrfDescriptor) Dependencies ¶ added in v3.2.0
func (d *InterfaceVrfDescriptor) Dependencies(key string, iface *interfaces.Interface) (deps []kvs.Dependency)
Dependencies lists the VRF device as the only dependency.
func (*InterfaceVrfDescriptor) IsInterfaceVrfKey ¶ added in v3.2.0
func (d *InterfaceVrfDescriptor) IsInterfaceVrfKey(key string) bool
IsInterfaceVrfKey returns true if the key represents assignment of a Linux interface into a VRF.
func (*InterfaceVrfDescriptor) SetInterfaceIndex ¶ added in v3.2.0
func (d *InterfaceVrfDescriptor) SetInterfaceIndex(intfIndex ifaceidx.LinuxIfMetadataIndex)
SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.
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, notifyInterface func(*ifmodel.InterfaceNotification), 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.