# VPP Plugin ## Introduction A high-performance Hybrid ICN forwarder as a plugin to VPP. The plugin provides the following functionalities: - Fast packet processing - Interest aggregation - Content caching - Forwarding strategies ## Quick start All of these commands should be run from the code tree root. VPP installed with DEB pkg: ```bash cd hicn-plugin mkdir -p build cd build cmake .. -DCMAKE_INSTALL_PREFIX=/usr make sudo make install ``` VPP source code - build type `RELEASE`: ```bash cd hicn-plugin mkdir -p build cd build cmake .. -DVPP_HOME=/build-root/install-vpp-native/vpp -DCMAKE_INSTALL_PREFIX=/build-root/install-vpp-native/vpp make sudo make install ``` VPP source code - build type `DEBUG`: ```bash cd hicn-plugin mkdir -p build cd build cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DVPP_HOME=/build-root/install-vpp_debug-native/vpp -DCMAKE_INSTALL_PREFIX=/build-root/install-vpp_debug-native/vpp make sudo make install ``` CMAKE variables: - `CMAKE_INSTALL_PREFIX`: set the install directory for the hicn-plugin. This is the common path to the lib folder containing vpp_plugins and vpp_api_test_plugins folders. Default is /usr/local. - `VPP_HOME`: set the directory containing the include and lib directories of vpp. ## Using hICN plugin ### Dependencies Build dependencies: - VPP 20.01 - DEB packages (can be found - vpp - libvppinfra-dev - vpp-dev Runtime dependencies: - VPP 20.01 - DEB packages (can be found - vpp - vpp-plugin-core - vpp-plugin-dpdk (only to use DPDK compatible nics) Hardware support (not mandatory): - [DPDK](http://DPDK.org/) compatible NICs ## Getting started In order to start, the hICN plugin requires a running instance of VPP. The steps required to successfully start hICN are: - Setup the host to run VPP - Configure VPP to use DPDK compatible nics - Start VPP - Configure VPP interfaces - Configure and start hICN Detailed information for configuring VPP can be found at [https://wiki.fd.io/view/VPP](https://wiki.fd.io/view/VPP). ### Setup the host for VPP Hugepages must be enabled in the system. ```bash sudo sysctl -w vm.nr_hugepages=1024 ``` In order to use a DPDK interface, the `uio` and `uio_pci_generic` or `vfio_pci` modules need to be loaded in the kernel. ```bash sudo modprobe uio sudo modprobe uio_pci_generic sudo modprobe vfio_pci ``` If the DPDK interface we want to assign to VPP is up, we must bring it down: ```bash sudo ifconfig down ``` or ```bash sudo ip link set down ``` ### Configure VPP The file `/etc/VPP/startup.conf` contains a set of parameters to setup VPP at startup. The following example sets up VPP to use a DPDK interface: ```bash unix { nodaemon log /tmp/vpp.log full-coredump } api-trace { on } api-segment { gid vpp } dpdk { dev 0000:08:00.0 } plugins { ## Disable all plugins by default and then selectively enable specific plugins plugin default { disable } plugin dpdk_plugin.so { enable } plugin acl_plugin.so { enable } plugin memif_plugin.so { enable } plugin hicn_plugin.so { enable } ## Enable all plugins by default and then selectively disable specific plugins # plugin dpdk_plugin.so { disable } # plugin acl_plugin.so { disable } } ``` `0000:08:00.0` must be replaced with the actual PCI address of the DPDK interface. ### Start VPP VPP can be started as a process or a service: Start VPP as a service in Ubuntu 16.04+: ```bash sudo systemctl start vpp ``` Start VPP as a process: ```bash sudo vpp -c /etc/vpp/startup.conf ``` ### Configure hICN plugin The hICN plugin can be configured either using the VPP command-line interface (CLI), through a configuration file or through the VPP binary API. #### hICN plugin CLI The CLI commands for the hICN plugin start all with the `hicn` keyword. To see the full list of command available type: ```bash sudo vppctl vpp# hicn ? ``` `hicn control param`: configures the internal parameter of the hICN plugin. This command must be run before hicn control start. ```bash hicn control param { pit { size | { dfltlife | minlife | maxlife } } | cs {size | app } } :set the maximum number of entry in the PIT or CS. Default for PIT is 131072, for CS is 4096. CS size cannot be grater than PIT size. Moreover CS size must be smaller than (# of vlib buffer - 8196). :set the default, maximum or minimum lifetime of pit entries. Default value 2s (default), 0.2s (minumum), 20s (maximum) :set the portion of CS to reserve to application running locally on the forwarder. Default is 30% of the cs size. ``` `hicn control start`: starts the hICN plugin in VPP. `hicn control stop` : stops the hICN plugin in VPP. Currently not supported. `hicn face app` : manipulates producer and consumer application faces in the forwarder. ```bash hicn face app {add intfc {prod prefix cs_size } {cons}} | {del } :software interface existing in vpp on top of which to create an application face :prefix to bound to the producer application face. Only content matching the prefix will be allowed through such face. :content store size associated to the producer face. :id of the face to remove ``` `hicn face ip`: manipulates ip application faces in the forwarder. ```bash hicn face ip {add [local ] remote intfc } | {del id } :the IPv4 or IPv6 local IP address to bind to (not mandatory, if not specified the local address is one of the address assigned to sw_if) :the IPv4 or IPv6 address of the remote system :software interface on thop of which we create the face :id of the face to remove ``` `hicn face show`: list the available faces in the forwarder. ```bash hicn face show [| type ] :face id of which we want to display the informations :shows all the ip or udp faces available ``` `hicn face udp`: manipulates udp application faces in the forwarder. ```bash hicn face udp {add src_addr port dst_addr port } intfc | {del id } :the IPv4 or IPv6 local IP address to bind to :the local UDP port :the IPv4 or IPv6 address of the remote system :the remote UDP port :software interface on thop of which we create the face :id of the face to remove ``` `hicn fib`: manipulates hicn fib entries. ```bash hicn fib {{add | delete } prefix face } | set strategy prefix :prefix to add to the FIB :face id to add as nexto hop in the FIB entry :set a strategy for the corresponding prefix ``` `hicn pgen client`: set an vpp forwarder as an hicn packet generator client. ```bash hicn pgen client fwd src n_ifaces name lifetime intfc max_seq n_flows :set if the underlying forwarder is configured as ip or hicn :source address to use in the interests, i.e., the locator for routing the data packet back :set the number of ifaces (consumer faces) to emulate. If more than one, each interest is sent times, each of it with a different source address calculated from :prefix to use to generate hICN names :lifetime of the interests :interface through which the forwarder receives data :max the sequence number to use in the interest. Cycling between 0 and this value :emulate multiple flows downloaded in parallel ``` `hicn pgen server`: set an vpp forwarder as an hicn packet generator client. ```bash hicn pgen server fwd name intfc size :set if the underlying forwarder is configured as ip or hicn :prefix to use to reply to interest :interface through which the forwarder receives interest :size of the data payload ``` `hicn punting`: manipulates punting rules. ```bash hicn punting {add|delete} prefix intfc {type ip | type src_port dst_port } :prefix to punt to the hICN plugin :software interface where to apply the punting :creates a punting rule for hICN packet encapsulated into a ip4/6|udp tunnel or for regular hicn packet :source port of the udp4/6 tunnel :destination port of the udp4/6 tunnel ``` `hicn show`: show forwarder information. ```bash hicn show [detail] [strategies] :shows additional details as pit,cs entries allocation/deallocation :shows only the available strategies int he forwarder ``` `hicn strategy mw set`: set the weight for a face. ```bash hicn strategy mw set prefix face weight :prefix to which the strategy applies :id of the face to set the weight :weight ``` #### hICN plugin configuration file A configuration can be use to setup the hicn plugin when vpp starts. The configuration file is made of a list of CLI commands. In order to set vpp to read the configuration file, the file `/etc/vpp/startup.conf` needs to be modified as follows: ```bash unix { nodaemon log /tmp/vpp.log full-coredump startup-config } ``` #### hICN plugin binary API The binary api, or the vapi, can be used as well to configure the hicn plugin. For each CLI command there is a corresponding message in the binary api. The list of messages is available in the file hicn.api (located in `hicn/hicn-plugin/src/`). ### Example: consumer and producer ping In this example, we connect two vpp forwarders, A and B, each of them running the hicn plugin. On top of forwarder A we run the `ping_client` application, on top of forwarder B we run the `ping_server` application. Each application connects to the underlying forwarder through a memif-interface. The two forwarders are connected through a dpdk link. #### Forwarder A (client) ```bash sudo vppctl vpp# set interface ip address TenGigabitEtherneta/0/0 2001::2/64 vpp# set interface state TenGigabitEtherneta/0/0 up vpp# hicn control start vpp# hicn face ip add local 2001::2 remote 2001::3 intfc TenGigabitEtherneta/0/0 vpp# hicn fib add prefix b002::1/64 face 0 vpp# hicn punting add prefix b002::1/64 intfc TenGigabitEtherneta/0/0 type ip ``` #### Forwarder B (server) ```bash sudo vppctl vpp# set interface ip address TenGigabitEtherneta/0/1 2001::3/64 vpp# set interface state TenGigabitEtherneta/0/1 up vpp# hicn control start vpp# hicn punting add prefix b002::1/64 intfc TenGigabitEtherneta/0/1 type ip ``` Once the two forwarder are started, run the `ping_server` application on the host where the forwarder B is running: ```bash sudo ping_server -n b002::1 ``` Then `ping_client` on the host where forwarder B is running: ```bash sudo ping_client -n b002::1 ```