l3plugin

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

README

L3 plugin

The l3plugin is a Core Agent Plugin that is designed to configure ARP entries and routes in the VPP. 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>/vpp/config/v1/arp/<interface>/<ip-address>

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 file

vpp-agent-ctl -put "/vnf-agent/vpp1/vpp/config/v1/arp/tap1/192.168.10.21" json/arp.json

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

vpp-agent-ctl -arp

To remove it run:

vpp-agent-ctl -arpd

Proxy ARP

Proxy ARP configuration is composed from two parts; interfaces that are enabled and IP address ranges. Both of these configuration types are stored under separate keys.

For proxy arp interface array, use key:

/vnf-agent/<agent-label>/vpp/config/v1/proxyarp/interface/<if-cfg-label>

For proxy arp ranges:

/vnf-agent/<agent-label>/vpp/config/v1/proxyarp/range/<rng-cfg-label>

An example configuration for interfaces can be found here. An example configuration for IP ranges can be found here.

Predefined configuration in vpp-agent-ctl for interfaces:

vpp-agent-ctl -prxi

For ranges:

vpp-agent-ctl -prxd

Routes

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

/vnf-agent/<agent-label>/vpp/config/v1/vrf/0/fib/

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

Note: Value 0 in vrfID field denotes default VRF in vpp. Since it is default value it is omitted in the config above. If you want to configure a route for a VRF other than default, make sure that the VRF has already been created.

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.json file

vpp-agent-ctl -put "/vnf-agent/vpp1/vpp/config/v1/vrf/0/fib" json/routes.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 -route

To remove it run:

vpp-agent-ctl -routed

Documentation

Overview

Package l3plugin implements the L3 plugin that handles L3 FIBs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TransformRoute

func TransformRoute(routeInput *l3.StaticRoutes_Route, swIndex uint32, log logging.Logger) (*vppcalls.Route, error)

TransformRoute converts raw route data to Route object.

Types

type ArpConfigurator added in v1.0.8

type ArpConfigurator struct {
	Log logging.Logger

	GoVppmux govppmux.API

	// ARPIndexes is a list of ARP entries which are successfully configured on the VPP
	ARPIndexes l3idx.ARPIndexRW
	// ARPCache is a list of ARP entries with are present in the ETCD, but not on VPP
	// due to missing interface
	ARPCache l3idx.ARPIndexRW
	// ARPDeleted is a list of unsuccessfully deleted ARP entries. ARP entry cannot be removed
	// if the interface is missing (it runs into 'unnassigned' state). If the interface re-appears,
	// such an ARP have to be removed
	ARPDeleted l3idx.ARPIndexRW

	ARPIndexSeq uint32
	SwIfIndexes ifaceidx.SwIfIndex

	Stopwatch *measure.Stopwatch
	// contains filtered or unexported fields
}

ArpConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of L3 arp entries as modelled by the proto file "../model/l3/l3.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/vpp/config/v1/arp". Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.

func (*ArpConfigurator) AddArp added in v1.0.8

func (plugin *ArpConfigurator) AddArp(entry *l3.ArpTable_ArpEntry) error

AddArp processes the NB config and propagates it to bin api call

func (*ArpConfigurator) ChangeArp added in v1.0.8

func (plugin *ArpConfigurator) ChangeArp(entry *l3.ArpTable_ArpEntry, prevEntry *l3.ArpTable_ArpEntry) error

ChangeArp processes the NB config and propagates it to bin api call

func (*ArpConfigurator) Close added in v1.0.8

func (plugin *ArpConfigurator) Close() error

Close GOVPP channel

func (*ArpConfigurator) DeleteArp added in v1.0.8

func (plugin *ArpConfigurator) DeleteArp(entry *l3.ArpTable_ArpEntry) error

DeleteArp processes the NB config and propagates it to bin api call

func (*ArpConfigurator) Init added in v1.0.8

func (plugin *ArpConfigurator) Init() (err error)

Init initializes ARP configurator

func (*ArpConfigurator) ResolveCreatedInterface added in v1.4.0

func (plugin *ArpConfigurator) ResolveCreatedInterface(interfaceName string) error

ResolveCreatedInterface handles case when new interface appears in the config

func (*ArpConfigurator) ResolveDeletedInterface added in v1.4.0

func (plugin *ArpConfigurator) ResolveDeletedInterface(interfaceName string, interfaceIdx uint32) error

ResolveDeletedInterface handles case when interface is removed from the config

func (*ArpConfigurator) Resync added in v1.0.8

func (plugin *ArpConfigurator) Resync(arpEntries []*l3.ArpTable_ArpEntry) error

Resync confgures the empty VPP (overwrites the arp entries)

type ProxyArpConfigurator added in v1.4.0

type ProxyArpConfigurator struct {
	Log logging.Logger

	GoVppmux govppmux.API

	// ProxyArpIndices is a list of proxy ARP interface entries which are successfully configured on the VPP
	ProxyArpIfIndices idxvpp.NameToIdxRW
	// ProxyArpRngIndices is a list of proxy ARP range entries which are successfully configured on the VPP
	ProxyArpRngIndices idxvpp.NameToIdxRW
	// Cached interfaces
	ProxyARPIfCache []string

	ProxyARPIndexSeq uint32
	SwIfIndexes      ifaceidx.SwIfIndex

	Stopwatch *measure.Stopwatch
	// contains filtered or unexported fields
}

ProxyArpConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of L3 proxy arp entries as modelled by the proto file "../model/l3/l3.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/vpp/config/v1/proxyarp". Configuration uses separate keys for proxy arp range and interfaces. Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.

func (*ProxyArpConfigurator) AddInterface added in v1.4.0

func (plugin *ProxyArpConfigurator) AddInterface(pArpIf *l3.ProxyArpInterfaces_InterfaceList) error

func (*ProxyArpConfigurator) AddRange added in v1.4.0

func (plugin *ProxyArpConfigurator) AddRange(pArpRng *l3.ProxyArpRanges_RangeList) error

AddRange configures new IP range for proxy ARP

func (*ProxyArpConfigurator) Close added in v1.4.0

func (plugin *ProxyArpConfigurator) Close() error

Close VPP channel

func (*ProxyArpConfigurator) DeleteInterface added in v1.4.0

func (plugin *ProxyArpConfigurator) DeleteInterface(pArpIf *l3.ProxyArpInterfaces_InterfaceList) error

DeleteInterface disables proxy ARP interface or removes it from cache

func (*ProxyArpConfigurator) DeleteRange added in v1.4.0

func (plugin *ProxyArpConfigurator) DeleteRange(pArpRng *l3.ProxyArpRanges_RangeList) error

func (*ProxyArpConfigurator) Init added in v1.4.0

func (plugin *ProxyArpConfigurator) Init() error

Init VPP channel and check message compatibility

func (*ProxyArpConfigurator) ModifyInterface added in v1.4.0

func (plugin *ProxyArpConfigurator) ModifyInterface(newPArpIf, oldPArpIf *l3.ProxyArpInterfaces_InterfaceList) error

ModifyInterface does nothing

func (*ProxyArpConfigurator) ModifyRange added in v1.4.0

func (plugin *ProxyArpConfigurator) ModifyRange(newPArpRng, oldPArpRng *l3.ProxyArpRanges_RangeList) error

ModifyRange does nothing

func (*ProxyArpConfigurator) ResolveCreatedInterface added in v1.4.0

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

ResolveCreatedInterface handles new registered interface for proxy ARP

func (*ProxyArpConfigurator) ResolveDeletedInterface added in v1.4.0

func (plugin *ProxyArpConfigurator) ResolveDeletedInterface(ifName string) error

ResolveDeletedInterface handles new registered interface for proxy ARP

func (*ProxyArpConfigurator) ResyncInterfaces added in v1.4.0

func (plugin *ProxyArpConfigurator) ResyncInterfaces(nbProxyArpIfs []*l3.ProxyArpInterfaces_InterfaceList) error

Resync confgures the empty VPP (overwrites the proxy arp entries)

func (*ProxyArpConfigurator) ResyncRanges added in v1.4.0

func (plugin *ProxyArpConfigurator) ResyncRanges(nbProxyArpRanges []*l3.ProxyArpRanges_RangeList) error

Resync confgures the empty VPP (overwrites the proxy arp ranges)

type RouteConfigurator

type RouteConfigurator struct {
	Log              logging.Logger
	GoVppmux         govppmux.API
	RouteIndexes     l3idx.RouteIndexRW
	RouteIndexSeq    uint32
	SwIfIndexes      ifaceidx.SwIfIndex
	RouteCachedIndex l3idx.RouteIndexRW

	Stopwatch *measure.Stopwatch // timer used to measure and store time
	// contains filtered or unexported fields
}

RouteConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of L3 routes as modelled by the proto file "../model/l3/l3.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/vpp/config/v1routes". Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.

func (*RouteConfigurator) Close

func (plugin *RouteConfigurator) Close() error

Close GOVPP channel.

func (*RouteConfigurator) ConfigureRoute

func (plugin *RouteConfigurator) ConfigureRoute(config *l3.StaticRoutes_Route, vrfFromKey string) error

ConfigureRoute processes the NB config and propagates it to bin api calls.

func (*RouteConfigurator) DeleteRoute

func (plugin *RouteConfigurator) DeleteRoute(config *l3.StaticRoutes_Route, vrfFromKey string) (wasError error)

DeleteRoute processes the NB config and propagates it to bin api calls.

func (*RouteConfigurator) Init

func (plugin *RouteConfigurator) Init() (err error)

Init members (channels...) and start go routines.

func (*RouteConfigurator) ModifyRoute

func (plugin *RouteConfigurator) ModifyRoute(newConfig *l3.StaticRoutes_Route, oldConfig *l3.StaticRoutes_Route, vrfFromKey string) error

ModifyRoute processes the NB config and propagates it to bin api calls.

func (*RouteConfigurator) ResolveCreatedInterface added in v1.4.0

func (plugin *RouteConfigurator) ResolveCreatedInterface(ifName string, swIdx uint32)

ResolveCreatedInterface is responsible for reconfiguring cached routes and then from removing them from route cache

func (*RouteConfigurator) ResolveDeletedInterface added in v1.4.0

func (plugin *RouteConfigurator) ResolveDeletedInterface(ifName string, swIdx uint32)

ResolveDeletedInterface is responsible for moving routes of deleted interface to cache

func (*RouteConfigurator) Resync

func (plugin *RouteConfigurator) Resync(nbRoutes []*l3.StaticRoutes_Route) error

Resync configures the VPP static routes.

type SortedRoutes

type SortedRoutes []*vppcalls.Route

SortedRoutes type is used to implement sort interface for slice of Route.

func (SortedRoutes) Len

func (arr SortedRoutes) Len() int

Return length of slice. Implements sort.Interface

func (SortedRoutes) Less

func (arr SortedRoutes) Less(i, j int) bool

Less returns true if the item at index i in slice should be sorted before the element with index j. Implements sort.Interface

func (SortedRoutes) Swap

func (arr SortedRoutes) Swap(i, j int)

Swap swaps two items in slice identified by indices. Implements sort.Interface

Directories

Path Synopsis
Package vppcalls contains wrappers over VPP binary APIs for L3 FIBs.
Package vppcalls contains wrappers over VPP binary APIs for L3 FIBs.
Package vppdump provides helpers for dumping all L3 FIBs configured in VPP.
Package vppdump provides helpers for dumping all L3 FIBs configured in VPP.

Jump to

Keyboard shortcuts

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