Test harness for testing XDP programs.
XDP test harness
A test harness that can be used to test the implementation of XDP and XDP programs.
Python 3.5, bcc, Pyroute2, Scapy
To start the test harness, run
python3 -m xdp_test_harness.runner in a folder
containing tests as a superuser. There are three commands that can be used:
Start a client, running tests using network interfaces to process packets by XDP
program. One can further specify which tests to run, using
That is modules, classes and methods separated by dots, for example
python3 -m xdp_test_harness.runner client test_general.ReturnValuesBasic.
Similar to the
client command, but uses the
command instead of a server to process packets by an XDP program.
Starts a server, used by
client command to send packets.
Configuration of interfaces to be used for testing is done in the
file. In the configuration file there are two variables:
A variable specifying the interface of the server, used for testing, and the interface of the server used for communication with a client.
local_server_ctx = ContextServer( ContextLocal("enp0s31f6"), ContextCommunication("192.168.0.106", 6555), )
List of contexts specifying one physical testing interface and one virtual
testing interface. Elements of the list are either
for physical interfaces, or objects created by
for virtual interfaces.
remote_server_ctxs = ContextClientList([ ContextClient( ContextLocal("enp0s31f6", xdp_mode=XDPFlag.SKB_MODE), ContextCommunication("192.168.0.107", 6555) ), new_virtual_ctx( ContextLocal("a_to_b", xdp_mode=XDPFlag.DRV_MODE), ContextCommunication("192.168.1.1"), "test_b", ContextLocal("b_to_a", xdp_mode=XDPFlag.DRV_MODE), ContextCommunication("192.168.1.2", 6000), ), ])
Creating new tests
To create a new test, create a class inheriting from
XDPCase. This class
should be located in a file named with a
test_ prefix and placed in the
tests folder. Each method of this class, that should be run while testing,
has to be named with a
Each test should either call both
attach_xdp methods in this
order, before calling
send_packets, or be decorated with
usingCustomLoader and attach own XDP program to the interface. After
attaching attaching an XDP program, calling
send_packets, returns a
SendResult object, containing lists of packets that arrived to each
interface engaged in testing.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size xdp_test_harness-0.1.4-py3-none-any.whl (27.2 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size xdp-test-harness-0.1.4.tar.gz (13.1 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for xdp_test_harness-0.1.4-py3-none-any.whl