diff options
Diffstat (limited to 'docs/interfacing')
-rw-r--r-- | docs/interfacing/binapi/index.rst | 12 | ||||
l--------- | docs/interfacing/binapi/vpp_api_language.rst | 1 | ||||
l--------- | docs/interfacing/binapi/vpp_api_module.rst | 1 | ||||
l--------- | docs/interfacing/binapi/writing_api_handlers.rst | 1 | ||||
-rw-r--r-- | docs/interfacing/go/add_plugin_goapi.rst | 83 | ||||
-rw-r--r-- | docs/interfacing/go/index.rst | 10 | ||||
l--------- | docs/interfacing/libmemif/buildinstructions_doc.rst | 1 | ||||
l--------- | docs/interfacing/libmemif/example_setup_doc.rst | 1 | ||||
l--------- | docs/interfacing/libmemif/examples_doc.rst | 1 | ||||
l--------- | docs/interfacing/libmemif/gettingstarted_doc.rst | 1 | ||||
-rw-r--r-- | docs/interfacing/libmemif/index.rst | 24 | ||||
l--------- | docs/interfacing/libmemif/libmemif_doc.rst | 1 | ||||
-rw-r--r-- | docs/interfacing/rust/index.rst | 8 |
13 files changed, 145 insertions, 0 deletions
diff --git a/docs/interfacing/binapi/index.rst b/docs/interfacing/binapi/index.rst new file mode 100644 index 00000000000..500c16df74c --- /dev/null +++ b/docs/interfacing/binapi/index.rst @@ -0,0 +1,12 @@ +.. _vpp_binapi: + +============== +The binary API +============== + +.. toctree:: + :maxdepth: 2 + + vpp_api_module + vpp_api_language + writing_api_handlers diff --git a/docs/interfacing/binapi/vpp_api_language.rst b/docs/interfacing/binapi/vpp_api_language.rst new file mode 120000 index 00000000000..16a078857b9 --- /dev/null +++ b/docs/interfacing/binapi/vpp_api_language.rst @@ -0,0 +1 @@ +../../../src/tools/vppapigen/VPPAPI.rst
\ No newline at end of file diff --git a/docs/interfacing/binapi/vpp_api_module.rst b/docs/interfacing/binapi/vpp_api_module.rst new file mode 120000 index 00000000000..d412ef63bb4 --- /dev/null +++ b/docs/interfacing/binapi/vpp_api_module.rst @@ -0,0 +1 @@ +../../../src/vpp-api/vapi/vapi_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/binapi/writing_api_handlers.rst b/docs/interfacing/binapi/writing_api_handlers.rst new file mode 120000 index 00000000000..6c58111c60e --- /dev/null +++ b/docs/interfacing/binapi/writing_api_handlers.rst @@ -0,0 +1 @@ +../../../src/vlibapi/api_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/go/add_plugin_goapi.rst b/docs/interfacing/go/add_plugin_goapi.rst new file mode 100644 index 00000000000..dce35b8f0a2 --- /dev/null +++ b/docs/interfacing/go/add_plugin_goapi.rst @@ -0,0 +1,83 @@ +.. _add_plugin_goapi: + +Add a plugin's GO API +===================== + +In order to use your plugin's API with GO, you will need to use +a GO client and GO definitions of the API messages that you defined +in ``myplugin.api`` (go bindings). + +These two things can be found in `govpp <https://github.com/FDio/govpp>`_ + +* The API client lives in `./core` +* The api-generator lives in `./binapigen` +* A sample of its output (the go bindings) for VPP's latest version lives in `./binapi` + +To generate the go bindings for your plugin. Assuming : +* ``/home/vpp`` is a VPP clone with your plugin in it. +* ``/home/controlplane`` is a go controlplane repo + +.. code-block:: console + + $ mkdir /home/controlplane/vpp-go-bindings + $ git clone https://github.com/FDio/govpp> + $ cd govpp + $ BINAPI_DIR=/home/controlplane/vpp-go-bindings VPP_DIR=/home/vpp make gen-binapi-from-code + +This will generate the go-bindings in ``/home/controlplane/vpp-go-bindings`` +For example ``vpp-go-bindings/myplugin/myplugin.ba.go`` will contain : + +.. code-block:: go + + // MypluginEnableDisable defines message 'myplugin_enable_disable'. + type MypluginEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + } + + +You can then use the generated go bindings in your go code like this : + +.. code-block:: go + + package main + + import ( + "fmt" + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/binapi/interfaces" + "git.fd.io/govpp.git/binapi/vpe" + + "myplugin.io/controlplane/vpp-go-bindings/myplugin/myplugin" + ) + + func main() { + // Connect to VPP + conn, _ := govpp.Connect("/run/vpp/api.sock") + defer conn.Disconnect() + + // Open channel + ch, _ := conn.NewAPIChannel() + defer ch.Close() + + request := &vpe.MypluginEnableDisable{ + EnableDisable: true, + } + reply := &vpe.MypluginEnableDisableReply{} + + err := ch.SendRequest(request).ReceiveReply(reply) + if err != nil { + fmt.Errorf("SendRequest: %w\n", err) + } + } + +As you will need to import (or ``go get "git.fd.io/govpp.git"``) to leverage the API +client in your code, you might want to use the api-generator directly from the +clone ``go build`` fetches for you. You can do this with : + +.. code-block:: console + + $ export GOVPP_DIR=$(go list -f '{{.Dir}}' -m git.fd.io/govpp.git) + $ cd $GOVPP_DIR && go build -o /some/bin/dir ./cmd/binapi-generator + $ # instead of make gen-binapi-from-code you can rewrite the code to target + $ # your version ./binapi-generator diff --git a/docs/interfacing/go/index.rst b/docs/interfacing/go/index.rst new file mode 100644 index 00000000000..68c01e086b0 --- /dev/null +++ b/docs/interfacing/go/index.rst @@ -0,0 +1,10 @@ +.. _govpp: + +============== +Go api (govpp) +============== + +.. toctree:: + :maxdepth: 2 + + add_plugin_goapi diff --git a/docs/interfacing/libmemif/buildinstructions_doc.rst b/docs/interfacing/libmemif/buildinstructions_doc.rst new file mode 120000 index 00000000000..9a5cf40f593 --- /dev/null +++ b/docs/interfacing/libmemif/buildinstructions_doc.rst @@ -0,0 +1 @@ +../../../extras/libmemif/docs/buildinstructions_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/libmemif/example_setup_doc.rst b/docs/interfacing/libmemif/example_setup_doc.rst new file mode 120000 index 00000000000..79e7dcfd672 --- /dev/null +++ b/docs/interfacing/libmemif/example_setup_doc.rst @@ -0,0 +1 @@ +../../../extras/libmemif/examples/example_setup_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/libmemif/examples_doc.rst b/docs/interfacing/libmemif/examples_doc.rst new file mode 120000 index 00000000000..0f93bab5e58 --- /dev/null +++ b/docs/interfacing/libmemif/examples_doc.rst @@ -0,0 +1 @@ +../../../extras/libmemif/examples/examples_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/libmemif/gettingstarted_doc.rst b/docs/interfacing/libmemif/gettingstarted_doc.rst new file mode 120000 index 00000000000..f9f20f6c31a --- /dev/null +++ b/docs/interfacing/libmemif/gettingstarted_doc.rst @@ -0,0 +1 @@ +../../../extras/libmemif/docs/gettingstarted_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/libmemif/index.rst b/docs/interfacing/libmemif/index.rst new file mode 100644 index 00000000000..4d4b24f36ce --- /dev/null +++ b/docs/interfacing/libmemif/index.rst @@ -0,0 +1,24 @@ +.. _libmemif_index: + +Memif library (libmemif) +======================== + +Shared memory packet interface (memif) provides high performance packet +transmit and receive between user application and Vector Packet +Processing (VPP) or multiple user applications. Using libmemif, user +application can create shared memory interface in master or slave mode +and connect to VPP or another application using libmemif. Once the +connection is established, user application can receive or transmit +packets using libmemif API. + +.. figure:: /_images/libmemif_architecture.png + :alt: Architecture + +.. toctree:: + :maxdepth: 2 + + libmemif_doc + buildinstructions_doc + example_setup_doc + examples_doc + gettingstarted_doc diff --git a/docs/interfacing/libmemif/libmemif_doc.rst b/docs/interfacing/libmemif/libmemif_doc.rst new file mode 120000 index 00000000000..394e83cd4e0 --- /dev/null +++ b/docs/interfacing/libmemif/libmemif_doc.rst @@ -0,0 +1 @@ +../../../extras/libmemif/libmemif_doc.rst
\ No newline at end of file diff --git a/docs/interfacing/rust/index.rst b/docs/interfacing/rust/index.rst new file mode 100644 index 00000000000..31b6931ab86 --- /dev/null +++ b/docs/interfacing/rust/index.rst @@ -0,0 +1,8 @@ +.. _rustvpp: + +=============== +Rust api client +=============== + +The VPP Rust API client is in alpha stage +You can read more in `this blog post <https://dev.to/felixfaisal/rust-vpp-api-bindings-lfx-mentorship-project-2g8p>`_ |