Skip to content

Commit

Permalink
testenv: Update README and link it from top-level
Browse files Browse the repository at this point in the history
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
  • Loading branch information
tohojo committed Mar 18, 2019
1 parent 645dbf8 commit e5c708b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Before you can start completing step in this tutorial, you will need to
install a few dependencies on your system. These are are described in
[[file:setup_dependencies.org]].

We also provide a helper script that will set up a test environment with
virtual interfaces for you to test your code on. This is introduced in the
basic lessons, and also has [[file:testenv/README.org][it's own README file]].

* How the lessons are organised
The tutorial is organised into a number of lessons; each lesson has its own
subdirectory, and the lessons are grouped by category:
Expand Down
34 changes: 25 additions & 9 deletions testenv/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@
#+TITLE: Test environment script
#+OPTIONS: ^:nil

This directory contains a test environment setup script that you can use to
create test environments for testing your XDP programs. It works by creating
virtual ethernet (veth) interface pairs and moving one end of each pair to
another namespace. You can load the XDP program in the other namespace and
This directory contains a setup script that you can use to create test
environments for testing your XDP programs. It works by creating virtual
ethernet (veth) interface pairs and moving one end of each pair to another
network namespace. You can load the XDP program in the other namespace and
send traffic to it through the interface that is visible in the root
namespace.

Run =./testenv.sh= with no parameter to get a list of available commands, or
run =./testenv.sh --help= to get the full help listing with all options. The
script can maintain several environments active at the same time, and you
can switch between them using the =--name= option.

If you don't specify a name, the most recently used environment will be
used. If you don't specify a name when setting up a new environment, a
random name will be generated for you.

Examples:

Setup new environment named "test":
=./testenv.sh create test=
=./testenv.sh setup --name=test=

Create a shell alias for easy use of script from anywhere:
=eval $(./testenv.sh alias)=

See the currently active environment, and a list of all active environment
names (with alias defined as above):
=t status=

Enter the environment:
=./testenv.sh enter test=
Enter the currently active environment:
=t enter=

Execute a command inside the environment:
=./testenv ns_exec test ip a=
=t exec -- ip a=

Teardown the environment:
=./testenv teardown test=
=t teardown=

0 comments on commit e5c708b

Please sign in to comment.