From c75d6ccbfe95d2708618ade7cc7198e46ee467dd Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 24 Nov 2021 16:28:48 +0200 Subject: [PATCH] tests: Check if `match ipv6 next-hop prefix-list` command works Signed-off-by: Donatas Abraitis --- .../__init__.py | 0 .../r1/bgpd.conf | 5 +++++ .../r1/zebra.conf | 0 .../r2/bgpd.conf | 4 ++++ .../r2/zebra.conf | 1 + .../test_bgp_route_map_match_ipv6_nexthop.py} | 7 ++++++- 6 files changed, 16 insertions(+), 1 deletion(-) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list => bgp_route_map_match_ipv6_nexthop}/__init__.py (100%) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list => bgp_route_map_match_ipv6_nexthop}/r1/bgpd.conf (83%) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list => bgp_route_map_match_ipv6_nexthop}/r1/zebra.conf (100%) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list => bgp_route_map_match_ipv6_nexthop}/r2/bgpd.conf (85%) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list => bgp_route_map_match_ipv6_nexthop}/r2/zebra.conf (84%) rename tests/topotests/{bgp_route_map_match_ipv6_nexthop_access_list/test_bgp_route_map_match_ipv6_nexthop_access_list.py => bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py} (94%) diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/__init__.py b/tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py similarity index 100% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/__init__.py rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r1/bgpd.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf similarity index 83% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r1/bgpd.conf rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf index 5f35d353f4..c2a49252d6 100644 --- a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r1/bgpd.conf +++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf @@ -3,6 +3,8 @@ ipv6 access-list nh1 permit 2001:db8:1::/64 ipv6 access-list nh2 permit 2001:db8:2::/64 ipv6 access-list nh3 permit 2001:db8:3::/64 ! +ipv6 prefix-list nh4 permit 2001:db8:5::/64 le 128 +! router bgp 65001 bgp router-id 10.10.10.1 no bgp ebgp-requires-policy @@ -24,4 +26,7 @@ route-map r2 permit 30 route-map r2 permit 40 match ipv6 next-hop address 2001:db8:4::1 set community 65002:4 +route-map r2 permit 50 + match ipv6 next-hop prefix-list nh4 + set community 65002:5 ! diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r1/zebra.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf similarity index 100% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r1/zebra.conf rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/bgpd.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf similarity index 85% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/bgpd.conf rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf index bca67c5363..19dcf3664b 100644 --- a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/bgpd.conf +++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf @@ -13,6 +13,7 @@ ipv6 prefix-list p1 permit 2001:db8:1::1/128 ipv6 prefix-list p2 permit 2001:db8:2::1/128 ipv6 prefix-list p3 permit 2001:db8:3::1/128 ipv6 prefix-list p4 permit 2001:db8:4::1/128 +ipv6 prefix-list p5 permit 2001:db8:5::1/128 ! route-map r1 permit 10 match ipv6 address prefix-list p1 @@ -26,4 +27,7 @@ route-map r1 permit 30 route-map r1 permit 40 match ipv6 address prefix-list p4 set ipv6 next-hop global 2001:db8:4::1 +route-map r1 permit 50 + match ipv6 address prefix-list p5 + set ipv6 next-hop global 2001:db8:5::1 ! diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/zebra.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf similarity index 84% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/zebra.conf rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf index 9039f1dec1..e69345f4f6 100644 --- a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/r2/zebra.conf +++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf @@ -4,6 +4,7 @@ int lo ipv6 address 2001:db8:2::1/128 ipv6 address 2001:db8:3::1/128 ipv6 address 2001:db8:4::1/128 + ipv6 address 2001:db8:5::1/128 ! int r2-eth0 ip address 2001:db8::2/64 diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/test_bgp_route_map_match_ipv6_nexthop_access_list.py b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py similarity index 94% rename from tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/test_bgp_route_map_match_ipv6_nexthop_access_list.py rename to tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py index 3efe1eca76..8c86526bf1 100644 --- a/tests/topotests/bgp_route_map_match_ipv6_nexthop_access_list/test_bgp_route_map_match_ipv6_nexthop_access_list.py +++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py @@ -20,7 +20,7 @@ """ Test if we can match BGP prefixes by next-hop which is -specified by an IPv6 Access-list. +specified by an IPv6 Access-list, prefix-list or just an address. """ import os @@ -103,6 +103,11 @@ def test_bgp_route_map_match_ipv6_next_hop_access_list(): "communities": "65002:4", } ], + "2001:db8:5::1/128": [ + { + "communities": "65002:5", + } + ], } return topotest.json_cmp(output, expected) -- 2.39.5