Documentation ¶
Overview ¶
Package adapter provides an interface between govpp core and the VPP. It is responsible for sending and receiving binary-encoded data to/from VPP via shared memory.
The default adapter being used for connection with real VPP is called vppapiclient. It is based on the communication with the vppapiclient VPP library written in C via CGO.
Apart from the vppapiclient adapter, mock adapter is provided for unit/integration testing where the actual communication with VPP is not demanded.
Index ¶
- Constants
- Variables
- func ReduceCombinedCounterStatIndex(s CombinedCounterStat, i int) [2]uint64
- func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64
- type CombinedCounter
- type CombinedCounterStat
- type CombinedCounterVNI
- type Counter
- type ErrorStat
- type MsgCallback
- type Name
- type NameStat
- type ScalarStat
- type SimpleCounterStat
- type Stat
- type StatDir
- type StatEntry
- type StatType
- type StatsAPI
- type UnknownMsgError
- type VPCCombinedCounterStats
- type VppAPI
Constants ¶
const (
// DefaultBinapiSocket defines a default socket file path for VPP binary API.
DefaultBinapiSocket = "/run/vpp/api.sock"
)
const (
// DefaultStatsSocket defines a default socket file path for VPP stats API.
DefaultStatsSocket = "/run/vpp/stats.sock"
)
Variables ¶
var ( ErrStatsDataBusy = errors.New("stats data busy") ErrStatsDirStale = errors.New("stats dir stale") ErrStatsAccessFailed = errors.New("stats access failed") )
var ( // ErrNotImplemented is an error returned when missing implementation. ErrNotImplemented = errors.New("not implemented for this OS") )
Functions ¶
func ReduceCombinedCounterStatIndex ¶ added in v0.3.7
func ReduceCombinedCounterStatIndex(s CombinedCounterStat, i int) [2]uint64
ReduceCombinedCounterStatIndex returns reduced CombinedCounterStat s for index i.
func ReduceSimpleCounterStatIndex ¶ added in v0.3.7
func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64
ReduceSimpleCounterStatIndex returns reduced SimpleCounterStat s for index i.
Types ¶
type CombinedCounter ¶
type CombinedCounter [2]uint64
CombinedCounter represents counter with two values, for packet count and bytes count.
func (CombinedCounter) Bytes ¶
func (s CombinedCounter) Bytes() uint64
func (CombinedCounter) Packets ¶
func (s CombinedCounter) Packets() uint64
type CombinedCounterStat ¶
type CombinedCounterStat [][]CombinedCounter
CombinedCounterStat represents stat for CombinedCounterVector. The outer array represents workers and the inner array represents interface/node/.. indexes. Values should be aggregated per interface/node for every worker. ReduceCombinedCounterStatIndex can be used to reduce specific index.
func (CombinedCounterStat) IsZero ¶ added in v0.3.7
func (s CombinedCounterStat) IsZero() bool
type CombinedCounterVNI ¶ added in v0.3.7
type CombinedCounterVNI [3]uint64
func (CombinedCounterVNI) Bytes ¶ added in v0.3.7
func (s CombinedCounterVNI) Bytes() uint64
func (CombinedCounterVNI) Packets ¶ added in v0.3.7
func (s CombinedCounterVNI) Packets() uint64
func (CombinedCounterVNI) Vni ¶ added in v0.3.7
func (s CombinedCounterVNI) Vni() uint64
type Counter ¶
type Counter uint64
Counter represents simple counter with single value, which is usually packet count.
type MsgCallback ¶
MsgCallback defines func signature for message callback.
type ScalarStat ¶
type ScalarStat float64
ScalarStat represents stat for ScalarIndex.
func (ScalarStat) IsZero ¶ added in v0.3.7
func (s ScalarStat) IsZero() bool
type SimpleCounterStat ¶
type SimpleCounterStat [][]Counter
SimpleCounterStat represents stat for SimpleCounterVector. The outer array represents workers and the inner array represents interface/node/.. indexes. Values should be aggregated per interface/node for every worker. ReduceSimpleCounterStatIndex can be used to reduce specific index.
func (SimpleCounterStat) IsZero ¶ added in v0.3.7
func (s SimpleCounterStat) IsZero() bool
type Stat ¶
type Stat interface { // IsZero returns true if all of its values equal to zero. IsZero() bool // contains filtered or unexported methods }
Stat represents some type of stat which is usually defined by StatType.
type StatEntry ¶
StatEntry represents single stat entry. The type of stat stored in Data is defined by Type.
type StatType ¶
type StatType int
StatType represents type of stat directory and simply defines what type of stat data is stored in the stat entry.
type StatsAPI ¶
type StatsAPI interface { // Connect establishes client connection to the stats API. Connect() error // Disconnect terminates client connection. Disconnect() error // ListStats lists names for stats matching patterns. ListStats(patterns ...string) (names []string, err error) // DumpStats dumps all stat entries. DumpStats(patterns ...string) (entries []StatEntry, err error) // DumpVPCStats dumps vpc stat entries by vni DumpVPCStats(vni ...uint64) (entries []StatEntry, err error) // PrepareDir prepares new stat dir for entries that match any of prefixes. PrepareDir(patterns ...string) (*StatDir, error) // UpdateDir updates stat dir and all of their entries. UpdateDir(dir *StatDir) error }
StatsAPI provides connection to VPP stats API.
type UnknownMsgError ¶ added in v0.3.7
UnknownMsgError is the error type usually returned by GetMsgID method of VppAPI. It describes the name and CRC for the unknown message.
func (*UnknownMsgError) Error ¶ added in v0.3.7
func (u *UnknownMsgError) Error() string
type VPCCombinedCounterStats ¶ added in v0.3.7
type VPCCombinedCounterStats [][]CombinedCounterVNI
VPCCombinedCounterStats is similar to CombinedCounterStats,Only one more vni element
func (VPCCombinedCounterStats) IsZero ¶ added in v0.3.7
func (s VPCCombinedCounterStats) IsZero() bool
type VppAPI ¶
type VppAPI interface { // Connect connects the process to VPP. Connect() error // Disconnect disconnects the process from VPP. Disconnect() error // GetMsgID returns a runtime message ID for the given message name and CRC. GetMsgID(msgName string, msgCrc string) (msgID uint16, err error) // SendMsg sends a binary-encoded message to VPP. SendMsg(context uint32, data []byte) error // SetMsgCallback sets a callback function that will be called by the adapter whenever a message comes from VPP. SetMsgCallback(cb MsgCallback) // WaitReady waits until adapter is ready. WaitReady() error }
VppAPI provides connection to VPP binary API. It is responsible for sending and receiving of binary-encoded messages to/from VPP.
Directories ¶
Path | Synopsis |
---|---|
Package mock is an alternative VPP adapter aimed for unit/integration testing where the actual communication with VPP is not demanded.
|
Package mock is an alternative VPP adapter aimed for unit/integration testing where the actual communication with VPP is not demanded. |
binapi
Package binapi is a helper package for generic handling of VPP binary API messages in the mock adapter and integration tests.
|
Package binapi is a helper package for generic handling of VPP binary API messages in the mock adapter and integration tests. |
Package socketclient is a pure Go implementation of adapter.VppAPI, which uses unix domain sockets as the transport for connecting to the VPP binary API.
|
Package socketclient is a pure Go implementation of adapter.VppAPI, which uses unix domain sockets as the transport for connecting to the VPP binary API. |
Package statsclient is pure Go implementation of VPP stats API client.
|
Package statsclient is pure Go implementation of VPP stats API client. |
Package vppapiclient is the default VPP adapter being used for the connection to VPP binary & stats API via shared memory.
|
Package vppapiclient is the default VPP adapter being used for the connection to VPP binary & stats API via shared memory. |