l3plugin

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: Apache-2.0 Imports: 16 Imported by: 47

README

Linux L3 plugin

The linux l3plugin is a Core Agent Plugin that is designed to configure ARP entries and routes in the linux environment. Configuration managed by this plugin is modelled by the proto file.

ARP entries

The configuration must be stored in ETCD using the following key:

/vnf-agent/<agent-label>/linux/config/v1/arp/<label>

An example of configuration in json format can be found here.

To insert config into etcd in json format vpp-agent-ctl can be used. We assume that we want to configure vpp with label vpp1 and config is stored in the arp-json.json file

vpp-agent-ctl -put "/vnf-agent/vpp1/linux/config/v1/arp/arp1" json/arp-linux.json

The vpp-agent-ctl also contains a simple predefined linux ARP entry config. It can be used for testing purposes. To setup the predefined ARP config run:

vpp-agent-ctl -larp

To remove it run:

vpp-agent-ctl -larpd

Routes

The configuration must be stored in etcd using the following key:

/vnf-agent/<agent-label>/linux/config/v1/route/<label>

An example of configuration in json format can be found here for static routes and here for default routes.

To insert config into etcd in json format vpp-agent-ctl can be used. We assume that we want to configure vpp with label vpp1 and config is stored in the routes-linux-static.json or routes-linux-default.json file

vpp-agent-ctl -put "/vnf-agent/vpp1/linux/config/v1/route/route1" json/routes-linux-static.json
vpp-agent-ctl -put "/vnf-agent/vpp1/linux/config/v1/route/defRoute" json/routes-linux-default.json

The vpp-agent-ctl contains a simple predefined route config also. It can be used for testing purposes. To setup the predefined route config run:

vpp-agent-ctl -lrte

To remove it run:

vpp-agent-ctl -lrted

To create a route, appropriate interface is required.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArpIdentifier

func ArpIdentifier(arp *netlink.Neigh) string

ArpIdentifier generates unique ARP ID used in mapping

func RouteIdentifier

func RouteIdentifier(route *netlink.Route) string

RouteIdentifier generates unique route ID used in mapping

Types

type LinuxArpConfigurator

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

LinuxArpConfigurator watches for any changes in the configuration of static ARPs as modelled by the proto file "model/l3/l3.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/linux/config/v1/arp". Updates received from the northbound API are compared with the Linux network configuration and differences are applied through the Netlink AP

func (*LinuxArpConfigurator) Close

func (plugin *LinuxArpConfigurator) Close() error

Close closes all goroutines started during Init

func (*LinuxArpConfigurator) ConfigureLinuxStaticArpEntry

func (plugin *LinuxArpConfigurator) ConfigureLinuxStaticArpEntry(arpEntry *l3.LinuxStaticArpEntries_ArpEntry) error

ConfigureLinuxStaticArpEntry reacts to a new northbound Linux ARP entry config by creating and configuring the entry in the host network stack through Netlink API.

func (*LinuxArpConfigurator) DeleteLinuxStaticArpEntry

func (plugin *LinuxArpConfigurator) DeleteLinuxStaticArpEntry(arpEntry *l3.LinuxStaticArpEntries_ArpEntry) (err error)

DeleteLinuxStaticArpEntry reacts to a removed NB configuration of a Linux ARP entry.

func (*LinuxArpConfigurator) GetArpIndexes

func (plugin *LinuxArpConfigurator) GetArpIndexes() l3idx.LinuxARPIndexRW

GetArpIndexes returns arp in-memory indexes

func (*LinuxArpConfigurator) GetArpInterfaceCache

func (plugin *LinuxArpConfigurator) GetArpInterfaceCache() map[string]*arpToInterface

GetArpInterfaceCache returns internal non-configurable interface cache, mainly for testing purpose

func (*LinuxArpConfigurator) Init

func (plugin *LinuxArpConfigurator) Init(logger logging.PluginLogger, l3Handler linuxcalls.NetlinkAPI, nsHandler nsplugin.NamespaceAPI,
	ifIndexes ifaceidx.LinuxIfIndexRW, stopwatch *measure.Stopwatch) error

Init initializes ARP configurator and starts goroutines

func (*LinuxArpConfigurator) LookupLinuxArpEntries

func (plugin *LinuxArpConfigurator) LookupLinuxArpEntries() error

LookupLinuxArpEntries reads all ARP entries from all interfaces and registers them if needed

func (*LinuxArpConfigurator) ModifyLinuxStaticArpEntry

func (plugin *LinuxArpConfigurator) ModifyLinuxStaticArpEntry(newArpEntry *l3.LinuxStaticArpEntries_ArpEntry, oldArpEntry *l3.LinuxStaticArpEntries_ArpEntry) (err error)

ModifyLinuxStaticArpEntry applies changes in the NB configuration of a Linux ARP through Netlink API.

func (*LinuxArpConfigurator) ResolveCreatedInterface

func (plugin *LinuxArpConfigurator) ResolveCreatedInterface(ifName string, ifIdx uint32) error

ResolveCreatedInterface resolves a new linux interface from ARP perspective

func (*LinuxArpConfigurator) ResolveDeletedInterface

func (plugin *LinuxArpConfigurator) ResolveDeletedInterface(ifName string, ifIdx uint32) error

ResolveDeletedInterface resolves removed linux interface from ARP perspective

func (*LinuxArpConfigurator) Resync

func (plugin *LinuxArpConfigurator) Resync(arpEntries []*l3.LinuxStaticArpEntries_ArpEntry) (errs []error)

Resync configures an initial set of ARPs. Existing Linux ARPs are registered and potentially re-configured.

type LinuxRouteConfigurator

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

LinuxRouteConfigurator watches for any changes in the configuration of static routes as modelled by the proto file "model/l3/l3.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/linux/config/v1/route". Updates received from the northbound API are compared with the Linux network configuration and differences are applied through the Netlink AP

func (*LinuxRouteConfigurator) Close

func (plugin *LinuxRouteConfigurator) Close() error

Close does nothing for route configurator

func (*LinuxRouteConfigurator) ConfigureLinuxStaticRoute

func (plugin *LinuxRouteConfigurator) ConfigureLinuxStaticRoute(route *l3.LinuxStaticRoutes_Route) error

ConfigureLinuxStaticRoute reacts to a new northbound Linux static route config by creating and configuring the route in the host network stack through Netlink API.

func (*LinuxRouteConfigurator) DeleteLinuxStaticRoute

func (plugin *LinuxRouteConfigurator) DeleteLinuxStaticRoute(route *l3.LinuxStaticRoutes_Route) error

DeleteLinuxStaticRoute reacts to a removed NB configuration of a Linux static route entry.

func (*LinuxRouteConfigurator) GetAutoRouteIndexes

func (plugin *LinuxRouteConfigurator) GetAutoRouteIndexes() l3idx.LinuxRouteIndexRW

GetAutoRouteIndexes returns automatic route in-memory indexes

func (*LinuxRouteConfigurator) GetCachedGatewayRoutes

func (plugin *LinuxRouteConfigurator) GetCachedGatewayRoutes() map[string]*l3.LinuxStaticRoutes_Route

GetCachedGatewayRoutes returns in-memory indexes of unreachable gateway routes

func (*LinuxRouteConfigurator) GetCachedRoutes

func (plugin *LinuxRouteConfigurator) GetCachedRoutes() l3idx.LinuxRouteIndexRW

GetCachedRoutes returns cached route in-memory indexes

func (*LinuxRouteConfigurator) GetRouteIndexes

func (plugin *LinuxRouteConfigurator) GetRouteIndexes() l3idx.LinuxRouteIndexRW

GetRouteIndexes returns route in-memory indexes

func (*LinuxRouteConfigurator) Init

func (plugin *LinuxRouteConfigurator) Init(logger logging.PluginLogger, l3Handler linuxcalls.NetlinkAPI, nsHandler nsplugin.NamespaceAPI,
	ifIndexes ifaceidx.LinuxIfIndexRW, stopwatch *measure.Stopwatch) error

Init initializes static route configurator and starts goroutines

func (*LinuxRouteConfigurator) ModifyLinuxStaticRoute

func (plugin *LinuxRouteConfigurator) ModifyLinuxStaticRoute(newRoute *l3.LinuxStaticRoutes_Route, oldRoute *l3.LinuxStaticRoutes_Route) error

ModifyLinuxStaticRoute applies changes in the NB configuration of a Linux static route into the host network stack through Netlink API.

func (*LinuxRouteConfigurator) ResolveCreatedInterface

func (plugin *LinuxRouteConfigurator) ResolveCreatedInterface(name string, index uint32) error

ResolveCreatedInterface manages static routes for new interface. Linux interface also creates its own route which can make other routes accessible and ready to create - the case is also resolved here.

func (*LinuxRouteConfigurator) ResolveDeletedInterface

func (plugin *LinuxRouteConfigurator) ResolveDeletedInterface(name string, index uint32) error

ResolveDeletedInterface manages static routes for removed interface

func (*LinuxRouteConfigurator) Resync

func (plugin *LinuxRouteConfigurator) Resync(nbRoutes []*l3.LinuxStaticRoutes_Route) (errs []error)

Resync configures an initial set of static routes. Existing Linux static routes are registered and potentially re-configured. Resync does not remove any linux route.

Directories

Path Synopsis
Package l3idx implements name-to-index mapping registry and cache for Linux static arp entries and static routes.
Package l3idx implements name-to-index mapping registry and cache for Linux static arp entries and static routes.

Jump to

Keyboard shortcuts

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