api

package
v0.0.0-...-fb2e7cc Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error = NodeCounter

type HandlerAPI

type HandlerAPI interface {
	// RunCli sends CLI command to VPP
	RunCli(ctx context.Context, cmd string) (string, error)

	// DumpInterfaces retrieves VPP interface data and returns them as
	// a northbound interface data
	DumpInterfaces(ctx context.Context) (map[uint32]*InterfaceDetails, error)

	// DumpInterfaceStats retrieves interface statistics
	DumpInterfaceStats(context.Context) (*govppapi.InterfaceStats, error)

	// DumpNodeCounters retrieves information about VPP node counters
	DumpNodeCounters(context.Context) (*NodeCounterInfo, error)

	// DumpRuntimeInfo retrieves node's runtime info
	DumpRuntimeInfo(context.Context) (*RuntimeInfo, error)

	// DumpPlugins retrieves info about loaded VPP plugins.
	DumpPlugins(context.Context) ([]PluginInfo, error)

	// DumpVersion retrieves info about VPP version.
	DumpVersion(context.Context) (*VersionInfo, error)

	// DumpSession retrieves info about active session
	DumpSession(context.Context) (*SessionInfo, error)

	// DumpThreads retrieves info about VPP threads
	DumpThreads(context.Context) ([]ThreadData, error)

	// Close the handler gracefully
	Close()
}

HandlerAPI uses appropriate underlying implementation (either local or via Ligato agent) to obtain all stats required to be displayed by the VPPTop. It effectively replaces specific plugin-based handlers (interface, telemetry... )

type HandlerDef

type HandlerDef interface {
	IsHandlerCompatible(c *VppClient, isRemote bool) (HandlerAPI, string, error)
}

HandlerDef is a handler definition - it verifies whether the definition is compatible with connected VPP version. If so, the binapi version together with the handler is returned. Remote handler in addition also registers VPP API message type records.

type Interface

type Interface struct {
	govppapi.InterfaceCounters
	IPAddresses []string
	State       string
	MTU         []uint32
}

Interface contains interface data mandatory for the VPPTop including interface counters

type InterfaceDetails

type InterfaceDetails struct {
	Name         string
	InternalName string
	SwIfIndex    uint32
	IsEnabled    bool
	IPAddresses  []string
	MTU          []uint32
}

InterfaceDetails contains data about retrieved interface

type Node

type Node = RuntimeItem

type NodeCounter

type NodeCounter struct {
	Count    uint64 `json:"count"`
	Node     string `json:"node"`
	Reason   string `json:"reason"`
	Severity string `json:"severity"`
}

NodeCounter (Error) is a single node counter entry type

type NodeCounterInfo

type NodeCounterInfo struct {
	Counters []NodeCounter
}

NodeCounterInfo contains telemetry data about VPP node counters

type PluginInfo

type PluginInfo struct {
	Name        string
	Path        string
	Version     string
	Description string
}

PluginInfo represents a single VPP plugin

type RuntimeInfo

type RuntimeInfo struct {
	Threads []RuntimeThread
}

RuntimeInfo contains telemetry data about VPP runtime

type RuntimeItem

type RuntimeItem struct {
	Index          uint    `json:"index"`
	Name           string  `json:"name"`
	State          string  `json:"state"`
	Calls          uint64  `json:"calls"`
	Vectors        uint64  `json:"vectors"`
	Suspends       uint64  `json:"suspends"`
	Clocks         float64 `json:"clocks"`
	VectorsPerCall float64 `json:"vectors_per_call"`
}

RuntimeItem (Node) represents a single node in thread

type RuntimeThread

type RuntimeThread struct {
	ID                  uint          `json:"id"`
	Name                string        `json:"name"`
	Time                float64       `json:"time"`
	AvgVectorsPerNode   float64       `json:"avg_vectors_per_node"`
	LastMainLoops       uint64        `json:"last_main_loops"`
	VectorsPerMainLoop  float64       `json:"vectors_per_main_loop"`
	VectorLengthPerNode float64       `json:"vector_length_per_node"`
	VectorRatesIn       float64       `json:"vector_rates_in"`
	VectorRatesOut      float64       `json:"vector_rates_out"`
	VectorRatesDrop     float64       `json:"vector_rates_drop"`
	VectorRatesPunt     float64       `json:"vector_rates_punt"`
	Items               []RuntimeItem `json:"items"`
}

RuntimeThread is a set of thread-related data with Nodes

type SessionInfo

type SessionInfo struct {
	PID       uint32
	ClientIdx uint32
	Uptime    float64
}

SessionInfo contains data about VPP session

type ThreadData

type ThreadData struct {
	ID        uint32
	Name      string
	Type      string
	PID       uint32
	CPUID     uint32
	Core      uint32
	CPUSocket uint32
}

ThreadData wraps all thread data counters.

type VPPInfo

type VPPInfo struct {
	Connected   bool
	VersionInfo VersionInfo
	SessionInfo SessionInfo
	Plugins     []PluginInfo
	Version     string
}

VPPInfo basic information about the connected VPP

type VersionInfo

type VersionInfo struct {
	Program        string
	Version        string
	BuildDate      string
	BuildDirectory string
}

VersionInfo is a VPP version

type VppClient

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

VppClient implements VPP-Agent client interface

func NewProxyClient

func NewProxyClient(client *proxy.Client, statsConn govppapi.StatsProvider) *VppClient

NewProxyClient returns VPP client which is connected to the VPP dialing remote proxy server

func NewVppClient

func NewVppClient(vppConn *core.Connection, statsConn govppapi.StatsProvider) *VppClient

NewVppClient returns VPP client connected to the VPP via the shared memory

func (*VppClient) BinapiVersion

func (c *VppClient) BinapiVersion() vpp.Version

func (*VppClient) CheckCompatiblity

func (c *VppClient) CheckCompatiblity(msgs ...govppapi.Message) error

func (*VppClient) Close

func (c *VppClient) Close()

func (*VppClient) Connection

func (c *VppClient) Connection() govppapi.Connection

func (*VppClient) Disconnect

func (c *VppClient) Disconnect()

Disconnect from the VPP

func (VppClient) Invoke

func (c VppClient) Invoke(ctx context.Context, req govppapi.Message, reply govppapi.Message) error

func (*VppClient) IsPluginLoaded

func (c *VppClient) IsPluginLoaded(plugin string) bool

func (VppClient) NewAPIChannel

func (c VppClient) NewAPIChannel() (govppapi.Channel, error)

func (VppClient) NewStream

func (c VppClient) NewStream(ctx context.Context, options ...govppapi.StreamOption) (govppapi.Stream, error)

func (*VppClient) OnReconnect

func (c *VppClient) OnReconnect(_ func())

func (*VppClient) SetInfo

func (c *VppClient) SetInfo(vppInfo VPPInfo)

SetInfo about the connected VPP

func (*VppClient) Stats

func (c *VppClient) Stats() govppapi.StatsProvider

type VppProviderAPI

type VppProviderAPI interface {
	// Connect to the VPP either using provided socket, or remotely
	// with help of remote Address
	Connect(soc string) error
	ConnectRemote(rAddr string) error

	// Disconnect from the VPP
	Disconnect()

	// GetInfo returns text representation of the overall connection state of both
	// providers (vpp, stats) including string containing the version and the build date
	GetState() (core.ConnectionState, string)

	// Get various VPP data (interfaces, nodes...)
	GetInterfaces(ctx context.Context) ([]Interface, error)
	GetNodes(ctx context.Context) ([]Node, error)
	GetErrors(ctx context.Context) ([]Error, error)
	GetMemory(ctx context.Context) ([]string, error)
	GetThreads(ctx context.Context) ([]ThreadData, error)

	// Clear VPP counters
	ClearInterfaceCounters(ctx context.Context) error
	ClearRuntimeCounters(ctx context.Context) error
	ClearErrorCounters(ctx context.Context) error
}

VppProviderAPI uses VPPTop app to manage VPP connection and retrieve various VPP data and statistics in proper format. VppProvider retrieves data via respective handler

Jump to

Keyboard shortcuts

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