]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/README.md
bgp-ecmp-topo1: Workaround for version check
[mirror_frr.git] / tests / topotests / README.md
CommitLineData
598d8457 1# FRRouting Topology Tests with Mininet
59d80fff
MW
2
3## Installation of Mininet for running tests
024fc0b8 4Only tested with Ubuntu 16.04 (which uses Mininet 2.2.0)
59d80fff 5
8ab9a376
MW
6Instructions are the same for all setups (ie ExaBGP is only used for BGP
7tests)
59d80fff
MW
8
9### Installing Mininet Infrastructure:
10
111. apt-get install mininet
122. apt-get install python-pip
133. apt-get install iproute
144. pip install ipaddr
6b1be61a 155. pip install pytest
cc230e73
MW
166. pip install exabgp==3.4.17
17 (Newer 4.0 version of exabgp is not yet supported)
6b1be61a
MW
187. useradd -d /var/run/exabgp/ -s /bin/false exabgp
19
20### Enable Coredumps
21Optional, will give better output
22
231. apt-get install gdb
242. disable apport (which move core files)
25
26 Set `enabled=0` in `/etc/default/apport`
27
283. Update security limits
29
30 Add/change `/etc/security/limits.conf` to
31
32 #<domain> <type> <item> <value>
33 * soft core unlimited
34 root soft core unlimited
35 * hard core unlimited
36 root hard core unlimited
37
384. reboot (for options to take effect)
59d80fff 39
598d8457 40## FRRouting (FRR) Installation
1c909f42 41FRR needs to be installed separatly. It is assume to be configured
8ab9a376 42like the standard Ubuntu Packages:
59d80fff 43
33ae1f75
MW
44- Binaries in /usr/lib/frr
45- State Directory /var/run/frr
46- Running under user frr, group frr
47- vtygroup: frrvty
48- config directory: /etc/frr
49- For FRR Packages, install the dbg package as well for coredump decoding
59d80fff 50
33ae1f75 51No FRR config needs to be done and no FRR daemons should be run ahead
59d80fff
MW
52of the test. They are all started as part of the test
53
598d8457 54#### Manual FRRouting (FRR) build
024fc0b8 55
33ae1f75 56If you prefer to manually build FRR, then use the following suggested config:
024fc0b8
MW
57
58 ./configure \
59 --prefix=/usr \
33ae1f75
MW
60 --localstatedir=/var/run/frr \
61 --sbindir=/usr/lib/frr \
62 --sysconfdir=/etc/frr \
024fc0b8
MW
63 --enable-vtysh \
64 --enable-pimd \
65 --enable-multipath=64 \
33ae1f75
MW
66 --enable-user=frr \
67 --enable-group=frr \
68 --enable-vty-group=frrvty \
024fc0b8
MW
69 --with-pkg-extra-version=-my-manual-build
70
33ae1f75 71And create frr User and frrvty group as follows:
024fc0b8 72
33ae1f75
MW
73 addgroup --system --gid 92 frr
74 addgroup --system --gid 85 frrvty
33ae1f75 75 adduser --system --ingroup frr --home /var/run/frr/ \
598d8457 76 --gecos "FRRouting suite" --shell /bin/false frr
3a4f98d5 77 usermod -G frrvty frr
024fc0b8 78
59d80fff
MW
79## Executing Tests
80
6b1be61a
MW
81#### Execute all tests with output to console
82
83 py.test -s -v --tb=no
84
50c40bde
MW
85All test_* scripts in subdirectories are detected and executed (unless
86disabled in `pytest.ini` file)
6b1be61a
MW
87
88`--tb=no` disables the python traceback which might be irrelevant unless the
89test script itself is debugged
90
91#### Execute single test
09bd98fb 92
6b1be61a
MW
93 cd test_to_be_run
94 ./test_to_be_run.py
09bd98fb 95
6b1be61a
MW
96For further options, refer to pytest documentation
97
98Test will set exit code which can be used with `git bisect`
59d80fff
MW
99
100For the simulated topology, see the description in the python file
8ab9a376
MW
101
102If you need to clear the mininet setup between tests (if it isn't cleanly
103shutdown), then use the `mn -c` command to clean up the environment
104
50c40bde
MW
105#### (Optional) StdErr log from daemos after exit
106
107To enable the reporting of any messages seen on StdErr after the
108daemons exit, the following env variable can be set.
109
110 export TOPOTESTS_CHECK_STDERR=Yes
111
112(The value doesn't matter at this time. The check is if the env variable
113exists or not)
114There is no pass/fail on this reporting. The Output will be reported to
115the console
116
117 export TOPOTESTS_CHECK_MEMLEAK="/home/mydir/memleak_"
118
119This will enable the check and output to console and the writing of
120the information to files with the given prefix (followed by testname),
121ie `/home/mydir/memcheck_test_bgp_multiview_topo1.txt` in case of a
122memory leak.
123
124#### (Optional) Collect Memory Leak Information
125
126FreeRangeRouting processes have the capabilities to report remaining memory
127allocations upon exit. To enable the reporting of the memory, define an
128enviroment variable `TOPOTESTS_CHECK_MEMLEAK` with the file prefix, ie
129
130 export TOPOTESTS_CHECK_MEMLEAK="/home/mydir/memleak_"
131
132This will enable the check and output to console and the writing of
133the information to files with the given prefix (followed by testname),
134ie `/home/mydir/memcheck_test_bgp_multiview_topo1.txt` in case of a
135memory leak.
136
3a1f8275
MW
137#### (Optional) Run topotests with GCC AddressSanitizer enabled
138
139Topotests can be run with the GCC AddressSanitizer. It requires GCC 4.8 or
140newer. (Ubuntu 16.04 as suggested here is fine with GCC 5 as default)
141For more information on AddressSanitizer, see
142https://github.com/google/sanitizers/wiki/AddressSanitizer
143
144The checks are done automatically in the library call of `checkRouterRunning`
145(ie at beginning of tests when there is a check for all daemons running).
146No changes or extra configuration for topotests is required beside compiling
147the suite with AddressSanitizer enabled.
148
149If a daemon crashed, then the errorlog is checked for AddressSanitizer
150output. If found, then this is added with context (calling test) to
151`/tmp/AddressSanitizer.txt` in markdown compatible format.
152
153Compiling for GCC AddressSanitizer requires to use gcc as a linker as well
154(instead of ld). Here is a suggest way to compile frr with AddressSanitizer
155for `stable/3.0` branch:
156
157 git clone https://github.com/FRRouting/frr.git
158 cd frr
159 git checkout stable/3.0
160 ./bootstrap.sh
161 export CC=gcc
162 export CFLAGS="-O1 -g -fsanitize=address -fno-omit-frame-pointer"
163 export LD=gcc
164 export LDFLAGS="-g -fsanitize=address -ldl"
165 ./configure --enable-shared=no \
166 --prefix=/usr/lib/frr --sysconfdir=/etc/frr \
167 --localstatedir=/var/run/frr \
168 --sbindir=/usr/lib/frr --bindir=/usr/lib/frr \
169 --enable-exampledir=/usr/lib/frr/examples \
170 --with-moduledir=/usr/lib/frr/modules \
171 --enable-multipath=0 --enable-rtadv \
172 --enable-tcp-zebra --enable-fpm --enable-pimd
173 make
174 sudo make install
09bd98fb
MW
175 # Create symlink for vtysh, so topotest finds it in /usr/lib/frr
176 sudo ln -s /usr/lib/frr/vtysh /usr/bin/
177
178and create `frr` user and `frrvty` group as shown above
3a1f8275 179
8ab9a376
MW
180## License
181
182All the configs and scripts are licensed under a ISC-style license. See
183Python scripts for details.