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) (*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 SetAdapter ¶
func SetAdapter(ad adapter.VppAdapter)
SetAdapter 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. |
vppapiclient
Package vppapiclient is the default VPP adapter being used for the connection with VPP via shared memory.
|
Package vppapiclient is the default VPP adapter being used for the connection with VPP 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
|
|
bin_api/acl
Package acl is a generated from VPP binary API module 'acl'.
|
Package acl is a generated from VPP binary API module 'acl'. |
bin_api/af_packet
Package af_packet is a generated from VPP binary API module 'af_packet'.
|
Package af_packet is a generated from VPP binary API module 'af_packet'. |
bin_api/interfaces
Package interfaces is a generated from VPP binary API module 'interface'.
|
Package interfaces is a generated from VPP binary API module 'interface'. |
bin_api/ip
Package ip is a generated from VPP binary API module 'ip'.
|
Package ip is a generated from VPP binary API module 'ip'. |
bin_api/memif
Package memif is a generated from VPP binary API module 'memif'.
|
Package memif is a generated from VPP binary API module 'memif'. |
bin_api/stats
Package stats is a generated from VPP binary API module 'stats'.
|
Package stats is a generated from VPP binary API module 'stats'. |
bin_api/tap
Package tap is a generated from VPP binary API module 'tap'.
|
Package tap is a generated from VPP binary API module 'tap'. |
bin_api/vpe
Package vpe is a generated from VPP binary API module 'vpe'.
|
Package vpe is a generated from VPP binary API module 'vpe'. |
cmd/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. |
cmd/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. |
cmd/stats-client
Binary stats-client is an example VPP management application that exercises the govpp API for interface counters together with asynchronous connection to VPP.
|
Binary stats-client is an example VPP management application that exercises the govpp API for interface counters together with asynchronous connection to VPP. |
cmd/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. |