aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples/sample-plugin/sample_plugin_doc.rst
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-10-08 14:05:58 +0200
committerDave Wallace <dwallacelf@gmail.com>2021-10-13 15:32:22 +0000
commita2c9509a4ab22380937a2b613fcc518da22f5166 (patch)
tree93e0629de82c99ca4b1f9802083cf9362f1dc325 /src/examples/sample-plugin/sample_plugin_doc.rst
parent8acc5ee9079d0b03229a72e72a5308e7de0a359a (diff)
docs: convert extras doc md->rst
Type: improvement Change-Id: Ie3b25a86b99098d2b3a21a11fc73234c8ed589d6 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/examples/sample-plugin/sample_plugin_doc.rst')
-rw-r--r--src/examples/sample-plugin/sample_plugin_doc.rst97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/examples/sample-plugin/sample_plugin_doc.rst b/src/examples/sample-plugin/sample_plugin_doc.rst
new file mode 100644
index 00000000000..23023e21bfb
--- /dev/null
+++ b/src/examples/sample-plugin/sample_plugin_doc.rst
@@ -0,0 +1,97 @@
+.. _sample_plugin_doc:
+
+Sample plugin for VPP
+=====================
+
+Overview
+--------
+
+This is the VPP sample plugin demonstrates how to create a new plugin
+that integrates with VPP. The sample code implements a trivial macswap
+algorithm that demonstrates plugin runtime integration with the VPP
+graph hierarchy, api and cli.
+
+For deeper dive information see the annotations in the sample code
+itself. See `sample.c <@ref%20sample.c>`__
+
+How to build and run the sample plugin.
+---------------------------------------
+
+Now (re)build VPP.
+
+::
+
+ $ make wipe
+
+Define environmental variable ‘SAMPLE_PLUGIN=yes’ with a process scope
+
+::
+
+ $ SAMPLE_PLUGIN=yes make build
+
+or a session scope, and build VPP.
+
+::
+
+ $ export SAMPLE_PLUGIN=yes
+ $ make build
+
+Now run VPP and make sure the plugin is loaded.
+
+::
+
+ $ make run
+ ...
+ load_one_plugin:184: Loaded plugin: memif_plugin.so (Packet Memory Interface (experimetal))
+ load_one_plugin:184: Loaded plugin: sample_plugin.so (Sample of VPP Plugin)
+ load_one_plugin:184: Loaded plugin: nat_plugin.so (Network Address Translation)
+ ...
+ DBGvpp#
+
+How to create a new plugin
+--------------------------
+
+To create a new plugin based on the sample plugin, copy and rename the
+sample plugin directory and automake config.
+
+::
+
+ cp -r src/examples/sample-plugin/sample src/plugins/newplugin
+ cp src/examples/sample-plugin/sample.am src/plugins/newplugin.am
+
+Add the following entry to the plugins section of ``src/configure.ac``.
+
+::
+
+ PLUGIN_ENABLED(newplugin)
+
+Add the following entry to the plugins section of
+``src/plugins/Makefile.am``
+
+::
+
+ if ENABLE_NEWPLUGIN
+ include newplugin.am
+ endif
+
+Now (re)build VPP.
+
+::
+
+ $ make wipe
+ $ make build
+
+Configuration
+-------------
+
+To enable the sample plugin
+
+::
+
+ sample macswap <interface name>
+
+To disable the sample plugin
+
+::
+
+ sample macswap <interface name> disable