From aa1ca32dbca85e4f4bfc5fe699062f87f9f14251 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sun, 19 Mar 2023 22:46:35 +0200 Subject: [PATCH] tests: Check if prefix-lists with IPv6 any works fine Signed-off-by: Donatas Abraitis (cherry picked from commit d8986f0134887f5d8916e71993ab378efaee4306) --- .../bgp_prefix_list_any/r1/bgpd.conf | 6 ++++ .../bgp_prefix_list_any/r1/zebra.conf | 1 + .../bgp_prefix_list_any/r2/bgpd.conf | 30 ++++++++++++++++--- .../bgp_prefix_list_any/r2/zebra.conf | 1 + .../test_bgp_prefix_list_any.py | 13 ++++++-- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/tests/topotests/bgp_prefix_list_any/r1/bgpd.conf b/tests/topotests/bgp_prefix_list_any/r1/bgpd.conf index d822cdb917..14c28ca906 100644 --- a/tests/topotests/bgp_prefix_list_any/r1/bgpd.conf +++ b/tests/topotests/bgp_prefix_list_any/r1/bgpd.conf @@ -3,7 +3,13 @@ router bgp 65001 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.1.2 remote-as external + neighbor 2001:db8:1::2 remote-as external address-family ipv4 unicast network 192.168.0.1/32 + no neighbor 2001:db8:1::2 activate + exit-address-family + address-family ipv6 unicast + neighbor 2001:db8:1::2 activate + network 2001:db8::1/128 exit-address-family ! diff --git a/tests/topotests/bgp_prefix_list_any/r1/zebra.conf b/tests/topotests/bgp_prefix_list_any/r1/zebra.conf index b29940f46a..c01a8cf033 100644 --- a/tests/topotests/bgp_prefix_list_any/r1/zebra.conf +++ b/tests/topotests/bgp_prefix_list_any/r1/zebra.conf @@ -1,4 +1,5 @@ ! int r1-eth0 ip address 192.168.1.1/24 + ipv6 address 2001:db8:1::1/64 ! diff --git a/tests/topotests/bgp_prefix_list_any/r2/bgpd.conf b/tests/topotests/bgp_prefix_list_any/r2/bgpd.conf index 248b5d40ec..77f7c5581b 100644 --- a/tests/topotests/bgp_prefix_list_any/r2/bgpd.conf +++ b/tests/topotests/bgp_prefix_list_any/r2/bgpd.conf @@ -5,24 +5,46 @@ router bgp 65002 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.1.1 remote-as external + neighbor 2001:db8:1::1 remote-as external address-family ipv4 unicast network 10.10.10.1/32 network 10.10.10.2/32 network 10.10.10.3/32 network 10.10.10.10/32 - neighbor 192.168.1.1 route-map r1 out + no neighbor 2001:db8:1::1 activate + neighbor 192.168.1.1 route-map r1-v4 out + exit-address-family + address-family ipv6 unicast + network 2001:db8:10::1/128 + network 2001:db8:10::2/128 + network 2001:db8:10::3/128 + network 2001:db8:10::10/128 + neighbor 2001:db8:1::1 activate + neighbor 2001:db8:1::1 route-map r1-v6 out exit-address-family ! ip prefix-list r1-1 seq 5 permit 10.10.10.1/32 ip prefix-list r1-1 seq 10 permit 10.10.10.2/32 ip prefix-list r1-1 seq 15 permit 10.10.10.3/32 ip prefix-list r1-2 seq 5 permit 10.10.10.10/32 -!ip prefix-list r1-2 seq 5 deny any ! -route-map r1 permit 10 +ipv6 prefix-list r1-1 seq 5 permit 2001:db8:10::1/128 +ipv6 prefix-list r1-1 seq 10 permit 2001:db8:10::2/128 +ipv6 prefix-list r1-1 seq 15 permit 2001:db8:10::3/128 +ipv6 prefix-list r1-2 seq 5 permit 2001:db8:10::10/128 +! +route-map r1-v4 permit 10 match ip address prefix-list r1-1 exit ! -route-map r1 permit 20 +route-map r1-v4 permit 20 match ip address prefix-list r1-2 exit +! +route-map r1-v6 permit 10 + match ipv6 address prefix-list r1-1 +exit +! +route-map r1-v6 permit 20 + match ipv6 address prefix-list r1-2 +exit diff --git a/tests/topotests/bgp_prefix_list_any/r2/zebra.conf b/tests/topotests/bgp_prefix_list_any/r2/zebra.conf index cffe827363..e90135c786 100644 --- a/tests/topotests/bgp_prefix_list_any/r2/zebra.conf +++ b/tests/topotests/bgp_prefix_list_any/r2/zebra.conf @@ -1,4 +1,5 @@ ! int r2-eth0 ip address 192.168.1.2/24 + ipv6 address 2001:db8:1::2/64 ! diff --git a/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py b/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py index 9446242787..0eb244717e 100644 --- a/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py +++ b/tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py @@ -60,8 +60,15 @@ def test_bgp_route_map_prefix_list(): r2 = tgen.gears["r2"] def _bgp_prefixes_sent(count): - output = json.loads(r2.vtysh_cmd("show bgp ipv4 unicast summary json")) - expected = {"peers": {"192.168.1.1": {"pfxSnt": count, "state": "Established"}}} + output = json.loads(r2.vtysh_cmd("show bgp summary json")) + expected = { + "ipv4Unicast": { + "peers": {"192.168.1.1": {"pfxSnt": count, "state": "Established"}} + }, + "ipv6Unicast": { + "peers": {"2001:db8:1::1": {"pfxSnt": count, "state": "Established"}} + }, + } return topotest.json_cmp(output, expected) test_func = functools.partial(_bgp_prefixes_sent, 4) @@ -72,6 +79,7 @@ def test_bgp_route_map_prefix_list(): """ configure terminal ip prefix-list r1-2 seq 5 deny any + ipv6 prefix-list r1-2 seq 5 deny any """ ) @@ -83,6 +91,7 @@ def test_bgp_route_map_prefix_list(): """ configure terminal ip prefix-list r1-2 seq 5 permit 10.10.10.10/32 + ipv6 prefix-list r1-2 seq 5 permit 2001:db8:10::10/128 """ ) -- 2.39.5