l3plugin

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: 16 Imported by: 0

README

L3 plugin

The l3plugin is a Core Agent Plugin that is designed to configure routes in the VPP. Configuration managed by this plugin is modelled by the proto file. 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" 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 -cr

To remove it run:

vpp-agent-ctl -dr

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, index ifaceidx.SwIfIndex, log logging.Logger) (*vppcalls.Route, error)

TransformRoute converts raw route data to Route object

Types

type RouteConfigurator

type RouteConfigurator struct {
	Log           logging.Logger
	GoVppmux      govppmux.API
	RouteIndexes  idxvpp.NameToIdxRW
	RouteIndexSeq uint32
	SwIfIndexes   ifaceidx.SwIfIndex

	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 process 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 process 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 process the NB config and propagates it to bin api calls

func (*RouteConfigurator) Resync

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

Resync confgures the empty VPP (overwrites the static route)

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

Returns length of slice Implements sort.Interface

func (SortedRoutes) Less

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

Less returns true if the item in slice 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 indexes Implements sort.Interface

Directories

Path Synopsis
Package binapi defines the l3plugin's southbound API.
Package binapi defines the l3plugin's southbound API.
ip
Code generated by govpp binapi-generator DO NOT EDIT.
Code generated by govpp binapi-generator DO NOT EDIT.
Package model defines the l3plugin's northbound API.
Package model defines the l3plugin's northbound API.
l3
Package l3 is a generated protocol buffer package.
Package l3 is a generated protocol buffer package.
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 to dump all L3 FIBs configured in VPP.
Package vppdump provides helpers to dump all L3 FIBs configured in VPP.

Jump to

Keyboard shortcuts

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