docs: convert extras doc md->rst
Type: improvement Change-Id: Ie3b25a86b99098d2b3a21a11fc73234c8ed589d6 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
This commit is contained in:
parent
8acc5ee907
commit
a2c9509a4a
@ -1,48 +0,0 @@
|
||||
# Code coverage analysis with lcov {#lcov_code_coverage}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
The Linux gcov and lcov tools are fussy about gcc / g++ compiler
|
||||
versions. As of this writing, Ubuntu 18.04 gcov / lcov work with
|
||||
these toolchain versions:
|
||||
|
||||
$ gcc --version
|
||||
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
|
||||
$ g++ --version
|
||||
g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
|
||||
|
||||
Refer to
|
||||
https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version for information on how to install multiple gcc / g++ versions, and
|
||||
switch between them.
|
||||
|
||||
You'll need to install the following additional packages:
|
||||
|
||||
$ sudo apt-get install gcovr ggcov lcov
|
||||
|
||||
## Compile an instrumented vpp image
|
||||
|
||||
Two ways:
|
||||
|
||||
$ cd <workspace-root>
|
||||
$ make test-gcov
|
||||
$ ## interrupt compilation after building the image
|
||||
|
||||
or
|
||||
$ cd <workspace-root>/build-root
|
||||
$ make PLATFORM=vpp TAG=vpp_gcov vpp-install
|
||||
|
||||
## Initialize the lcov database
|
||||
|
||||
$ cd <workspace-root>
|
||||
$ ./extras/lcov/lcov_prep
|
||||
$ make test-gcov or make TEST=my_test test-gcov
|
||||
$ # repeat or vary as desired to increase reported coverage
|
||||
$ # Generate the report:
|
||||
$ ./extras/lcov/lcov_post
|
||||
|
||||
You can run vpp manually, do anything you like. Results are cumulative
|
||||
until you re-run the "prep" script.
|
||||
|
||||
## Look at the results
|
||||
|
||||
Point a browser at file:///<workspace-root>/build-root/html/index.html
|
48
extras/lcov/README.rst
Normal file
48
extras/lcov/README.rst
Normal file
@ -0,0 +1,48 @@
|
||||
.. _lcov_code_coverage:
|
||||
|
||||
Code coverage with lcov
|
||||
=======================
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
The Linux gcov and lcov tools are fussy about gcc / g++ compiler
|
||||
versions. As of this writing, Ubuntu 18.04 gcov / lcov work with these
|
||||
toolchain versions:
|
||||
|
||||
$ gcc –version gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 $ g++ –version
|
||||
g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
|
||||
|
||||
Refer to
|
||||
https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version
|
||||
for information on how to install multiple gcc / g++ versions, and
|
||||
switch between them.
|
||||
|
||||
You’ll need to install the following additional packages:
|
||||
|
||||
$ sudo apt-get install gcovr ggcov lcov
|
||||
|
||||
Compile an instrumented vpp image
|
||||
---------------------------------
|
||||
|
||||
Two ways:
|
||||
|
||||
$ cd $ make test-gcov $ ## interrupt compilation after building the
|
||||
image
|
||||
|
||||
or $ cd /build-root $ make PLATFORM=vpp TAG=vpp_gcov vpp-install
|
||||
|
||||
Initialize the lcov database
|
||||
----------------------------
|
||||
|
||||
$ cd $ ./extras/lcov/lcov_prep $ make test-gcov or make TEST=my_test
|
||||
test-gcov $ # repeat or vary as desired to increase reported coverage $
|
||||
# Generate the report: $ ./extras/lcov/lcov_post
|
||||
|
||||
You can run vpp manually, do anything you like. Results are cumulative
|
||||
until you re-run the “prep” script.
|
||||
|
||||
Look at the results
|
||||
-------------------
|
||||
|
||||
Point a browser at file:////build-root/html/index.html
|
67
extras/scripts/check_documentation.sh
Executable file
67
extras/scripts/check_documentation.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2021 Cisco and/or its affiliates.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at:
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -eEo pipefail
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
WS_ROOT=$( realpath ${SCRIPTDIR}/../.. )
|
||||
|
||||
function red () { printf "\e[0;31m$1\e[0m\n" ; }
|
||||
function green () { printf "\e[0;32m$1\e[0m\n" ; }
|
||||
|
||||
find_linked_docs () {
|
||||
find ${WS_ROOT}/docs -type l \
|
||||
\( -name '*.rst' -o -name '*.md' \) \
|
||||
-exec readlink -f {} \; | sort
|
||||
}
|
||||
|
||||
find_excluded_docs () {
|
||||
cat ${WS_ROOT}/docs/docsignore \
|
||||
| grep -v '#' \
|
||||
| sed s@^@${WS_ROOT}/@ \
|
||||
| sort
|
||||
}
|
||||
|
||||
find_linked_and_excluded_docs () {
|
||||
cat <( find_linked_docs ) <( find_excluded_docs ) | sort
|
||||
}
|
||||
|
||||
find_candidate_docs () {
|
||||
find \
|
||||
${WS_ROOT}/src \
|
||||
${WS_ROOT}/test \
|
||||
${WS_ROOT}/extras \
|
||||
-not -path "${WS_ROOT}/test/venv/*" \
|
||||
\( -name '*.rst' -o -name '*.md' \) \
|
||||
| sort
|
||||
}
|
||||
|
||||
spellcheck () {
|
||||
make -C ${WS_ROOT} docs-spell
|
||||
}
|
||||
|
||||
if [ "x$(comm -13 <( find_linked_and_excluded_docs ) <( find_candidate_docs ))" != x ]; then
|
||||
red "The following files need to be linked"
|
||||
red "in the doc folder e.g. :"
|
||||
red "$ cd vpp/docs/developer/plugins"
|
||||
red "$ ln -s ../../../src/plugins/my_plugin/my_plugin.rst"
|
||||
echo ""
|
||||
cat <( comm -13 <( find_linked_and_excluded_docs ) <( find_candidate_docs ) )
|
||||
exit 1
|
||||
fi
|
||||
spellcheck
|
||||
green "**********************************************"
|
||||
green "* VPP Docs Checkstyle Successfully Completed *"
|
||||
green "**********************************************"
|
File diff suppressed because it is too large
Load Diff
554
extras/selinux/selinux_doc.rst
Normal file
554
extras/selinux/selinux_doc.rst
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,86 +0,0 @@
|
||||
VPP Snap Build {#snap_doc}
|
||||
--------------
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
The external dependency package will not build in the snapcraft
|
||||
vm. The path of least resistance is to copy it to the root of the
|
||||
(original) workspace before running the prep script.
|
||||
|
||||
Snapcraft has mount issues except under /home. Run the prep script and
|
||||
copy the entire directory (including the .tgz file) under
|
||||
/home/yourself.
|
||||
|
||||
Run the prep script
|
||||
-------------------
|
||||
|
||||
```
|
||||
$ cd <vpp-workspace>/extras/snap
|
||||
$ ./prep
|
||||
```
|
||||
|
||||
Copy data to /home (if necessary)
|
||||
|
||||
```
|
||||
$ mkdir /home/xxx
|
||||
$ cd <vpp-workspace>/extras/snap
|
||||
$ cp * /home/xxx
|
||||
|
||||
Set snapcraft environment variables
|
||||
-----------------------------------
|
||||
|
||||
Minimum requirements:
|
||||
|
||||
```
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_DISK=32G
|
||||
```
|
||||
|
||||
Optional:
|
||||
|
||||
```
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8
|
||||
SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes
|
||||
```
|
||||
|
||||
Run snapcraft
|
||||
-------------
|
||||
|
||||
With luck, simply running snapcraft will produce the snap
|
||||
|
||||
```
|
||||
$ <environment-variable-settings> snapcraft [--debug]
|
||||
```
|
||||
|
||||
Rerunning snapcraft phases
|
||||
--------------------------
|
||||
|
||||
Here's how to (re)run individual phases, to avoid starting from
|
||||
scratch N times in case of errors:
|
||||
|
||||
```
|
||||
snapcraft pull [<part-name>]
|
||||
snapcraft build [<part-name>]
|
||||
snapcraft stage [<part-name>]
|
||||
snapcraft prime [<part-name>]
|
||||
snapcraft snap or snapcraft
|
||||
```
|
||||
|
||||
Restart without rebuilding VM
|
||||
-----------------------------
|
||||
|
||||
To restart from scratch without rebuilding the VM:
|
||||
|
||||
```
|
||||
snapcraft clean vpp
|
||||
```
|
||||
|
||||
Delete (all) snapcraft VMs
|
||||
--------------------------
|
||||
|
||||
```
|
||||
for vm in $(multipass list | awk '{print $1}' | grep ^snapcraft-); do
|
||||
multipass delete $vm --purge
|
||||
done
|
||||
```
|
84
extras/snap/README.rst
Normal file
84
extras/snap/README.rst
Normal file
@ -0,0 +1,84 @@
|
||||
.. _snap_doc:
|
||||
|
||||
VPP Snap Build
|
||||
==============
|
||||
|
||||
The external dependency package will not build in the snapcraft vm. The
|
||||
path of least resistance is to copy it to the root of the (original)
|
||||
workspace before running the prep script.
|
||||
|
||||
Snapcraft has mount issues except under /home. Run the prep script and
|
||||
copy the entire directory (including the .tgz file) under
|
||||
/home/yourself.
|
||||
|
||||
Run the prep script
|
||||
-------------------
|
||||
|
||||
::
|
||||
|
||||
$ cd <vpp-workspace>/extras/snap
|
||||
$ ./prep
|
||||
|
||||
Copy data to /home (if necessary)
|
||||
|
||||
::
|
||||
|
||||
$ mkdir /home/xxx
|
||||
$ cd <vpp-workspace>/extras/snap
|
||||
$ cp * /home/xxx
|
||||
|
||||
Set snapcraft environment variables
|
||||
-----------------------------------
|
||||
|
||||
Minimum requirements:
|
||||
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=16G
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_DISK=32G
|
||||
|
||||
::
|
||||
|
||||
|
||||
Optional:
|
||||
|
||||
SNAPCRAFT_BUILD_ENVIRONMENT_CPU=8 SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes
|
||||
|
||||
::
|
||||
|
||||
|
||||
Run snapcraft
|
||||
-------------
|
||||
|
||||
With luck, simply running snapcraft will produce the snap
|
||||
|
||||
$ snapcraft [–debug]
|
||||
|
||||
::
|
||||
|
||||
|
||||
Rerunning snapcraft phases
|
||||
--------------------------
|
||||
|
||||
Here's how to (re)run individual phases, to avoid starting from
|
||||
scratch N times in case of errors:
|
||||
|
||||
snapcraft pull [] snapcraft build [] snapcraft stage [] snapcraft prime
|
||||
[] snapcraft snap or snapcraft
|
||||
|
||||
::
|
||||
|
||||
|
||||
Restart without rebuilding VM
|
||||
-----------------------------
|
||||
|
||||
To restart from scratch without rebuilding the VM:
|
||||
|
||||
snapcraft clean vpp
|
||||
|
||||
::
|
||||
|
||||
|
||||
Delete (all) snapcraft VMs
|
||||
--------------------------
|
||||
|
||||
for vm in $(multipass list \| awk ‘{print $1}’ \| grep ^snapcraft-); do
|
||||
multipass delete $vm –purge done \``\`
|
@ -1,23 +0,0 @@
|
||||
# VPP Swanstrong Testing Recipe {#strongswan_test_doc}
|
||||
|
||||
Simple test framework for VPP and strongSwan scenarios.
|
||||
|
||||
## setup and run
|
||||
|
||||
`docker` is needed to run the tests.
|
||||
|
||||
Create `~/.vpp_sswan` file and set `VPP_BIN` and `VPPCTL` variables that points to vpp and vppctl binaries, like follows:
|
||||
```
|
||||
export VPP_BIN=/path/to/vpp
|
||||
export VPPCTL=/path/to/vppctl
|
||||
```
|
||||
|
||||
To run all test
|
||||
```
|
||||
./run.sh
|
||||
```
|
||||
|
||||
or specific test
|
||||
```
|
||||
./test_responder.sh
|
||||
```
|
31
extras/strongswan/README.rst
Normal file
31
extras/strongswan/README.rst
Normal file
@ -0,0 +1,31 @@
|
||||
.. _strongswan_test_doc:
|
||||
|
||||
Strongswan Testing Tool
|
||||
=======================
|
||||
|
||||
Simple test framework for VPP and strongSwan scenarios.
|
||||
|
||||
setup and run
|
||||
-------------
|
||||
|
||||
``docker`` is needed to run the tests.
|
||||
|
||||
Create ``~/.vpp_sswan`` file and set ``VPP_BIN`` and ``VPPCTL``
|
||||
variables that points to vpp and vppctl binaries, like follows:
|
||||
|
||||
::
|
||||
|
||||
export VPP_BIN=/path/to/vpp
|
||||
export VPPCTL=/path/to/vppctl
|
||||
|
||||
To run all test
|
||||
|
||||
::
|
||||
|
||||
./run.sh
|
||||
|
||||
or specific test
|
||||
|
||||
::
|
||||
|
||||
./test_responder.sh
|
@ -1,27 +0,0 @@
|
||||
# vcl-ldpreload: a LD_PRELOAD library that uses the VPP Communications Library (VCL). {#vcl_ldpreload_doc}
|
||||
|
||||
User can LD_PRELOAD any application that uses POSIX socket API.
|
||||
|
||||
NOTE: The sources have been moved to .../vpp/src/vcl and
|
||||
libvcl_ldpreload.so is built with VPP and can be found in
|
||||
.../vpp/build-root/install-vpp[_debug]-native/vpp/lib
|
||||
|
||||
## HowTo
|
||||
|
||||
# 1. Running the demo
|
||||
## Run test script without parameters to see help menu:
|
||||
|
||||
export WS_ROOT=<top level vpp git repo dir> (e.g. /scratch/my_name/vpp)
|
||||
$WS_ROOT/test/scripts/socket_test.sh
|
||||
|
||||
# 2. Docker iPerf examples.
|
||||
## These launch xterms. To quit, close xterms and run following docker kill cmd (WARNING: This will kill all docker containers!) 'docker kill $(docker ps -q)'
|
||||
|
||||
|
||||
## Docker iPerf using default Linux Bridge
|
||||
|
||||
$WS_ROOT/test/scripts/socket_test.sh -bi docker-kernel
|
||||
|
||||
## Docker iPerf using VPP
|
||||
$WS_ROOT/test/scripts/socket_test.sh -bi docker-preload
|
||||
|
40
extras/vcl-ldpreload/README.rst
Normal file
40
extras/vcl-ldpreload/README.rst
Normal file
@ -0,0 +1,40 @@
|
||||
.. _vcl_ldpreload_doc:
|
||||
|
||||
LD_PRELOAD the VCL
|
||||
==================
|
||||
|
||||
vcl-ldpreload is a LD_PRELOAD library that uses the VPP Communications Library (VCL).
|
||||
|
||||
User can LD_PRELOAD any application that uses POSIX socket API.
|
||||
|
||||
NOTE: The sources have been moved to ``vpp/src/vcl`` and ``libvcl_ldpreload.so`` is built with VPP and can be found in
|
||||
``vpp/build-root/install-vpp[_debug]-native/vpp/lib``
|
||||
|
||||
1. Running the demo
|
||||
-------------------
|
||||
|
||||
Run test script without parameters to see help menu:
|
||||
|
||||
::
|
||||
|
||||
export WS_ROOT= (e.g. /scratch/my_name/vpp)
|
||||
$WS_ROOT/test/scripts/socket_test.sh
|
||||
|
||||
|
||||
2. Docker iPerf examples
|
||||
------------------------
|
||||
|
||||
These launch xterms. To quit, close xterms and run following docker kill cmd (WARNING: This will kill all docker containers!) ‘docker kill $(docker ps -q)’
|
||||
|
||||
Docker iPerf using default Linux Bridge
|
||||
|
||||
::
|
||||
|
||||
$WS_ROOT/test/scripts/socket_test.sh -bi docker-kernel
|
||||
|
||||
|
||||
Docker iPerf using VPP
|
||||
|
||||
::
|
||||
|
||||
$WS_ROOT/test/scripts/socket_test.sh -bi docker-preload
|
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
# VPP interface stats client {#if_stats_client_doc}
|
||||
|
||||
This is a source code and a binary of a 'thin client' to collect,
|
||||
aggregate and expose VPP interface stats through VPP stats socket API.
|
||||
It also provides some information about the installed VPP version.
|
||||
|
||||
This can be used by monitoring systems that needs to grab those details
|
||||
through a simple executable client with no dependencies.
|
||||
|
||||
example use case: where VPP runs in a container that can't expose the socket API to the host level
|
||||
|
||||
|
||||
## Prerequisites (for building)
|
||||
|
||||
**GoVPP** library (compatible with VPP 18.10)
|
||||
vpp, vpp-api, vpp-lib
|
||||
|
||||
## Building
|
||||
|
||||
```bash
|
||||
go get git.fd.io/govpp.git
|
||||
go build
|
||||
```
|
||||
|
||||
## Using (post-build for example on linux 64bit)
|
||||
|
||||
```bash
|
||||
./bin/vpp_if_stats_linux_amd64
|
||||
```
|
||||
|
||||
## Output examples
|
||||
|
||||
[JSON schema](./response_schema.json)
|
||||
[Example](./response_example.json)
|
||||
|
40
extras/vpp_if_stats/README.rst
Normal file
40
extras/vpp_if_stats/README.rst
Normal file
@ -0,0 +1,40 @@
|
||||
.. _if_stats_client_doc:
|
||||
|
||||
VPP interface stats client
|
||||
==========================
|
||||
|
||||
This is a source code and a binary of a ‘thin client’ to collect,
|
||||
aggregate and expose VPP interface stats through VPP stats socket API.
|
||||
It also provides some information about the installed VPP version.
|
||||
|
||||
This can be used by monitoring systems that needs to grab those details
|
||||
through a simple executable client with no dependencies.
|
||||
|
||||
example use case: where VPP runs in a container that can’t expose the
|
||||
socket API to the host level
|
||||
|
||||
Prerequisites (for building)
|
||||
----------------------------
|
||||
|
||||
**GoVPP** library (compatible with VPP 18.10) vpp, vpp-api, vpp-lib
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
.. code:: bash
|
||||
|
||||
go get git.fd.io/govpp.git
|
||||
go build
|
||||
|
||||
Using (post-build for example on linux 64bit)
|
||||
---------------------------------------------
|
||||
|
||||
.. code:: bash
|
||||
|
||||
./bin/vpp_if_stats_linux_amd64
|
||||
|
||||
Output examples
|
||||
---------------
|
||||
|
||||
`JSON schema <./response_schema.json>`__
|
||||
`Example <./response_example.json>`__
|
@ -1,113 +0,0 @@
|
||||
# VPP stats segment FUSE filesystem {#stats_fs_doc}
|
||||
|
||||
The statfs binary allows to create a FUSE filesystem to expose and to browse the stats segment.
|
||||
It relies on the Go-FUSE library and requires Go-VPP stats bindings to work.
|
||||
|
||||
The binary mounts a filesystem on the local machine whith the data from the stats segments.
|
||||
The counters can be opened and read as files (e.g. in a Unix shell).
|
||||
Note that the value of a counter is determined when the corresponding file is opened (as for /proc/interrupts).
|
||||
|
||||
Directories update their contents on epoch changes so that new counters get added to the filesystem.
|
||||
|
||||
The script `install.sh` is responsible for buildiing and installing the filesystem.
|
||||
|
||||
## Usage
|
||||
|
||||
The local Makefile contains targets for all the possible intercations with the stats_f binary.
|
||||
|
||||
### Help
|
||||
A basic help menu
|
||||
```bash
|
||||
make help
|
||||
```
|
||||
|
||||
### Install
|
||||
Building the binary
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
### Start
|
||||
Starts the filesystem. Requires a running VPP instance using the default socket /run/vpp/stats.sock.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
```bash
|
||||
make start
|
||||
```
|
||||
|
||||
### Stop
|
||||
Stops and unmounts the filesystem if it is not busy.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
```bash
|
||||
make stop
|
||||
```
|
||||
|
||||
### Force unmount
|
||||
Forces the unmount of the filesystem even if it is busy.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
```bash
|
||||
make force-unmount
|
||||
```
|
||||
|
||||
### Cleanup
|
||||
Cleaning stats_fs binary.
|
||||
|
||||
May require a privileged user (sudo).
|
||||
```bash
|
||||
make clean
|
||||
```
|
||||
|
||||
## Browsing the filesystem
|
||||
|
||||
The default mountpoint is /run/vpp/stats_fs_dir.
|
||||
You can browse the filesystem as a regular user.
|
||||
Example:
|
||||
|
||||
```bash
|
||||
cd /run/vpp/stats_fs_dir
|
||||
cd sys/node
|
||||
ls -al
|
||||
cat names
|
||||
```
|
||||
|
||||
## Building and mounting the filesystem manually
|
||||
|
||||
For more modularity, you can build and mount the filesystem manually.
|
||||
|
||||
### Building
|
||||
Inside the local directory, you can build the go binary:
|
||||
```bash
|
||||
go build
|
||||
```
|
||||
|
||||
### Mounting
|
||||
Then, ou can mount the filesystem with the local binary.
|
||||
|
||||
May require a privileged user (sudo).
|
||||
|
||||
The basic usage is:
|
||||
```bash
|
||||
./stats_fs <MOUNT_POINT>
|
||||
```
|
||||
|
||||
**Options:**
|
||||
- debug \<true|false\> (default is false)
|
||||
- socket \<statSocket\> (default is /run/vpp/stats.sock) : VPP socket for stats
|
||||
|
||||
|
||||
### Unmounting the file system
|
||||
|
||||
You can unmount the filesystem with the fusermount command.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
|
||||
```bash
|
||||
fusermount -u /path/to/mountpoint
|
||||
```
|
||||
|
||||
To force the unmount even if the resource is busy, add the -z option:
|
||||
```bash
|
||||
fusermount -uz /path/to/mountpoint
|
||||
```
|
148
extras/vpp_stats_fs/README.rst
Normal file
148
extras/vpp_stats_fs/README.rst
Normal file
@ -0,0 +1,148 @@
|
||||
.. _stats_fs_doc:
|
||||
|
||||
VPP stats segment FUSE filesystem
|
||||
=================================
|
||||
|
||||
The statfs binary allows to create a FUSE filesystem to expose and to
|
||||
browse the stats segment. It relies on the Go-FUSE library and requires
|
||||
Go-VPP stats bindings to work.
|
||||
|
||||
The binary mounts a filesystem on the local machine with the data from
|
||||
the stats segments. The counters can be opened and read as files
|
||||
(e.g. in a Unix shell). Note that the value of a counter is determined
|
||||
when the corresponding file is opened (as for /proc/interrupts).
|
||||
|
||||
Directories update their contents on epoch changes so that new counters
|
||||
get added to the filesystem.
|
||||
|
||||
The script ``install.sh`` is responsible for building and installing
|
||||
the filesystem.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The local Makefile contains targets for all the possible interactions
|
||||
with the stats_f binary.
|
||||
|
||||
Help
|
||||
~~~~
|
||||
|
||||
A basic help menu
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make help
|
||||
|
||||
Install
|
||||
~~~~~~~
|
||||
|
||||
Building the binary
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make install
|
||||
|
||||
Start
|
||||
~~~~~
|
||||
|
||||
Starts the filesystem. Requires a running VPP instance using the default
|
||||
socket /run/vpp/stats.sock.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make start
|
||||
|
||||
Stop
|
||||
~~~~
|
||||
|
||||
Stops and unmounts the filesystem if it is not busy.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make stop
|
||||
|
||||
Force unmount
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Forces the unmount of the filesystem even if it is busy.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make force-unmount
|
||||
|
||||
Cleanup
|
||||
~~~~~~~
|
||||
|
||||
Cleaning stats_fs binary.
|
||||
|
||||
May require a privileged user (sudo).
|
||||
|
||||
.. code:: bash
|
||||
|
||||
make clean
|
||||
|
||||
Browsing the filesystem
|
||||
-----------------------
|
||||
|
||||
The default mountpoint is /run/vpp/stats_fs_dir. You can browse the
|
||||
filesystem as a regular user. Example:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd /run/vpp/stats_fs_dir
|
||||
cd sys/node
|
||||
ls -al
|
||||
cat names
|
||||
|
||||
Building and mounting the filesystem manually
|
||||
---------------------------------------------
|
||||
|
||||
For more modularity, you can build and mount the filesystem manually.
|
||||
|
||||
Building
|
||||
~~~~~~~~
|
||||
|
||||
Inside the local directory, you can build the go binary:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
go build
|
||||
|
||||
Mounting
|
||||
~~~~~~~~
|
||||
|
||||
Then, you can mount the filesystem with the local binary.
|
||||
|
||||
May require a privileged user (sudo).
|
||||
|
||||
The basic usage is:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
./stats_fs <MOUNT_POINT>
|
||||
|
||||
**Options:** - debug <true|false> (default is false) - socket
|
||||
<statSocket> (default is /run/vpp/stats.sock) : VPP socket for stats
|
||||
|
||||
Unmounting the file system
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can unmount the filesystem with the fusermount command.
|
||||
|
||||
May require a privileged user (sudo)
|
||||
|
||||
.. code:: bash
|
||||
|
||||
fusermount -u /path/to/mountpoint
|
||||
|
||||
To force the unmount even if the resource is busy, add the -z option:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
fusermount -uz /path/to/mountpoint
|
@ -1,25 +0,0 @@
|
||||
# VPP Top Installation {#vpp_top_doc}
|
||||
|
||||
[VPPTop]((https://github.com/PANTHEONtech/vpptop)) is a real-time data viewer for VPP interfaces and metrics displayed in dynamic terminal user interface, written in GO.
|
||||
|
||||
Following make targets are available:
|
||||
|
||||
**install** downloads and installs VPPTop including all external dependencies, binary API generator and latest version of GO. Running `make install-dep` (from the VPP top-level Makefile)
|
||||
is recommended.
|
||||
|
||||
**cleanup** removes VPPTop repository from the target directory (/build-root/vpptop)
|
||||
|
||||
**start** runs the VPPTop if installed
|
||||
|
||||
**help** shows information about available commands
|
||||
|
||||
The VPPTop is installed to be compatible with the given VPP version and may not work with other versions with different API. In that case, the VPPTop has to be re-installed.
|
||||
|
||||
### GO variables management
|
||||
|
||||
The installer depends on Golang environment variables GOROOT (for the GO installation) and GOPATH (for other binaries). Those variables are read from the environment and set to following values if not found:
|
||||
|
||||
GOROOT=/root/.go/
|
||||
GOPATH=/root/go/
|
||||
|
||||
If you have the GO already installed and have to run the installer with `sudo`, use the `-E` switch to provide those variables to the installer.
|
36
extras/vpptop/README.rst
Normal file
36
extras/vpptop/README.rst
Normal file
@ -0,0 +1,36 @@
|
||||
.. _vpp_top_doc:
|
||||
|
||||
VPP Top Installation
|
||||
====================
|
||||
|
||||
`VPPTop <(https://github.com/PANTHEONtech/vpptop)>`__ is a real-time
|
||||
data viewer for VPP interfaces and metrics displayed in dynamic terminal
|
||||
user interface, written in GO.
|
||||
|
||||
Following make targets are available:
|
||||
|
||||
* ``install`` downloads and installs VPPTop including all external dependencies, binary API generator
|
||||
and latest version of GO. Running ``make install-dep`` (from the VPP top-level Makefile) is recommended.
|
||||
* ``cleanup`` removes VPPTop repository from the target directory (``/build-root/vpptop``)
|
||||
* ``start`` runs the VPPTop if installed
|
||||
* ``help`` shows information about available commands
|
||||
|
||||
The VPPTop is installed to be compatible with the given VPP version and
|
||||
may not work with other versions with different API. In that case, the
|
||||
VPPTop has to be re-installed.
|
||||
|
||||
GO variables management
|
||||
-----------------------
|
||||
|
||||
The installer depends on Golang environment variables GOROOT (for the GO
|
||||
installation) and GOPATH (for other binaries). Those variables are read
|
||||
from the environment and set to following values if not found:
|
||||
|
||||
::
|
||||
|
||||
GOROOT=/root/.go/ GOPATH=/root/go/
|
||||
|
||||
|
||||
If you have the GO already installed and have to run the installer with
|
||||
``sudo``, use the ``-E`` switch to provide those variables to the
|
||||
installer.
|
@ -1,186 +0,0 @@
|
||||
# Handoff queue demo plugin {#handoff_queue_demo_plugin}
|
||||
|
||||
This plugin provides a simplified example of how to hand off
|
||||
packets between threads. I used it to debug packet-tracer handoff
|
||||
tracing support.
|
||||
|
||||
# Packet generator input script
|
||||
|
||||
```
|
||||
packet-generator new {
|
||||
name x
|
||||
limit 5
|
||||
size 128-128
|
||||
interface local0
|
||||
node handoffdemo-1
|
||||
data {
|
||||
incrementing 30
|
||||
}
|
||||
}
|
||||
```
|
||||
# Start vpp with 2 worker threads
|
||||
|
||||
The demo plugin hands packets from worker 1 to worker 2.
|
||||
|
||||
# Enable tracing, and start the packet generator
|
||||
|
||||
```
|
||||
trace add pg-input 100
|
||||
packet-generator enable
|
||||
```
|
||||
|
||||
# Sample Run
|
||||
|
||||
```
|
||||
DBGvpp# ex /tmp/pg_input_script
|
||||
DBGvpp# pa en
|
||||
DBGvpp# sh err
|
||||
Count Node Reason
|
||||
5 handoffdemo-1 packets handed off processed
|
||||
5 handoffdemo-2 completed packets
|
||||
DBGvpp# show run
|
||||
Thread 1 vpp_wk_0 (lcore 0)
|
||||
Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
|
||||
vector rates in 3.7331e-2, out 0.0000e0, drop 0.0000e0, punt 0.0000e0
|
||||
Name State Calls Vectors Suspends Clocks Vectors/Call
|
||||
handoffdemo-1 active 1 5 0 4.76e3 5.00
|
||||
pg-input disabled 2 5 0 5.58e4 2.50
|
||||
unix-epoll-input polling 22760 0 0 2.14e7 0.00
|
||||
---------------
|
||||
Thread 2 vpp_wk_1 (lcore 2)
|
||||
Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
|
||||
vector rates in 0.0000e0, out 0.0000e0, drop 3.7331e-2, punt 0.0000e0
|
||||
Name State Calls Vectors Suspends Clocks Vectors/Call
|
||||
drop active 1 5 0 1.35e4 5.00
|
||||
error-drop active 1 5 0 2.52e4 5.00
|
||||
handoffdemo-2 active 1 5 0 2.56e4 5.00
|
||||
unix-epoll-input polling 22406 0 0 2.18e7 0.00
|
||||
```
|
||||
|
||||
Enable the packet tracer and run it again...
|
||||
|
||||
```
|
||||
DBGvpp# trace add pg-input 100
|
||||
DBGvpp# pa en
|
||||
DBGvpp# sh trace
|
||||
sh trace
|
||||
------------------- Start of thread 0 vpp_main -------------------
|
||||
No packets in trace buffer
|
||||
------------------- Start of thread 1 vpp_wk_0 -------------------
|
||||
Packet 1
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000000
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 2
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000001
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 3
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000002
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 4
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000003
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 5
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000004
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
------------------- Start of thread 2 vpp_wk_1 -------------------
|
||||
Packet 1
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 0
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 2
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 1
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 3
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 2
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 4
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 3
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 5
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 4
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
DBGvpp#
|
||||
```
|
194
src/examples/handoffdemo/handoffdemo.rst
Normal file
194
src/examples/handoffdemo/handoffdemo.rst
Normal file
@ -0,0 +1,194 @@
|
||||
.. _handoff_queue_demo_plugin:
|
||||
|
||||
Handoff queue in a plugin
|
||||
=========================
|
||||
|
||||
This plugin provides a simplified example of how to hand off packets
|
||||
between threads. I used it to debug packet-tracer handoff tracing
|
||||
support.
|
||||
|
||||
Packet generator input script
|
||||
-----------------------------
|
||||
|
||||
::
|
||||
|
||||
packet-generator new {
|
||||
name x
|
||||
limit 5
|
||||
size 128-128
|
||||
interface local0
|
||||
node handoffdemo-1
|
||||
data {
|
||||
incrementing 30
|
||||
}
|
||||
}
|
||||
|
||||
Start vpp with 2 worker threads
|
||||
-------------------------------
|
||||
|
||||
The demo plugin hands packets from worker 1 to worker 2.
|
||||
|
||||
Enable tracing, and start the packet generator
|
||||
----------------------------------------------
|
||||
|
||||
::
|
||||
|
||||
trace add pg-input 100
|
||||
packet-generator enable
|
||||
|
||||
Sample Run
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
DBGvpp# ex /tmp/pg_input_script
|
||||
DBGvpp# pa en
|
||||
DBGvpp# sh err
|
||||
Count Node Reason
|
||||
5 handoffdemo-1 packets handed off processed
|
||||
5 handoffdemo-2 completed packets
|
||||
DBGvpp# show run
|
||||
Thread 1 vpp_wk_0 (lcore 0)
|
||||
Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
|
||||
vector rates in 3.7331e-2, out 0.0000e0, drop 0.0000e0, punt 0.0000e0
|
||||
Name State Calls Vectors Suspends Clocks Vectors/Call
|
||||
handoffdemo-1 active 1 5 0 4.76e3 5.00
|
||||
pg-input disabled 2 5 0 5.58e4 2.50
|
||||
unix-epoll-input polling 22760 0 0 2.14e7 0.00
|
||||
---------------
|
||||
Thread 2 vpp_wk_1 (lcore 2)
|
||||
Time 133.9, average vectors/node 5.00, last 128 main loops 0.00 per node 0.00
|
||||
vector rates in 0.0000e0, out 0.0000e0, drop 3.7331e-2, punt 0.0000e0
|
||||
Name State Calls Vectors Suspends Clocks Vectors/Call
|
||||
drop active 1 5 0 1.35e4 5.00
|
||||
error-drop active 1 5 0 2.52e4 5.00
|
||||
handoffdemo-2 active 1 5 0 2.56e4 5.00
|
||||
unix-epoll-input polling 22406 0 0 2.18e7 0.00
|
||||
|
||||
Enable the packet tracer and run it again…
|
||||
|
||||
::
|
||||
|
||||
DBGvpp# trace add pg-input 100
|
||||
DBGvpp# pa en
|
||||
DBGvpp# sh trace
|
||||
sh trace
|
||||
------------------- Start of thread 0 vpp_main -------------------
|
||||
No packets in trace buffer
|
||||
------------------- Start of thread 1 vpp_wk_0 -------------------
|
||||
Packet 1
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000000
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 2
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000001
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 3
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000002
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 4
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000003
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
Packet 5
|
||||
|
||||
00:06:50:520688: pg-input
|
||||
stream x, 128 bytes, 0 sw_if_index
|
||||
current data 0, length 128, buffer-pool 0, ref-count 1, trace handle 0x1000004
|
||||
00000000: 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d0000
|
||||
00000020: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000040: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00000060: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
00:06:50:520762: handoffdemo-1
|
||||
HANDOFFDEMO: current thread 1
|
||||
|
||||
------------------- Start of thread 2 vpp_wk_1 -------------------
|
||||
Packet 1
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 0
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 2
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 1
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 3
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 2
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 4
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 3
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
|
||||
Packet 5
|
||||
|
||||
00:06:50:520796: handoff_trace
|
||||
HANDED-OFF: from thread 1 trace index 4
|
||||
00:06:50:520796: handoffdemo-2
|
||||
HANDOFFDEMO: current thread 2
|
||||
00:06:50:520867: error-drop
|
||||
rx:local0
|
||||
00:06:50:520914: drop
|
||||
handoffdemo-2: completed packets
|
||||
DBGvpp#
|
@ -1,66 +0,0 @@
|
||||
# Sample plugin for VPP {#sample_plugin_doc}
|
||||
|
||||
## Overview
|
||||
|
||||
This is the VPP sample plugin demonstrates how to create a new plugin that integrates
|
||||
with VPP. The sample code implements a trival macswap algorithim that demonstrates plugin
|
||||
runtime integration with the VPP graph hierachy, api and cli.
|
||||
|
||||
For deeper dive information see the annotations in the sample code itself. See [sample.c](@ref sample.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
|
97
src/examples/sample-plugin/sample_plugin_doc.rst
Normal file
97
src/examples/sample-plugin/sample_plugin_doc.rst
Normal file
@ -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
|
@ -1,30 +0,0 @@
|
||||
# Sample SRv6 LocalSID documentation {#srv6_plugin_doc}
|
||||
|
||||
## Introduction
|
||||
|
||||
This plugin is an example of how an user can create a new SRv6 LocalSID behavior by using VPP plugins with the appropiate API calls to the existing SR code.
|
||||
|
||||
This **example** plugin registers a new localsid behavior, with cli keyword 'new_srv6_localsid' which only takes one parameter, a fib-table. Upon recival of a packet, this plugin will enforce the next IP6 lookup in the specific fib-table specified by the user. (Indeed it will do the lookup in the fib_table n+1 (since for the shake of the example we increment the fib-table.)
|
||||
|
||||
Notice that the plugin only 'defines' a new SRv6 LocalSID behavior, but the existing SR code in VNET is the one actually instantiating new LocalSIDs. Notice that there are callback functions such that when you create or remove a LocalSID you can actually setup specific parameters through the functions in this plugin.
|
||||
|
||||
## Variables to watch for
|
||||
|
||||
* srv6_localsid_name: This variable is the name (used as a unique key) identifying this SR LocalSID plugin.
|
||||
* keyword_str: This is the CLI keyword to be used for the plugin. In this example 'new_srv6_localsid'. (i.e. sr localsid address cafe::1 behavior new_srv6_localsid <parameters>)
|
||||
* def_str: This is a definition of this SR behavior. This is printed when you do 'show sr localsid behaviors'.
|
||||
* params_str: This is a definition of the parameters of this localsid. This is printed when you do 'show sr localsid behaviors'.
|
||||
|
||||
## Functions to watch for
|
||||
|
||||
* srv6_localsid_creation_fn: This function will be called every time a new SR LocalSID is instantiated with the behavior defined in this plugin.
|
||||
* srv6_localsid_removal_fn: This function will be called every time a new SR LocalSID is removed with the behavior defined in this plugin. This function tends to be used for freeing up all the memory created in the previous function.
|
||||
* format_srv6_localsid_sample: This function prints nicely the parameters of every SR LocalSID using this behavior.
|
||||
* unformat_srv6_localsid_sample: This function parses the CLI command when initialising a new SR LocalSID using this behavior. It parses all the parameters and ensures that the parameters are correct.
|
||||
* format_srv6_localsid_sample_dpo: This function formats the 'show ip6 fib' message for the SR LocalSIDs created with this plugin behavior.
|
||||
|
||||
## Graph node
|
||||
|
||||
The current graph node uses the function 'end_srh_processing' to do the Segment Routing Endpoint behavior. Notice that it does not allow the cleanup of a Segment Routing header (as per the SRv6 behavior specs).
|
||||
This function is identical to the one found in /src/vnet/srv6/sr_localsid.c
|
||||
In case that by some other reason you want to do decapsulation, or SRH clean_up you can use the functions 'end_decaps_srh_processing' or 'end_psp_srh_processing' respectively.
|
@ -0,0 +1,66 @@
|
||||
.. _srv6_plugin_doc:
|
||||
|
||||
Sample SRv6 LocalSID documentation
|
||||
==================================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This plugin is an example of how an user can create a new SRv6 LocalSID
|
||||
behavior by using VPP plugins with the appropriate API calls to the
|
||||
existing SR code.
|
||||
|
||||
This **example** plugin registers a new localsid behavior, with cli
|
||||
keyword ‘new_srv6_localsid’ which only takes one parameter, a fib-table.
|
||||
Upon receival of a packet, this plugin will enforce the next IP6 lookup
|
||||
in the specific fib-table specified by the user. (Indeed it will do the
|
||||
lookup in the fib_table n+1 (since for the shake of the example we
|
||||
increment the fib-table.)
|
||||
|
||||
Notice that the plugin only ‘defines’ a new SRv6 LocalSID behavior, but
|
||||
the existing SR code in VNET is the one actually instantiating new
|
||||
LocalSIDs. Notice that there are callback functions such that when you
|
||||
create or remove a LocalSID you can actually setup specific parameters
|
||||
through the functions in this plugin.
|
||||
|
||||
Variables to watch for
|
||||
----------------------
|
||||
|
||||
- srv6_localsid_name: This variable is the name (used as a unique key)
|
||||
identifying this SR LocalSID plugin.
|
||||
- keyword_str: This is the CLI keyword to be used for the plugin. In
|
||||
this example ‘new_srv6_localsid’. (i.e. sr localsid address cafe::1
|
||||
behavior new_srv6_localsid )
|
||||
- def_str: This is a definition of this SR behavior. This is printed
|
||||
when you do ‘show sr localsid behaviors’.
|
||||
- params_str: This is a definition of the parameters of this localsid.
|
||||
This is printed when you do ‘show sr localsid behaviors’.
|
||||
|
||||
Functions to watch for
|
||||
----------------------
|
||||
|
||||
- srv6_localsid_creation_fn: This function will be called every time a
|
||||
new SR LocalSID is instantiated with the behavior defined in this
|
||||
plugin.
|
||||
- srv6_localsid_removal_fn: This function will be called every time a
|
||||
new SR LocalSID is removed with the behavior defined in this plugin.
|
||||
This function tends to be used for freeing up all the memory created
|
||||
in the previous function.
|
||||
- format_srv6_localsid_sample: This function prints nicely the
|
||||
parameters of every SR LocalSID using this behavior.
|
||||
- unformat_srv6_localsid_sample: This function parses the CLI command
|
||||
when initializing a new SR LocalSID using this behavior. It parses
|
||||
all the parameters and ensures that the parameters are correct.
|
||||
- format_srv6_localsid_sample_dpo: This function formats the ‘show ip6
|
||||
fib’ message for the SR LocalSIDs created with this plugin behavior.
|
||||
|
||||
Graph node
|
||||
----------
|
||||
|
||||
The current graph node uses the function ‘end_srh_processing’ to do the
|
||||
Segment Routing Endpoint behavior. Notice that it does not allow the
|
||||
cleanup of a Segment Routing header (as per the SRv6 behavior specs).
|
||||
This function is identical to the one found in
|
||||
/src/vnet/srv6/sr_localsid.c In case that by some other reason you want
|
||||
to do decapsulation, or SRH clean_up you can use the functions
|
||||
‘end_decaps_srh_processing’ or ‘end_psp_srh_processing’ respectively.
|
Loading…
x
Reference in New Issue
Block a user