govppmux

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 40 Imported by: 8

Documentation

Overview

Package govppmux implements the GoVPPMux plugin that allows multiple plugins to share a single connection to VPP.

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is default instance of Plugin

View Source
var DisableOldStats = os.Getenv("GOVPPMUX_OLDSTATS_DISABLED") != ""

DisableOldStats is used to disabled old way of collecting stats.

Functions

func NewStatsAdapter

func NewStatsAdapter(socketName string) adapter.StatsAPI

NewStatsAdapter returns VPP stats API adapter, implemented as pure Go client.

func NewVppAdapter

func NewVppAdapter(addr string, useShm bool) adapter.VppAPI

NewVppAdapter returns VPP binary API adapter, implemented as pure Go client.

Types

type API

type API interface {
	// VPPInfo returns VPP information which is retrieved immediatelly after connecting to VPP.
	VPPInfo() VPPInfo

	vpp.Client
}

API for other plugins to get connectivity to VPP.

type Config

type Config struct {
	// ReconnectResync enables resync after reconnect to VPP.
	ReconnectResync bool `json:"resync-after-reconnect"`

	// ReplyTimeout defines timeout period for replies in channels from VPP.
	ReplyTimeout time.Duration `json:"reply-timeout"`

	// Connect to VPP for configuration requests via the shared memory instead of through the socket.
	ConnectViaShm bool `json:"connect-via-shm"`

	// ShmPrefix defines prefix prepended to the name used for shared memory (SHM) segments.
	// If not set, shared memory segments are created directly in the SHM directory /dev/shm.
	ShmPrefix string `json:"shm-prefix"`

	// BinAPISocketPath defines path to the binapi socket file.
	BinAPISocketPath string `json:"binapi-socket-path"`

	// StatsSocketPath defines path to the stats socket file.
	StatsSocketPath string `json:"stats-socket-path"`

	// How many times can be request resent in case vpp is suddenly disconnected.
	RetryRequestCount int `json:"retry-request-count"`

	// Time between request resend attempts. Default is 500ms.
	RetryRequestTimeout time.Duration `json:"retry-request-timeout"`

	// How many times can be connection request resent in case the vpp is not reachable.
	RetryConnectCount int `json:"retry-connect-count"`

	// Time between connection request resend attempts. Default is 1s.
	RetryConnectTimeout time.Duration `json:"retry-connect-timeout"`

	// Enable VPP proxy.
	ProxyEnabled bool `json:"proxy-enabled"`

	// Below are options used for VPP connection health checking.
	HealthCheckProbeInterval time.Duration `json:"health-check-probe-interval"`
	HealthCheckReplyTimeout  time.Duration `json:"health-check-reply-timeout"`
	HealthCheckThreshold     int           `json:"health-check-threshold"`

	// DEPRECATED: TraceEnabled is obsolete and used only in older versions.
	TraceEnabled bool `json:"trace-enabled"`
}

Config defines configurable parameters for govppmux plugin.

func DefaultConfig

func DefaultConfig() *Config

type Deps

type Deps struct {
	infra.PluginDeps
	HTTPHandlers rest.HTTPHandlers
	StatusCheck  statuscheck.PluginStatusWriter
	Resync       *resync.Plugin
}

Deps defines dependencies for the govppmux plugin.

type Option

type Option func(*Plugin)

Option is a function that acts on a Plugin to inject Dependencies or configuration

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

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

Plugin is the govppmux plugin implementation.

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provides Options

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() error

AfterInit reports status check.

func (*Plugin) BinapiVersion

func (p *Plugin) BinapiVersion() vpp.Version

func (*Plugin) CheckCompatiblity

func (p *Plugin) CheckCompatiblity(msgs ...govppapi.Message) error

func (*Plugin) Close

func (p *Plugin) Close() error

Close cleans up the resources allocated by the govppmux plugin.

func (*Plugin) DumpStats

func (p *Plugin) DumpStats(prefixes ...string) ([]adapter.StatEntry, error)

DumpStats returns all stats with name, type and value

func (*Plugin) GetBufferStats

func (p *Plugin) GetBufferStats(stats *govppapi.BufferStats) error

GetBufferStats retrieves VPP error counters

func (*Plugin) GetErrorStats

func (p *Plugin) GetErrorStats(stats *govppapi.ErrorStats) error

GetErrorStats retrieves VPP error counters

func (*Plugin) GetInterfaceStats

func (p *Plugin) GetInterfaceStats(stats *govppapi.InterfaceStats) error

GetInterfaceStats retrieves all counters related to the VPP interfaces

func (*Plugin) GetMemoryStats added in v3.3.0

func (p *Plugin) GetMemoryStats(stats *govppapi.MemoryStats) error

GetMemoryStats retrieves VPP memory info

func (*Plugin) GetNodeStats

func (p *Plugin) GetNodeStats(stats *govppapi.NodeStats) error

GetNodeStats retrieves a list of Node VPP counters (vectors, clocks, ...)

func (*Plugin) GetSystemStats

func (p *Plugin) GetSystemStats(stats *govppapi.SystemStats) error

GetSystemStats retrieves system statistics of the connected VPP instance like Vector rate, Input rate, etc.

func (*Plugin) Init

func (p *Plugin) Init() (err error)

Init is the entry point called by Agent Core. A single binary-API connection to VPP is established.

func (*Plugin) Invoke added in v3.2.0

func (p *Plugin) Invoke(ctx context.Context, req govppapi.Message, reply govppapi.Message) error

func (*Plugin) IsPluginLoaded

func (p *Plugin) IsPluginLoaded(plugin string) bool

IsPluginLoaded returns true if plugin is loaded.

func (*Plugin) ListStats

func (p *Plugin) ListStats(prefixes ...string) ([]adapter.StatIdentifier, error)

ListStats returns all stats names

func (*Plugin) NewAPIChannel

func (p *Plugin) NewAPIChannel() (govppapi.Channel, error)

NewAPIChannel returns a new API channel for communication with VPP via govpp core. It uses default buffer sizes for the request and reply Go channels.

func (*Plugin) NewAPIChannelBuffered

func (p *Plugin) NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (govppapi.Channel, error)

NewAPIChannelBuffered returns a new API channel for communication with VPP via govpp core. It allows to specify custom buffer sizes for the request and reply Go channels.

func (*Plugin) NewStream added in v3.2.0

func (p *Plugin) NewStream(ctx context.Context, options ...govppapi.StreamOption) (govppapi.Stream, error)

func (*Plugin) OnReconnect added in v3.1.0

func (p *Plugin) OnReconnect(fn func())

func (*Plugin) Stats

func (p *Plugin) Stats() govppapi.StatsProvider

func (*Plugin) VPPInfo

func (p *Plugin) VPPInfo() VPPInfo

VPPInfo returns information about VPP session.

func (*Plugin) Version

func (p *Plugin) Version() vpp.Version

type Stats

type Stats struct {
	govppmux.Metrics

	Errors metrics.Calls

	AllMessages metrics.CallStats
	Messages    metrics.Calls

	Replies metrics.Calls
}

Stats defines various statistics for govppmux plugin.

func GetStats

func GetStats() *Stats

type VPPInfo

type VPPInfo struct {
	Connected bool
	vppcalls.VersionInfo
	vppcalls.SessionInfo
	Plugins []vppcalls.PluginInfo
}

VPPInfo defines retrieved information about the connected VPP instance.

func (VPPInfo) GetReleaseVersion

func (vpp VPPInfo) GetReleaseVersion() string

GetReleaseVersion returns VPP release version (XX.YY), which is normalized from GetVersion.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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