|
2 | 2 | #+TITLE: Test environment script
|
3 | 3 | #+OPTIONS: ^:nil
|
4 | 4 |
|
5 |
| -This directory contains a test environment setup script that you can use to |
6 |
| -create test environments for testing your XDP programs. It works by creating |
7 |
| -virtual ethernet (veth) interface pairs and moving one end of each pair to |
8 |
| -another namespace. You can load the XDP program in the other namespace and |
| 5 | +This directory contains a setup script that you can use to create test |
| 6 | +environments for testing your XDP programs. It works by creating virtual |
| 7 | +ethernet (veth) interface pairs and moving one end of each pair to another |
| 8 | +network namespace. You can load the XDP program in the other namespace and |
9 | 9 | send traffic to it through the interface that is visible in the root
|
10 | 10 | namespace.
|
11 | 11 |
|
| 12 | +Run =./testenv.sh= with no parameter to get a list of available commands, or |
| 13 | +run =./testenv.sh --help= to get the full help listing with all options. The |
| 14 | +script can maintain several environments active at the same time, and you |
| 15 | +can switch between them using the =--name= option. |
| 16 | + |
| 17 | +If you don't specify a name, the most recently used environment will be |
| 18 | +used. If you don't specify a name when setting up a new environment, a |
| 19 | +random name will be generated for you. |
| 20 | + |
12 | 21 | Examples:
|
13 | 22 |
|
14 | 23 | Setup new environment named "test":
|
15 |
| -=./testenv.sh create test= |
| 24 | +=./testenv.sh setup --name=test= |
| 25 | + |
| 26 | +Create a shell alias for easy use of script from anywhere: |
| 27 | +=eval $(./testenv.sh alias)= |
| 28 | + |
| 29 | +See the currently active environment, and a list of all active environment |
| 30 | +names (with alias defined as above): |
| 31 | +=t status= |
16 | 32 |
|
17 |
| -Enter the environment: |
18 |
| -=./testenv.sh enter test= |
| 33 | +Enter the currently active environment: |
| 34 | +=t enter= |
19 | 35 |
|
20 | 36 | Execute a command inside the environment:
|
21 |
| -=./testenv ns_exec test ip a= |
| 37 | +=t exec -- ip a= |
22 | 38 |
|
23 | 39 | Teardown the environment:
|
24 |
| -=./testenv teardown test= |
| 40 | +=t teardown= |
0 commit comments