Commit Graph

37356 Commits

Author SHA1 Message Date
Russ White
6e1eeed507
Merge pull request #17306 from pguibert6WIND/bmp_test_factorise_plus_fix
BMP test rework
2024-12-03 08:42:24 -05:00
Philippe Guibert
d1301f1c2a topotests: save bgp_bmp json temp files to bmp log folder instead of /tmp
Some temporary files are hardwritten in /tmp folder. Use the bmp log
folder instead. Replace the bmp log file argument with bmp log folder.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-02 18:44:53 +01:00
Louis Scalbert
f2eb14d381 tests: save bmp pcap in logdir instead of /tmp
DEBUG_PCAP can be set True to manually enable pcap debugging when
running bmp tests.

Save bmp pcap in logdir (ie. /tmp/topotests/bgp_bmp.bgp_bmp_X/ instead
of /tmp.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-02 18:44:53 +01:00
Louis Scalbert
b12e04fdf1 tests: fix bmp test parallelization
Multiple BMP tests can run in parallel but, when one instance ends,
it kills the BMP server process of all BMP tests.

Save the PID of a BMP server and only kill it at the end.

Link: https://github.com/FRRouting/frr/issues/17465
Fixes: 875511c466 ("topotests: add basic bmp collector")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-12-02 18:44:53 +01:00
Louis Scalbert
bbf8ee1769 tests: add py extension to bmpserver
to help identify the file type. And apply black.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-12-02 18:44:53 +01:00
Philippe Guibert
1ea8ba5902 topotests: bgp_bmp, use unified configuration
Use unified configuration procedure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-02 18:44:50 +01:00
Philippe Guibert
2dc693e808 topotests: fix bmp_collector handling of empty as-path
When configuring the bgp_bmp test with an additional
peer that sends empty AS-PATH, the bmp collector is stopping:

> [2024-10-28 17:41:51] Finished dissecting data from ('192.0.2.1', 33922)
> [2024-10-28 17:41:52] Data received from ('192.0.2.1', 33922): length 195
> [2024-10-28 17:41:52] Got message type: <class 'bmp.BMPRouteMonitoring'>
> [2024-10-28 17:41:52] unpack_from requires a buffer of at least 2 bytes for unpacking 2 bytes at offset 0 (actual buffer size is 0)
> [2024-10-28 17:41:52] TCP session closed with ('192.0.2.1', 33922)
> [2024-10-28 17:41:52] Server shutting down on 192.0.2.10:1789

The parser attempts to read an empty AS-path and considers the length
value as a length in bytes, whereas RFC mentions this value as
definining the number of AS-PAths. Fix this in the parser.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-02 16:54:04 +01:00
Philippe Guibert
0af653eaf7 topotests: bmp, create shared library for bmp
The bgp_bmp and bgp_bmp_vrf tests use similar routines
to test the bmp, but are duplicates. Gather the bgp_bmp
and the bgp_bmp_vrf tests in a single bgp_bmp folder.

- Create a bgpbmp.py library under the bgp_bmp test folder
- The bgp_bmp and bgp_bmp_vrf test are renamed to bgp_bmp_1
and bgp_bmp_2 test.
- Maintain separate folder for config and output results. Adapt
the bgp_bmp library accordingly.
- The json output for bgp_bmp_2 test has no referenc to hostame.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-12-02 16:54:04 +01:00
Donatas Abraitis
ee5a3456d3
Merge pull request #17525 from famfo/podman-tests
topotests: Allow runing under both docker and podman
2024-11-29 10:02:12 +02:00
Donatas Abraitis
8e1231d061
Merge pull request #16700 from louis-6wind/fix-nhrp-output
nhrpd: fix show ip nhrp output
2024-11-28 17:16:24 +02:00
Donatas Abraitis
8c9cd28aaa
Merge pull request #17491 from pguibert6WIND/bgp_evpn_rt5_routemap
Bgp evpn rt5 routemap
2024-11-28 16:59:57 +02:00
famfo
d87ec38dfd
topotests: Allow runing under both docker and podman
Signed-off-by: famfo <famfo@famfo.xyz>
2024-11-28 14:59:29 +01:00
Donatas Abraitis
9d118e3bd0
Merge pull request #17520 from mikemallin/dev/ubuntu-docker-custom-uid
Docker: Add the ability to override the FRR UID during docker creation
2024-11-28 15:58:09 +02:00
Donatas Abraitis
f46e65f440
Merge pull request #15542 from pguibert6WIND/bgp_srv6_real_sid
bgpd: fix use real SID in BGP nexthop tracking
2024-11-28 15:21:10 +02:00
Philippe Guibert
8b3b152a1a bgpd: fix use real SID in BGP nexthop tracking
When receiving an SRv6 BGP update, the nexthop tracking is used
to find out the reachability of the BGP update.

> # show bgp ipv6 vpn fd00:200::/64
> Paths: (1 available, best #1)
> [..]
>     4:4::4:4 from 4:4::4:4 (4.4.4.4)
>       Origin incomplete, metric 0, localpref 100, valid, internal, best (First path received)
>       Extended Community: RT:52:100
>       Remote label: 16
>       Remote SID: 2001:db8:f4::
>       Last update: Mon Mar 11 11:50:04 2024

The IPv6 address used is the "Remote SID". Actually, this value is
incomplete. Remote SID stands for the attribute value received in BGP,
while the label value determines a complement of SRv6 SID value. The
transposition technique authorises that in BGP, and in the above case,
the incoming BGP update has used the transposition length.

When there is a transposition in the SID attribute available, use the
real SID address. The nexthop tracking will use that forged address.

> # show bgp nexthop
> Current BGP nexthop cache:
>  4:4::4:4 valid [IGP metric 30], #paths 0, peer 4:4::4:4
>   gate fe80::dced:1ff:fed6:878c, if ntfp3
>   Last update: Mon Mar 11 11:50:02 2024
>  2001:db8:f4:1:: valid [IGP metric 0], #paths 2
>   gate fe80::dced:1ff:fed6:878c, if ntfp3

Fixes: 26c747ed6c ("bgpd: extend make_prefix to form srv6-based prefix")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-11-28 09:13:53 +01:00
Philippe Guibert
b8b7a615ac topotests: bgp_evpn_rt5, add test for advertise route-map service
Use the advertise route-map command, and check that it
filters out correctly the undesirable prefixes. Reversely,
check that undoing that route-map recovers all prefixes.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-11-27 08:47:24 +01:00
Philippe Guibert
fe272d3508 topotests: bgp_evpn_rt5, rework test
Rework the test file by adding test methods.
Add a convergence test that checks for the incoming BGP prefixes.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-11-27 08:47:19 +01:00
Donatas Abraitis
855873aa77
Merge pull request #17527 from guoguojia2021/guozhongfeng_alibaba
doc:Fix bgp doc warning
2024-11-27 08:27:08 +02:00
guozhongfeng.gzf
8a51814085 doc:Fix bgp doc warning
Signed-off-by: guozhongfeng.gzf <guozhongfeng.gzf@alibaba-inc.com>
2024-11-27 10:05:03 +08:00
Mark Stapp
8ef5282c8d
Merge pull request #17519 from chiragshah6/evpn_dev4
zebra: EVPN fix code style in vlan vni map debugs
2024-11-26 16:39:47 -05:00
Donatas Abraitis
4c2f5c70ba
Merge pull request #17385 from donaldsharp/more_found_connection_conversion_issues
More found connection conversion issues
2024-11-26 22:45:10 +02:00
Jafar Al-Gharaibeh
5c1154beaf
Merge pull request #16878 from donaldsharp/increased_test_cover
Add some test cases, and some ability to see what is going on in zebra
2024-11-26 13:40:39 -06:00
Russ White
d4057251b6
Merge pull request #17510 from pguibert6WIND/show_bgp_flowspec_extra_space
bgpd: fix use single whitespace when displaying flowspec entries
2024-11-26 13:11:22 -05:00
Mike RE Mallin
d643190500 Docker: Add the ability to override FRR UID
Signed-off-by: Mike RE Mallin <mmallin@cisco.com>
Signed-off-by: Mike RE Mallin <mremallin@gmail.com>
2024-11-26 12:18:37 -05:00
Chirag Shah
887a0840f6 zebra: EVPN fix code style in vlan vni map debugs
Fix up couple of style issues missed in
PR 17483

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-11-26 09:06:44 -08:00
Donald Sharp
7bf3f53e44 bgpd: peer_active is connection oriented, make it so
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:59:39 -05:00
Donald Sharp
1baeb81632 bgpd: bgp_getsockname should use connection
Let's use the connection associated with the peer
instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:59:33 -05:00
Donald Sharp
72f716ef28 bgpd: Modify bgp_connect_in_progress_update_connection to use connection
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:59:27 -05:00
Donald Sharp
2771431938 bgpd: Modify bgp_udpatesockname to pass in a connection
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:59:19 -05:00
Donald Sharp
eacf923b00 bgpd: Fix pattern of usage in bgp_notify_config_change
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
        peer_notify_config_change(peer->connection);
else
        bgp_session_reset_safe(peer, &nnode);

Let's add a bool return to peer_notify_config_change of whether or
not it should call the peer session reset.  This simplifies
the code a bunch.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:59:18 -05:00
Donald Sharp
ba0edb9545 bgpd: Add peer_notify_config_change() function
We have about a bajillion tests of if we can
notify the peer and then we send a config change
notification.  Let's just make a function that
does this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:58:23 -05:00
Donald Sharp
2e5b4e32c4 bgpd: peer_notify_unconfig should be connection based
Convert this function to being connection based.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-26 11:49:34 -05:00
Russ White
bcf6e53314
Merge pull request #17483 from chiragshah6/evpn_dev4
zebra: fix EVPN check vxlan oper up in vlan mapping
2024-11-26 11:48:01 -05:00
Russ White
842da0d00e
Merge pull request #17501 from opensourcerouting/fix/gr_peer-groups
bgpd: Fix Graceful-Restart for peer-groups
2024-11-26 10:35:19 -05:00
Russ White
c84a680097
Merge pull request #14367 from donaldsharp/ospfapi_test_failure
two test cleanups
2024-11-26 10:13:59 -05:00
Russ White
0a40e044ac
Merge pull request #17219 from zhou-run/202406201119
isisd: When the ISIS types of the routers do not match on a P2P link, the neighbor status remains UP
2024-11-26 10:10:33 -05:00
Russ White
e268fc4665
Merge pull request #16987 from opensourcerouting/bfd-echo-sock
bfdd: disable echo socket when not using it
2024-11-26 08:51:07 -05:00
Donald Sharp
e8fdbbeb7b
Merge pull request #17504 from mjstapp/fix_fpm_cancel_race
zebra: avoid a race during FPM dplane plugin shutdown
2024-11-26 08:32:54 -05:00
Donatas Abraitis
bd37658018
Merge pull request #17506 from pguibert6WIND/int_versus_string
bgpd: fix version attribute is an int, not a string
2024-11-26 15:28:51 +02:00
Donald Sharp
c15188f4eb
Merge pull request #17509 from opensourcerouting/fix/run_topotests_from_quay.io
Fix docker image for topotests
2024-11-26 08:28:23 -05:00
Philippe Guibert
561debab54 bgpd: fix use single whitespace when displaying flowspec entries
There is an extra space in the 'Displayed' line of show bgp command,
that should not be present.
Fix this by being consistent with the output of the other address
families.

Fixes: ("a1baf9e84f71") bgpd: Use single whitespace when displaying show bgp summary
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-11-26 14:22:13 +01:00
Philippe Guibert
c5d7815ccc bgpd: fix version attribute is an int, not a string
The json display of the version attribute is originally an
integer. It has changed, most probably mistakenly.

> {
>   "vrfId": 7,
>   "vrfName": "vrf1",
>   "tableVersion": 3,
>   "routerId": "192.0.2.1",
>   "defaultLocPrf": 100,
>   "localAS": 65500,
>   "routes": {
>     "172.31.0.1/32": {
>       "prefix": "172.31.0.1/32",
>       "version": "1",		<--- int or string ??

Let us fix it, by using the integer display instead.

Fixes: f9f2d188e3 ("bgpd: fix 'json detail' output structure")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-11-26 11:01:57 +01:00
Donatas Abraitis
f3189d797d tests: Deprecate TOPOTEST_PULL
We do not maintain docker.com/frrouting anymore and not building custom
images for topotests.

Use local images for topotests instead.

Just use:

```
mak topotests-build
make topotests
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-11-26 11:42:49 +02:00
Donatas Abraitis
6eb3a60289 tests: Set vm.mmap_rnd_bits for topotests docker foobar
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-11-26 11:34:12 +02:00
Donatas Abraitis
2484793bc5 tests: Fix docker build for topotests
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-11-26 11:26:55 +02:00
Mark Stapp
277784fe34 zebra: avoid a race during FPM dplane plugin shutdown
During zebra shutdown, the main pthread and the FPM pthread can
deadlock if the FPM pthread is in fpm_reconnect(). Each pthread
tries to use event_cancel_async() to cancel tasks that may be
scheduled for the other pthread - this leads to a deadlock as
neither thread can progress.

This adds an atomic boolean that's managed as each pthread
enters and leaves the cleanup code in question, preventing the
two threads from running into the deadlock.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-11-25 15:37:39 -05:00
Donald Sharp
bf05536741 tests: fix max med on startup
The test is failing because on r2 we are looking for a metric of 777
on startup, but the start of looking for this happens to be after
the 5 second delay that is setup in the config.

On r1:

2023/09/06 17:05:14.999407 BGP: [G822R-SBMNH] config-from-file# router bgp 65001
2023/09/06 17:05:15.003060 BGP: [G822R-SBMNH] config-from-file#   bgp max-med on-startup 5 777
2023/09/06 17:05:15.003342 BGP: [G822R-SBMNH] config-from-file#   no bgp ebgp-requires-policy
2023/09/06 17:05:15.003453 BGP: [G822R-SBMNH] config-from-file#   neighbor 192.168.255.2 remote-as 65001
2023/09/06 17:05:15.004029 BGP: [G822R-SBMNH] config-from-file#   neighbor 192.168.255.2 timers 3 10
2023/09/06 17:05:15.004242 BGP: [G822R-SBMNH] config-from-file#   address-family ipv4 unicast
2023/09/06 17:05:15.004329 BGP: [G822R-SBMNH] config-from-file#     redistribute connected
2023/09/06 17:05:15.005023 BGP: [G822R-SBMNH] config-from-file#   exit-address-family
2023/09/06 17:05:15.005140 BGP: [G822R-SBMNH] config-from-file#   !
2023/09/06 17:05:15.005162 BGP: [G822R-SBMNH] config-from-file# !
2023/09/06 17:05:17.538112 BGP: [M7Q4P-46WDR] vty[25]@> enable
2023/09/06 17:05:17.546700 BGP: [M7Q4P-46WDR] vty[25]@# clear log cmdline-targets
2023/09/06 17:05:17.570635 BGP: [M7Q4P-46WDR] vty[25]@(config)# log commands
2023/09/06 17:05:17.572518 BGP: [M7Q4P-46WDR] vty[25]@(config)# log timestamp precision 6
2023/09/06 17:05:24.982647 BGP: [YNGC8-65JDM] Begin maxmed onstartup mode - timer 5 seconds
2023/09/06 17:05:26.033134 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.255.2 in vrf default
2023/09/06 17:05:29.982960 BGP: [N1747-51Y51] Max med on startup ended - timer expired.

on r2:

2023/09/06 17:05:23.976029 BGP: [G822R-SBMNH] config-from-file# !
2023/09/06 17:05:26.084086 BGP: [M59KS-A3ZXZ] bgp_update_receive: rcvd End-of-RIB for IPv4 Unicast from 192.168.255.1 in vrf default
2023/09/06 17:05:27.280103 BGP: [M7Q4P-46WDR] vty[25]@> enable
2023/09/06 17:05:27.290204 BGP: [M7Q4P-46WDR] vty[25]@# clear log cmdline-targets
2023/09/06 17:05:27.328798 BGP: [M7Q4P-46WDR] vty[25]@(config)# log commands
2023/09/06 17:05:27.335032 BGP: [M7Q4P-46WDR] vty[25]@(config)# log timestamp precision 6
2023/09/06 17:05:31.558216 BGP: [M7Q4P-46WDR] vty[5]@> enable
2023/09/06 17:05:31.562482 BGP: [M7Q4P-46WDR] vty[5]@# do show logging
2023/09/06 17:05:32.942204 BGP: [M7Q4P-46WDR] vty[5]@> enable
2023/09/06 17:05:32.946745 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 json
2023/09/06 17:05:34.173879 BGP: [M7Q4P-46WDR] vty[5]@> enable
2023/09/06 17:05:34.178448 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json
2023/09/06 17:05:36.459365 BGP: [M7Q4P-46WDR] vty[5]@> enable
2023/09/06 17:05:36.472019 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json
2023/09/06 17:05:38.557840 BGP: [M7Q4P-46WDR] vty[5]@> enable
2023/09/06 17:05:38.558948 BGP: [M7Q4P-46WDR] vty[5]@# show ip bgp neighbor 192.168.255.1 routes json
2023/09/06 17:05:40.198563 BGP: [M7Q4P-46WDR] vty[5]@> enable

Notice that the 5 second delay for the max med expires at 29 seconds but the show routes
on r2 does not even begin until 34 seconds, long after the max med has expired and the
test has moved on.

Let's relax the max-med timer to 30 seconds and modify the test to wait a bit longer for
both finding it and expiring timer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:22:32 -05:00
Donald Sharp
4f032a44a4 tests: Fix ospfapi client to clear ospf process
Test is failing locally:
2023-09-06 18:39:56,865 DEBUG: r1: vtysh result:
        Hello, this is FRRouting (version 9.1-dev).
        Copyright 1996-2005 Kunihiro Ishiguro, et al.

        r1# conf t
        r1(config)# router ospf
        r1(config-router)# ospf router-id 1.1.1.1
        For this router-id change to take effect, use "clear ip ospf process" command
        r1(config-router)#
2023-09-06 18:39:56,865 DEBUG: root: GOT LINE: 'SUCCESS: 1.0.0.0'
2023-09-06 18:39:56,866 DEBUG: root: GOT LINE: '2023-09-06 18:39:55,982 INFO: TESTER: root: Waiting for 1.1.1.1'
2023-09-06 18:39:56,867 DEBUG: root: GOT LINE: '2023-09-06 18:39:55,982 DEBUG: TESTER: root: expected '1.1.1.1' != '1.0.0.0''
2023-09-06 18:39:56,867 DEBUG: root: GOT LINE: 'waiting on notify'

Sure looks like the router-id is not allowed to be changed because
neighbors have already been formed.  If we are changing the router-id
then let's clear the process to allow it to correctly change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:20:50 -05:00
Donald Sharp
67526c4b8c lib: Remove route_node_match_ipv[4|6] not being used
These functions are not being used.  Let's just remove
them from our code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:12:10 -05:00
Donald Sharp
735809756f ripd: Use route_node_match instead of route_node_match_ipv4
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:12:10 -05:00