Documentation ¶
Overview ¶
Package govppmux implements the GoVPPMux plugin that allows multiple plugins to share a single connection to VPP.
Index ¶
- Variables
- func NewStatsAdapter(socketName string) adapter.StatsAPI
- func NewVppAdapter(addr string, useShm bool) adapter.VppAPI
- type API
- type Config
- type Deps
- type Option
- type Plugin
- func (p *Plugin) AfterInit() error
- func (p *Plugin) Close() error
- func (p *Plugin) DumpStats(prefixes ...string) ([]adapter.StatEntry, error)
- func (p *Plugin) GetBufferStats(stats *govppapi.BufferStats) error
- func (p *Plugin) GetErrorStats(stats *govppapi.ErrorStats) error
- func (p *Plugin) GetInterfaceStats(stats *govppapi.InterfaceStats) error
- func (p *Plugin) GetNodeStats(stats *govppapi.NodeStats) error
- func (p *Plugin) GetSystemStats(stats *govppapi.SystemStats) error
- func (p *Plugin) Init() (err error)
- func (p *Plugin) ListStats(prefixes ...string) ([]string, error)
- func (p *Plugin) NewAPIChannel() (govppapi.Channel, error)
- func (p *Plugin) NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (govppapi.Channel, error)
- func (p *Plugin) VPPInfo() (VPPInfo, error)
- type Stats
- type StatsAPI
- type VPPInfo
Constants ¶
This section is empty.
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is default instance of Plugin
Functions ¶
func NewStatsAdapter ¶
NewStatsAdapter returns VPP stats 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, error) govppapi.ChannelProvider }
API for other plugins to get connectivity to VPP.
type Config ¶
type Config struct { TraceEnabled bool `json:"trace-enabled"` ReconnectResync bool `json:"resync-after-reconnect"` HealthCheckProbeInterval time.Duration `json:"health-check-probe-interval"` HealthCheckReplyTimeout time.Duration `json:"health-check-reply-timeout"` HealthCheckThreshold int `json:"health-check-threshold"` 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"` // The 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 string `json:"binapi-socket-path"` 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"` }
Config groups the configurable parameter of GoVpp.
type Deps ¶
type Deps struct { infra.PluginDeps HTTPHandlers rest.HTTPHandlers StatusCheck statuscheck.PluginStatusWriter Resync *resync.Plugin }
Deps groups injected dependencies of plugin so that they do not mix with other plugin fields.
type Option ¶
type Option func(*Plugin)
Option is a function that acts on a Plugin to inject Dependencies or configuration
type Plugin ¶
type Plugin struct { Deps // contains filtered or unexported fields }
Plugin implements the govppmux plugin interface.
func NewPlugin ¶
NewPlugin creates a new Plugin with the provides Options
func (*Plugin) Close ¶
Close cleans up the resources allocated by the govppmux plugin.
func (*Plugin) DumpStats ¶
DumpStats returns all stats with name, type and value
func (*Plugin) GetBufferStats ¶
func (p *Plugin) GetBufferStats(stats *govppapi.BufferStats) error
GetErrorStats 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) GetNodeStats ¶
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 ¶
Init is the entry point called by Agent Core. A single binary-API connection to VPP is established.
func (*Plugin) ListStats ¶
ListStats returns all stats names
func (*Plugin) NewAPIChannel ¶
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.
Example of binary API call from some plugin using GOVPP:
ch, _ := govpp_mux.NewAPIChannel() ch.SendRequest(req).ReceiveReply
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.
Example of binary API call from some plugin using GOVPP:
ch, _ := govpp_mux.NewAPIChannelBuffered(100, 100) ch.SendRequest(req).ReceiveReply
type Stats ¶
type Stats struct { ChannelsCreated uint64 ChannelsOpen uint64 RequestsSent uint64 RequestsDone uint64 RequestsErrors uint64 RequestReplies uint64 Errors metrics.Calls AllMessages metrics.CallStats Messages metrics.Calls Replies metrics.Calls }
Stats defines various statistics for govppmux plugin.
type StatsAPI ¶
type StatsAPI interface { API govppapi.StatsProvider }
StatsAPI is extended API with ability to get VPP stats data