From 9ad39c026c8a3c945a7003c4aa4f5cb1d4c80160 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Thu, 19 Aug 2021 11:38:06 +0200 Subject: docs: better docs, mv doxygen to sphinx This patch refactors the VPP sphinx docs in order to make it easier to consume for external readers as well as VPP developers. It also makes sphinx the single source of documentation, which simplifies maintenance and operation. Most important updates are: - reformat the existing documentation as rst - split RELEASE.md and move it into separate rst files - remove section 'events' - remove section 'archive' - remove section 'related projects' - remove section 'feature by release' - remove section 'Various links' - make (Configuration reference, CLI docs, developer docs) top level items in the list - move 'Use Cases' as part of 'About VPP' - move 'Troubleshooting' as part of 'Getting Started' - move test framework docs into 'Developer Documentation' - add a 'Contributing' section for gerrit, docs and other contributer related infos - deprecate doxygen and test-docs targets - redirect the "make doxygen" target to "make docs" Type: refactor Change-Id: I552a5645d5b7964d547f99b1336e2ac24e7c209f Signed-off-by: Nathan Skrzypczak Signed-off-by: Andrew Yourtchenko --- docs/interfacing/binapi/index.rst | 12 ++++ docs/interfacing/binapi/vpp_api_language.rst | 1 + docs/interfacing/binapi/vpp_api_module.rst | 1 + docs/interfacing/binapi/writing_api_handlers.rst | 1 + docs/interfacing/go/add_plugin_goapi.rst | 83 ++++++++++++++++++++++ docs/interfacing/go/index.rst | 10 +++ .../interfacing/libmemif/buildinstructions_doc.rst | 1 + docs/interfacing/libmemif/example_setup_doc.rst | 1 + docs/interfacing/libmemif/examples_doc.rst | 1 + docs/interfacing/libmemif/gettingstarted_doc.rst | 1 + docs/interfacing/libmemif/index.rst | 24 +++++++ docs/interfacing/libmemif/libmemif_doc.rst | 1 + docs/interfacing/rust/index.rst | 8 +++ 13 files changed, 145 insertions(+) create mode 100644 docs/interfacing/binapi/index.rst create mode 120000 docs/interfacing/binapi/vpp_api_language.rst create mode 120000 docs/interfacing/binapi/vpp_api_module.rst create mode 120000 docs/interfacing/binapi/writing_api_handlers.rst create mode 100644 docs/interfacing/go/add_plugin_goapi.rst create mode 100644 docs/interfacing/go/index.rst create mode 120000 docs/interfacing/libmemif/buildinstructions_doc.rst create mode 120000 docs/interfacing/libmemif/example_setup_doc.rst create mode 120000 docs/interfacing/libmemif/examples_doc.rst create mode 120000 docs/interfacing/libmemif/gettingstarted_doc.rst create mode 100644 docs/interfacing/libmemif/index.rst create mode 120000 docs/interfacing/libmemif/libmemif_doc.rst create mode 100644 docs/interfacing/rust/index.rst (limited to 'docs/interfacing') 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 `_ + +* 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 `_ -- cgit 1.2.3-korg