Documentation ¶
Overview ¶
Package govpp provides the entry point to govpp functionality. It provides the API for connecting the govpp core to VPP either using the default VPP adapter, or using the adapter previously set by SetAdapter function (useful mostly just for unit/integration tests with mocked VPP adapter).
To create a connection to VPP, use govpp.Connect function:
conn, err := govpp.Connect() if err != nil { // handle error! } defer conn.Disconnect()
Make sure you close the connection after using it. If the connection is not closed, it will leak resources. Please note that only one VPP connection is allowed for a single process.
In case you need to mock the connection to VPP (e.g. for testing), use the govpp.SetAdapter function before calling govpp.Connect.
Once connected to VPP, use the functions from the api package to communicate with it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncConnect ¶
func AsyncConnect(shm string, attempts int, interval time.Duration) (*core.Connection, chan core.ConnectionEvent, error)
AsyncConnect asynchronously connects the govpp core to VPP either using the default VPP Adapter, or using the adapter previously set by SetAdapter. This call does not block until connection is established, it returns immediately. The caller is supposed to watch the returned ConnectionState channel for Connected/Disconnected events. In case of disconnect, the library will asynchronously try to reconnect.
func Connect ¶
func Connect(shm string) (*core.Connection, error)
Connect connects the govpp core to VPP either using the default VPP Adapter, or using the adapter previously set by SetAdapter (useful mostly just for unit/integration tests with mocked VPP adapter). This call blocks until VPP is connected, or an error occurs. Only one connection attempt will be performed.
func SetVppAdapter ¶
SetVppAdapter sets the adapter that will be used for connections to VPP in the subsequent `Connect` calls.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package adapter provides an interface between govpp core and the VPP.
|
Package adapter provides an interface between govpp core and the VPP. |
mock
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. |
mock/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. |
socketclient
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. |
statsclient
Package statsclient is pure Go implementation of VPP stats API client.
|
Package statsclient is pure Go implementation of VPP stats API client. |
vppapiclient
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. |
Package api defines interfaces required by every file generated with binapi-generator
|
Package api defines interfaces required by every file generated with binapi-generator |
cmd
|
|
binapi-generator
Generator of Go structs out of the VPP binary API definitions in JSON format.
|
Generator of Go structs out of the VPP binary API definitions in JSON format. |
Package codec provides methods allowing to encode and decode message structs to/from binary format accepted by VPP.
|
Package codec provides methods allowing to encode and decode message structs to/from binary format accepted by VPP. |
Package core provides connectivity to VPP via the adapter: sends and receives the messages to/from VPP, marshalls/unmarshalls them and forwards them between the client Go channels and the VPP.
|
Package core provides connectivity to VPP via the adapter: sends and receives the messages to/from VPP, marshalls/unmarshalls them and forwards them between the client Go channels and the VPP. |
examples
|
|
binapi/acl
Package acl is a generated VPP binary API for 'acl' module.
|
Package acl is a generated VPP binary API for 'acl' module. |
binapi/af_packet
Package af_packet is a generated VPP binary API for 'af_packet' module.
|
Package af_packet is a generated VPP binary API for 'af_packet' module. |
binapi/interfaces
Package interfaces is a generated VPP binary API for 'interface' module.
|
Package interfaces is a generated VPP binary API for 'interface' module. |
binapi/ip
Package ip is a generated VPP binary API for 'ip' module.
|
Package ip is a generated VPP binary API for 'ip' module. |
binapi/memclnt
Package memclnt is a generated VPP binary API for 'memclnt' module.
|
Package memclnt is a generated VPP binary API for 'memclnt' module. |
binapi/memif
Package memif is a generated VPP binary API for 'memif' module.
|
Package memif is a generated VPP binary API for 'memif' module. |
binapi/vpe
Package vpe is a generated VPP binary API for 'vpe' module.
|
Package vpe is a generated VPP binary API for 'vpe' module. |
perf-bench
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
|
Binary simple-client is an example VPP management application that exercises the govpp API on real-world use-cases. |
rpc-service
service-client is an example VPP management application that exercises the govpp API using generated service client.
|
service-client is an example VPP management application that exercises the govpp API using generated service client. |
simple-client
simple-client is an example VPP management application that exercises the govpp API on real-world use-cases.
|
simple-client is an example VPP management application that exercises the govpp API on real-world use-cases. |
union-example
union-example is an example to show how to use unions in VPP binary API.
|
union-example is an example to show how to use unions in VPP binary API. |
extras
|
|
libmemif
Package libmemif is a Golang adapter for the libmemif library (extras/libmemif in the VPP repository).
|
Package libmemif is a Golang adapter for the libmemif library (extras/libmemif in the VPP repository). |
libmemif/examples/gopacket
gopacket is a simple example showing how to answer APR and ICMP echo requests through a memif interface.
|
gopacket is a simple example showing how to answer APR and ICMP echo requests through a memif interface. |
libmemif/examples/icmp-responder
icmp-responder is a simple example showing how to answer APR and ICMP echo requests through a memif interface.
|
icmp-responder is a simple example showing how to answer APR and ICMP echo requests through a memif interface. |
libmemif/examples/jumbo-frames
jumbo-frames is simple example how to send larger and larger jumbo packets with libmemif adapter.
|
jumbo-frames is simple example how to send larger and larger jumbo packets with libmemif adapter. |
libmemif/examples/raw-data
raw-data is a basic example showing how to create a memif interface, handle events through callbacks and perform Rx/Tx of raw data.
|
raw-data is a basic example showing how to create a memif interface, handle events through callbacks and perform Rx/Tx of raw data. |