Start abstraction of the module_present into module_present_linux and freebsd
To allow for multiple platforms that the topotests can be run on.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Start the cleanup of diagnose_env to allow the running of topotests
on platforms besides linux.
So we split up diagnose_env into linux and freebsd variants.
At this point in time freebsd doesn't have any special code.
To be determined in the future.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
A recent commit broke this functionality, so add a very basic
route leak vrf test.
router bgp 99 vrf DONNA
address-family ipv4 uni
redistribute connected
import vrf EVA
router bgp 99 vrf EVA
address-family ipv4 uni
redistribute connected
import vrf DONNA
Routes should be leaked between the two vrf's. Ensure that it does.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
We have set up automated builds for the topotest images at dockerhub.
Therefore, people don't need to perform a local build to run the
topotests on docker, but can use the image built by dockerhub.
As there is not much benefit in building locally, but the disadvantage
of weird errors if using an outdated image, change the topotests target
to always pull the most recent image from dockerhub.
Add an environment variable to disable this, e.g. for local development.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
YANG allows lists without keys for operational data, in which case
the list elements are uniquely identified using a positional index
(starting from one).
This commit does the following:
* Remove the need to implement the 'get_keys' and 'lookup_entry'
callbacks for keyless lists.
* Extend nb_oper_data_iter_list() so that it special-cases keyless
lists appropriately. Since both the CLI and the sysrepo plugin
use nb_oper_data_iterate() to fetch operational data, both these
northbound clients automatically gain the ability to understand
keyless lists without additional changes.
* Extend the confd plugin to special-case keyless lists as well. This
was a bit painful to implement given ConfD's clumsy API, but
keyless lists should work ok now.
* Update the "test_oper_data" unit test to test keyless YANG lists in
addition to regular lists.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
These are causing random test failures when the host's domainname is
actually set to something (as opposed to empty/unset, which it is 99% of
times.)
Signed-off-by: David Lamparter <equinox@diac24.net>
Confirmed commits allow the user to request an automatic rollback to
the previous configuration if the commit operation is not confirmed
within a number of minutes. This is particularly useful when the user
is accessing the CLI through the network (e.g. using SSH) and any
configuration change might cause an unexpected loss of connectivity
between the user and the managed device (e.g. misconfiguration of a
routing protocol). By using a confirmed commit, the user can rest
assured the connectivity will be restored after the given timeout
expires, avoiding the need to access the router physically to fix
the problem.
When "commit confirmed TIMEOUT" is used, a new "commit" command is
expected to confirm the previous commit before the given timeout
expires. If "commit confirmed TIMEOUT" is used while there's already
a confirmed-commit in progress, the confirmed-commit timeout is
reset to the new value.
In the current implementation, if other users perform commits while
there's a confirmed-commit in progress, all commits are rolled back
when the confirmed-commit timeout expires. It's recommended to use
the "configure exclusive" configuration mode to prevent unexpected
outcomes when using confirmed commits.
When an user exits from the configuration mode while there's a
confirmed-commit in progress, the commit is automatically rolled
back and the user is notified about it. In the future we might
want to prompt the user if he or she really wants to exit from the
configuration mode when there's a pending confirmed commit.
Needless to say, confirmed commit only work for configuration
commands converted to the new northbound model. vtysh support will
be implemented at a later time.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
We call `modprobe -n` to check if mpls modules are available to be
loaded. We do this as normal user, to only ask for root permissions
if we are actually loading the module.
This breaks if `modprobe` is in `/sbin` and normal users don't have
sbin in path.
So add `/sbin` to the search path to work around this.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
If we mount the tests into the container from the host, we also
mount any `*.pyc` files with them, which will lead to issues
as the mount is done read-only to avoid any changes to the host.
Since the tests are now integrated and we already create a writeable
copy of the FRR tree, just use the tests from the FRR tree to avoid
this issue.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit adds a template for "show bgp ipv4/ipv6" display to include default local preference and local-AS O/P.
Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
Before this update, json_cmp_results which were formatted as strings
would not show the error mesage but just an object reference.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This reverts commit 659782730b.
Apparently, the build context is inferred from the Dockerfile path.
Yay for sensible documentation. :/
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
We are mounting the topotests from the host into the container
and mark them as read-only to avoid any modifications to the host.
Pytest tries to create a .pytest_chache directory in that location
which fails because of the read-only mount.
Configure a different cache dir which is writable to resolve this.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
In order to support automated builds, the build context needs to be
the repository root.
So adapt our dockerfile and buildscript for this. Also, add files which
should not be included into the build context in .dockerignore to limit
the size of the build context to something sensible.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
With libyang, we need to build the frr_user_types.so libyang
plugin for FRR to work.
This means we cannot build with disable shared.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
For normal operation, there is no need for the container to run
in the host network environment or to have access to the users
X Session.
To accomodate usecases which need this, there is now a `TOPOTEST_OPTIONS`
environment variable to provide additional options to the docker run
command.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
According to https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
`apt-get update` should always be combined with `apt-get install` in
the same `RUN` statement, to avoid installation of outdated packages.
Also, combine some more `RUN`s together as to avoid fewer layers.
Finally, remove some comments which are superflous. Comments shouldn't
describe what is done, especially when it's obvious. They should
explain why something is done.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Add a breadcrumb for people testing to hopefully allow
them to figure out what is going wrong when they
are testing different versions of FRR using
topotests and staticd is not running because
this version of staticd needs to be cleaned up
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Python's `string' method 'replace' doesn't actually modify the string,
instead it returns a new string with the modified content.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
By default, default vrf name is default, whereas BGP default vrf was
hardcoded to Default. Because this will be fixes, do not care about the
vrf name field and apply a regexp to move Default to default.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Topotests would fail with errors like these:
AssertionError: Linux Kernel IPv6 Routing Table verification failed for router r1:
--- actual OSPFv3 IPv6 routing table
+++ expected OSPFv3 IPv6 routing table
@@ -8,6 +8,6 @@
fc00:4:4:4::/64 via fe80::__(r3-sw5)__ dev r1-sw5 proto XXXX metric 20 pref medium
fc00🅰️a🅰️:/64 dev r1-sw5 proto XXXX metric 256 pref medium
fc00🅱️b🅱️:/64 via fe80::__(r3-sw5)__ dev r1-sw5 proto XXXX metric 20 pref medium
-fe80::/64 dev lo proto XXXX metric 256 pref medium
fe80::/64 dev r1-stubnet proto XXXX metric 256 pref medium
-fe80::/64 dev r1-sw5 proto XXXX metric 256 pref medium
+fe80::/64 dev r1-sw5 proto XXXX metric 256 pref medium
+unreachable fe80::/64 dev lo proto XXXX metric 256 error -101 pref medium
Resolve this by not comparing link-local routes.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Label proxy manager test covering both LDP and BGP label requests.
lib/topotest.py:restartRouter() function has been fixed in order to
allow propagating options to deamons other than zebra.
Signed-off-by: F. Aragon <paco@voltanet.io>
Test that after a link goes down BGPd will be notified and recovered
quickly. Also test that BFD show command tells us that the peer went
down.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
The code was not attempting to set the max platform_labels
on a per router basis, leaving us w/ situations where
mpls install would fail because platform_labels was 0.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Because on some platforms like i386, 'ip netns ' commands are unstable,
then I use an other API to operate the shutdown/no shutdown operation by
using vtysh.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
To analyse which route has been entered in the kernel, the
zebra show ip route vrf command is used.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
In the case where vrf backend is based on NETNS, the link enable command
switches from context so as to perform the command.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
In a effort to migrate more tests to use `run_and_expect` instead of
`sleep`s, this commit imports some common functions used to compare
router output. Retrying output comparison for N times, instead of
relying on arbitrary code `sleep`s, should help CI system tests fail
less and possibly run for less time.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
When normalizing a text also remove trailing whitespace since external
tools might add them. This commit fixes a test failure in ospf_topo1 on
Ubuntu 18.04.1.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Standardize run_and_expect to show start and end time along with maximum
estimated wait time.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
IPv6 metric for FRR version <3.X is different than for newer versions,
so to avoid extra code logic lets just ignore these checks.
The IPv6 changes weren't detected earlier because of the json_cmp list
fix.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
The pseudo_TE-IS entries vary and depend on the way the topology
converges, so lets not rely on that.
The IS-IS routers in the middle TE-IS entries vary the parent
interface, so we also removed that entry to avoid json_cmp comparison
failures.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Don't quit on the first match. While here add some more `json_cmp` tests
to make sure this doesn't happen again.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Allow json_cmp to compare JSON values which begin with a list instead of
a dictionary.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
The v6 isis topology didn't really match the illustration. Fix
the configs and the test expectations so that all the parts
agree.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
The table header has changed slightly for "bgp show" commands. Change
all-protocol-startup (test_bgp_ipv4() and test_bgp_ipv6()) and
bgp_multiview_topo1 (test_bgp_routingTable()) to run diffs against multiple
templates (representing the various valid outputs for different versions
of the FRR code) and mark the test "passed" if any one template matches.
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Check CE routes from CE in another VRF attached to same PE router. Relies
on FRR bug fix to not require labeled nexthop for paths that go only
through PE router and not mpls core.
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Prior behavior of luCommand was to convert newlines to spaces in DUT
output before pattern matching. New method operating in parallel uses
re.DOTALL to mimic same behavior and allow preserving original DUT output.
The original output is needed for some scripts that parse line-by-line.
There is also some test code to compare match results using the
old way and new way and log a message if they are different. After
some short time we can develop confidence that using this new method
will not break any existing tests.
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
It seems vrf netns is not working on 32 bit platforsm.
For that, the test should be cancelled.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
The test consist in starting a BGP router on a NETNS, and interacting
with an exaBGP instance. The test automatically relies on VRF with netns
backend but can be easily configured so as to perform basic BGP VRF
testing with VRF with VRF-lite backend.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
topotest library is being added a new parameter when preparing the
configurationof each daemon. This parameter will be used to call the
daemon with some extra parameters. The -n parameter for zebra is taken
into account.
Also, when a extra parameter is given for calling zebra, a check is done to
see if it is possible to run zebra daemon with that option. This is the
case for vrfwnetns option. If not available, an error message is sent
back.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Support the new OSPF JSON output format for `show ip ospf neighbor
json` introduced in FRR's PR 1723.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
In order to avoid failed test on unsupported version:
- Test that version is greater than 4
- Check that Segment Routing CLI are available
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
- Build a topology made of 4 routers: 3 PE connected to a P
- Segment Routing is activated on all 4 routers with various setting
for the MSD, Global Block and Prefix (with or without NO-PHP flag)
- 2 tests have been elaborated: the first one check the consistency of the
Segment Routing database on each router compared to a reference and the second
one check that the MPLS FIB has been correctly configured on each router,
again compared to a reference
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Use the pytest assert function to be able to report to pytest failures
that happened inside the API.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
It was noticed that this topology doesn't converge when there are IPv6
configurations, so this commit makes the tests to be skipped when the
version is 2.X.Y.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org
Configure IPv6 addresses and ISIS distribution, then test the topology
for the newly configured addresses.
This commit also adds support for parsing IPv6 data from the ISIS
topology output while updating the routers topology JSON files.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Allow isis-topo1 tests to run on stable versions (2.0.2 and 3.0.2).
There are two differences between the stable versions and master:
1. ISIS nexthops don't show interfaceName nor interfaceIndex
(on 'show ip route json')
2. New FRR version install ISIS routes in Linux with a different proto
type identification.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Accept new format in ospf neighbor json output in addition to
old version. New format was introduced with PR1659
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Remove PID files after a SIGKILL or confirmation that the pid file no
longer contains a running PID.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
The messages level of this commit were downgraded because some of them
happen on 'non-error' situations. This should help diminish the error
log verbosity on the CI-system run.
It was found a regression on an edge case when the second number in the
comparison was (at least) 2 numbers longer the comparison would fail
with a wrong return value. It succeeded for some cases because the
first comparison in the exception was correct, but not the second.
- Generic Debian only has a single space in front of “proto” in the linux shell routing outptu
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
PR #1213 in FRR changed the protocol of installed LSPs. To avoid breaking
older outstanding Pull Requests, remove the protocol check.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
- Distance used to be wrong (0), new commit fixes this (90). To avoid breaking older outstanding Pull Requests, remove the distance check
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
The values saved for the route table and eigrp topo
were a bit off because they have been corrected
in the eigrp daemon
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This feature from pytest can not be used to detect runtime errors.
Also, remove test_router_running() since all tests should actually check
if all daemons are up and running.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Nothing fancy here, just add 3 routers in a row
attempt to let eigrp come up and start a mininet
xterm to debug, since eigrp doesn't work yet.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
json check accidently checked for the spfLastDurationMsecs which
isn't always 0 for slower system in our tests. ARM7 sometimes has
a slightly higher value (1).
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Add check for number of routes to convergence. InQ=0, OutQ=0
together with correct number of routes received shows that
BGP has converged
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Using relative path to start the exabgp python scripts didn't work out
of the box in my enviroment, so be more specific since we already know
where the scripts are.