Commit Graph

2224 Commits

Author SHA1 Message Date
Igor Ryzhov
2f9a06f060 isisd: fix circuit is-type configuration
Currently, we have a lot of checks in CLI and NB layer to prevent
incompatible IS-types of circuits and areas. All these checks become
completely meaningless when the interface is moved between VRFs. If the
area IS-type is different in the new VRF, previously done checks mean
nothing and we still end up with incorrect circuit IS type. To actually
prevent incorrect IS type, all checks must be done in the processing
code.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-30 03:17:49 +03:00
Martin Winter
cd206022b1
Merge pull request #9920 from donaldsharp/zebra_seg6local_race
tests: zebra_seg6local has a race condition
2021-10-30 01:36:35 +02:00
Donald Sharp
7d2cf93636 tests: Fix zebra_seg6_route to not always reinstall the same route
This code has two issues:

a) The loop to test for successful installation re-installs
the route every time it loops.  A system under load will
have issues ensuring the route is installed and repeated
attempts does not help

b) The nexthop group installation was always failing
but never noticed (because of the previous commit)
and the test was always passing, when it should
have never passed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-29 13:17:54 -04:00
Donald Sharp
b7b352c000
Merge pull request #9830 from idryzhov/config-timing-fixes
tests: test_static_timing fixes
2021-10-29 13:17:24 -04:00
Donald Sharp
25347872bf tests: zebra_seg6local has a race condition
The test is checking installing of seg6 routes by this
loop:

for up to 5 times:
    sharp install seg6 route
    show ip route and is it installed

The problem is that if the system is under heavy
load the installation may not have happened yet
and by immediately reinstalling the same route
the same thing could happen again.

Modify the code to pull the route installation
outside of the loop and to increase to 10 attempts
in case there is very heavy system load.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-29 08:53:03 -04:00
Igor Ryzhov
9f25891037
Merge pull request #9851 from sartura/isis_unpack_item_ext_subtlvs_fixes
isisd: fix unpack_item_ext_subtlvs TLV parsing issues
2021-10-29 13:34:02 +03:00
Donald Sharp
6b60e7b81d tests: Fix check_ping function in test_bgp_srv6l3vpn_to_bgp_vrf.py
The check_ping function `_check` function was asserting and being
passed to the topotests.run_and_expect() functionality causing
it to not run the full range of pings if one failed the test.

So effectively it was properly detecting pass / failure but
only allowing for 1 iteration if it was going to fail.

Modify the code to not assert and act like all the other
run_and_expect functionality.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-28 15:51:46 -04:00
Juraj Vijtiuk
17b0839b35 isisd: fix unpack_item_ext_subtlvs TLV parsing issues
isis_tlvs.c would fail at multiple places if incorrect
TLVs were received in unpack_item_ext_subtlvs(),
causing stream assertion violations.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
2021-10-27 17:04:26 +00:00
Donald Sharp
f1506cf36b
Merge pull request #9902 from LabNConsulting/working/lb/lutil-wait-optimization
tests: topotests/lib/lutil.py: optimize wait to not repeat command after expected result found
2021-10-27 06:57:26 -04:00
Christian Hopps
e898d2490e
Merge pull request #9862 from donaldsharp/all_protocol_retry
tests: all_protocol_startup needs some tweaks to allow for processing
2021-10-27 00:56:06 -04:00
Russ White
a2b52cbeb4
Merge pull request #9854 from opensourcerouting/zapi-call-table
*: convert zclient callbacks to table
2021-10-26 11:33:44 -04:00
Lou Berger
fd1aebbe77
Merge pull request #9840 from donaldsharp/lu_commands
tests/topotests/lib/lutil.py
2021-10-26 11:27:34 -04:00
Lou Berger
6804af739d tests: topotests/lib/lutil.py: optimize wait to not repeat command after expected result found
Signed-off-by: Lou Berger <lberger@labn.net>
2021-10-26 10:56:50 -04:00
Donald Sharp
fc0a3f8883 tests: Attempt to fix bgp_l3vpn_to_direct timing issues
The bgp_l3vpn_to_direct test is failing sometimes because
the 2.2.2.2 route is dissapearing.  What is happening?

The log file for the failed test run shows us this:

build	15-Oct-2021 07:26:12	scripts/adjacencies.py:8 WAIT:r4:ping 2.2.2.2 -c 1: 0. packet loss:wait:PE->P2 (loopback) ping:60:0.5:
build	15-Oct-2021 07:26:12	Fri Oct 15 14:26:12 2021 (#9) scripts/adjacencies.py:8 COMMAND:r4:ping 2.2.2.2 -c 1: 0. packet loss:wait:PE->P2 (loopback) ping:
build	15-Oct-2021 07:26:12	COMMAND OUTPUT:PING 2.2.2.2 (2.2.2.2) 56(84) bytes of data.
build	15-Oct-2021 07:26:12	64 bytes from 2.2.2.2: icmp_seq=1 ttl=64 time=0.143 ms
build	15-Oct-2021 07:26:12
build	15-Oct-2021 07:26:12	--- 2.2.2.2 ping statistics ---
build	15-Oct-2021 07:26:12	1 packets transmitted, 1 received, 0% packet loss, time 0ms
build	15-Oct-2021 07:26:12	rtt min/avg/max/mdev = 0.143/0.143/0.143/0.000 ms:
build	15-Oct-2021 07:26:12	Done after 1 loops, time=0.024507761001586914, Found= 0% packet loss
build	15-Oct-2021 07:26:12	Fri Oct 15 14:26:12 2021 (#9) scripts/adjacencies.py:9 COMMAND:r4:ping 2.2.2.2 -c 1: 0. packet loss:pass:PE->P2 (loopback) ping +0.02 secs:
build	15-Oct-2021 07:26:12	2021-10-15 14:26:12,446 WARNING: topolog.r4: LinuxNamespace(r4): proc failed: rc 2 pid 28826
build	15-Oct-2021 07:26:12		args: /usr/bin/nsenter -a -t 27444 -F --wd=/tmp/topotests/bgp_l3vpn_to_bgp_direct.test_bgp_l3vpn_to_bgp_direct/r4 /bin/bash -c ping 2.2.2.2 -c 1
build	15-Oct-2021 07:26:12		stdout: connect: Network is unreachable:
build	15-Oct-2021 07:26:17	COMMAND OUTPUT:connect: Network is unreachable:
build	15-Oct-2021 07:26:17	R:9    r4     PE->P2 (loopback) ping +0.02 secs                        0    1

So the 2.2.2.2 route is coming/going and is failing on these test lines:

luCommand(
    "r1", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)
luCommand(
    "r3", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)
luCommand(
    "r4", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)

So the 2.2.2.2 routes on r1,3 and 4 are received via ospf, but are
modified by some other process to add labels ( probably ldp, since
it is running too ).  The 2nd ping to 2.2.2.2 is failing because
the 2.2.2.2 route on r4 is being replaced.  As an example here
is `ip monitor all` on r4 during boot up.  Please note timestamps
are not necessarily representative of what we will see on the
loaded ci system.

[2021-10-15T15:46:52.261456] [NEXTHOP]id 27 via 10.0.2.2 dev r4-eth0 scope link proto zebra
[2021-10-15T15:46:52.261490] [ROUTE]2.2.2.2 nhid 27 via 10.0.2.2 dev r4-eth0 proto ospf metric 20
<snip>
[2021-10-15T15:46:53.556405] [NEXTHOP]Deleted id 27 via 10.0.2.2 dev r4-eth0 scope link proto zebra
<snip>
[2021-10-15T15:46:53.566575] [NEXTHOP]id 32 via 10.0.2.2 dev r4-eth0 scope link proto zebra
[2021-10-15T15:46:53.566585] [ROUTE]2.2.2.2 nhid 32 via 10.0.2.2 dev r4-eth0 proto ospf metric 20

For a small amount of time the route was *gone*.  I believe the upstream
CI system hits that window sometimes, causing the test to fail.

This patch attempts to ensure that the 2.2.2.2 route should be learned
appropriately ( thus slowing it down ) before the test moves onto
the ping.  I suspect the long term answer might be to add a test to
the scripts/adjancies.py script to ensure that the test does not
continue until the appropriate label is in place, but I want to
make the test run a bit more perscriptive in what it is looking
for here.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-25 09:16:08 -04:00
Donald Sharp
f66e42011a tests: Fix accidental 10 second wait
Recent commit 83f325901a had a accidental
turn of a 1 second wait into a 10 second wait
between retries.  10 seconds is too long.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-25 08:00:23 -04:00
Martin Winter
f641623151
tests: Fix frequent failure of ospf_gr_topo1 on slower systems
Test doesn't wait long enough when it checks the routers after
restart. On slower systems, it frequently failed as it ran out
of time

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2021-10-25 00:53:49 +02:00
Donald Sharp
cbdf030613
Merge pull request #9670 from LabNConsulting/chopps/fix-valgrind-fail-check
Chopps/fix valgrind fail check
2021-10-24 08:30:29 -04:00
Donald Sharp
83f325901a tests: bfd_isis_topo1 expects unreasonable convergence times under load
When our ci test system is under high load, expecting bfd to converge
in under 2 seconds is not going to happen.  Modify the test suites
to just ensure that things converge.  If we need actual functional
testing of bfd response times the topotests are not an appropriate place
to do this or we need to modify the test system to gather the data for
how long it takes after the tests are run.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-22 15:27:50 -04:00
Donald Sharp
1430ea83da tests: Fix bgp_ecmp_topo3 to look for a bit more state
During a local CI run, bgp_ecmp_topo3 was failing
to properly notice the fast-convergence command
issued before the interface is shut down.  As
such there exists a race condition where under
high load the zebra process can actually shut
an interface down before we have properly ensured
that fast convergence is on for ibgp.

Modify the test for in two ways:

1) Ensure that previous section makes sure
that we have properly converged for when we
bring back up the interfaces instead of
assuming that we have done so.

2) After issuing the fast-convergence command.
Ensure that bgp has fully processed it and is
ready to receive the interface down events
as triggers for shutting down the ibgp session.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-22 14:47:49 -04:00
Donald Sharp
e5369c471b tests: Make test_ldp_topo1.py aware of how many neighbors it needs
On a local CI run.  The test_ldp_topo1.py showed fail to converge
on r3.  r3 has 2 neighbors but only 1 was up when we got to
further steps in the test suites.

Modify the neighbor checking to `know` how many neighbors
should be operational and continue looking for them until
they are up and running.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-22 14:18:33 -04:00
Christian Hopps
a15e5ac082 tests: fix --valgrind-memleaks option
Previously, when a valgrind memleak was discovered, would cause a
catastrophic pytest failure. Now correctly fails the current pytest as
intended.

As a result of this fix --valgrind-memleaks now works in distributed
pytest mode as well.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-10-22 17:44:47 +00:00
Christian Hopps
1f87861ecc tests: revert default enable of memleak tests
Revert the accidental enabling of the optional memleak tests that came
with the large micronet changeset.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-10-22 17:44:47 +00:00
Christian Hopps
f24157851b tests: fix missing space in --valgrind-extra option
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-10-22 17:44:47 +00:00
Donald Sharp
9482d96e3f tests: all_protocol_startup needs some tweaks to allow for processing
The nexthop group code is installing routes and nexthop groups
and immediately expecting zebra to have processed the results
as a result there is a situation when the CI system is under
intense load that the nexthop group might not have been processed.

Add a bit of code to allow the test to give FRR some time
to finish work before declaring it not working.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-22 11:28:31 -04:00
Russ White
61a7ec774c
Merge pull request #9783 from mjstapp/fix_bgp_lu_lsp
bgpd, tests: BGP-labeled-unicast advertise implicit-null in more cases
2021-10-20 18:22:01 -04:00
Igor Ryzhov
e57c66d5e9 tests: relax requirements for test_static_timing
When the CI system is heavily loaded, we might see the following failures:

```
test failed at "test_config_timing/test_static_timing": assert 20.083204 <= 19.487716
```

Currently we allow each step to run 2 times slower than the initial
measurement. Let's allow them to run 3 times slower.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-21 01:04:44 +03:00
Igor Ryzhov
925d7f925b tests: fix test_static_timing route removal
On the first step, the test creates 10000 static routes. It passes 10000
to `get_ip_networks` and it generates 10000 /22 routes.

On the fourth step, the test tries to remove 5000 previously created
routes. It passes 5000 to `get_ip_networks` and here starts the problem.
Instead of generating 5000 /22 routes, it generates 5000 /21 routes. And
the whole step is a no-op, we constantly see the following logs:
```
% Refusing to remove a non-existent route
```

To consistently generate same routes, `get_ip_networks` must always use
the same prefix length.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-21 01:04:44 +03:00
David Lamparter
5a001ddd24
Merge pull request #9855 from donaldsharp/ospf_fini 2021-10-20 19:19:43 +02:00
Mark Stapp
52e458d922
Merge pull request #9766 from opensourcerouting/typesafe-member-nhrp-zap
lib: add typesafe membership-test functions
2021-10-20 08:13:17 -04:00
Donald Sharp
e9a59a2a59 tests: When heavily loaded do not send SIGBUS so fast
Our topotests send SIGBUS 2 seconds after a SIGTERM is
initiated.  This is bad because under a heavily loaded
topotest system we may have a case where the system has
not had a chance to properly shut down the daemon.
Extend the time greatly before topotests send SIGBUS.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-20 08:02:10 -04:00
David Lamparter
a243d1db93 *: convert zclient callbacks to table
This removes a giant `switch { }` block from lib/zclient.c and
harmonizes all zclient callback function types to be the same (some had
a subset of the args, some had a void return, now they all have
ZAPI_CALLBACK_ARGS and int return.)

Apart from getting rid of the giant switch, this is a minor security
benefit since the function pointers are now in a `const` array, so they
can't be overwritten by e.g. heap overflows for code execution anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-20 13:28:46 +02:00
Russ White
656b3fdceb
Merge pull request #9839 from donaldsharp/test_ospf_summarization
Test ospf summarization
2021-10-19 19:17:35 -04:00
Russ White
ed131d8b74
Merge pull request #9752 from opensourcerouting/ospf6d-nssa-ranges
ospf6d: add support for NSSA Type-7 address ranges
2021-10-19 19:15:40 -04:00
David Lamparter
a1103bd352 build: add tests missed in .gitignore
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:58:51 +02:00
David Lamparter
40ee228da9 lib: add unsorted typesafe_anywhere()
*_anywhere(item) returns whether an item is on _any_ container.  Only
available for unsorted containers for now.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:55:39 +02:00
David Lamparter
f45897e45c lib: typesafe *_member()
This provides a "is this item on this list" check, which may or may not
be faster than using *_find() for the same purpose.  (If the container
has no faster way of doing it, it falls back to using *_find().)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:55:39 +02:00
David Lamparter
9de36e51fe tests: fix leak in test code
Even if it doesn't matter for an unit test in general, it hides actual
leaks in the code being tested.  Fix so any leaks will be actual bugs.
(Currently there aren't any, yay.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19 14:55:39 +02:00
Donald Sharp
6862166ed5 tests: Fix ospf_asbr_summary_topo1.py
This script is failing occassionally in our upstream topotests.
Where it was changing route-maps and attempting to see if
summarization was working correctly.  The problem was that
the code appeared to be attempting to add route-maps to
redistribution in ospf then modifying the route-maps behavior
to affect summarization as well as the metric type of that
summarization.

The problem is of course that ospf does not appear to modify
the summary routes metric-type when the components
of that summary change it's metric-type.  So the test
is testing nothing.  In addition the test had messed
up the usage of the route-map generation code and all
the generated config was in different sequence numbers
but route-map processing would never get to those
new sequence numbers because of how route-maps are processed.

Let's just remove this part of the test instead of trying
to unwind it into anything meaningfull

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-15 11:43:44 -04:00
Donald Sharp
45cfb2495f lib: Add metric-type to possible set operations
Several tests used the route_map_create functionality
with `metric-type` but never bothered to add the
backend code to ensure it works correctly.
Add it in so it can be used.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-15 11:42:06 -04:00
Donatas Abraitis
9139cc723d
Merge pull request #9825 from donaldsharp/one_sleep_twice_shy
tests: BFD timing tests under system load need more leeway
2021-10-14 15:31:23 +03:00
Renato Westphal
512901ae53
Merge pull request #9822 from donaldsharp/ospf_testing
Ospf testing
2021-10-13 23:38:44 -03:00
Igor Ryzhov
1aa12de695
Merge pull request #9761 from mjstapp/fix_topo_debug_cli
tests: remove deprecated debug cli references
2021-10-14 01:48:41 +03:00
Igor Ryzhov
e0a63f1703
Merge pull request #9796 from mjstapp/fix_topo_isis_vrf_cmds
tests: in isis_topo1_vrf, only configure valid interfaces
2021-10-14 01:44:03 +03:00
Donald Sharp
f786c3ee29 tests: BFD timing tests under system load need more leeway
We have this pattern in this test:

    # Let's kill the interface on rt2 and see what happens with the RIB and BFD on rt1
    tgen.gears["rt2"].link_enable("eth-rt1", enabled=False)

    # By default BFD provides a recovery time of 900ms plus jitter, so let's wait
    # initial 2 seconds to let the CI not suffer.
    topotest.sleep(2, 'Wait for BFD down notification')

    router_compare_json_output(
        "rt1", "show ip route ospf json", "step3/show_ip_route_rt2_down.ref", 1, 0
    )

Under a heavy CI load, interface down events and then reacting to them may not actually
happen within 2 seconds.  Allow some more grace time in the test to ensure that we
react to it in an appropriate manner.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-13 14:12:51 -04:00
Russ White
c9adeefcfa
Merge pull request #9819 from donaldsharp/deprecation_python
tests: Fix `Invalid escape sequence` warnings in test runs
2021-10-13 13:55:06 -04:00
Donald Sharp
a22d51e21e tests: Convert over to using converged to test for ospf being converged
OSPF when it is deciding on whom it should elect for DR and backup
has a process that prioritizes network stabilty over the exact
same results of who is the DR / Backups.

Essentially if we have r1 ----- r2

Let's say r1 has a higher priority, but r2 comes up first, starts
sending hello packets and then decides that it is the DR.  At some
point in time in the future, r1 comes up and then connects to r2
at that point it sees that r2 has elected itself DR and it keeps
it that way.

This is by design of the system.  With our tight ospf timers as
well as high load being experienced on our test systems.  There
exists a bunch of ospf tests that we cannot guarantee that a
consistent DR will be elected for the test.  As such let's not
even pretend that we care a bunch and just look for `Full`.
If we care about `ordering` we need to spend more time getting
the tests to actually start routers, ensure that htey are up and
running in the right order so that priority can take place.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-13 12:46:22 -04:00
Donald Sharp
48f05b233f tests: Fix Invalid escape sequence warnings in test runs
Test runs are creating these warnings:
bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_linux_mpls
  <string>:7: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_linux_mpls
  <string>:19: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_scale_up
  <string>:24: DeprecationWarning: invalid escape sequence \d

bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py::test_check_scale_up
  <string>:191: DeprecationWarning: invalid escape sequence \d

-- Docs: https://docs.pytest.org/en/stable/warnings.html

Find and destroy these warnings

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-13 09:03:27 -04:00
Donatas Abraitis
314479e114
Merge pull request #9715 from idryzhov/cleanup-number-named-acl
*: cleanup number-named access-lists in CLI
2021-10-13 10:00:43 +03:00
Russ White
0f96b7e69b
Merge pull request #9763 from ton31337/fix/more_thread_null
More struct thread null
2021-10-12 11:49:46 -04:00
Russ White
effd4c7bdd
Merge pull request #9779 from donaldsharp/gr_repeated
Some GR fixes
2021-10-12 11:00:44 -04:00
Mark Stapp
4008633d7b tests: in isis_topo1_vrf, only configure valid interfaces
Fix a loop in the setup phase of isis_topo1_vrf: only configure
interfaces that each router actually has.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-11 17:25:46 -04:00
Russ White
99497bc4ee
Merge pull request #9471 from pguibert6WIND/table_manager_alloc2
zebra: extend table manager per vrf, add vty configuration
2021-10-08 13:49:54 -04:00
Renato Westphal
10396dc55a tests: check for received Grace-LSAs on the OSPF GR topotests
Ensure GR helpers have received a Grace-LSA before killing the
ospfd/ospf6d process that is undergoing a graceful restart.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-08 14:38:27 -03:00
Igor Ryzhov
7e86999140 *: cleanup number-named access-lists in CLI
There's no more difference between number-named and word-named access-lists.
This commit removes separate arguments for number-named ACLs from CLI.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-08 19:25:41 +03:00
Mark Stapp
74d79ead01 tests: adjust bgp_lu_topo1 for updated BGP LU
BGP LU will use implicit-null in more situations now; adjust
the original LU topotest to align with that. Node R2 uses
imp-null now, while R1 continues to allocate labels.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-08 09:11:51 -04:00
Mark Stapp
8734a29c8f tests: add bgp_lu_topo2 test suite
Add a second BGP labelled-unicast (BGP-LU) test suite, with
an additional router and some additional tests.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-08 09:11:51 -04:00
Donald Sharp
6255aad0bc tests: Fix ospf[6]_gr_topo1 tests to work better under load
2 things:

a) Each test was setting up for graceful restart with calls to
`graceful-restart prepare ip[v6] ospf`, then sleeping for
3 or 5 seconds.  Then killing the ospf process.  Under heavy
load there is no guarantee that zebra has received/processed
this signal.  Write some code to ensure that this happens

b) Tests are issuing commands in this order:
   1) issue gr prepare command
   2) kill router
   3) <ensure routes were still installed in zebra>
   4) start router
   5) <ensure routes were stil installed in zebra>

Imagine that the system is under some load and there is
a small amount of time before step 5 happens.  In this
case ospf could have come up and started neighbor relations
and also started installing routes.  If zebra receives
a new route before step 5 is issued then the route could
be in a state where it is not installed, because it is
being sent to the kernel for installation.  This would
fail the test because it would only look 1 time.  This
is fixed by giving time on restart for the routes to
be in the installed state.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-08 08:35:16 -04:00
Igor Ryzhov
1c49e8138e bgpd: fix crash when using "show bgp vrf all"
Any command that uses `peer_lookup_in_view` crashes when "vrf all" is
used, because bgp is NULL in this case.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-08 11:42:13 +03:00
Donatas Abraitis
1a8e5aea78 tests: Do not explicitly set the thread pointer to NULL
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF
semantics.  This is espacially true for the functions we
end up calling the thread for.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-08 08:56:42 +03:00
Mark Stapp
c0fa628e99 tests: clean up all_proto_startup a bit
Remove references to the deprecated "CLI()" function; clean up
a couple of string escapes; make one test-case sensitive to
previous failures.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-06 13:49:52 -04:00
Mark Stapp
a1985a2dc9 tests: remove deprecated debug cli from some tests
Some tests had commented-out references to the old "CLI()"
function. Remove those so they're not confusing in the future,
and replace at least one with a comment that uses the
'mininet_cli()' function.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-06 10:51:04 -04:00
Donald Sharp
11ed589224
Merge pull request #9745 from opensourcerouting/bfd-ospf-topo-improv
topotests: improve bfd_ospf_topo1 test
2021-10-06 06:40:36 -04:00
Renato Westphal
343e16cec5 tests: extend topotest to test NSSA ranges
Test NSSA address ranges, including the "cost" and "not-advertise"
options.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-05 21:25:55 -03:00
Renato Westphal
cb81dd25e5 tests: update ospf6_topo2's ospf6d configs
* Add new debug directives for NSSA LSAs;
* Remove the "debug ospf6 gr helper" command since it doesn't make
  sense for this test (not to mention it was renamed to "debug ospf6
  graceful-restart");
* Migrate to the new interface-level command to enable OSPFv3 on
  interfaces ("interface WORD area A.B.C.D" was deprecated).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-05 21:25:55 -03:00
Rafael Zalamena
2d28cbe661 topotests: justify code sleep
Document the `sleep` statement so people know that we are sleeping
because we are waiting for the BFD down notification. If we don't
sleep here it is possible that we get outdated `show` command results.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-10-05 12:41:33 -03:00
Rafael Zalamena
8ff24fd29e topotests: decrease result check frequency
Call the `show` commands less often to reduce the CPU pressure.

Also increase the wait time from 60 to 80 seconds to have spare room
for failures (4 times more). This is the latest measure wait time:

> INFO: topolog: 'router_json_cmp' succeeded after 20.08 seconds

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-10-05 12:40:14 -03:00
Rafael Zalamena
a6ce07852c topotests: increase OSPF convergence speed
Reduce timers so we send hello packets more often and reduce dead
interval to converge faster.

Previous test wait amount:
> INFO: topolog: 'router_json_cmp' succeeded after 47.20 seconds

New test wait amount:
> INFO: topolog: 'router_json_cmp' succeeded after 20.08 seconds

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-10-05 12:38:40 -03:00
Donatas Abraitis
feabd51dae tests: Do not explicitly set the thread pointer to NULL
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF
semantics.  This is espacially true for the functions we
end up calling the thread for.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-04 19:29:06 +03:00
Mark Stapp
f89211f7c9 tests: fix log string in topotests/lib/bgprib.py
Correct a log string in a method in bgprib.py - cut-and-paste
error, maybe?

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-10-01 08:06:35 -04:00
Igor Ryzhov
ac32b03f98
Merge pull request #9694 from mjstapp/fix_topo_pim_cmp
tests: fix string comparison in lib/pim.py
2021-09-30 12:40:55 +03:00
Mark Stapp
94e8feaa9f tests: fix string comparison in lib/pim.py
Use correct string comparison syntax in lib/pim.py

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2021-09-29 11:49:43 -04:00
David Lamparter
a89bae26f7
Merge pull request #9560 from LabNConsulting/ziemba/frrmod_load-error-messages
frrmod_load(): fix error messages
2021-09-29 14:35:35 +02:00
Lou Berger
1b9ebabb27 tests: get bgp_l3vpn_to_bgp_vrf running, also improve logging
Signed-off-by: Lou Berger <lberger@labn.net>
2021-09-28 11:29:46 -04:00
Russ White
b8beb67ef5
Merge pull request #9585 from opensourcerouting/ospf6d-nssa-dflt-originate
ospf6d: add a knob to generate Type-7 default routes
2021-09-24 13:42:49 -04:00
Donald Sharp
e39ea73486
Merge pull request #9647 from opensourcerouting/ospf-gr-cmd-rename
ospfd, ospf6d: rename the "graceful-restart helper-only" command
2021-09-22 14:53:40 -04:00
Donald Sharp
86b2043033
Merge pull request #9646 from LabNConsulting/ziemba/skiplist-level-counters-int
lib: skiplist: clean up level counter implementation
2021-09-22 07:21:14 -04:00
G. Paul Ziemba
c324b10f28 lib: skiplist: clean up level counter implementation
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-21 17:03:53 -07:00
Renato Westphal
6735622c24 ospf6d: implement Type-7 default routes for NSSA areas
Add the "default-information-originate" option to the "area X nssa"
command. That option allows the origination of Type-7 default routes
on NSSA ABRs and ASBRs.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:47:13 -03:00
Renato Westphal
210429c747 ospf6d: don't generate Type-7 LSA for route created by "default-information-originate"
The route created by the "default-information-originate" command
isn't a regular external route. As such, an NSSA ABR shouldn't
originate a corresponding Type-7 LSA for it (there's a separate
configuration knob to generate Type-7 default routes).

While here, fix a small issue in ospf6_asbr_redistribute_add()
where routes created by "default-information-originate" were being
displayed with an incorrect "unknown" type.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:43:45 -03:00
Renato Westphal
242a9767f7 ospf6d: fix metric type of NSSA Type-7 LSAs
Fix wrong comparison since route->path.metric_type is always set
to either 1 or 2. The OSPF6_PATH_TYPE_EXTERNAL2 constant, whose
value is 4, refers to a route type so its usage was incorrect here.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:43:45 -03:00
Renato Westphal
859bce816b ospfd: rename the "graceful-restart helper-only" command
Considering that both the GR helper mode and restarting mode can be
enabled at the same time, the "graceful-restart helper-only" command
can be a bit misleading since it implies that only the helper mode
is enabled. Rename the command to "graceful-restart helper enable"
to clarify what the command does.

Start a deprecation cycle of one year before removing the original
command

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:42:03 -03:00
Philippe Guibert
42d4b30e00 zebra: extend table manager per vrf, add vty configuration
Because vrf backend may be based on namespaces, each vrf can
use in the [16-(2^32-1)] range table identifier for daemons that
request it. Extend the table manager to be hosted by vrf.

That possibility is disabled in the case the vrf backend is vrflite.
In that case, all vrf context use the same table manager instance.

Add a configuration command to be able to configure the wished
range of tables to use. This is a solution that permits to give
chunks to bgp daemon when it works with bgp flowspec entries and
wants to use specific iptables that do not override vrf tables.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-21 18:37:30 +02:00
Russ White
2075387e77
Merge pull request #9546 from proelbtn/add-support-for-perfix-sid-type-5
Add support for Prefix-SID (Type 5)
2021-09-21 11:36:53 -04:00
Renato Westphal
6b513b4c92 ospf6d: rename the "graceful-restart helper-only" command
Considering that both the GR helper mode and restarting mode can be
enabled at the same time, the "graceful-restart helper-only" command
can be a bit misleading since it implies that only the helper mode
is enabled. Rename the command to "graceful-restart helper enable"
to clarify what the command does.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 11:51:36 -03:00
Renato Westphal
f4f0098ca0 ospf6d: rework filtering commands to be in line with ospfd
Issue #9535 describes how the export-list/import-list commands work
differently on ospfd and ospf6d.

In short:
* On ospfd, "area A.B.C.D export-list" filters which internal
  routes an ABR exports to other areas. On ospf6d, instead, that
  command filters which inter-area routes an ABR exports to the
  configured area (which is quite counter-intuitive). In other words,
  both commands do the same but in opposite directions.
* On ospfd, "area A.B.C.D import-list" filters which inter-area
  routes an ABR imports into the configured area. On ospf6d, that
  command filters which inter-area routes an interior router accepts.
* On both daemons, "area A.B.C.D filter-list prefix NAME <in|out>"
  works exactly the same as import/export lists, but using prefix-lists
  instead of ACLs.

The inconsistency on how those commands work is undesirable. This
PR proposes to adapt the ospf6d commands to behave like they do
in ospfd.

These changes are obviously backward incompatible and this PR doesn't
propose any mitigation strategy other than warning users about the
changes in the next release notes. Since these ospf6d commands are
undocumented and work in such a peculiar way, it's unlikely many
users will be affected (if any at all).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-20 13:06:35 -03:00
Russ White
88dde69cb6
Merge pull request #9632 from donaldsharp/no_forced_wait
tests: Do not do a initial_timeout of 2 seconds for verify_bgp_rib
2021-09-17 12:22:36 -04:00
Russ White
ca45d9e5bf
Merge pull request #8985 from opensourcerouting/ospf6d-gr
ospf6d: introduce support for Graceful Restart (restarting mode)
2021-09-17 12:22:07 -04:00
Jafar Al-Gharaibeh
7c3ea1c424
Merge pull request #9619 from AnuradhaKaruppiah/lttng-updates
lttng build updates
2021-09-16 14:55:43 -05:00
Donald Sharp
4367df1575 tests: Do not do a initial_timeout of 2 seconds for verify_bgp_rib
A bunch of tests have this pattern:

a) Install a new prefix into bgp
b) Run this loop:
foreach (router in topology) {
	verify_bgp_rib(router)
}

This is to ensure that the prefix is actually disseminated.
The problem with this, of course, is that a wait of 2 seconds
for every item in that loop makes no sense.  As that the initial
router verification of it's bgp rib will wait 2 seconds and
all the remaining bgp routers in the topology will have gotten
the data.  So we end up waiting a bunch of extra time.

Remove the initial_wait time for verify_bgp_rib.  Also
increase the failure wait time to 30 seconds.  This is
to give a bigger window for bgp to send it's data for
our test systems that could be under heavy load.  In the
normal case tests will never hit this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-16 15:12:13 -04:00
Renato Westphal
b1c1004fb9 tests: add OSPFv3 graceful restart topotest
Add a new topotest that features a topology with seven routers spread
across four OSPF areas:
* 1 backbone area;
* 1 regular non-backbone area (0.0.0.1);
* 1 stub area (0.0.0.2);
* 1 NSSA area (0.0.0.3).

All routers have both GR and GR helper functionality enabled in
the configuration. The test consists of restarting each router,
one at time, and checking that all forwarding planes (and LSDBs)
are kept intact during those restarts.

A successful run takes about three minutes to finish.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:48 -03:00
Donald Sharp
6aed8082b6 tests: Fix make check builds on some bsd variants
Compilation is warning that a memcpy is only copying
the first (sizeof pointer) into memory.  This is not
what we really want.  Although it does beg the question about
why this memcpy is needed( or what it is doing ).  I'm going
to just fix the memcpy and call it a day.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-15 21:10:24 -04:00
Donald Sharp
827ddd5a1d
Merge pull request #9596 from LabNConsulting/ziemba/printfrr-nexthop
printfrr %pNHcg, %pNHci
2021-09-15 20:23:30 -04:00
Anuradha Karuppiah
c038cddff8 tests: include lttng libs in the bgp tests build
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-09-15 11:22:08 -07:00
G. Paul Ziemba
016cfe701e lib,doc,tests: printfrr %pNHcg, %pNHci
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-14 10:06:57 -07:00
G. Paul Ziemba
52fad8f656 lib/module.c and callers of frrmod_load(): fix error messages
frrmod_load() attempts to dlopen() several possible paths
    (constructed from its basename argument) until one succeeds.

    Each dlopen() attempt may fail for a different reason, and
    the important one might not be the last one. Example:

	dlopen(a/foo): file not found
	dlopen(b/foo): symbol "bar" missing
	dlopen(c/foo): file not found

    Previous code reported only the most recent error. Now frrmod_load()
    describes each dlopen() failure.

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2021-09-14 09:51:49 -07:00
Igor Ryzhov
b8c01bba53
Merge pull request #9486 from slankdev/slankdev-srv6-no-cli-1
CLI to delete SRv6 locator
2021-09-14 19:04:03 +03:00
Hiroki Shirokura
d4a94e93e5 topotests: bgp_srv6l3vpn_to_bgp_vrf bgp locator unset test case
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-09-13 23:32:09 +00:00
Christian Hopps
3a1ef6784f
Merge pull request #9589 from donaldsharp/route_scale_cleanup
tests: Break up route_scale into 2 separate tests
2021-09-13 14:12:27 -04:00
Donald Sharp
0b4c566b1c
Merge pull request #9587 from opensourcerouting/all-proto-test-fix
tests: Fix BGP check in all_protocol_startup
2021-09-13 13:57:49 -04:00
Igor Ryzhov
fa1b629254
Merge pull request #9543 from donaldsharp/actually_set_mpls_data
tests: Fix wrong setting of mpls being turned on
2021-09-13 19:31:53 +03:00