GoVPP
The GoVPP repository contains Go client libraries, code bindings generator and other toolings for VPP.
Here is a brief summary of features provided by GoVPP:
- Generator of Go bindings for VPP API
- Go client library for VPP binary API & Stats API
- Extendable code generator supporting custom plugins
- Pure Go implementation of VPP binary API protocol
- Efficient reader of VPP Stats data from shared memory
- Simple client API that does not rely on VPP API semantics
- Generated RPC client code that handles all boilerplate
- ..and much more!
Quick Start
Here is a code sample of an effortless way for calling the VPP API by using a generated RPC client.
// Connect to VPP API socket
conn, err := govpp.Connect("/run/vpp/api.sock")
if err != nil {
// handle err
}
defer conn.Disconnect()
// Initialize VPP API service client
client := vpe.NewServiceClient(conn)
// Call VPP API service method
reply, err := client.ShowVersion(context.Background(), &vpe.ShowVersion{})
if err != nil {
// handle err
}
log.Print("Version: ", reply.Version)
See complete example in examples/rpc-service.
Examples
For all code examples demonstrating GoVPP features, please refer to the examples directory.
Documentation
Refer to User Guide document for all the basics. If you run into issues or just need help debugging read our Troubleshooting document.
Go reference is available at https://pkg.go.dev/go.fd.io/govpp. More documentation can be found under docs directory.
How to contribute?
- Contribute code by submitting a Pull Request.
- Report bugs by opening an Issue.
- Ask questions & open discussions by starting a Discussion.
Repository Structure
Here is a brief overview of the repository structure.
- govpp - the entry point for the GoVPP client
- adapter - VPP binary & stats API interface
- mock - Mock adapter used for testing
- socketclient - Go implementation of VPP API client for unix socket
- statsclient - Go implementation of VPP Stats client for shared memory
- api - GoVPP client API
- binapi - generated Go bindings for the latest VPP release
- binapigen - library for generating code from VPP API
- vppapi - VPP API parser
- cmd
- binapi-generator - VPP binary API generator
- vpp-proxy - VPP proxy for remote access
- codec - handles encoding/decoding of generated messages into binary form
- core - implementation of the GoVPP client
- docs - user & developer documentation
- examples - examples demonstrating GoVPP functionality
- proxy - contains client/server implementation for proxy
- test - integration tests, benchmarks and performance tests
- adapter - VPP binary & stats API interface