aboutsummaryrefslogtreecommitdiffstats
path: root/docs/interfacing
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2023-03-15 21:54:53 +0100
committerDave Wallace <dwallacelf@gmail.com>2023-03-28 13:04:41 +0000
commit7c11156752abc32d3c1e7be4517a06aa7716d8d1 (patch)
treefb2a4064a64c4b1a96d35baca481434172482ce7 /docs/interfacing
parent4172448954d7787f511c91eecfb48897e946ed0b (diff)
docs: Update info about GoVPP
Type: docs Signed-off-by: Ondrej Fabry <ofabry@cisco.com> Change-Id: I1e28c6858a986d6ede1c7a6d06055400fdc0196b
Diffstat (limited to 'docs/interfacing')
-rw-r--r--docs/interfacing/go/index.rst15
1 files changed, 8 insertions, 7 deletions
diff --git a/docs/interfacing/go/index.rst b/docs/interfacing/go/index.rst
index 6675853dda8..c40627a4d56 100644
--- a/docs/interfacing/go/index.rst
+++ b/docs/interfacing/go/index.rst
@@ -4,7 +4,7 @@
Go api (govpp)
==============
-If you are writing a Control plane in GO that interfaces with VPP, `GoVPP <https://github.com/FDio/govpp>`__ is the library that will allow you to connect to VPP, and program it through its binary API socket.
+If you are writing a Go application that needs to control and manage VPP, the `GoVPP <https://github.com/FDio/govpp>`__ is a toolset providing a client library that will allow you to connect to VPP and interact with VPP binary API, Stats API and more.
Components involved
===================
@@ -37,6 +37,7 @@ Generating the API bindings from the VPP source
.. note::
+
The two options are similar but specify two different things. The output-dir option sets the directory where the generated bindings will be stored. The import prefix sets the go package name to be used in the generated bindings, this will be the string to be used in your ``import ( "" )`` in go. Both can or can not match depending on your ``go.mod``.
@@ -52,11 +53,11 @@ Generating the API bindings from the VPP package
# First install the binary API generator
# It will be installed to $GOPATH/bin/binapi-generator
# or $HOME/go/bin/binapi-generator
- go install git.fd.io/govpp.git/cmd/binapi-generator@latest
+ go install go.fd.io/govpp/cmd/binapi-generator@latest
# Run the binapi-generator
$GOPATH/bin/binapi-generator \
- --input-dir=/usr/share/vpp/api/ \
+ --input=/usr/share/vpp/api/ \
--output-dir=$HOME/myproject/vppbinapi \
--import-prefix=mygit.com/myproject/vppbinapi
@@ -94,7 +95,7 @@ Once you have your go bindings in ``$HOME/myproject/vppbinapi``, you can start b
cd "$HOME/myproject"
go mod init mygit.com/myproject
- go get git.fd.io/govpp.git@latest
+ go get go.fd.io/govpp@latest
* Create ``main.go`` in ``$HOME/myproject`` like below :
@@ -106,15 +107,15 @@ Once you have your go bindings in ``$HOME/myproject/vppbinapi``, you can start b
"os"
"fmt"
- "git.fd.io/govpp.git"
- "git.fd.io/govpp.git/api"
+ "go.fd.io/govpp"
+ "go.fd.io/govpp/api"
"mygit.com/myproject/vppbinapi/af_packet"
interfaces "mygit.com/myproject/vppbinapi/interface"
"mygit.com/myproject/vppbinapi/interface_types"
)
- func CreateHostInterface (ch api.Channel, ifName string) (uint32, error) {
+ func CreateHostInterface(ch api.Channel, ifName string) (uint32, error) {
response := &af_packet.AfPacketCreateReply{}
request := &af_packet.AfPacketCreate{HostIfName: ifName}
err := ch.SendRequest(request).ReceiveReply(response)