Skip to content

Getting Started

Simon Jouet edited this page Feb 14, 2024 · 1 revision

Environment

This guide has been written with Ubuntu 22.04.3 LTS as the operating system. If you are planning to use a different operating system the dependencies might need to be adjusted.

Install build dependencies

In order to build BPFabric and DPDK you need to install the development and build dependencies packages.

sudo apt install git build-essential pkg-config gcc-multilib meson ninja-build python3-pyelftools libnuma-dev protobuf-c-compiler libprotobuf-c-dev libprotobuf-dev protobuf-compiler libpcap-dev libbpf-dev libclang mininet python3-twisted

Get the code

First retrieve the last version of BPFabric from the repository

mkdir -p ~/repos
cd ~/repos
git clone https://github.com/UofG-netlab/BPFabric.git

Setup DPDK

If you are planning to run the DPDK version of the switch you must first set up the DPDK SDK. The minimum working steps are provided here, read the official documentation for more options.

First get the DPDK 23.11 release

cd ~/repos
wget https://fast.dpdk.org/rel/dpdk-23.11.tar.xz
tar xJf dpdk-23.11.tar.xz
rm dpdk-23.11.tar.xz

Build DPDK from source, this might take a while.

cd ~/repos/dpdk-23.11
meson setup build
cd build
ninja
meson install

Double check DPDK is installed by running dpdk-test

dpdk-test

EAL: Detected CPU lcores: 2
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /run/user/1000/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: No free 2048 kB hugepages reported on node 0
EAL: FATAL: Cannot get hugepage information.
EAL: Cannot get hugepage information.

Compile BPFabric

cd ~/repos/BPFabric
make

Test that the softswitch is compiled

./softswitch/softswitch --help

Usage: softswitch [OPTION...] interface1 interface2 [interface3 ...]
eBPF-switch -- eBPF user space switch

  -c, --controller=address   Controller address default to 127.0.0.1:9000
  -d, --dpid=dpid            Datapath id of the switch
  -i, --sigint               Disable sigint handler
  -p, --promiscuous          Enable promiscuous mode
  -t, --tap[=tap]            Add additional TAP interfaces
  -v, --verbose              Produce verbose output
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Test the the DPDK switch is compiled

./dpdkswitch/build/bpfabric --help

EAL: Detected CPU lcores: 2
EAL: Detected NUMA nodes: 1

Usage: ./dpdkswitch/build/bpfabric [options]
[...]

Check that the example functions are compiled

ls -1 examples/*.o

examples/ewma.o
examples/flowarrival.o
examples/interarrival.o
examples/latency.o
examples/learningswitch_centralized.o
examples/learningswitch.o
examples/lpm.o
examples/mirror.o
examples/trafficcount.o
examples/traffichist.o
examples/wire.o

Check that the controller CLI is running (use CTRL + C to exit)

cd controller

python3 cli.py
--------------------------------------------------------------------------------
    eBPF Switch Controller Command Line Interface - Netlab 2024
    Simon Jouet <[email protected]> - University of Glasgow
--------------------------------------------------------------------------------


Documented commands (type help <topic>):
========================================
help

Undocumented commands:
======================
connections

(Cmd)
Clone this wiki locally