Documentation ¶
Index ¶
- Constants
- Variables
- type DHCPDescriptor
- func (d *DHCPDescriptor) Add(key string, emptyVal proto.Message) (metadata scheduler.Metadata, err error)
- func (d *DHCPDescriptor) Close() error
- func (d *DHCPDescriptor) Delete(key string, emptyVal proto.Message, metadata scheduler.Metadata) error
- func (d *DHCPDescriptor) DerivedValues(key string, dhcpData proto.Message) (derValues []scheduler.KeyValuePair)
- func (d *DHCPDescriptor) Dump(correlate []scheduler.KVWithMetadata) ([]scheduler.KVWithMetadata, error)
- func (d *DHCPDescriptor) GetDescriptor() *scheduler.KVDescriptor
- func (d *DHCPDescriptor) IsDHCPRelatedKey(key string) bool
- func (d *DHCPDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
- func (d *DHCPDescriptor) WatchDHCPNotifications(ctx context.Context, dhcpChan chan govppapi.Message)
- type InterfaceDescriptor
- func (d *InterfaceDescriptor) Add(key string, intf *interfaces.Interface) (metadata *ifaceidx.IfaceMetadata, err error)
- func (d *InterfaceDescriptor) Delete(key string, intf *interfaces.Interface, metadata *ifaceidx.IfaceMetadata) error
- func (d *InterfaceDescriptor) Dependencies(key string, intf *interfaces.Interface) []scheduler.Dependency
- func (d *InterfaceDescriptor) DerivedValues(key string, intf *interfaces.Interface) (derValues []scheduler.KeyValuePair)
- func (d *InterfaceDescriptor) Dump(correlate []adapter.InterfaceKVWithMetadata) (dump []adapter.InterfaceKVWithMetadata, err error)
- func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf *interfaces.Interface) bool
- func (d *InterfaceDescriptor) GetDescriptor() *adapter.InterfaceDescriptor
- func (d *InterfaceDescriptor) InterfaceNameFromKey(key string) string
- func (d *InterfaceDescriptor) IsInterfaceKey(key string) bool
- func (d *InterfaceDescriptor) IsRetriableFailure(err error) bool
- func (d *InterfaceDescriptor) MetadataFactory() idxmap.NamedMappingRW
- func (d *InterfaceDescriptor) Modify(key string, oldIntf, newIntf *interfaces.Interface, ...) (newMetadata *ifaceidx.IfaceMetadata, err error)
- func (d *InterfaceDescriptor) ModifyWithRecreate(key string, oldIntf, newIntf *interfaces.Interface, ...) bool
- func (d *InterfaceDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
- type LinuxPluginAPI
- type NetlinkAPI
- type UnnumberedIfDescriptor
- func (d *UnnumberedIfDescriptor) Add(key string, unIntf *interfaces.Interface_Unnumbered) (metadata interface{}, err error)
- func (d *UnnumberedIfDescriptor) Delete(key string, unIntf *interfaces.Interface_Unnumbered, metadata interface{}) error
- func (d *UnnumberedIfDescriptor) Dependencies(key string, unIntf *interfaces.Interface_Unnumbered) []scheduler.Dependency
- func (d *UnnumberedIfDescriptor) GetDescriptor() *adapter.UnnumberedDescriptor
- func (d *UnnumberedIfDescriptor) IsUnnumberedInterfaceKey(key string) bool
- func (d *UnnumberedIfDescriptor) ModifyWithRecreate(key string, oldUnIntf, newUnIntf *interfaces.Interface_Unnumbered, ...) bool
- func (d *UnnumberedIfDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
Constants ¶
const ( // DHCPDescriptorName is the name of the descriptor configuring DHCP for VPP // interfaces. DHCPDescriptorName = "vpp-dhcp" )
const (
// InterfaceDescriptorName is the name of the descriptor for VPP interfaces.
InterfaceDescriptorName = "vpp-interface"
)
const ( // UnnumberedIfDescriptorName is the name of the descriptor for the unnumbered // config-subsection of VPP interfaces. UnnumberedIfDescriptorName = "vpp-unnumbered-interface" )
Variables ¶
var ( // ErrUnsupportedVPPInterfaceType is returned for VPP interfaces of unknown type. ErrUnsupportedVPPInterfaceType = errors.New("unsupported VPP interface type") // ErrInterfaceWithoutName is returned when VPP interface configuration has undefined // Name attribute. ErrInterfaceWithoutName = errors.New("VPP interface defined without logical name") // ErrInterfaceWithoutType is returned when VPP interface configuration has undefined // Type attribute. ErrInterfaceWithoutType = errors.New("VPP interface defined without type") // ErrUnnumberedWithIP is returned when configuration of a VPP unnumbered interface // includes an IP address. ErrUnnumberedWithIP = errors.New("VPP unnumbered interface was defined with IP address") // ErrAfPacketWithoutHostName is returned when AF-Packet configuration is missing host interface name. ErrAfPacketWithoutHostName = errors.New("VPP AF-Packet interface was defined without host interface name") // ErrInterfaceLinkMismatch is returned when interface type does not match the link configuration. ErrInterfaceLinkMismatch = errors.New("VPP interface type and link configuration do not match") // ErrUnsupportedRxMode is returned when the given interface type does not support the chosen // RX mode. ErrUnsupportedRxMode = errors.New("unsupported RX Mode") )
A list of non-retriable errors:
Functions ¶
This section is empty.
Types ¶
type DHCPDescriptor ¶
type DHCPDescriptor struct {
// contains filtered or unexported fields
}
DHCPDescriptor enables/disables DHCP for VPP interfaces and notifies about new DHCP leases.
func NewDHCPDescriptor ¶
func NewDHCPDescriptor(scheduler scheduler.KVScheduler, ifHandler vppcalls.IfVppAPI, log logging.PluginLogger) *DHCPDescriptor
NewDHCPDescriptor creates a new instance of DHCPDescriptor.
func (*DHCPDescriptor) Add ¶
func (d *DHCPDescriptor) Add(key string, emptyVal proto.Message) (metadata scheduler.Metadata, err error)
Add enables DHCP client.
func (*DHCPDescriptor) Close ¶
func (d *DHCPDescriptor) Close() error
Close stops watching of DHCP notifications.
func (*DHCPDescriptor) Delete ¶
func (d *DHCPDescriptor) Delete(key string, emptyVal proto.Message, metadata scheduler.Metadata) error
Delete disables DHCP client.
func (*DHCPDescriptor) DerivedValues ¶
func (d *DHCPDescriptor) DerivedValues(key string, dhcpData proto.Message) (derValues []scheduler.KeyValuePair)
DerivedValues derives empty value for leased IP address.
func (*DHCPDescriptor) Dump ¶
func (d *DHCPDescriptor) Dump(correlate []scheduler.KVWithMetadata) ([]scheduler.KVWithMetadata, error)
Dump returns all existing DHCP leases.
func (*DHCPDescriptor) GetDescriptor ¶
func (d *DHCPDescriptor) GetDescriptor() *scheduler.KVDescriptor
GetDescriptor returns descriptor suitable for registration with the KVScheduler.
func (*DHCPDescriptor) IsDHCPRelatedKey ¶
func (d *DHCPDescriptor) IsDHCPRelatedKey(key string) bool
IsDHCPRelatedKey returns true if the key is identifying DHCP client (derived value) or DHCP lease (notification).
func (*DHCPDescriptor) SetInterfaceIndex ¶
func (d *DHCPDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.
func (*DHCPDescriptor) WatchDHCPNotifications ¶
func (d *DHCPDescriptor) WatchDHCPNotifications(ctx context.Context, dhcpChan chan govppapi.Message)
WatchDHCPNotifications starts watching for DHCP notifications.
type InterfaceDescriptor ¶
type InterfaceDescriptor struct {
// contains filtered or unexported fields
}
InterfaceDescriptor teaches KVScheduler how to configure VPP interfaces.
func NewInterfaceDescriptor ¶
func NewInterfaceDescriptor(ifHandler vppcalls.IfVppAPI, defaultMtu uint32, linuxIfHandler NetlinkAPI, linuxIfPlugin LinuxPluginAPI, log logging.PluginLogger) *InterfaceDescriptor
NewInterfaceDescriptor creates a new instance of the Interface descriptor.
func (*InterfaceDescriptor) Add ¶
func (d *InterfaceDescriptor) Add(key string, intf *interfaces.Interface) (metadata *ifaceidx.IfaceMetadata, err error)
Add creates a VPP interface.
func (*InterfaceDescriptor) Delete ¶
func (d *InterfaceDescriptor) Delete(key string, intf *interfaces.Interface, metadata *ifaceidx.IfaceMetadata) error
Delete removes VPP interface.
func (*InterfaceDescriptor) Dependencies ¶
func (d *InterfaceDescriptor) Dependencies(key string, intf *interfaces.Interface) []scheduler.Dependency
Dependencies lists dependencies for a VPP interface.
func (*InterfaceDescriptor) DerivedValues ¶
func (d *InterfaceDescriptor) DerivedValues(key string, intf *interfaces.Interface) (derValues []scheduler.KeyValuePair)
DerivedValues derives:
- key-value for unnumbered configuration sub-section
- empty value for enabled DHCP client
- one empty value for every IP address assigned to the interface.
func (*InterfaceDescriptor) Dump ¶
func (d *InterfaceDescriptor) Dump(correlate []adapter.InterfaceKVWithMetadata) (dump []adapter.InterfaceKVWithMetadata, err error)
Dump returns all configured VPP interfaces.
func (*InterfaceDescriptor) EquivalentInterfaces ¶
func (d *InterfaceDescriptor) EquivalentInterfaces(key string, oldIntf, newIntf *interfaces.Interface) bool
EquivalentInterfaces is case-insensitive comparison function for interfaces.Interface, 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 VPP interface name from the key.
func (*InterfaceDescriptor) IsInterfaceKey ¶
func (d *InterfaceDescriptor) IsInterfaceKey(key string) bool
IsInterfaceKey returns true if the key is identifying VPP 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 VPP interfaces.
func (*InterfaceDescriptor) Modify ¶
func (d *InterfaceDescriptor) Modify(key string, oldIntf, newIntf *interfaces.Interface, oldMetadata *ifaceidx.IfaceMetadata) (newMetadata *ifaceidx.IfaceMetadata, err error)
Modify is able to change Type-unspecific attributes.
func (*InterfaceDescriptor) ModifyWithRecreate ¶
func (d *InterfaceDescriptor) ModifyWithRecreate(key string, oldIntf, newIntf *interfaces.Interface, metadata *ifaceidx.IfaceMetadata) bool
ModifyWithRecreate returns true if Type, VRF (or VRF IP version) or Type-specific attributes are different.
func (*InterfaceDescriptor) SetInterfaceIndex ¶
func (d *InterfaceDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.
type LinuxPluginAPI ¶
type LinuxPluginAPI interface { // GetInterfaceIndex gives read-only access to map with metadata of all configured // linux interfaces. GetInterfaceIndex() linux_ifaceidx.LinuxIfMetadataIndex }
LinuxPluginAPI is defined here to avoid import cycles.
type NetlinkAPI ¶
type NetlinkAPI interface { // InterfaceExists verifies interface existence InterfaceExists(ifName string) (bool, error) }
NetlinkAPI here lists only those Netlink methods that are actually used by InterfaceDescriptor.
type UnnumberedIfDescriptor ¶
type UnnumberedIfDescriptor struct {
// contains filtered or unexported fields
}
UnnumberedIfDescriptor sets/unsets VPP interfaces as unnumbered. Values = Interface_Unnumbered{} derived from interfaces where IsUnnumbered==true
func NewUnnumberedIfDescriptor ¶
func NewUnnumberedIfDescriptor(ifHandler vppcalls.IfVppAPI, log logging.PluginLogger) *UnnumberedIfDescriptor
NewUnnumberedIfDescriptor creates a new instance of UnnumberedIfDescriptor.
func (*UnnumberedIfDescriptor) Add ¶
func (d *UnnumberedIfDescriptor) Add(key string, unIntf *interfaces.Interface_Unnumbered) (metadata interface{}, err error)
Add sets interface as unnumbered.
func (*UnnumberedIfDescriptor) Delete ¶
func (d *UnnumberedIfDescriptor) Delete(key string, unIntf *interfaces.Interface_Unnumbered, metadata interface{}) error
Delete un-sets interface as unnumbered.
func (*UnnumberedIfDescriptor) Dependencies ¶
func (d *UnnumberedIfDescriptor) Dependencies(key string, unIntf *interfaces.Interface_Unnumbered) []scheduler.Dependency
Dependencies lists dependencies for an unnumbered VPP interface.
func (*UnnumberedIfDescriptor) GetDescriptor ¶
func (d *UnnumberedIfDescriptor) GetDescriptor() *adapter.UnnumberedDescriptor
GetDescriptor returns descriptor suitable for registration (via adapter) with the KVScheduler.
func (*UnnumberedIfDescriptor) IsUnnumberedInterfaceKey ¶
func (d *UnnumberedIfDescriptor) IsUnnumberedInterfaceKey(key string) bool
IsUnnumberedInterfaceKey returns true if the key is identifying unnumbered VPP interface.
func (*UnnumberedIfDescriptor) ModifyWithRecreate ¶
func (d *UnnumberedIfDescriptor) ModifyWithRecreate(key string, oldUnIntf, newUnIntf *interfaces.Interface_Unnumbered, oldMetadata interface{}) bool
ModifyWithRecreate returns always true so that the link to interface with IP address is reconfigured with UnsetUnnumberedIP followed by SetUnnumberedIP for the new interface.
func (*UnnumberedIfDescriptor) SetInterfaceIndex ¶
func (d *UnnumberedIfDescriptor) SetInterfaceIndex(intfIndex ifaceidx.IfaceMetadataIndex)
SetInterfaceIndex should be used to provide interface index immediately after the descriptor registration.