# FRRouting Topology Tests with Mininet
+## Running tests with docker
+
+There is a docker image which allows to run topotests. Instructions can be
+found [here](docker/README.md).
+
## Guidelines
Instructions for use, write or debug topologies can be found in the
new topology, preferably, using the newest
[template](example-test/test_template.py).
-## Running tests with docker
-
-There is a docker image which allows to run topotests. Instructions can be
-found [here](docker/README.md).
-
## Installation of Mininet for running tests
Only tested with Ubuntu 16.04 and Ubuntu 18.04 (which uses Mininet 2.2.x)
## Quickstart
If you have Docker installed, you can run the topotests in Docker.
-The easiest way to do this, is to use the `frr-topotests.sh` script
-from this repository:
+The easiest way to do this, is to use the make targets from this
+repository.
+
+Your current user needs to have access to the Docker daemon. Alternatively
+you can run these commands as root.
```console
-wget -O /usr/local/bin/frr-topotests \
- https://raw.githubusercontent.com/frrouting/topotests/master/docker/frr-topotests.sh
-chmod +x /usr/local/bin/frr-topotests
+make topotests-build
+make topotests
```
-Once this script is in place, simply run it while you are inside your FRR repository:
+The first command will build a docker image with all the dependencies needed
+to run the topotests.
-```console
-frr-topotests
-```
+The second command will spawn an instance of this image, compile FRR inside
+of it, and run the topotests.
## Advanced Usage
-There are several environtment variables which can be used to modify the behavior of
-the image. Those can be listed using `frr-topotests -h`.
+Internally, the topotests make target uses a shell script to spawn the docker
+container.
+
+There are several environment variables which can be used to modify the behavior
+of the script, these can be listed by calling it with `-h`:
+
+```console
+./tests/topotests/docker/frr-topotests.sh -h
+```
For example, a volume is used to cache build artifacts between multiple runs
of the image. If you need to force a complete recompile, you can set `TOPOTEST_CLEAN`:
```console
-TOPOTEST_CLEAN=1 frr-topotests
+TOPOTEST_CLEAN=1 ./tests/topotests/docker/frr-topotests.sh
```
-By default, `frr-topotests` will build frr and run pytest. If you append
+By default, `frr-topotests.sh` will build frr and run pytest. If you append
arguments and the first one starts with `/` or `./`, they will replace the call to
pytest. If the appended arguments do not match this patttern, they will be provided to
pytest as arguments.
So, to run a specific test with more verbose logging:
```console
-frr-topotests -vv -s all-protocol-startup/test_all_protocol_startup.py
+./tests/topotests/docker/frr-topotests.sh -vv -s all-protocol-startup/test_all_protocol_startup.py
```
And to compile FRR but drop into a shell instead of running pytest:
```console
-frr-topotests /bin/bash
+./tests/topotests/docker/frr-topotests.sh /bin/bash
```