Documentation ¶
Index ¶
- func GetLinuxInterfaceIndex(ifName string) int
- type LinuxDataPair
- type LinuxInterfaceConfig
- type LinuxInterfaceConfigurator
- func (plugin *LinuxInterfaceConfigurator) Close() error
- func (plugin *LinuxInterfaceConfigurator) ConfigureLinuxInterface(linuxIf *interfaces.LinuxInterfaces_Interface) error
- func (plugin *LinuxInterfaceConfigurator) DeleteLinuxInterface(linuxIf *interfaces.LinuxInterfaces_Interface) error
- func (plugin *LinuxInterfaceConfigurator) Init(stateChan chan *LinuxInterfaceStateNotification, ...) (err error)
- func (plugin *LinuxInterfaceConfigurator) ModifyLinuxInterface(newLinuxIf, oldLinuxIf *interfaces.LinuxInterfaces_Interface) (err error)
- func (plugin *LinuxInterfaceConfigurator) Resync(nbIfs []*interfaces.LinuxInterfaces_Interface) (errs []error)
- type LinuxInterfaceStateNotification
- type LinuxInterfaceStateUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLinuxInterfaceIndex ¶
GetLinuxInterfaceIndex returns the index of a Linux interface identified by its name. In Linux, interface index is a positive integer that starts at one, zero is never used. Function returns negative number in case of a failure, such as when the interface doesn't exist. TODO: move to the package with network utilities
Types ¶
type LinuxDataPair ¶ added in v1.4.0
type LinuxDataPair struct {
// contains filtered or unexported fields
}
LinuxDataPair stores linux interface with matching NB configuration
type LinuxInterfaceConfig ¶
type LinuxInterfaceConfig struct {
// contains filtered or unexported fields
}
LinuxInterfaceConfig is used to cache the configuration of Linux interfaces.
type LinuxInterfaceConfigurator ¶
type LinuxInterfaceConfigurator struct { Log logging.Logger /* logical interface name -> Linux interface index (both managed and unmanaged interfaces) */ IfIndexes ifaceidx.LinuxIfIndexRW IfIdxSeq uint32 /* VPP interface indices */ VppIfIndices vppIfIdx.SwIfIndex NsHandler *nsplugin.NsHandler /* time measurement */ Stopwatch *measure.Stopwatch // timer used to measure and store time // contains filtered or unexported fields }
LinuxInterfaceConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of interfaces as modelled by the proto file "model/interfaces/interfaces.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/linux/config/v1/interface". Updates received from the northbound API are compared with the Linux network configuration and differences are applied through the Netlink API.
func (*LinuxInterfaceConfigurator) Close ¶
func (plugin *LinuxInterfaceConfigurator) Close() error
Close stops all goroutines started by linuxplugin
func (*LinuxInterfaceConfigurator) ConfigureLinuxInterface ¶
func (plugin *LinuxInterfaceConfigurator) ConfigureLinuxInterface(linuxIf *interfaces.LinuxInterfaces_Interface) error
ConfigureLinuxInterface reacts to a new northbound Linux interface config by creating and configuring the interface in the host network stack through Netlink API.
func (*LinuxInterfaceConfigurator) DeleteLinuxInterface ¶
func (plugin *LinuxInterfaceConfigurator) DeleteLinuxInterface(linuxIf *interfaces.LinuxInterfaces_Interface) error
DeleteLinuxInterface reacts to a removed NB configuration of a Linux interface.
func (*LinuxInterfaceConfigurator) Init ¶
func (plugin *LinuxInterfaceConfigurator) Init(stateChan chan *LinuxInterfaceStateNotification, ifNotif chan *nsplugin.MicroserviceEvent) (err error)
Init linuxplugin and start go routines.
func (*LinuxInterfaceConfigurator) ModifyLinuxInterface ¶
func (plugin *LinuxInterfaceConfigurator) ModifyLinuxInterface(newLinuxIf, oldLinuxIf *interfaces.LinuxInterfaces_Interface) (err error)
ModifyLinuxInterface applies changes in the NB configuration of a Linux interface into the host network stack through Netlink API.
func (*LinuxInterfaceConfigurator) Resync ¶
func (plugin *LinuxInterfaceConfigurator) Resync(nbIfs []*interfaces.LinuxInterfaces_Interface) (errs []error)
Resync writes interfaces to Linux. Interface host name corresponds with Linux host interface name (but name can be different). Resync consists of following steps: 1. Iterate over all NB interfaces. Try to find interface with the same name in required namespace for every NB interface. 2. If interface does not exist, will be created anew 3. If interface exists, it is correlated and modified if needed. Resync configures an initial set of interfaces. Existing Linux interfaces are registered and potentially re-configured.
type LinuxInterfaceStateNotification ¶ added in v1.4.0
type LinuxInterfaceStateNotification struct {
// contains filtered or unexported fields
}
LinuxInterfaceStateNotification aggregates operational status derived from netlink with the details (state) about the interface.
type LinuxInterfaceStateUpdater ¶ added in v1.4.0
type LinuxInterfaceStateUpdater struct { Log logging.Logger // contains filtered or unexported fields }
LinuxInterfaceStateUpdater processes all linux interface state data
func (*LinuxInterfaceStateUpdater) Close ¶ added in v1.4.0
func (plugin *LinuxInterfaceStateUpdater) Close() error
Close watcher channel (state chan is closed in LinuxInterfaceConfigurator)
func (*LinuxInterfaceStateUpdater) Init ¶ added in v1.4.0
func (plugin *LinuxInterfaceStateUpdater) Init(ctx context.Context, ifIndexes ifaceidx.LinuxIfIndexRW, stateChan chan *LinuxInterfaceStateNotification, notifChan chan netlink.LinkUpdate, notifDone chan struct{}) error
Init channels for interface state watcher, start it in separate go routine and subscribe to default namespace
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ifaceidx implements name-to-index mapping registry and cache for Linux interfaces.
|
Package ifaceidx implements name-to-index mapping registry and cache for Linux interfaces. |
Package linuxcalls contains wrappers over Netlink APIs related to Linux VETH interfaces or Linux interfaces in general.
|
Package linuxcalls contains wrappers over Netlink APIs related to Linux VETH interfaces or Linux interfaces in general. |