l2plugin

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

README

L2 Plugin

The l2plugin is a Core Agent Plugin designed to configure Bridge Domains and L2 FIB in the VPP. Configuration managed by this plugin is modelled by l2 proto file. The configuration must be stored in etcd using following keys:

/vnf-agent/<agent-label>/vpp/config/v1/bd/<bridge-domain-name>
/vnf-agent/<agent-label>/vpp/config/v1/bd/<bridge-domain-name>/fib/<mac-address>
/vnf-agent/<agent-label>/vpp/config/v1/xconnect/<rx-interface-name>

JSON configuration example with vpp-agent-ctl

An example of basic bridge domain configuration in JSON format can be found here. A bit more advanced example which includes ARP termination entries can be found here. Example of FIB tables is available here

To insert config into etcd in JSON format vpp-agent-ctl can be used. Let's assume that we want to configure vpp with the label vpp1 and config for bridge domain bd1 is stored in the bridge-domain.json file. Furthermore, we assume that the bridge domain bd1 contains tap interface tap1 with configuration stored in tap.json. To convey this configuration to the agent through northbound API, you would execute:

vpp-agent-ctl -put "/vnf-agent/vpp1/vpp/config/v1/interface/tap1" tap.json
vpp-agent-ctl -put "/vnf-agent/vpp1/vpp/config/v1/bd/bd1" bridge-domain.json

Agent operating with the microservice label vpp1 will then create bridge domain, assign every interface which belongs to it (tap1 in the example above), and set BVI (if there is such an interface). If one or more ARP entries are available, all of them are written to ARP Termination table.

Every L2 FIB entry is configured for specific bridge domain and interface, both of them have to be configured (in any order) to be written to FIB table.

Inbuilt configuration example with vpp-agent-ctl

The vpp-agent-ctl binary also ships with some simple predefined bridge domain configurations. It is meant to be used solely for testing purposes.

First create a new tap interface tap1:

vpp-agent-ctl /opt/vpp-agent/dev/etcd.conf -ct

To configure a new bridge domain bd1 containing the previously created tap interface tap1, use:

vpp-agent-ctl /opt/vpp-agent/dev/etcd.conf -cbd

Alternatively, the bridge domain bd1 can be created to include few ARP termination entries with:

vpp-agent-ctl /opt/vpp-agent/dev/etcd.conf -aat

To create a new tap interface tap2 and to L2-xConnect it with tap1, use:

vpp-agent-ctl /opt/vpp-agent/dev/etcd.conf -cxc

To create L2 FIB table, run:

vpp-agent-ctl /opt/vpp-agent/dev/etcd.conf -aft

Documentation

Overview

Package l2plugin implements the L2 plugin that handles Bridge Domains and L2 FIBs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BDConfigurator

type BDConfigurator struct {
	Log           logging.Logger
	GoVppmux      govppmux.API
	BdIndexes     bdidx.BDIndexRW    // bridge domains
	IfToBdIndexes idxvpp.NameToIdxRW // interface to bridge domain mapping - desired state. Metadata is boolean flag whether interface is bvi or not
	//TODO use rather BdIndexes.LookupNameByIfaceName
	IfToBdRealStateIdx     idxvpp.NameToIdxRW // interface to bridge domain mapping - current state. Metadata is boolean flag whether interface is bvi or not
	BridgeDomainIDSeq      uint32
	RegisteredIfaceCounter uint32

	SwIfIndexes ifaceidx.SwIfIndex

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

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

func (*BDConfigurator) Close

func (plugin *BDConfigurator) Close() error

Close GOVPP channel

func (*BDConfigurator) ConfigureBridgeDomain

func (plugin *BDConfigurator) ConfigureBridgeDomain(bridgeDomainInput *l2.BridgeDomains_BridgeDomain) error

ConfigureBridgeDomain for newly created bridge domain

func (*BDConfigurator) DeleteBridgeDomain

func (plugin *BDConfigurator) DeleteBridgeDomain(bridgeDomain *l2.BridgeDomains_BridgeDomain) error

DeleteBridgeDomain process the NB config and propagates it to bin api calls

func (*BDConfigurator) Init

func (plugin *BDConfigurator) Init(notificationChannel chan BridgeDomainStateMessage) (err error)

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

func (*BDConfigurator) LookupBridgeDomainDetails

func (plugin *BDConfigurator) LookupBridgeDomainDetails(bdID uint32, bdName string) error

LookupBridgeDomainDetails looks for existing VPP bridge domain state and propagates it to the etcd bd state

func (*BDConfigurator) ModifyBridgeDomain

func (plugin *BDConfigurator) ModifyBridgeDomain(newConfig *l2.BridgeDomains_BridgeDomain, oldConfig *l2.BridgeDomains_BridgeDomain) error

ModifyBridgeDomain process the NB config and propagates it to bin api calls

func (*BDConfigurator) ResolveCreatedInterface

func (plugin *BDConfigurator) ResolveCreatedInterface(interfaceName string, interfaceIndex uint32) error

ResolveCreatedInterface looks for bridge domain this interface is assigned to and sets it up

func (*BDConfigurator) ResolveDeletedInterface

func (plugin *BDConfigurator) ResolveDeletedInterface(interfaceName string) error

ResolveDeletedInterface is called by VPP if an interface is removed

func (*BDConfigurator) Resync

func (plugin *BDConfigurator) Resync(nbBDs []*l2.BridgeDomains_BridgeDomain) error

Resync writes BDs to the empty VPP

type BridgeDomainMeta

type BridgeDomainMeta struct {
	BridgeDomainIndex uint32
	IsInterfaceBvi    bool
}

BridgeDomainMeta holds info about interfaces's bridge domain index and BVI

type BridgeDomainStateMessage

type BridgeDomainStateMessage struct {
	Message govppapi.Message
	Name    string
}

BridgeDomainStateMessage is message with bridge domain state + bridge domain name (because state message does not contain it). This state is sent to the bd_state.go to further processing after every change

type BridgeDomainStateNotification

type BridgeDomainStateNotification struct {
	State *l2.BridgeDomainState_BridgeDomain
}

BridgeDomainStateNotification contains bridge domain state object with all data published to ETCD

type BridgeDomainStateUpdater

type BridgeDomainStateUpdater struct {
	Log      logging.Logger
	GoVppmux govppmux.API
	// contains filtered or unexported fields
}

BridgeDomainStateUpdater holds all data required to handle bridge domain state

func (*BridgeDomainStateUpdater) Init

func (plugin *BridgeDomainStateUpdater) Init(ctx context.Context, bdIndexes bdidx.BDIndex, swIfIndexes ifaceidx.SwIfIndex,
	notificationChan chan BridgeDomainStateMessage, publishBdState func(notification *BridgeDomainStateNotification)) (err error)

Init bridge domain state updater

type FIBConfigurator

type FIBConfigurator struct {
	Log           logging.Logger
	GoVppmux      govppmux.API
	SwIfIndexes   ifaceidx.SwIfIndex
	BdIndexes     bdidx.BDIndex
	IfToBdIndexes idxvpp.NameToIdxRW //TODO use rather BdIndexes.LookupNameByIfaceName
	FibIndexes    idxvpp.NameToIdxRW
	FibIndexSeq   uint32
	FibDesIndexes idxvpp.NameToIdxRW // Serves as a cache for FIBs which cannot be configured immediately

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

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

func (*FIBConfigurator) Add

func (plugin *FIBConfigurator) Add(fib *l2.FibTableEntries_FibTableEntry, callback func(error)) error

Add configures provided FIB input. Every entry has to contain info about MAC address, interface and bridge domain. If interface or bridge domain is missing, FIB data is cached and recalled if particular entity is registered

func (*FIBConfigurator) Close

func (plugin *FIBConfigurator) Close() error

Close vpp channel

func (*FIBConfigurator) Delete

func (plugin *FIBConfigurator) Delete(fib *l2.FibTableEntries_FibTableEntry, callback func(error)) error

Delete removes FIB table entry. To have request successful, both interface and bridge domain indexes have to be available. Request does nothing without this info. If interface (or bridge domain) was removed before, provided FIB data is just unregistered and agent assumes, that VPP removed FIB entry itself

func (*FIBConfigurator) Diff

func (plugin *FIBConfigurator) Diff(oldFib *l2.FibTableEntries_FibTableEntry,
	newFib *l2.FibTableEntries_FibTableEntry, callback func(error)) error

Diff provides changes for FIB entry. Old fib entry is removed (if possible) and new one is registered if all conditions are fulfilled (interface and bridge domain presence), otherwise new configuration is cached

func (*FIBConfigurator) Init

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

Init goroutines, mappings, channels, ...

func (*FIBConfigurator) LookupFIBEntries

func (plugin *FIBConfigurator) LookupFIBEntries(bridgeDomain uint32) error

LookupFIBEntries iterates over all FIBs belonging to provided bridge domain ID and registers any missing configuration for them

func (*FIBConfigurator) ResolveCreatedBridgeDomain

func (plugin *FIBConfigurator) ResolveCreatedBridgeDomain(domainName string, domainID uint32, callback func(error)) error

ResolveCreatedBridgeDomain uses FIB cache to additionally configure any FIB entries for this bridge domain. Required interface is checked for existence. If resolution is successful, new FIB entry is configured, registered and removed from cache

func (*FIBConfigurator) ResolveCreatedInterface

func (plugin *FIBConfigurator) ResolveCreatedInterface(interfaceName string, interfaceIndex uint32,
	callback func(error)) error

ResolveCreatedInterface uses FIB cache to additionally configure any FIB entries for this interface. Bridge domain is checked for existence. If resolution is successful, new FIB entry is configured, registered and removed from cache

func (*FIBConfigurator) ResolveDeletedBridgeDomain

func (plugin *FIBConfigurator) ResolveDeletedBridgeDomain(domainName string, domainID uint32, callback func(error)) error

ResolveDeletedBridgeDomain if BD was deleted. All FIB entries belonging to this bridge domain are removed from configuration and added to FIB cache (from Agent perspective, FIB entry is not removed when bridge domain vanishes)

func (*FIBConfigurator) ResolveDeletedInterface

func (plugin *FIBConfigurator) ResolveDeletedInterface(interfaceName string, interfaceIndex uint32,
	callback func(error)) error

ResolveDeletedInterface if interface was deleted. All FIB entries belonging to this interface are removed from configuration and added to FIB cache (from Agent perspective, FIB entry is not removed when interface is removed)

func (*FIBConfigurator) Resync

func (plugin *FIBConfigurator) Resync(fibConfig []*l2.FibTableEntries_FibTableEntry) error

Resync writes FIBs to the empty VPP

type FIBMeta

type FIBMeta struct {
	InterfaceName    string
	BridgeDomainName string
	BVI              bool
	StaticConfig     bool
}

FIBMeta metadata holder holds information about entry interface and bridge domain

type XConnectConfigurator

type XConnectConfigurator struct {
	Log         logging.Logger
	GoVppmux    govppmux.API
	SwIfIndexes ifaceidx.SwIfIndex
	XcIndexes   idxvpp.NameToIdxRW
	XcIndexSeq  uint32

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

XConnectConfigurator implements PluginHandlerVPP

func (*XConnectConfigurator) Close

func (plugin *XConnectConfigurator) Close() error

Close GOVPP channel

func (*XConnectConfigurator) ConfigureXConnectPair

func (plugin *XConnectConfigurator) ConfigureXConnectPair(xConnectPairInput *l2.XConnectPairs_XConnectPair) error

ConfigureXConnectPair process the NB config and propagates it to bin api calls

func (*XConnectConfigurator) DeleteXConnectPair

func (plugin *XConnectConfigurator) DeleteXConnectPair(xConnectPairInput *l2.XConnectPairs_XConnectPair) error

DeleteXConnectPair process the NB config and propagates it to bin api calls

func (*XConnectConfigurator) Init

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

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

func (*XConnectConfigurator) LookupXConnectPairs

func (plugin *XConnectConfigurator) LookupXConnectPairs() error

LookupXConnectPairs registers missing l2 xConnect pairs

func (*XConnectConfigurator) ModifyXConnectPair

func (plugin *XConnectConfigurator) ModifyXConnectPair(newConfig *l2.XConnectPairs_XConnectPair, oldConfig *l2.XConnectPairs_XConnectPair) error

ModifyXConnectPair processes the NB config and propagates it to bin api calls

func (*XConnectConfigurator) ResolveCreatedInterface added in v1.0.3

func (plugin *XConnectConfigurator) ResolveCreatedInterface(interfaceName string, interfaceIndex uint32) error

ResolveCreatedInterface configures xconnect pairs that use the interface as rx or tx and have not been configured yet

func (*XConnectConfigurator) ResolveDeletedInterface added in v1.0.3

func (plugin *XConnectConfigurator) ResolveDeletedInterface(interfaceName string) error

ResolveDeletedInterface deltes xconnect pairs that have not been deleted yet and use the interface as rx or tx

func (*XConnectConfigurator) Resync

func (plugin *XConnectConfigurator) Resync(xcConfig []*l2.XConnectPairs_XConnectPair) error

Resync writes XCons to the empty VPP

type XConnectMeta

type XConnectMeta struct {
	TransmitInterface string
	// contains filtered or unexported fields
}

XConnectMeta meta hold info about transmit interface

Directories

Path Synopsis
Package bdidx implements name-to-index mapping registry and cache for bridge-domains.
Package bdidx implements name-to-index mapping registry and cache for bridge-domains.
Package binapi is the parent for packages that define various l2plugin southbound APIs.
Package binapi is the parent for packages that define various l2plugin southbound APIs.
l2
Code generated by govpp binapi-generator DO NOT EDIT.
Code generated by govpp binapi-generator DO NOT EDIT.
vpe
Code generated by govpp binapi-generator DO NOT EDIT.
Code generated by govpp binapi-generator DO NOT EDIT.
Package model defines the l2lugin's northbound API.
Package model defines the l2lugin's northbound API.
l2
Package l2 is a generated protocol buffer package.
Package l2 is a generated protocol buffer package.
Package vppcalls contains wrappers over VPP binary APIs for bridge-domains, L2 FIBs and XConnect pairs.
Package vppcalls contains wrappers over VPP binary APIs for bridge-domains, L2 FIBs and XConnect pairs.
Package vppdump provides helpers to dump all bridge-domains, L2 FIBs and XConnect pairs configured in VPP.
Package vppdump provides helpers to dump all bridge-domains, L2 FIBs and XConnect pairs configured in VPP.

Jump to

Keyboard shortcuts

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