Coder Social home page Coder Social logo

gabrielganne / vpp-flowtable-plugin Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 7.0 32 KB

Proposal to add a flowtable plugin to vpp

License: Apache License 2.0

Makefile 5.88% M4 1.29% C 82.71% Objective-C 4.19% Python 3.99% Shell 1.94%
vpp flowtable plugin archived

vpp-flowtable-plugin's Introduction

A flowtable plugin

Provide a stateful node with flow-level API, available for consecutive nodes or external applications.

Objective

Provides a flowtable node to do flow classification, and associate a flow context that can be enriched as needed by another node or an external application.

The objective is to be adaptable so as to be used for any stateful use such as load-balancing, firewall ...

Compared to the classifier, it stores a flow context, which changes the following:

  • a flow context (which can be updated with external information)
  • it can offload
  • flows have a lifetime

Sources

Build

cd <plugin-dir>

autoreconf -i -f
mkdir build && pushd build
../configure --prefix=/usr
make
sudo make install
popd

To build using vpp source tree instead of an installed one :

export VPP_ROOT=~/vpp/build-root/install-vpp-native
...
../configure --prefix=$VPP_ROOT/vpp
# then build && install

CLI

  • configuration
 flowtable [max-flows <n>] [intf <name>] [next-node <name>] [disable]

The traffic from the given intf is redirected to the flowtable using vnet_hw_interface_rx_redirect_to_node()

API

I used ~0 (or 0xff for u8) to leave configuration parameter unchanged.

  • flowtable configuration
 flowtable_conf(flows_max, sw_if_index, next_node_index, enable_disable)
  • send additional informations to the flowtable
 flowtable_update(is_ip4, ip_src, ip_dst, port_src, port_dst # used to compute flow key
                  lifetime, offloaded, infos) # additional flow informations

Test

In itself, the flowtable only provides a context and an API.

I added a simple port-mirroring node to test with an external application receiving the mirrored traffic and updating the flowtable using the binary API.

simple conf

2 scripts for quick flowtable test :

  • ~/test/flowtable-env-setup.sh creates 2 connected namespaces vpp1 & vpp2
  • ~/test/flowtable-api-conf.py redirect all traffic through the flowtable

Perfs

Tested with handoff node, with two working nodes.

Platform

  • Platform: Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz, 30720 KB Cache

pktgen

  • pktgen: gen 8k flows of 128 Bytes packets at ~7Gbps 2 interfaces
  • modify flowtable to expire flows after each packet (flow ttl = 0)

show run max gives: avg Clocks = 211.0

About half of it to process the packet, and the other half to lookup the flow contexts.

Breaking Point

pktgen cannot create many flows, so I tested with BP to test the number of flow context creation per second

  • Total BW: 12Gbps
  • Max flows 2.4 M # Breaking Point flows (2.4M) != vpp flows (4M)
  • avg pps : 750~800 k
  • avg flow creation rate : 18k/s
  • Max flow creation rate : 50k/s
  • ~4.5% recycled flows

The flow count difference between Breaking Point and vpp flowtable's is caused by the timer management.

portmirroring node

The node is only used as a sample to test the flowtable and has no value in itself.

Current status

  • Default behavior is to connect transparently to given interface.
  • Can reroute packets to given node
  • Can receive additional information
  • Can offload sessions
  • Only support IP packets
  • if the maximum number of flows is reached, the flowtable will recycle a flow by expiring a flow which was about to expire (typically the first flow found in the timer-wheel's next-slot)

Planned

  • split flowtable into two ip4/ip6 nodes

Main contributors

vpp-flowtable-plugin's People

Contributors

gabrielganne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vpp-flowtable-plugin's Issues

VPP instance has no attribute 'flowtable_conf'

Hello :
I have a question about test, I had been finished the plugins install, and tried to test the two plugins , when executed the flowtable-conf-sample.py , it reminded me "VPP instance has no attribute 'flowtable_conf".
Maybe I lost something , the flowtable plugin api didn't invoke. what can I do to test the plugin. The cli commond next node means what?
0 Traceback (most recent call last): File "flowtable-conf-simple.py", line 39, in <module> r = vpp.flowtable_conf(flows_max=0xffffffff, AttributeError: VPP instance has no attribute 'flowtable_conf'
image

build issue

Hi Gabriel,

[Posting here because your qosmos.com email bounced]

I am very new to VPP but plan to use it on an upcoming project. I have created and run a test plugin using the VPP script (../../extras/emacs/make-plugin.sh). It runs without issue. I am building VPP stable/2001 from source (make build; make run). So my environment seems to be working ok. I don't have any of the VPP system libs installed. Everything is in the VPP source tree.

I would like to try your plugin but can't seem to get it built. I have not built a stand-alone plugin before but it seems like it should be simple. My test plugin is part of the VPP tree.

I would appreciate if you could spend a couple of minutes looking at the below output and let me know what you think. I am setting VPP_ROOT correctly as far as I can tell.

vppdev:~/git$
vppdev:~/git$ git clone https://github.com/GabrielGanne/vpp-flowtable-plugin.git
Cloning into 'vpp-flowtable-plugin'...
remote: Enumerating objects: 52, done.
remote: Total 52 (delta 0), reused 0 (delta 0), pack-reused 52
Unpacking objects: 100% (52/52), done.
vppdev:~/git$ cd vpp-flowtable-plugin/flowtable-plugin/
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin$ export VPP_ROOT=~/git/vpp/build-root/install-vpp_debug-native
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin$ ls -l $VPP_ROOT
total 8
drwxrwxr-x 7 vppuser vppuser 4096 Feb 16 17:10 external
drwxrwxr-x 7 vppuser vppuser 4096 Feb 16 17:12 vpp
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin$ autoreconf -i -f
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:5: installing './compile'
configure.ac:5: installing './config.guess'
configure.ac:5: installing './config.sub'
configure.ac:3: installing './install-sh'
configure.ac:3: installing './missing'
Makefile.am: installing './depcomp'
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin$ mkdir build
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin$ pushd build
~/git/vpp-flowtable-plugin/flowtable-plugin/build ~/git/vpp-flowtable-plugin/flowtable-plugin
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$ ../configure --prefix=$VPP_ROOT/vpp
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking dependency style of gcc... gcc3
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$ make
make  all-am
make[1]: Entering directory '/home/vppuser/git/vpp-flowtable-plugin/flowtable-plugin/build'
/bin/bash ./libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"flowtable_plugin\" -DPACKAGE_TARNAME=\"flowtable_plugin\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"flowtable_plugin\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"flowtable_plugin\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -I..    -DDEBUG -g -g -O2 -DDEBUG -g -I/home/vppuser/git/vpp/build-root/install-vpp_debug-native/vpp/include -MT flowtable/flowtable_plugin_la-api.lo -MD -MP -MF flowtable/.deps/flowtable_plugin_la-api.Tpo -c -o flowtable/flowtable_plugin_la-api.lo `test -f 'flowtable/api.c' || echo '../'`flowtable/api.c
libtool: compile:  gcc -DPACKAGE_NAME=\"flowtable_plugin\" -DPACKAGE_TARNAME=\"flowtable_plugin\" -DPACKAGE_VERSION=\"0.9\" "-DPACKAGE_STRING=\"flowtable_plugin 0.9\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"flowtable_plugin\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -I.. -DDEBUG -g -g -O2 -DDEBUG -g -I/home/vppuser/git/vpp/build-root/install-vpp_debug-native/vpp/include -MT flowtable/flowtable_plugin_la-api.lo -MD -MP -MF flowtable/.deps/flowtable_plugin_la-api.Tpo -c ../flowtable/api.c  -fPIC -DPIC -o flowtable/.libs/flowtable_plugin_la-api.o
../flowtable/api.c:25:10: fatal error: flowtable/flowtable.api.h: No such file or directory
 #include <flowtable/flowtable.api.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:529: recipe for target 'flowtable/flowtable_plugin_la-api.lo' failed
make[1]: *** [flowtable/flowtable_plugin_la-api.lo] Error 1
make[1]: Leaving directory '/home/vppuser/git/vpp-flowtable-plugin/flowtable-plugin/build'
Makefile:401: recipe for target 'all' failed
make: *** [all] Error 2
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$


It looks like it is not creating the flowtable include directory.


vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$
vppdev:~/git/vpp-flowtable-plugin/flowtable-plugin/build$ cd $VPP_ROOT
vppdev:~/git/vpp/build-root/install-vpp_debug-native$ ls
external  vpp
vppdev:~/git/vpp/build-root/install-vpp_debug-native$ cd vpp
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp$ ls
bin  etc  include  lib  share  vpp_papi-1.6.2-py2.7.egg
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp$ cd include/
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp/include$ ls
nat  svm  vapi  vat  vcl  vlib  vlibapi  vlibmemory  vnet  vpp  vpp-api  vppinfra  vpp_plugins
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp/include$ cd vpp_plugins/
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp/include/vpp_plugins$ ls
abf  builtinurl  dhcp  dslite     gbp          igmp   ioam  lacp     map    nat   oddbuf  sctp    srv6as      svs         vrrp
acl  cdp         dns   etm        gtpu         ikev2  l2e   lb       mdata  nsh   pppoe   srv6ad  srv6mobile  tlsopenssl
avf  ct6         dpdk  flowprobe  http_static  ila    l3xc  mactime  memif  nsim  rdma    srv6am  stn         vmxnet3
vppdev:~/git/vpp/build-root/install-vpp_debug-native/vpp/include/vpp_plugins$

Really appreciate any insights you can give. I have also tried all sorts of variations including trying to build as a plugin within the VPP tree and also changing build-root to use the non-debug version. The VPP dev environment is really basic (clean checkout with only my test plugin).

Thanks,
-Bill

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.