api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package api defines interfaces required by every file generated with binapi-generator

Index

Constants

View Source
const (
	UNSPECIFIED                        = -1
	INVALID_SW_IF_INDEX                = -2
	NO_SUCH_FIB                        = -3
	NO_SUCH_INNER_FIB                  = -4
	NO_SUCH_LABEL                      = -5
	NO_SUCH_ENTRY                      = -6
	INVALID_VALUE                      = -7
	INVALID_VALUE_2                    = -8
	UNIMPLEMENTED                      = -9
	INVALID_SW_IF_INDEX_2              = -10
	SYSCALL_ERROR_1                    = -11
	SYSCALL_ERROR_2                    = -12
	SYSCALL_ERROR_3                    = -13
	SYSCALL_ERROR_4                    = -14
	SYSCALL_ERROR_5                    = -15
	SYSCALL_ERROR_6                    = -16
	SYSCALL_ERROR_7                    = -17
	SYSCALL_ERROR_8                    = -18
	SYSCALL_ERROR_9                    = -19
	SYSCALL_ERROR_10                   = -20
	FEATURE_DISABLED                   = -30
	INVALID_REGISTRATION               = -31
	NEXT_HOP_NOT_IN_FIB                = -50
	UNKNOWN_DESTINATION                = -51
	PREFIX_MATCHES_NEXT_HOP            = -52
	NEXT_HOP_NOT_FOUND_MP              = -53
	NO_MATCHING_INTERFACE              = -54
	INVALID_VLAN                       = -55
	VLAN_ALREADY_EXISTS                = -56
	INVALID_SRC_ADDRESS                = -57
	INVALID_DST_ADDRESS                = -58
	ADDRESS_LENGTH_MISMATCH            = -59
	ADDRESS_NOT_FOUND_FOR_INTERFACE    = -60
	ADDRESS_NOT_DELETABLE              = -61
	IP6_NOT_ENABLED                    = -62
	IN_PROGRESS                        = 10
	NO_SUCH_NODE                       = -63
	NO_SUCH_NODE2                      = -64
	NO_SUCH_TABLE                      = -65
	NO_SUCH_TABLE2                     = -66
	NO_SUCH_TABLE3                     = -67
	SUBIF_ALREADY_EXISTS               = -68
	SUBIF_CREATE_FAILED                = -69
	INVALID_MEMORY_SIZE                = -70
	INVALID_INTERFACE                  = -71
	INVALID_VLAN_TAG_COUNT             = -72
	INVALID_ARGUMENT                   = -73
	UNEXPECTED_INTF_STATE              = -74
	TUNNEL_EXIST                       = -75
	INVALID_DECAP_NEXT                 = -76
	RESPONSE_NOT_READY                 = -77
	NOT_CONNECTED                      = -78
	IF_ALREADY_EXISTS                  = -79
	BOND_SLAVE_NOT_ALLOWED             = -80
	VALUE_EXIST                        = -81
	SAME_SRC_DST                       = -82
	IP6_MULTICAST_ADDRESS_NOT_PRESENT  = -83
	SR_POLICY_NAME_NOT_PRESENT         = -84
	NOT_RUNNING_AS_ROOT                = -85
	ALREADY_CONNECTED                  = -86
	UNSUPPORTED_JNI_VERSION            = -87
	FAILED_TO_ATTACH_TO_JAVA_THREAD    = -88
	INVALID_WORKER                     = -89
	LISP_DISABLED                      = -90
	CLASSIFY_TABLE_NOT_FOUND           = -91
	INVALID_EID_TYPE                   = -92
	CANNOT_CREATE_PCAP_FILE            = -93
	INCORRECT_ADJACENCY_TYPE           = -94
	EXCEEDED_NUMBER_OF_RANGES_CAPACITY = -95
	EXCEEDED_NUMBER_OF_PORTS_CAPACITY  = -96
	INVALID_ADDRESS_FAMILY             = -97
	INVALID_SUB_SW_IF_INDEX            = -98
	TABLE_TOO_BIG                      = -99
	CANNOT_ENABLE_DISABLE_FEATURE      = -100
	BFD_EEXIST                         = -101
	BFD_ENOENT                         = -102
	BFD_EINUSE                         = -103
	BFD_NOTSUPP                        = -104
	ADDRESS_IN_USE                     = -105
	ADDRESS_NOT_IN_USE                 = -106
	QUEUE_FULL                         = -107
	APP_UNSUPPORTED_CFG                = -108
	URI_FIFO_CREATE_FAILED             = -109
	LISP_RLOC_LOCAL                    = -110
	BFD_EAGAIN                         = -111
	INVALID_GPE_MODE                   = -112
	LISP_GPE_ENTRIES_PRESENT           = -113
	ADDRESS_FOUND_FOR_INTERFACE        = -114
	SESSION_CONNECT                    = -115
	ENTRY_ALREADY_EXISTS               = -116
	SVM_SEGMENT_CREATE_FAIL            = -117
	APPLICATION_NOT_ATTACHED           = -118
	BD_ALREADY_EXISTS                  = -119
	BD_IN_USE                          = -120
	BD_NOT_MODIFIABLE                  = -121
	BD_ID_EXCEED_MAX                   = -122
	SUBIF_DOESNT_EXIST                 = -123
	L2_MACS_EVENT_CLINET_PRESENT       = -124
	INVALID_QUEUE                      = -125
	UNSUPPORTED                        = -126
	DUPLICATE_IF_ADDRESS               = -127
	APP_INVALID_NS                     = -128
	APP_WRONG_NS_SECRET                = -129
	APP_CONNECT_SCOPE                  = -130
	APP_ALREADY_ATTACHED               = -131
	SESSION_REDIRECT                   = -132
	ILLEGAL_NAME                       = -133
	NO_NAME_SERVERS                    = -134
	NAME_SERVER_NOT_FOUND              = -135
	NAME_RESOLUTION_NOT_ENABLED        = -136
	NAME_SERVER_FORMAT_ERROR           = -137
	NAME_SERVER_NO_SUCH_NAME           = -138
	NAME_SERVER_NO_ADDRESSES           = -139
	NAME_SERVER_NEXT_SERVER            = -140
	APP_CONNECT_FILTERED               = -141
	ACL_IN_USE_INBOUND                 = -142
	ACL_IN_USE_OUTBOUND                = -143
	INIT_FAILED                        = -144
	NETLINK_ERROR                      = -145
	BIER_BSL_UNSUP                     = -146
	INSTANCE_IN_USE                    = -147
	INVALID_SESSION_ID                 = -148
	ACL_IN_USE_BY_LOOKUP_CONTEXT       = -149
	INVALID_VALUE_3                    = -150
	NON_ETHERNET                       = -151
	BD_ALREADY_HAS_BVI                 = -152
)

definitions from: vpp/src/vnet/api_errno.h

View Source
const GoVppAPIPackageIsVersion1 = true

GoVppAPIPackageIsVersion1 is referenced from generated binapi files to assert that that code is compatible with this version of the GoVPP api package.

Variables

This section is empty.

Functions

func GetRegisteredMessages

func GetRegisteredMessages() map[string]Message

GetRegisteredMessages returns list of all registered messages.

func RegisterMessage

func RegisterMessage(x Message, name string)

RegisterMessage is called from generated code to register message.

func RetvalToVPPApiError

func RetvalToVPPApiError(retval int32) error

RetvalToVPPApiError returns error for retval value. Retval 0 returns nil error.

Types

type BufferPool

type BufferPool struct {
	PoolName  string
	Cached    float64
	Used      float64
	Available float64
}

BufferPool represents buffer pool.

type BufferStats

type BufferStats struct {
	Buffer map[string]BufferPool
}

BufferStats represents statistics per buffer pool.

type Channel

type Channel interface {
	// SendRequest asynchronously sends a request to VPP. Returns a request context, that can be used to call ReceiveReply.
	// In case of any errors by sending, the error will be delivered to ReplyChan (and returned by ReceiveReply).
	SendRequest(msg Message) RequestCtx

	// SendMultiRequest asynchronously sends a multipart request (request to which multiple responses are expected) to VPP.
	// Returns a multipart request context, that can be used to call ReceiveReply.
	// In case of any errors by sending, the error will be delivered to ReplyChan (and returned by ReceiveReply).
	SendMultiRequest(msg Message) MultiRequestCtx

	// SubscribeNotification subscribes for receiving of the specified notification messages via provided Go channel.
	// Note that the caller is responsible for creating the Go channel with preferred buffer size. If the channel's
	// buffer is full, the notifications will not be delivered into it.
	SubscribeNotification(notifChan chan Message, event Message) (SubscriptionCtx, error)

	// SetReplyTimeout sets the timeout for replies from VPP. It represents the maximum time the API waits for a reply
	// from VPP before returning an error.
	SetReplyTimeout(timeout time.Duration)

	// CheckCompatibility checks the compatiblity for the given messages.
	// It will return an error if any of the given messages are not compatible.
	CheckCompatiblity(msgs ...Message) error

	// Close closes the API channel and releases all API channel-related resources in the ChannelProvider.
	Close()
}

Channel provides methods for direct communication with VPP channel.

type ChannelProvider

type ChannelProvider interface {
	// NewAPIChannel returns a new channel for communication with VPP via govpp core.
	// It uses default buffer sizes for the request and reply Go channels.
	NewAPIChannel() (Channel, error)

	// NewAPIChannelBuffered returns a new channel for communication with VPP via govpp core.
	// It allows to specify custom buffer sizes for the request and reply Go channels.
	NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (Channel, error)
}

ChannelProvider provides the communication channel with govpp core.

type DataType

type DataType interface {
	// GetTypeName returns the original VPP name of the data type, as defined in the VPP API.
	GetTypeName() string
}

DataType is an interface that is implemented by all VPP Binary API data types by the binapi_generator.

type ErrorCounter

type ErrorCounter struct {
	CounterName string
	Value       uint64
}

ErrorCounter represents error counter.

type ErrorStats

type ErrorStats struct {
	Errors []ErrorCounter
}

ErrorStats represents statistics per error counter.

type InterfaceCounters

type InterfaceCounters struct {
	InterfaceIndex uint32
	InterfaceName  string // requires VPP 19.04+

	RxPackets uint64
	RxBytes   uint64
	RxErrors  uint64
	TxPackets uint64
	TxBytes   uint64
	TxErrors  uint64

	RxUnicast     [2]uint64 // packets[0], bytes[1]
	RxMulticast   [2]uint64 // packets[0], bytes[1]
	RxBroadcast   [2]uint64 // packets[0], bytes[1]
	TxUnicastMiss [2]uint64 // packets[0], bytes[1]
	TxMulticast   [2]uint64 // packets[0], bytes[1]
	TxBroadcast   [2]uint64 // packets[0], bytes[1]

	Drops   uint64
	Punts   uint64
	IP4     uint64
	IP6     uint64
	RxNoBuf uint64
	RxMiss  uint64
}

InterfaceCounters represents interface counters.

type InterfaceStats

type InterfaceStats struct {
	Interfaces []InterfaceCounters
}

InterfaceStats represents per interface statistics.

type Message

type Message interface {
	// GetMessageName returns the original VPP name of the message, as defined in the VPP API.
	GetMessageName() string

	// GetCrcString returns the string with CRC checksum of the message definition (the string represents a hexadecimal number).
	GetCrcString() string

	// GetMessageType returns the type of the VPP message.
	GetMessageType() MessageType
}

Message is an interface that is implemented by all VPP Binary API messages generated by the binapigenerator.

type MessageType

type MessageType int

MessageType represents the type of a VPP message. Note: this is currently derived from the message header (fields), and in many cases it does not represent the actual type of VPP message. This means that some replies can be identified as requests, etc. TODO: use services to identify type of message

const (
	// RequestMessage represents a VPP request message
	RequestMessage MessageType = iota
	// ReplyMessage represents a VPP reply message
	ReplyMessage
	// EventMessage represents a VPP event message
	EventMessage
	// OtherMessage represents other VPP message
	OtherMessage
)

type MultiRequestCtx

type MultiRequestCtx interface {
	// ReceiveReply receives a reply from VPP (blocks until a reply is delivered from VPP, or until an error occurs).
	// The reply will be decoded into the msg argument. If the last reply has been already consumed, lastReplyReceived is
	// set to true. Do not use the message itself if lastReplyReceived is true - it won't be filled with actual data.
	// Error will be returned if the response cannot be received or decoded.
	ReceiveReply(msg Message) (lastReplyReceived bool, err error)
}

MultiRequestCtx is helper interface which allows to receive reply on multi-request.

type NodeCounters

type NodeCounters struct {
	NodeIndex uint32
	NodeName  string // requires VPP 19.04+

	Clocks   uint64
	Vectors  uint64
	Calls    uint64
	Suspends uint64
}

NodeCounters represents node counters.

type NodeStats

type NodeStats struct {
	Nodes []NodeCounters
}

NodeStats represents per node statistics.

type RequestCtx

type RequestCtx interface {
	// ReceiveReply receives a reply from VPP (blocks until a reply is delivered from VPP, or until an error occurs).
	// The reply will be decoded into the msg argument. Error will be returned if the response cannot be received or decoded.
	ReceiveReply(msg Message) error
}

RequestCtx is helper interface which allows to receive reply on request.

type StatsProvider

type StatsProvider interface {
	GetSystemStats() (*SystemStats, error)
	GetNodeStats() (*NodeStats, error)
	GetInterfaceStats() (*InterfaceStats, error)
	GetErrorStats(names ...string) (*ErrorStats, error)
	GetBufferStats() (*BufferStats, error)
}

StatsProvider provides the methods for getting statistics.

type SubscriptionCtx

type SubscriptionCtx interface {
	// Unsubscribe unsubscribes from receiving the notifications tied to the subscription context.
	Unsubscribe() error
}

SubscriptionCtx is helper interface which allows to control subscription for notification events.

type SystemStats

type SystemStats struct {
	VectorRate     float64
	InputRate      float64
	LastUpdate     float64
	LastStatsClear float64
	Heartbeat      float64
}

SystemStats represents global system statistics.

type VPPApiError

type VPPApiError int32

VPPApiError represents VPP's vnet API error that is usually returned as Retval field in replies from VPP binary API.

func (VPPApiError) Error

func (e VPPApiError) Error() string

Jump to

Keyboard shortcuts

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