1tdc - Linux Traffic Control (tc) unit testing suite
2
3Author: Lucas Bates - lucasb@mojatatu.com
4
5tdc is a Python script to load tc unit tests from a separate JSON file and
6execute them inside a network namespace dedicated to the task.
7
8
9REQUIREMENTS
10------------
11
12*  Minimum Python version of 3.4. Earlier 3.X versions may work but are not
13   guaranteed.
14
15*  The kernel must have network namespace support
16
17*   The kernel must have veth support available, as a veth pair is created
18   prior to running the tests.
19
20*  All tc-related features must be built in or available as modules.
21   To check what is required in current setup run:
22   ./tdc.py -c
23
24   Note:
25   In the current release, tdc run will abort due to a failure in setup or
26   teardown commands - which includes not being able to run a test simply
27   because the kernel did not support a specific feature. (This will be
28   handled in a future version - the current workaround is to run the tests
29   on specific test categories that your kernel supports)
30
31
32BEFORE YOU RUN
33--------------
34
35The path to the tc executable that will be most commonly tested can be defined
36in the tdc_config.py file. Find the 'TC' entry in the NAMES dictionary and
37define the path.
38
39If you need to test a different tc executable on the fly, you can do so by
40using the -p option when running tdc:
41	./tdc.py -p /path/to/tc
42
43
44RUNNING TDC
45-----------
46
47To use tdc, root privileges are required. tdc will not run otherwise.
48
49All tests are executed inside a network namespace to prevent conflicts
50within the host.
51
52Running tdc without any arguments will run all tests. Refer to the section
53on command line arguments for more information, or run:
54	./tdc.py -h
55
56tdc will list the test names as they are being run, and print a summary in
57TAP (Test Anything Protocol) format when they are done. If tests fail,
58output captured from the failing test will be printed immediately following
59the failed test in the TAP output.
60
61
62USER-DEFINED CONSTANTS
63----------------------
64
65The tdc_config.py file contains multiple values that can be altered to suit
66your needs. Any value in the NAMES dictionary can be altered without affecting
67the tests to be run. These values are used in the tc commands that will be
68executed as part of the test. More will be added as test cases require.
69
70Example:
71	$TC qdisc add dev $DEV1 ingress
72
73
74COMMAND LINE ARGUMENTS
75----------------------
76
77Run tdc.py -h to see the full list of available arguments.
78
79-p PATH           Specify the tc executable located at PATH to be used on this
80                  test run
81-c                Show the available test case categories in this test file
82-c CATEGORY       Run only tests that belong to CATEGORY
83-f FILE           Read test cases from the JSON file named FILE
84-l [CATEGORY]     List all test cases in the JSON file. If CATEGORY is
85                  specified, list test cases matching that category.
86-s ID             Show the test case matching ID
87-e ID             Execute the test case identified by ID
88-i                Generate unique ID numbers for test cases with no existing
89                  ID number
90
91
92ACKNOWLEDGEMENTS
93----------------
94
95Thanks to:
96
97Jamal Hadi Salim, for providing valuable test cases
98Keara Leibovitz, who wrote the CLI test driver that I used as a base for the
99   first version of the tc testing suite. This work was presented at
100   Netdev 1.2 Tokyo in October 2016.
101Samir Hussain, for providing help while I dove into Python for the first time
102    and being a second eye for this code.
103