Commit Graph

1013 Commits

Author SHA1 Message Date
Rafael Zalamena
3e379f6e49 topotests: fix json_cmp wrong list handling
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>
2018-11-27 20:22:14 -05:00
Rafael Zalamena
a82e5f9a7f lib: improve json_cmp
Allow json_cmp to compare JSON values which begin with a list instead of
a dictionary.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:14 -05:00
Rafael Zalamena
5a2f1e6fbe *: ignore .pytest_cache directories
These folders are being generated by recent py.test versions and should
be ignored.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:14 -05:00
Christian Franke
f2d6ce41ca lib: check presence of mpls modules, not exitcode of modprobe
Signed-off-by: Christian Franke <nobody@nowhere.ws>
2018-11-27 20:22:14 -05:00
Mark Stapp
cf38bed97a isis-topo1: make isis topology match .dot file
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>
2018-11-27 20:22:14 -05:00
Philippe Guibert
4b1f7a62db bgp_vrf_netns: swap the order of netns destruction
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-11-27 20:22:14 -05:00
Martin Winter
2c805e6cf6 lib: Fix staticd extension
Do not provide a staticd.conf to force staticd to read it's config
from zebra.conf

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:14 -05:00
Martin Winter
a2a1134c77 lib: Add support for staticd
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:14 -05:00
Lou Berger
160ce66a28 bgp_l3vpn_to_bgp_vrf: allow some time for updates to propogate
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
ffd3f54493 lib: more logging to aid in failure debugging
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
dce382d4a9 lib: don't report cores on exit as asserts in 5.0
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
436aa319bc lib: don't assert on shutdown errors in rel < 5.0
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
fb80b81b26 lib: add and use Router.checkRouterVersion (based on bdpd version)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
95460a6b7e lib: collect and report shutdown errors across whole topology
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
83c26937f4 lib: collect shutdown errors, add assert on single router shutdown
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Rafael Zalamena
edc7a5036c ldp-topo1: fix ip mpls route output format
Remove the different file as it is no longer needed.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:14 -05:00
Christian Franke
5c4e963e40 ospf6-topo1: make ip-route comparison more robust
Signed-off-by: Christian Franke <nobody@nowhere.ws>
2018-11-27 20:22:14 -05:00
Christian Franke
3a103f9a46 ldp-topo1: fix parsing for iproute from Ubuntu 18.04
Signed-off-by: Christian Franke <nobody@nowhere.ws>
2018-11-27 20:22:14 -05:00
Lou Berger
6c700097d6 lib: bgprib - get human readable verson of json commands for log
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
b0f0d980b5 lib: allow all rw access to /tmp/topotests (for package support and debug)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
da63d5b319 lib: use per node log directory when topotest is used without topogen
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
deb4cef09a lib: log to start/local (per node) dir, log commands
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
93701fcf98 GUIDELINES.md: update to reflect per node log dirs
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
2b0e32967c *: convert startup logs to use per node directories also have startup and running log files match
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
2a59a86b50 lib: limit checkRouterCores output to once per router start
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Donald Sharp
d3335443bf bgp_l3vpn_to_bgp_vrf: Fixup topo test to write log files to same location at start of run
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:14 -05:00
Lou Berger
f76774ec9d lib: add check for core and memory issues after routerstop
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
e1dfa45e1b lib: convert to directories per node
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:14 -05:00
Lou Berger
068df8819b bgp_l3vpn_to_bgp_vrf: more pings... 2018-11-27 20:22:14 -05:00
Lou Berger
e8540bcb55 bgp_l3vpn_to_bgp_vrf: fix wrong table entries 2018-11-27 20:22:14 -05:00
Lou Berger
c941311fef lib: lutil - fix test numbering, add test number to command logging 2018-11-27 20:22:14 -05:00
Lou Berger
8e1bb0b707 bgp_l3vpn_to_bgp_vrf: remote static routes left over from old test versions 2018-11-27 20:22:14 -05:00
G. Paul Ziemba
3675bf4222 bgp_multiview_topo1: more fixes for header changes of PR 2045
For this test, vrf id in headers is unset

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:14 -05:00
G. Paul Ziemba
6a57e10314 bgp: tolerate route-table-show header changes of PR 2045
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>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
e4992f04e0 bgp_l3vpn_to_bgp_vrf: use FRR PR #2053
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>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
8651b9e617 bgp_l3vpn_to_bgp_vrf: check_linux_mpls: delete obsolete code; formatting
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
518874f48a lib: fix path the led to group_nl_converted being referenced when not set
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
d521440020 lib/bgprib.py: add copyright notice
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
c63906e8cf lib: lutil matching without changing newlines
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>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
d86321ae94 bgp_l3vpn_to_bgp_vrf: require frr 4.1
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
52a77b80e4 bgp_l3vpn_to_bgp_vrf: update to current vpn-vrf leak syntax and behavior
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
587e28a4f0 lib/bgprib.py: handle empty json results gracefully
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
90d56c6cca lib/ltemplate.py: add KeepGoing parameter to ltemplateTest
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
19246819f4 test_bgp_l3vpn_to_bgp_vrf: match new nexthop=0 code
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
22b888017c test_bgp_l3vpn_to_bgp_vrf: small config comment cleanup
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
7fdc42389a ltemplate.py: start isisd when isisd.conf present
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
09da03d50d ltemplate.py: remove dependency on hard-coded router name r2
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
1630ad4695 bgp_l3vpn_to_bgp_vrf: assign different RDs to customers on r4
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
38770d3c9d bgp_l3vpn_to_bgp_vrf: comment out route-add commands no longer needed
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
953858275e bgp_l3vpn_to_bgp_vrf: check_routes test now uses bgprib for exact route checking
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
044e2a3119 lib/bgprib.py naming rib->bgprib is more accurate
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
b7addc48d3 bgp_l3vpn_to_bgp_vrf: updated config files to current vpn-policy syntax
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
f7af60f202 lutil: expose result method
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
8a28936d41 lib: bgprib utility to compare rib against list of required routes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
G. Paul Ziemba
9c8eda68e9 bgp vpn-vrf leaking: partial changes toward using new functionality
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-11-27 20:22:13 -05:00
Philippe Guibert
1c2bcf650f bgp_vrf_netns: revert changes from topotest 77
revert
https://github.com/FRRouting/topotests/pull/77
bgp_vrf_netns: do not run test on 32 bit linux machines

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-11-27 20:22:13 -05:00
Philippe Guibert
505fc1bedf bgp_vrf_netns: increase bgp convergence timer
BGP convergence timer is increased from 90 seconds to 120 seconds.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-11-27 20:22:13 -05:00
Philippe Guibert
e0fac6ad5e bgp_vrf_netns: do not run test on 32 bit linux machines
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>
2018-11-27 20:22:13 -05:00
Lou Berger
4072a15323 bgp_vrf_netns: attempt cleanup of previous test abnormal exit. skip test if setup fails
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
87d5e16a45 lib: TopoExaBGP.start - report unexpected exabgp output
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
1cb051708d bgp_vrf_netns: allow more time for adjacency to come up, report unexpected output
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Philippe Guibert
12919c4255 bgp_vrf_netns: add basic test to support netns backend with netns
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>
2018-11-27 20:22:13 -05:00
Philippe Guibert
8dd5077d81 lib: zebra support for vrfwnetns parameter
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>
2018-11-27 20:22:13 -05:00
Lou Berger
14314036ca bgp_l3vpn_to_bgp_vrf: fix route set on non-vrf interface (thanks ben!)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
cc3cf6a883 lib: lutil - fix test counting, add returnJson flag
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
623afc9d83 ldp-vpls-topo1: support new OSPF JSON format
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>
2018-11-27 20:22:13 -05:00
Martin Winter
e1e048002d Revert previous 2 commits (pushed by mistake)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Olivier Dugeon
0c9274877a Update OSPF-SR tests to handle various version
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>
2018-11-27 20:22:13 -05:00
Olivier Dugeon
a60948db9c Add OSPF Segment Routing tests
- 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>
2018-11-27 20:22:13 -05:00
Martin Winter
d01e89f168 ldp-topo1: Support implicit-null and old format on "show_mpls_table"
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Lou Berger
a209417da6 bgp_l3vpn_to_bgp_direct: use new ltemplate common functions
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
98a1523fc8 bgp_l3vpn_to_bgp_vrf: use new ltemplate common functions
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
89b9abd97e lib: ltemplate add common ltemplateRtrCmd and ltemplateVersionCheck
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
1e21dc870d bgp_l3vpn_to_bgp_vrf: centralize iproute2 check, add checks to appropriate tests
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
a1a359ad8d bgp_l3vpn_to_bgp_vrf: required 4.11 kernel on arm processors
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
a0cbe75d20 bgp_l3vpn_to_bgp_vrf: add test to check linux vrf info
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
6198913449 bgp_l3vpn_to_bgp_vrf: prepend rtr name to vrf name, per Philippe
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
4a17413709 bgp_l3vpn_to_bgp_vrf: skip mpls vrf ping tests when have old iproute2
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
e766417ec9 bgp_l3vpn_to_bgp_vrf: add testing for manually setup MPLS path (until have dynamic)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
cf469a232b isis-topo1: allow up to 90 sec for convergence
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
d868d685e3 bgp_l3vpn_to_bgp_direct: use tgen.hasmpls flag
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
f2f902aca8 bgp_l3vpn_to_bgp_vrf: catch linux setup failures
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
d1f82d97db bgp_l3vpn_to_bgp_vrf: collect iproute2 package into
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
6dd81dbbfe bgp_l3vpn_to_bgp_vrf: add kernel check (>=4.9)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
1c507d27e3 bgp_l3vpn_to_bgp_vrf: use tgen.hasmpls flag
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
9711fc7e0b lib: add tgen level mpls init and hasmpls flag
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
85c81f9540 bgp_l3vpn_to_bgp_vrf: 2nd try at skipping tests when MPLS not available
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
2015a49715 bgp_l3vpn_to_bgp_vrf: skip tests when mpls not available
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
4348027f3e lib: add script name to summary output
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
66c5287ec0 lib: add luLast to get last found luCommand regex match
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
8d99289694 bgp_l3vpn_to_bgp_direct: allow for some ping loss
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
f0287609c5 bgp_l3vpn_to_bgp_vrf: allow for some ping loss
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
c0c1496c62 bgp_l3vpn_to_bgp_vrf: add basic data path checks prior to adjacency check
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
0bd1c31f5b bgp_l3vpn_to_bgp_direct: add basic data path checks prior to adjacency check
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
340ecf297e bgp_l3vpn_to_bgp_xxx: match ltemplate start/stop changes
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
850de337d9 lib: ltemplate simplify start/stop
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
d0c5acabb9 bgp_l3vpn_to_bgp_xxx: avoid collision of customize.py match lutil and ltemplate changes
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
9e219b9af7 lib: scope life of Lutil and _lt to a single test run reorg to support regression environment
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
b9ff36bed7 bgp_l3vpn_to_bgp_vrf: just test adjacencies now - for dev/integration
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
308ae0773f bgp_l3vpn_to_bgp_vrf: don't set vrf-policy, wait for new format
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
856b9cce2d bgp_l3vpn_to_bgp_vrf: add ce4 off of r4 for inter-vrf route leaking
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
c0ace6d8e1 bgp_l3vpn_to_bgp_vrf: in progress version Adjacenies up, MPLS configured on interfaces -- right now provides testbed for code changes
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
4ac1e79fbc bgp_l3vpn_to_bgp_vrf: clone bgp_l3vpn_to_bgp_direct as starting point
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
99f5f0350b bgp_l3vpn_to_bgp_direct: 2nd try at skipping tests when MPLS not available
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
9ed0809e49 bgp_l3vpn_to_bgp_direct: skip tests when mpls not available
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
447f2d5a16 lib: add router.has_mpls check
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
46325763aa topogen: fix assertion on routers_have_failure
`errors != ''` is never going to be false so the assert was never being
triggered.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
0e17ee9e03 topogen: import pytest assert function
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>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
d4368260c3 isis-topo1: check IPv6 linux route install
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
d43cd0fd62 isis-topo1: simplify dictionary key removal code
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
88f83773d9 isis-topo1: check ipv6 zebra route installation
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
fc7752c118 isis-topo1: skip test on FRR 2.0
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
2018-11-27 20:22:13 -05:00
Rafael Zalamena
5836fac223 isis-topo1: add IPv6 ISIS topology test
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>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
29614f56c5 isis-topo1: add support for stable versions
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>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
2d013cdabc isis-topo1: check ISIS kernel route installation
Check if the ISIS learned routes are being installed in the underlying
OS.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
e4d08d5be7 isis-topo1: test ISIS route installation
Check the 'show ip route json' output for installed ISIS routes.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
67f1e9ed09 isis-topo1: test ISIS topology convergence
Add function to parse 'show isis topology' and expect the correct
convergence result.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
74bd8dd9ba isis-topo1: add topology graph
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Rafael Zalamena
3aefe20797 isis-topo1: import topology
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:13 -05:00
Martin Winter
4649eef8e1 ldp-vpls-topo1: new format for ospf neighbor json
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>
2018-11-27 20:22:13 -05:00
Lou Berger
8ab91133c7 lib: ltemplate - fix handling of CallOnFail (take 2)
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
5859c4be6b lib: ltemplate - fix handling of CallOnFail
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
3eff4cc9dd bgp_l3vpn_to_bgp_direct: fix hook routines for ltemplate
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
2eddcd9ff3 bgp_l3vpn_to_bgp_direct: rename bgp_direct_to_bgp_vpn Rename BGP L3VPN test to have L3VPN at start of test name Also remove unused/pre-ltemplate files
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
c30e3e40a6 bgp_direct_to_bgp_vpn: enable mpls forwarding, add more details on adjacencies
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
db2dbd246e bgp_direct_to_bgp_vpn: convert to lib/ltemplate
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:13 -05:00
Lou Berger
df437d254a lib: add LabN testing template
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Martin Winter
d75f5f94cd ospf-topo1: Allow IPv6 ECMP version to pass
Check ospf IPv6 routes for ECMP version first and fallback
to previous version if needed.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
a1f1550fc2 ospf-topo1: Add IPv6 addresses to diagram
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Lou Berger
50b15737c9 lib: lutil - make it easier to spot command output and null output
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
2fdcc34250 lib: lutil - make requested error logging change
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
bd15005d3a bgp_direct_to_bgp_vpn: scripts - avoid race condition, and test for predicable results
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
ffdac4dbd8 bgp_direct_to_bgp_vpn: add some progress output
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
e437365bb9 bgp_direct_to_bgp_vpn: general cleanup use moved lutil.py improve error information adjust to new luCommand default timeout sdd support for CliOnFail, remove no_test_call_mininet_cli scripts - update to correct stable values use topo test's log dir
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
a582a8e9c5 lib: lutil cleanup move utilities/lutil.py -> lib/lutil.py add: luShowFail, CallOnFail, luStart parameter to set log dir change default wait to 10sec
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
7ed102b925 bgp_direct_to_bgp_vpn: convert to new template, skip tests on pre-3.1 versions
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
6d0dbb7996 bgp_direct_to_bgp_vpn: initial version
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Lou Berger
199a7c79c1 lutil: initial version
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
e600b2d93c topotest: remove pid files
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>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
065bd557f8 topotest: improve informational messages
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
63038f4b02 topotest: show the user that we are waiting
Add a log message to tell the user that we are waiting for zebra.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Lou Berger
3a568b9ca6 lib: speed up router shutdown stopRouter: report when a process is being killed only sleep if actually killed a process add option to not sleep or conduct -7 kill topogen stop: add wait parameter (defaults to old/wait) when stopping routers, first stop all without waiting then do a second pass where will wait if needed
Signed-off-by: Lou Berger <lberger@labn.net>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
08533b7bce topotest: always show diff on json_cmp failure
Append diffs on all json_cmp failures so the reader can compare JSON
field differences.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
479b98aacd topotest: specify why we are waiting
This shows the user why the router teardown is taking 2 seconds long.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
28a9b4f56e doc: update README and add code snippets
Add some pointers in the README documentation that might help users get
ready to use topotest.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
222ea88b2a topotest/topogen: demote some messages level
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.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
034237db12 topotest: fix a regression in version_cmp
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.
2018-11-27 20:22:12 -05:00
Martin Winter
a018893f7c bgp-ecmp-topo1: Workaround for version check
temp workaround for Issue #43

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
3d6c6f01ac ldp-vpls-topo1: Allow ospf neighbor json command with list (new) and dict (old)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
968afc2848 ldp-vpls-topo1: fix a json_cmp result assert
Use the 'right' assert to show more detailed failure report and remove
a unused variable.
2018-11-27 20:22:12 -05:00
Martin Winter
dd3ddc0663 Fix output to allow it on generic Debian
- 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>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
7c1f9631fc eigrp-topo1: solve output ordering problem
Transform 'show ip eigrp topo' output into data structures and compare
using json_cmp() to avoid expecting output order.
2018-11-27 20:22:12 -05:00
Renato Westphal
13e8bc063f ldp-topo1: Remove check for protocol in installed LSPs
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>
2018-11-27 20:22:12 -05:00
Martin Winter
ad59d1f5bb eigrp-topo1: Remove check for EIGRP distance
- 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>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
7bd28cfc67 topotest: improve json error messages
Show a diff of the JSON values instead of dumping the whole
data structures.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
2db5888df5 topotest: json_cmp_result split error lines
When the API user wanted to show newlines we have to break them manually
to get the propper format.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
bc2872fd17 topotest: allow passing options to difflib
Extend the topotest diff functions to allow receiving difflib options.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
566567e9be topotest: remove unused json_cmp unused parameter 2018-11-27 20:22:12 -05:00
Martin Winter
6ae351e837 all-protocol-startup/isis: Fix check for "show isis interface" to allow different circuit ids than 1 2018-11-27 20:22:12 -05:00
Rafael Zalamena
fcfbc7696b topogen: fix diagnostics failure
Don't try to log to file if directory doesn't exist.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
d34f613477 topogen: save zebra version output
Keep the zebra version output for later problem diagnostics.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
7547ebd8cd topogen: log diagnostics to file 2018-11-27 20:22:12 -05:00
Martin Winter
1b46274d5c eigrp-topo1: Cleanup leftover comments from previous commit
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
ee4523a215 eigrp-topo1: Change Route verification to use json
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
555451faa5 all-protocol-starup: Fix triple-output of same vtysh stderr/stdout messages.
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
7551168cba lib: Use SIGTERM for killing daemons first and only SIGBUS (7) if the daemons fail to exit.
- This allows daemons to free up memory and avoid false memory leak reports

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
8e957dbb04 multiple_topos: Don't report about StdErr Output if there is no output
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Donald Sharp
9057cd2cc3 eigrp-topo1: Correct eigrp test results.
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>
2018-11-27 20:22:12 -05:00
Martin Winter
8ee1273e44 Enable eigrp-topo1
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
44a592b2a6 lib: check for eigrpd available and return warning if missing instead of failing 2018-11-27 20:22:12 -05:00
Rafael Zalamena
e5355a016f eigrp-topo1: convert to topogen 2018-11-27 20:22:12 -05:00
Rafael Zalamena
c267e5b112 topogen: add support for eigrpd and nhrp 2018-11-27 20:22:12 -05:00
Rafael Zalamena
57c5075b7b topogen: router startup failure triggers errors
Makes `router_have_failure()` detect frr startup errors.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
b3b1b1d16c topogen: treat some corner cases on vtysh failure
Don't throw unneeded tracebacks when 'show version' doesn't show us what
we expect, instead gracefully fail.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
1eb633c012 topogen: show pretty output for skipped messages
Format them properly instead of printing a dictionary.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
333139b22e ldp_vpls_topo1: set an error instead of exit
It will have the same effect and code will not have to be repeated since
all functions must call `routers_have_failure()`.
2018-11-27 20:22:12 -05:00
Renato Westphal
f13a242c76 ldp_vpls_topo1: don't use pytest.mark.skipif
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>
2018-11-27 20:22:12 -05:00
Renato Westphal
c4057baab7 ldp_vpls_topo1: skip all tests on stable/2.0
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Renato Westphal
6fcaea2bc6 ldp_vpls_topo1: add new topology for ldp pseudowires
This is a very simple topology for testing LDP pseudowires.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Donald Sharp
2dad85f432 Basic EIGRP topo test working
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:12 -05:00
Donald Sharp
1fccd8e958 Exclude eigrp test from running normally yet
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:12 -05:00
Donald Sharp
a4e471cfc5 Add a basic EIGRP topology.
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>
2018-11-27 20:22:12 -05:00
Donald Sharp
cda83bee9f Allow topotests to work with eigrp and nhrp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:12 -05:00
Martin Winter
be7286cc82 ldp-topo1: Use 'label implicit-null' for implicit labels
Signed-off-by: Martin Winter <mwinter@netdef.org>
2018-11-27 20:22:12 -05:00
David Lamparter
91733ef85e topotests: change from "context" to "unified" diff
context diff:
*** before.py
2018-11-27 20:22:12 -05:00
Rafael Zalamena
5684f8100d topotests: add topology name to assert output
Make it easy to identify which topology test we are running.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
e7ba3cd11c topotests: make asserts show up in stderr
Code was based on the pytest default makereport code:
c92760dca8/_pytest/runner.py (L264)
2018-11-27 20:22:12 -05:00
Martin Winter
9427b78f65 lib: Change topology to output INFO and DEBUG to stdout and other levels to stderr
Previously, all logs were sent to stderr
2018-11-27 20:22:12 -05:00
Martin Winter
c11c4cc7d3 lib: add check for mpls kernel modules to diagnose_env()
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
b431b5540f lib: Enhance daemon_available() function to check for mpls modules in case of LDPd
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
e1b2ce6a70 lib: Add check for MPLS kernel modules to exist before trying LDP tests
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
1380ecb1ce ospf-topo1: Remove check for spfLastDurationMsecs value
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>
2018-11-27 20:22:12 -05:00
Martin Winter
67651166b6 bgp-ecmp-topo1: Check number of routes received for convergence
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>
2018-11-27 20:22:12 -05:00
Rafael Zalamena
9a950d76bd bgp-ecmp-topo: add support for FRR 2.0
The FRR 2.0 json output is different from newer version, so add the
appropriate treatment.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
35a00f240f bgp-ecmp-topo: test BGP convergence
Add a test that waits for BGP convergence.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
62271fe3fa bgp-ecmp-topo: use the new sleep function 2018-11-27 20:22:12 -05:00
Rafael Zalamena
570f25d80a topotest: log sleep function
Added a wrapper for the sleep function that should be used to register
in the log files the amount of time spent sleeping.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
1f4c4aec44 bgp-ecmp-topo1: add convergence test
Assert that we got the routes from ExaBGP and they are multipath
enabled.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
91a4415704 bgp-ecmp-topo1: convert to topogen 2018-11-27 20:22:12 -05:00
Rafael Zalamena
0c68b87abc bgp-ecmp-topo1: fix exabgp configuration file
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.
2018-11-27 20:22:12 -05:00
Martin Winter
ac1087fa7b bgp-ecmp-topo1: Add BGP Topology for rcmp testing
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
0e8ccff311 ospf-topo: Mask IPv6 local-addressess instead of removing them
Just mask out the random part makes the diff output better readable
2018-11-27 20:22:12 -05:00
Rafael Zalamena
99dca1a0b8 ospf-topo: show areas in the topology dot/jpg 2018-11-27 20:22:12 -05:00
Rafael Zalamena
4524522dc8 ospf-topo: skip on tests on router failure
Update the test by adding the routers_have_failure() check. While here,
bump the amount of time to expect for convergence by 15 seconds.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
a61e85ab38 ospf-topo: remove log file specification
We don't need to set logging file per-daemon as topogen will already do
that for us. Also, remove hostname line as it seems to have no effect.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
f9b48d8b42 topogen: allow daemon spec in vtysh_cmd
Allow commands to be run per-daemon basis. While here make daemon
logging file configuration per-daemon.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
d1c3108673 ospf: test route kernel installation
Added tests to validate that OSPF routes are being installed/uninstalled
in the Linux kernel.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
99a7a912fd topotest: implement 'ip route' functions
Implement an abstraction to the commands 'ip route' to get the node
current routing table state.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
f175c4eb97 ospf: add IPv6 OSPF convergence test
Add more tests to the ospf-topo1 to include IPv6 testing. Since both IP
versions are running together, there is no need to wait OSPF convergence
per IP version.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
56842c0469 ospf: add some log calls to show activity
Brings the OSPF test closer to other topotest tests.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
43b15bc431 ospf: add 'show ip ospf json' test
Test the default values of 'show ip ospf json' output in the current
topology.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
622cc178c7 ospf: add memory leak test
Standard memory leak test/report.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
d4f6bcf127 ospf: added a convergence test for link failure
This new test simulates a link failure in router 3 and expects the OSPF
routing table to converge accordingly in all nodes.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
6024e0b5de ospf: added convergence test for IPv4
Added a convergence test for OSPF (IPv4) using the new topology
builder Topogen.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
812e38a94d topotests: make 'quagga' check optional
Only check for quagga directories and binaries when we don't find FRR.
Also fix a copy-paste error in warning message.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
45619ee3de topotest: simplify ldp kernel check
Use version_cmp() instead of hand rolling its own parser.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
007e731324 topotest: implement environment diagnostics
Run environment diagnostics on topotest start, report all detected
problems and abort if an error condition is met.
2018-11-27 20:22:12 -05:00
Rafael Zalamena
28c15fe7b8 bgp_multiview_topo1: fix exabgp configuration
Allow exabgp to run on my Ubuntu 16.04 by specifying the complete path
instead of relative.
2018-11-27 20:22:12 -05:00
Martin Winter
6c97c0cbf2 ldp-topo1: Make the implicit label optional to pass old frr code as well
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:12 -05:00
Martin Winter
cc230e73b7 Doc: Update README to specify ExaBGP version as 4.0 is not yet supported
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Rafael Zalamena
6ca2411e86 topogen: add equipment version handling
Added helper functions to TopoRouter to test equipment version and type.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
4190fe1ef1 topotest: add version comparison function
Implemented a version comparison function that tells if a version
contained in a string is greater/less/equal to another.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
f7840f6bdf topotest: add text normalization function
Standardized function that removes format spaces (or tab) and carriage
returns characters. This function is useful to allow output text
processing without breaking diff capabilities.

Output example:
*N IA 2001:db8:2::/64                ::                        r2-eth0    00:03:39

Becomes:
*N IA 2001:db8:2::/64 :: r2-eth0 00:03:39

If you remove 'IA' you won't have space formatting problem anymore.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
d176de4d0a template: add router check test
Show test developers that they can check if routers are running by
calling tgen.routers_have_failure().
2018-11-27 20:22:11 -05:00
Rafael Zalamena
7b093d84e0 topogen: handle JSON decode failures
Instead of raise()ing, return a empty dictionary.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
78ed61230c topogen: implement router check method
Use a standard function to do 'router running checks' instead of having
to duplicate the code in every test.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
e84692970b topogen: fix topogen memleak activation
When memleak_path is present in the configuration file it means that it is
activated.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
dc0d3fc53f topotest: add JSON list comparation support
Add missing list support for json_cmp(). The missing support was
noticed while writing the BGP ECMP topology test.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
19ccab570b topogen: add support for ExaBGP peers
Implemented basic support for ExaBGP peers.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
393ca0fa16 topogen: add error functions
Store errors and error code in topogen so other tests can look up for
failures and skip tests.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
4cfdff1a86 topogen: implement start/stop methods for TopoGear
Having a generic start/stop methods for TopoGear allows TopoGen to call
start/stop for all equipments. This allows us to reduce the teardown
code by removing the necessity of having to always remember to call
each equipment clean up function.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
f6899d4dd4 topogen: configure daemon logging files
Auto configure daemon logging files to the appropriated place. This
removes the responsibility from the test developer to set this in the
daemon configuration.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
36040f453e template: update test template
Use the new logger and implement a default memory leak test/report.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
13e1fc493b topogen: add per router logging
TopoRouters now create a logger (which logs to /tmp/{router_name}.log)
on start to record all commands and events that it goes through. All log
messages contain timestamps that may be used in the future to:
(1) correlate commands call with events
(2) benchmark/time command speed
2018-11-27 20:22:11 -05:00
Rafael Zalamena
6c131bd303 topotest: use topolog instead of print
Fix some whitespace issues while at it.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
77ebccacf4 topolog: support adding loggers during runtime
Allow topotest subsystems to create their own loggers. This will help
increase log organization and allow different settings to fit the
subsystems needs.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
36d1dc45eb topolog: implement a logging abstraction
The default logger (root) is already being used by Mininet, so to allow
customizing logging output and configuring log files Topolog was
created. Topolog is no more than a thin layer abstraction to call
logging functions without using the 'root' logger.
2018-11-27 20:22:11 -05:00
Martin Winter
985e6d50ec all_protocol_startup: More tolerant on interface MTU output
- Allow 'MTU mismatch detection: enabled' and 'MTU mismatch detection:enabled'

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Rafael Zalamena
c540096e86 topogen: add memory leak report configuration
Allow memory leak to be configured from the configuration file.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
edd2bdf6de topogen: support configuration file
Use a configuration file for casual settings like:

* Verbosity level (helps when debugging mininet issues)
* Custom daemon directory (in order to support running different daemon
  binaries without touching tests)
* Daemon type switch: allow running quagga without touching any test
  files

Also fix the add_router() documentation to include all options.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
e41b086151 topotest: add writing tests tips
Add two tips to help improve test code quality:
1) Store function returns for later inspection
2) Identify what failed using the assert message
2018-11-27 20:22:11 -05:00
Rafael Zalamena
3668ed8dc2 topotest: improve json_cmp assert output
Create a specialized assert and json_cmp() result to improve the
comparison output. With this we also got a way to display all comparison
failures instead of just the first one.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
8833a8387f topogen: don't backtrace when topogen is not used
This allows old tests to be run with '--topology-only' without
generating tons of error messages, instead it will just stop the test
without trying anything else.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
b06e9eff75 template: allow test to be run without pytest
Update the PYTHONPATH for standalone runs and pass all command line
arguments to pytest main. Also set the executable bit to the python
scripts file.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
a40daddc4c topogen: added JSON output support for vtysh_cmd
Allow vtysh_cmd() to convert JSON output to Python data structures.
This feature will be used to get vtysh JSON outputs for tests
comparsions.

Usage example:

```py
router = get_topogen().gears['r1']
json_output = router.vtysh_cmd('show ip ospf json', isjson=True)
json_cmp(json_output, {'important_key': 'important_value'})
```
2018-11-27 20:22:11 -05:00
Rafael Zalamena
09e21b4487 topotest: implement json_cmp function
Implemented a JSON compare function that tells you when a specific
subset of items exist or not inside a JSON dataset.

More details can be found in the function docstring or in the test file
lib/test_json.py.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
045aaf47ee template: change the default dot file
Make it look like the RIP(ng) dot files with authentic shapes and colors
for routers and switches.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
cef6ca99f9 topotest: added two new sections to guidelines
And fixed some smaller details in the previous sections.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
5f8f05be6e topotest: small guidelines fixes 2018-11-27 20:22:11 -05:00
Rafael Zalamena
0d3f2bf99e topotest: rename guidelines equipment names
Use short names for equipment names as the rest of the code in the
repository.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
31bfa9df79 topogen: use shorter names for equipments
After some feedback from mwinter@, the names of equipments are now
shorter to make it easier to type them and to keep consistency with
mininet documentation. While here, update the template and make it use
optional name parameters for clarity.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
3079edf96b topotest: add guidelines
This is the beginning of the guidelines file. It will contain all
necessary instructions to help people write topology tests.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
7326ea11c0 topogen: implement __str__ for TopoGear objects
Print TopoGear name, links and type (currently TopoRouter and Switch
don't have any other useful attributes).
2018-11-27 20:22:11 -05:00
Rafael Zalamena
240e334fca example: add missing __init__.py
Adding the __init__.py file makes python and its linter recognize that
the test makes part of the package, this makes us save a few lines of
code to make the linter and auto complete engines happy.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
38c3993248 topogen: implement memory leak test call
This is a shortcut for the memory leak test, it should be used in the
new tests in order to avoid boilerplate code.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
8c3fdf62a9 topogen: add support for setting link state
This commit changes how topology links are made in order to support
discovering who and what link is the node interface connected to. After
that, the implementation of the link state change functions were trivial
as calling a command in the node shell.

The method run() was moved from TopoRouter to TopoGear so all equipment
types can benefit from this code.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
d9ea1cda81 Topogen: document new options
We can now add routers to the topology using different daemon binaries
path. This will allow us to run tests with different daemon versions and
types.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
2ab8553078 topotest: parameterize daemon's path
This diff is a code cleanup that will allow us more flexibility when
defining and using the daemon binaries path, it also fixes a few pylint
warnings.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
1fca63c1e4 topogen: first code import
Topogen (Topology Generator) is a helper that wraps around Topotest to
simplify some of the boilerplate code. This abstraction will help the
development of new tests and new APIs without breaking the existing
ones. It also makes the relation of objects clearer, since we no longer
touch the Mininet API directly, which in turn also makes us less
vulnerable to external API changes.
2018-11-27 20:22:11 -05:00
Rafael Zalamena
797e8dcf5c lib: assert sysctl values
Implemented two functions to help setting sysctl values:

* set_sysctl: set a sysctl and return an auditable return value
* assert_sysctl: uses the previous function to assert that the sysctl
  was set
2018-11-27 20:22:11 -05:00
Renato Westphal
fa05076643 ldp-topo1: sync with PR#710 in FRR
Now zebra is adding the ldpd implicit-null labels to the RIB as well. We
don't want to hide them in the "show ip route" commands because knowing
that a route is associated with an implicit-null label is an useful
piece of information, specially when troubleshooting L2/L3 VPNs.

Note: preserve the original output for cli version 1 (stable/2.0).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Renato Westphal
0e5ae9cc1d ldp-topo1: add some debug commands to facilitate troubleshooting
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
c8cff3ced1 lib: Fix stopRouter not to fail for case if daemon was never started
Fixes the issue for topotest to fail ot end of skipped LDP test on
a system without MPLS support

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
9e05a644e9 ospf6_topo1: Remove ff00:/8 routes from Linux Table compare
Some Ubuntu VM setups show ff00:/8 kernel routes, not a FRR issue

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
17070436a3 lib: cleanup diff text output formatting issue and move to library
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
4942f29847 lib: Move AddressSanitizer check to separate procedure and add check for errors in vtysh itself as part of checkRouterRunning
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
311dba3332 lib: Send Output error from AddressSanitizer to StdErr
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
28aa9ae658 rip-topo1: Add check to make sure daemons are still running between essential tests
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
7e7fc73b49 (all tests): Add extra check to make sure daemons are still running after each essential stage.
If daemon crashed at a later stage (not startup), then the test scripts didn't properly detect it and report unpredictable errors. This will properly log the daemon crashes

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
84379e8e7f lib: Add different failure comment on processes killed by AddressSanitizer
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
597cabb74d lib: Move updated topotest.py lib with AddressSanitizer to correct directory (fix mistake from 2 commits ago)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
09bd98fbb7 Doc: Update manual sample build instruction with symlink for vtysh and reference to user creation
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
3a1f8275db Add support for collecting AddressSanitizer output. See README.md for details
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
faf94e5a3a ldp-topo1: Adjust to accept new format in "show ip route" as introduced with PR 495 (extra comma)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
50c40bdebb Fix memory leak detection and reporting which accidentally was dropped a month ago
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
e9125d9286 lib: Fix another typo on kernel compare
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
c63b6f86f0 lib: Fix version check in previous kernel compare
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Donald Sharp
dd43120e8e Actually fix version comparison
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:11 -05:00
Donald Sharp
b2764f904e Spell Verifying correctly
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:11 -05:00
Donald Sharp
8b2e59e943 Fix tests to handle new output
The show commands for bgp now have a bit more
data associated with labeled unicast routes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:11 -05:00
Donald Sharp
dd4eca4d97 lib: Fix kernel version parsing
When we have a kernel sub version > 10 the float conversion
of the kernel version causes 4.10 to be less than 4.5

Get the kernel version in groups on <major>.<minor> and do
comparison that way

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:11 -05:00
Martin Winter
f6c44df78f ospf6-topo1: Update to ignore the proto type in linux kernel table
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
798fb5934d all-protocol-startup: Fix bad assert in case of failed vtysh output test
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
1026c19adb all-protocol-startup: Fix pref commit - bamboo prefix is lower case
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
08fa1af779 all-protocol-startup: Add option to skip currently broken checks and relax BGP check
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
e341b1927d ripng-topo1: Fix duplicate IP (Thanks Renato!) and documentation typos 2018-11-27 20:22:11 -05:00
Martin Winter
4501fbcaa8 all-protocol-startup: Add test suite which runs all protocols at once and verifies startup and spurious errors of each
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
80eeefb7da lib: Add function to check for daemon available (i.e. LDPd) and function to return typ (quagga or frr)
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
598d845766 Update FreeRangeRouting -> FRRouting name
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
d6df723b10 rip_topo1: Adding new test for RIPv2 Topology
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
9f3e0f6493 ripng_topo1: Adding new test for RIPng Topology
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
a93477ec42 topotest library: Fix creation of /etc/XXX/vtysh.conf
- Needs to be created in local filesystem of each router

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
5b7a4ad33a bgp_multiview_topo1: Fix case of tests hanging if convergence is not successful.
- Part of a command was missing which caused a hang in cases when BGP didn't converge

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
3eaafbd95d LDP-Topo1: Update test to accept new format of LDP output
* Added test to check for version
* Adopted all tests to verify against the correct version of output

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
1c909f4248 Fix README incorrect reference to Quagga 2018-11-27 20:22:11 -05:00
Martin Winter
ff0d89dcfd ldp-topo1: Fix ordering of reference output to check against
Ordering of output is now done by LDP and should be consistent

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
37c4800c44 ldp-topo1: Delete accidentally include tar file
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Donald Sharp
3a4f98d587 Update Readme to have correct ordering for frr user
We cannot usermod the frr user until after we
create the user with adduser.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:11 -05:00
Martin Winter
33ae1f751e Update Readme to reflect FreeRangeRouting name
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
d98b7d6359 bgp_multiview_topo1: Mask out BGP Table version in comparison
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
99561211e1 Added optional output for memleaks at the end of test. Enable them by setting the environment variable TOPOTESTS_CHECK_STDERR to some value
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
594b1259f9 Move common function and class to topotest library
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2018-11-27 20:22:11 -05:00
Martin Winter
f03e38f397 ldp-topo1: Add new LDP Topology Test 2018-11-27 20:22:11 -05:00
Martin Winter
e631b5186f bgp_multiview_topo1: Fix bad check for running daemons
Only one ruter running in the setup
2018-11-27 20:22:11 -05:00
Martin Winter
b36d3e1c85 Add support for FRR in addition to Quagga 2018-11-27 20:22:11 -05:00
Martin Winter
593335d02d change in checkRunning: Check all daemons on all nodes before aborting with an assert 2018-11-27 20:22:11 -05:00
Martin Winter
615f6ba320 ospf6-topo1: Add Markdown doc with testdescription 2018-11-27 20:22:11 -05:00
Martin Winter
6d9d0176e4 bgp_multiview_topo1: Rename test_description.md to README.md for automatic rendering in online git 2018-11-27 20:22:11 -05:00
Martin Winter
d71f367580 bgp_multiview_topo1: Add Markdown doc for test 2018-11-27 20:22:11 -05:00
Martin Winter
024fc0b8bc README: Add example configure statement for building test quagga code 2018-11-27 20:22:11 -05:00
Martin Winter
3b6bac2adf bgp_multiview_topo1: Change from unified to context diff for better readability 2018-11-27 20:22:11 -05:00
Martin Winter
2bdcdbd1b8 ospf6-topo1: Add check for Linux Kernel Routing Table as well and change to better human readable context diff 2018-11-27 20:22:11 -05:00
Martin Winter
a99a6a026e ospf6-topo1: Enable coredumps for Quagga Daemons and add logic to skip remaining test in case of fatal error 2018-11-27 20:22:11 -05:00
Martin Winter
04df53ab5a bgp_multiview_topo1: Added Network Diagram as comment 2018-11-27 20:22:11 -05:00
Martin Winter
5ead87b456 bgp_multiview_topo1: Fix limit to create coredumps on quagga crashes 2018-11-27 20:22:11 -05:00
Martin Winter
64581658b1 bgp_multiview_topo1: Rename received bgp route log with .log for easy clean between runs 2018-11-27 20:22:11 -05:00
Martin Winter
309c9764c5 example-test: Add simple example pytest for documentation (and exclude it from running in pytest.ini) 2018-11-27 20:22:11 -05:00
Martin Winter
6b1be61ad8 Update Documentation 2018-11-27 20:22:11 -05:00
Martin Winter
2cda38e488 bgp_multiview_topo1: Skip remaining on fatal error and try to get more crash info of daemon is not running 2018-11-27 20:22:11 -05:00
Martin Winter
586e15c4fb bgp_multiview_topo1: Add "bgp multiview" simple topology to test. Initial commit 2018-11-27 20:22:10 -05:00
Martin Winter
68a655673f ospf6-topo1: Code cleanup 2018-11-27 20:22:10 -05:00
Martin Winter
50bd94cd20 ospf6-topo1: Less chatty timeout messages during convergence 2018-11-27 20:22:10 -05:00
Martin Winter
806111c083 ospf6-topo1: Cleanup log messages 2018-11-27 20:22:10 -05:00
Martin Winter
a177e146bb Add .gitignore 2018-11-27 20:22:10 -05:00
Martin Winter
b057efe120 test_ospf6_topo1: Restructure to run under pytest 2018-11-27 20:22:10 -05:00
Martin Winter
a92d8407ab Renamed Test Directory: ospf6-test1 -> ospf6_topo1 2018-11-27 20:22:10 -05:00
Martin Winter
52f17ef4aa ospf6-test1: Renamed testscript to have test_ prefix for pytest discovery 2018-11-27 20:22:10 -05:00
Martin Winter
d14615d865 ospf6-test1: Look for test config in directories relative to main script location 2018-11-27 20:22:10 -05:00
Martin Winter
8ab9a37669 Cleanup README and a reference to License 2018-11-27 20:22:10 -05:00
Martin Winter
59d80fffc2 Initial commit with first OSPFv6 Topology Test 2018-11-27 20:22:10 -05:00
Donald Sharp
8b5f676563 tests: Exclude topotests from consideration
When running make check, exclude the topotests directory from considertion.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-27 20:22:10 -05:00
Renato Westphal
1a4bc045de lib, tests: major rework in the operational-data callbacks
The northbound infrastructure for operational data was subpar compared
to the infrastructure for configuration data. This commit addresses most
of the existing problems, making it possible to write operational-data
callbacks for more complex YANG models.

Summary of the changes:
* Add support for nested YANG lists.
* Add support for leaf-lists.
* Add support for leafs of type "empty".
* Introduce the "show yang operational-data XPATH" command, and write an
  unit test for it. The main purpose of this command is to make it
  easier to test the operational-data northbound callbacks.
* Introduce the nb_oper_data_iterate() function, that can be used
  to iterate over operational data. Make the CLI and sysrepo use this
  function.
* Since ConfD has a very peculiar API, it can't reuse the
  nb_oper_data_iterate() like the other northbound clients. In this
  case, adapt the existing ConfD callbacks to support the new features
  (and make some performance improvements in the process).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 18:28:53 -02:00
Renato Westphal
8017028d6b tests: fix warning related to change in the hash API
The hash_cmp functions need to return bool since commit 74df8d6d9d.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-11-26 17:35:58 -02:00
Donald Sharp
bddea5fdf8
Merge pull request #3051 from mitch-skiba/addpath_change_V1
Addpath - Reuse IDs
2018-11-13 09:20:22 -05:00
Renato Westphal
9f0dc29b03
Merge pull request #3276 from donaldsharp/zclient_update
*: Replace zclient_new with zclient_new_notify
2018-11-12 13:40:47 -02:00
Donald Sharp
26f63a1ec6 *: Replace zclient_new with zclient_new_notify
It's been a year since we added the new optional parameters
to instantiation.  Let's switch over to the new name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-12 09:16:23 -05:00
Christian Franke
9c0437ecd7 tests: Verify correct operation of lsp_build_list_nonzero_ht
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-11-12 12:24:10 +01:00
Mitch Skiba
dcc68b5e2a bgpd: Re-use TX Addpath IDs where possible
The motivation for this patch is to address a concerning behavior of
tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was
pre-determined as the path was received from a peer. However, this meant
that any time the path selected as best from an AS changed, bgpd had no
choice but to withdraw the previous best path, and advertise the new
best-path under a new TX ID. This could cause significant network
disruption, especially for the subset of prefixes coming from only one
AS that were also communicated over a bestpath-per-AS session.

The patch's general approach is best illustrated by
txaddpath_update_ids. After a bestpath run (required for best-per-AS to
know what will and will not be sent as addpaths) ID numbers will be
stripped from paths that no longer need to be sent, and held in a pool.
Then, paths that will be sent as addpaths and do not already have ID
numbers will allocate new ID numbers, pulling first from that pool.
Finally, anything left in the pool will be returned to the allocator.

In order for this to work, ID numbers had to be split by strategy. The
tx-addpath-All strategy would keep every ID number "in use" constantly,
preventing IDs from being transferred to different paths. Rather than
create two variables for ID, this patch create a more generic array that
will easily enable more addpath strategies to be implemented. The
previously described ID manipulations will happen per addpath strategy,
and will only be run for strategies that are enabled on at least one
peer.

Finally, the ID numbers are allocated from an allocator that tracks per
AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very
improbable, there was the possibility with the free-running counter
approach for rollover to cause two paths on the same prefix to get
assigned the same TX ID. As remote as the possibility is, we prefer to
not leave it to chance.

This ID re-use method is not perfect. In some cases you could still get
withdraw-then-add behaviors where not strictly necessary. In the case of
bestpath-per-AS this requires one AS to advertise a prefix for the first
time, then a second AS withdraws that prefix, all within the space of an
already pending MRAI timer. In those situations a withdraw-then-add is
more forgivable, and fixing it would probably require a much more
significant effort, as IDs would need to be moved to ADVs instead of
paths.

Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-11-10 00:16:36 +00:00
Mitch Skiba
a94eca0968 lib: Implement an allocator for 32 bit ID numbers
This commit introduces lib/id_alloc, which has facilities for both an ID number
allocator, and less efficient ID holding pools. The pools are meant to be a
temporary holding area for ID numbers meant to be re-used, and are implemented
as a linked-list stack.

The allocator itself is much more efficient with memory. Based on sizeof
values on my 64 bit desktop, the allocator requires around 155 KiB per
million IDs tracked.

IDs are ultimately tracked in a bit-map split into many "pages." The
allocator tracks a list of pages that have free bits, and which sections
of each page have free IDs, so there isn't any scanning required to find
a free ID. (The library utility ffs, or "Find First Set," is generally a
single CPU instruction.) At the moment, totally empty pages will not be
freed, so the memory utilization of this allocator will remain at the
high water mark.

The initial intended use case is for BGP's TX Addpath IDs to be pulled
from an allocator that tracks which IDs are in use, rather than a free
running counter.  The allocator reserves ID #0 as a sentinel value for
an invalid ID numbers, and BGP will want ID #1 reserved as well. To
support this, the allocator allows for IDs to be explicitly reserved,
though be aware this is only practical to use with low numbered IDs
because the allocator must allocate pages in order.

Signed-off-by Mitchell Skiba <mskiba@amazon.com>
2018-11-09 21:50:34 +00:00
Renato Westphal
1c2facd12d lib: introduce new northbound API
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00
David Lamparter
67cf020d17 build: make clean and dist consistent
We weren't cleaning up some files (a whole lot of python foobar) and had
some files in the dist tarball that don't quite belong there.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-24 18:35:15 +02:00
David Lamparter
68b8a15f87 lib: add libunwind support for backtraces
libunwind provides an alternate to backtrace() for printing out the call
stack of a particular location.  It doesn't use the frame pointer, it
goes by the DWARF debug info.  In most cases the traces have exactly the
same information, but there are some situations where libunwind traces
are better.

(On some platforms, the libc backtrace() also uses the DWARF debug info
[e.g.: ARM backtraces are impossible without it] but this is not the
case everywhere, especially not on BSD libexecinfo.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-18 02:51:51 +02:00
Donald Sharp
121e245d4f bgpd: Cleanup warnings issued by CI system from these changes
Modify code to cleanup warnings issued by the CI system from
this series of changes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:26:30 -04:00
Donald Sharp
4b7e606625 bgpd: Convert struct bgp_info to struct bgp_path_info
Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`.
This commit will setup the rename of variables as well.

This is being done because `struct bgp_info` is not descriptive
of what this data actually is.  It is path information for routes
that we keep to build the actual routes nexthops plus some extra
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04:00
Donald Sharp
1defdda8e8 bgpd: Convert BGP_INFO_XXX to BGP_PATH_XXX
Search and replace all BGP_INFO_XXX to BGP_PATH_XXX

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Lou Berger
d127c61aeb
Merge pull request #3010 from opensourcerouting/no-frr-thread-id
lib: frr_pthread minor simplification
2018-09-22 15:02:09 -04:00
David Lamparter
1ac267a2d9 lib: remove frr_pthread->id
All I can see is an unneccessary complication.  If there's some purpose
here it needs to be documented...

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-19 22:01:46 +02:00
F. Aragon
20ae4acdba
bgpd: fix test (using bgp instance 0)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-18 17:39:23 +02:00
paco
f533be73f6
bgpd, doc, ldpd, lib, tests, zebra: LM fixes
Corrections so that the BGP daemon can work with the label manager properly
through a label-manager proxy. Details:

- Correction so the BGP daemon behind a proxy label manager gets the range
  correctly (-I added to the BGP daemon, to set the daemon instance id)
- For the BGP case, added an asynchronous label manager connect command so
  the labels get recycled in case of a BGP daemon reconnection. With this,
  BGPd and LDPd would behave similarly.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-18 17:39:16 +02:00
F. Aragon
7fe96307ee
bgpd lib ospf6d pbrd tests zebra: shadowing fixes
This fixes all remaining local variable shadowing cases

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-13 17:37:08 +02:00
David Lamparter
b45ac5f5c6 *: fix config.h/zebra.h include order
config.h (or, transitively, zebra.h) must be the first include file
listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work
correctly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
dbac691da6 build: fix & clean up *SAN flags
ASAN/MSAN/TSAN flags need to be in CFLAGS and LDFLAGS; the latter links
the correct compiler-dependent library.  Also, the configure switch was
broken (--disable-... would enable the sanitizer.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
e7c25325cc *: cleanup .gitignore files
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
b37ccace1e tests: properly locate files in builddir
test_cli.refout is written by configure into the build directory, thus
we need a little special glue to find it correctly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:19 +02:00
David Lamparter
a1286a3245 build: non-recursive tests
May SUBDIRS rest in pieces... er, peace.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:26:54 +02:00
Christian Franke
f6ae63ca95 isisd: fix warnings by removing union isis_N and going to void * instead
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:13 +02:00
Christian Franke
5f77d90188 isisd: add TLV 13 Purge Originator Identification
Extend our parser to support the Purge Originator Identifaction
TLV as per RFC 6232.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:13 +02:00
Christian Franke
9d33cf3886 tests/isisd: remove auth when fuzzing
Our "deserialize, reserialize, check-equality" test fails when the
fuzzer produces PDUs with incorrect cryptographic checksums.

While the most realistic solution would be to validate the
cryptographic checksums in the test program, that seems very silly,
given that we don't want to fuzz our cryptographic auth.

Given that, removing auth during fuzzing seems the next best solution.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:13 +02:00
Christian Franke
686afe9f07 fabricd: add field with first and second nexthop to SPF paths
OpenFabric requires knowledge of the first two hops on each path
calculated by spf to implement its flooding optimization. Extend the
hopcount-spf to build such a datastructure.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-09-05 11:38:13 +02:00
Philippe Guibert
ecbc5a3781 *: add a vrf update hook to be informed of the vrf name
The Vrf aliases can be known with a specific hook. That hook will then,
from zebra propagate the information to the relevant zapi clients.
The registration hook function is the same for all daemons.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-28 16:23:50 +02:00
Russ White
0a4ecf2729
Merge pull request #2886 from donaldsharp/stream_resize
Stream resize
2018-08-22 16:04:37 -04:00
Donald Sharp
db3c830afe isisd, ospfd, tests: Switch to using stream_resize_inplace
Switch code and tests to use new stream_resize_inplace functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-22 07:58:54 -04:00
David Lamparter
bd27ea43e9 build: wrap "fallthrough" attr
This generates a warning on gcc versions before 7.0.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-21 20:34:58 +02:00
David Lamparter
6bb30c2cba *: use frr_elevate_privs() (2/2: manual)
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14 20:02:05 +00:00
Donald Sharp
1314370166 tests: Cleanup assumption that ALLOC could fail.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11 19:58:23 +02:00
Christian Franke
321c1bbb94 isisd: make spf code dst-src aware
Take the source-prefix sub-TLV into consideration when running SPF
and support creation/deletion of dst-src routes as result.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-08-03 13:25:39 +02:00
Christian Franke
d43d2df5f3 isisd: learn and advertise IPv6 dst-src routes
Receive IPv6 dst-src routes from zebra and advertise them in our LSPs
if so configured.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-08-03 13:25:39 +02:00
Donald Sharp
ccc34deb38 tests: Let compiler know this was an intentionall fallthrough
Let the compiler know that this code intentionally fell
through to the next case statement in a switch.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-25 15:00:52 -04:00
Donald Sharp
9fc8a332b1 tests: Prevent weird type promotion objection in bgp tests
The va_start function cannot take a object that can be type promoted
Looks like a new warning coming in from a new compiler.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-25 14:50:29 -04:00
Donald Sharp
e3c5f7b689 tests: Fix const change
Some of the parameters for lib/srcdest.. have changed to
consts, make the test cases respect that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-25 14:50:29 -04:00
F. Aragon
a2ddc2a67b
tests/isisd: fix warnings
Commit ae9c9aba changed isis_vertex_id_init() and isis_find_vertex()
parameters, so compiler reported warnings in the test (the actual data
passing through is the same because of the union used in the latest changes).
This commit fixes the warnings in the test.

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-24 18:26:26 +02:00
Mark Stapp
432eaa5d97 tests: add test_bgp_table to gitignore
Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-13 07:56:38 -04:00
Mark Stapp
2861a0deda tests: align with srcdest lib changes, remove bgp binary
Align the srcdest table test with recent api changes that use
'const' more strictly. Remove test_bgp_table binary - looks
as if it was committed by mistake.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-07-12 09:51:52 -04:00
Marcel Röthke
a98b00ee3e bgpd: add test for bgp_table_range_lookup
Signed-off-by: Marcel Röthke <marcel.roethke@haw-hamburg.de>
2018-07-05 16:06:37 +02:00
Quentin Young
772b852662
Merge pull request #2408 from ajones-rvbd/ajones-issue-2403
tests: use BUILT_SOURCES in tests/Makefile.am for automake 1.16.1
2018-06-21 14:43:16 -04:00
Russ White
05d7e026c8
Merge pull request #2445 from ppmathis/feature/bgp-pg-overrides
bgpd: Improve peer-group override implementation
2018-06-19 08:20:31 -04:00
Russ White
8fef257611
Merge pull request #2465 from qlyoung/fix-build-am-cppflags-warning
tests: fixup minor autotools nit
2018-06-19 07:31:43 -04:00
paco
6d10727ac1
eigrpd, lib, tests, vtysh: security (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19 10:40:56 +02:00
paco
2ec42b858c
babeld, lib, ospfd, tests: fmt fixes (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 17:52:56 +02:00
Quentin Young
972c2ee9de tests: fixup minor autotools nit
Makes super strict builds fail due to a warning.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-15 17:17:42 +00:00
Pascal Mathis
4c3911425c
bgpd: Finalize group-overrides for peer/AF attrs
This commit finalizes the previous commits which introduced a generic
approach for making all BGP peer and address-family attributes
overrideable by keeping track of the configuration origin in separate
internal structures.

First of all, the test suite was greatly extended to also check the
internal data structures of peer/AF attributes, so that inheritance for
internal values like 'peer->weight' is also being checked in all cases.

This revealed some smaller issues in the implementation, which were also
fixed in this commit. The test suite now fully passes and covers all the
usual situations that should normally occur.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:33 +02:00
Pascal Mathis
a14810f43f
bgpd: Implement group-overrides for peer attrs
This commit introduces BGP peer-group overrides for the last set of
peer-level attrs which did not offer that feature yet. The following
attributes have been implemented: description, local-as, password and
update-source.

Each attribute, with the exception of description because it does not
offer any inheritance between peer-groups and peers, is now also setting
a peer-flag instead of just modifying the internal data structures. This
made it possible to also re-use the same implementation for attribute
overrides as already done for peer flags, AF flags and AF attrs.

The `no neighbor <neigh> description` command has been slightly changed
to support negation for no parameters, one parameter or * parameters
(LINE...). This was needed for the test suite to pass and is a small
change without any bigger impact on the CLI.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:32 +02:00
Pascal Mathis
b90a8e13ee
bgpd: Implement group-overrides for peer timers
This commit implements BGP peer-group overrides for the timer flags,
which control the value of the hold, keepalive, advertisement-interval
and connect connect timers. It was kept separated on purpose as the
whole timer implementation is quite complex and merging this commit
together with with the other flag implementations did not seem right.

Basically three new peer flags were introduced, namely
*PEER_FLAG_ROUTEADV*, *PEER_FLAG_TIMER* and *PEER_FLAG_TIMER_CONNECT*.
The overrides work exactly the same way as they did before, but
introducing these flags made a few conditionals simpler as they no
longer had to compare internal data structures against eachother.

Last but not least, the test suite has been adjusted accordingly to test
the newly implemented flag overrides.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:30 +02:00
Pascal Mathis
598a3d4288
bgpd: Improve test suite for peer-group overrides
This commit introduces the current test suite for BGP peer-group
overrides by adding support for custom check handlers (which can check
internal data structures more thoroughly) and by fixing several small
mistakes and issues that slipped through. Also some parts of the code
have been cleaned up to avoid duplicate and/or hard-to-read code.

Additionally a first experimental check for a BGP peer attribute with
values (advertisement-interval <value>) has been added to the test
suite. As this test suite is currently not passing, it has not been
added to the python test caller.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:28 +02:00
Pascal Mathis
e7103a9644
bgpd: Fix AF-attribute overrides when binding peer
The current implementation of the overrides for peer address-family
attributes suffered a bug, which caused all peer-specific attributes to
be lost when the peer was added to a peer-group which already had that
specific address-family active.

This commit extends the *peer_group2peer_config_copy_af* function to
respect overridden flags properly. Additionally, the arguments of the
macros *PEER_ATTR_INHERIT* and *PEER_STR_ATTR_INHERIT* have been
reordered to be more consistent and easy to read.

This commit also adds further test cases to the BGP peer attributes test
suite, so that this kind of error is being caught in future commits. The
missing AF-attribute *distribute-list* has also been added to the test
suite.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:25 +02:00
Pascal Mathis
9fb964de21
bgpd: Implement group-overrides for peer flags
The current implementation of peer flags (e.g. shutdown, passive, ...)
only has partial support for overriding flags of a peer-group when the
peer is a member. Often settings might get lost if the user toys around
with the peer-group configuration, which can lead to disaster.

This commit introduces the same override implementation which was
previously integrated to support proper peer flag/attribute override on
the address-family level. The code is very similar and the global
attributes now use their separate state-arrays *flags_invert* and
*flags_override*.

The test suite for BGP peer attributes was extended to also check peer
global attributes, so that the newly introduced changes are covered. An
additional feature was added which allows to test an attribute with an
*interface-peer*, which can be configured by running `neighbor IF-TEST
interface`. This was introduced so that the dynamic runtime inversion of
the `extended-nexthop` flag, which is only enabled by default for
interface peers, can also be tested.

Last but not least, two small changes have been made to the current bgpd
implementation:

- The command `strict-capability-match` can now also be set on a
peer-group, it seems like this command slipped through while
implementing peer-groups in the very past.

- The macro `COND_FLAG` was introduced inside lib/zebra.h, which now
allows to either set or unset a flag based on a condition. The syntax
for using this macro is: `COND_FLAG(flag_variable, flag, condition)`

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-06-14 18:55:18 +02:00
Arthur Jones
15ecc92750 tests: use BUILT_SOURCES in tests/Makefile.am for automake 1.16.1
When trying to run make check using automake 1.16.1, we get:

CC isisd/test_fuzz_isis_tlv-test_fuzz_isis_tlv.o
isisd/test_fuzz_isis_tlv.c:1:10: fatal error: test_fuzz_isis_tlv_tests.h: No such file or directory
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:1096: recipe for target 'isisd/test_fuzz_isis_tlv-test_fuzz_isis_tlv.o' failed
make[1]: *** [isisd/test_fuzz_isis_tlv-test_fuzz_isis_tlv.o] Error 1
make[1]: Leaving directory '/src/frr-frr-5.0/tests'
Makefile:1220: recipe for target 'check-am' failed
make: *** [check-am] Error 2

From reading the automake docs, it looks like there may be a more
reliable way to express built files in the Makefile.am using BUILT_SOURCES.
Using this method, we seem to build fine now on 1.16.1 and this
has been tested on Ubuntu 18.04, CentOS 7 and Alpine edge (which uses
automake 1.16.1).

Issue: https://github.com/FRRouting/frr/issues/2403
Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
2018-06-12 08:05:00 -07:00
Russ White
9eafc8abd7
Merge pull request #2298 from qlyoung/pipe-actions-vtysh
*: add support for `|` actions
2018-06-08 07:39:36 -04:00
Quentin Young
fe011935cd lib: add string utilities
I see lots of the same code being copy-pasted and slightly tweaked for
string processing all over the codebase. Time to start aggregating these
pieces into something consistent and correct.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-06 16:15:34 +00:00
Arthur Jones
1808d46db2 tests/isisd: bypass test_fuzz_isis_tlv when inet_ntop is broken
On Alpine Linux edge, musl does not seem to be RFC 5952 4.2.2
compliant (how to print a single :0: in the IPv6 address).  Let's
skip that test, as we get false negatives when running against
that version of musl.

Credit for the idea for the fix and how to fix it is due to
chris@opensourcerouting.org.

Testing done:

make check on alpine linux passes now

Issue: https://github.com/FRRouting/frr/issues/2375
Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
2018-06-06 08:08:46 -07:00
Quentin Young
483e5a3aa5
Merge pull request #2304 from ppmathis/enhancement/bgp-pg-overrides
bgpd: Add proper support for overriding peer-group AF-flags/filters
2018-06-05 11:51:57 -04:00
Donald Sharp
1525e99f17 bgpd: Cleanup assumptions in bgp_evpn.c
The bgp data structures:
bgp->vnihash
bgp->vrf_export_rtl
bgp->vrf_import_rtl
bgp->l2vnis

Must always be valid data structures.  So remove the tests
that ensure that they are.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-05 10:43:43 -04:00
Pascal Mathis
f906747961
tests: Improve test suite for peer attributes
This commit improves the previous implementation of the peer attribute
test suite by getting rid of some really ugly macros and replacing them
with sane functions.

Additionally, the macro TEST_ASSERT was changed to TEST_ASSERT_EQ (==
comparison) which now also prints the line where the assertion has been
infringend. This should make it way more clear where a specific issue
has been spotted.

Last but not least, the multicast families for both IPv4 and IPv6 had
been added as they are working without any further changes or special
cases for all currently existing peer attributes. Other AFI/SAFI
references have been removed to keep the code clean.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-28 22:07:53 +02:00
Pascal Mathis
cf9ac8bfb0
bgpd: Fix style issues for peer-group overrides
This commit fixes all outstanding style/formatting issues as detected by
'git clang-format' or 'checkpath' for the new peer-group override
implementation, which spanned across several commits.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-28 19:25:51 +02:00
Pascal Mathis
9d4f56237a
tests: Add tests for overriding BGP peer attrs
This commit introduces unit tests for BGP peer attributes and checks all
three involved components, which are:

- CLI Configuration Input: The appropriate commands to configure the
attribute on either a peer or peer-group are being executed the same way
an end user would do it.

- CLI Configuration Output: The output of 'show running-config' is being
checked for presence/absence of expected configuration strings.

- Internal Data Structures: The internal data structures for maintaining
flag/filter states (value + override + invert) are being checked after
each operation to ensure the override has been implemented properly.

All attributes to be tested must be defined within the 'peer_attrs'
structure, which contains all peer attributes as of today and checks
them with both IPv4 Unicast and IPv6 Unicast. More address families are
supposed to be introduced at a later point in time.

Each attribute is being checked in its own 'clean' BGP environment, so
everything gets reset after each attribute to avoid any weird edge
cases. The 'correct' BGP startup and shutdown routine was taken from
'bgp_main.c' to ensure that we are not leaking any memory or acting
different than the real 'bgpd' would do.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-05-28 19:20:46 +02:00
Christian Franke
a5558663af tests: add pytest cache to gitignore 2018-05-28 15:09:50 +02:00
Quentin Young
ecbe4344af tests: add missing file to Makefile.am
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-05-18 19:45:10 +00:00
Donald Sharp
4258abc56c tests: Add a prefix-sid test
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-02 18:51:07 -04:00
Donald Sharp
d0fa84c228 tests: Fix crash in test_mp_attr
Some recent changes in BGP now require that the
peer's nexthop have a valid ifp when we are looking
at:

	case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
	case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL:

This assumption makes sense for this type of Nexthop Attribute.
So for the test let's jimmy up a `fake` enough interface pointer
so that the actual test we can focus on what we are actually
testing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-25 12:39:17 -04:00