ifplugin

package
v2.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Drop    counterType = 0
	Punt                = 1
	IPv4                = 2
	IPv6                = 3
	RxNoBuf             = 4
	RxMiss              = 5
	RxError             = 6
	TxError             = 7
	MPLS                = 8
)

constants as defined in the vnet_interface_counter_type_t enum in 'vnet/interface.h'

View Source
const (
	Rx combinedCounterType = 0
	Tx                     = 1
)

constants as defined in the vnet_interface_counter_type_t enum in 'vnet/interface.h'

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of IfPlugin.

Functions

This section is empty.

Types

type API

type API interface {
	// GetInterfaceIndex gives read-only access to map with metadata of all configured
	// VPP interfaces.
	GetInterfaceIndex() ifaceidx.IfaceMetadataIndex

	// GetDHCPIndex gives read-only access to (untyped) map with DHCP leases.
	// Cast metadata to "github.com/ligato/vpp-agent/plugins/vppv2/model/interfaces".DHCPLease
	GetDHCPIndex() idxmap.NamedMapping
}

API defines methods exposed by VPP-IfPlugin.

type Config

type Config struct {
	Mtu              uint32   `json:"mtu"`
	StatusPublishers []string `json:"status-publishers"`
}

Config holds the vpp-plugin configuration.

type Deps

type Deps struct {
	infra.PluginDeps
	Scheduler scheduler.KVScheduler
	GoVppmux  govppmux.API

	/* optional, provide if AFPacket or TAP+TAP_TO_VPP interfaces are used */
	LinuxIfPlugin descriptor.LinuxPluginAPI

	// state publishing
	StatusCheck       statuscheck.PluginStatusWriter
	PublishErrors     datasync.KeyProtoValWriter            // TODO: to be used with a generic plugin for publishing errors (not just interfaces and BDs)
	Watcher           datasync.KeyValProtoWatcher           /* for resync of interface state data (PublishStatistics) */
	NotifyStatistics  datasync.KeyProtoValWriter            /* e.g. Kafka (up/down events only)*/
	PublishStatistics datasync.KeyProtoValWriter            /* e.g. ETCD (with resync) */
	DataSyncs         map[string]datasync.KeyProtoValWriter /* available DBs for PublishStatistics */

}

Deps lists dependencies of the interface plugin.

type IfPlugin

type IfPlugin struct {
	Deps
	// contains filtered or unexported fields
}

IfPlugin configures VPP interfaces using GoVPP.

func NewPlugin

func NewPlugin(opts ...Option) *IfPlugin

NewPlugin creates a new Plugin with the provides Options

func (*IfPlugin) AfterInit

func (p *IfPlugin) AfterInit() error

AfterInit delegates the call to ifStateUpdater.

func (*IfPlugin) Close

func (p *IfPlugin) Close() error

Close stops all go routines.

func (*IfPlugin) GetDHCPIndex

func (p *IfPlugin) GetDHCPIndex() idxmap.NamedMapping

GetDHCPIndex gives read-only access to (untyped) map with DHCP leases. Cast metadata to "github.com/ligato/vpp-agent/plugins/vppv2/model/interfaces".DHCPLease

func (*IfPlugin) GetInterfaceIndex

func (p *IfPlugin) GetInterfaceIndex() ifaceidx.IfaceMetadataIndex

GetInterfaceIndex gives read-only access to map with metadata of all configured VPP interfaces.

func (*IfPlugin) Init

func (p *IfPlugin) Init() error

Init loads configuration file and registers interface-related descriptors.

type InterfaceStateUpdater

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

InterfaceStateUpdater holds state data of all VPP interfaces.

func (*InterfaceStateUpdater) AfterInit

func (c *InterfaceStateUpdater) AfterInit() error

AfterInit subscribes for watching VPP notifications on previously initialized channel

func (*InterfaceStateUpdater) Close

func (c *InterfaceStateUpdater) Close() error

Close unsubscribes from interface state notifications from VPP & GOVPP channel

func (*InterfaceStateUpdater) Init

func (c *InterfaceStateUpdater) Init(ctx context.Context, logger logging.PluginLogger, kvScheduler scheduler.KVScheduler,
	goVppMux govppmux.API, swIfIndexes ifaceidx.IfaceMetadataIndex,
	publishIfState func(notification *intf.InterfaceNotification)) (err error)

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

func (*InterfaceStateUpdater) LogError

func (c *InterfaceStateUpdater) LogError(err error) error

LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further

type Option

type Option func(*IfPlugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseDeps

func UseDeps(f func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

Directories

Path Synopsis
Package ifaceidx implements name-to-index mapping registry and cache for VPP interfaces.
Package ifaceidx implements name-to-index mapping registry and cache for VPP interfaces.
Package vppcalls contains wrappers over VPP binary APIs for all supported interface types and for dumping all interfaces configured in VPP.
Package vppcalls contains wrappers over VPP binary APIs for all supported interface types and for dumping all interfaces configured in VPP.

Jump to

Keyboard shortcuts

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