summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-03-20 07:58:43 +0200
committerGitHub <noreply@github.com>2023-03-20 07:58:43 +0200
commit3fa49b125bb73d8f60e6cb5aedc9edbefd1916e9 (patch)
treecd7ca9dd2f205641efd48961149c73edff925f44
parent6da712b9e91a566f816f1d5396c78e247936faee (diff)
parent8e23fef97dd9928aa212f08daefe7dd6fa036eef (diff)
Merge pull request #13052 from FRRouting/mergify/bp/stable/8.5/pr-13049
lib: IPv6 prefix-list entry handling with `any` (backport #13049)
-rw-r--r--lib/filter_cli.c1
-rw-r--r--tests/topotests/bgp_prefix_list_any/r1/bgpd.conf6
-rw-r--r--tests/topotests/bgp_prefix_list_any/r1/zebra.conf1
-rw-r--r--tests/topotests/bgp_prefix_list_any/r2/bgpd.conf30
-rw-r--r--tests/topotests/bgp_prefix_list_any/r2/zebra.conf1
-rw-r--r--tests/topotests/bgp_prefix_list_any/test_bgp_prefix_list_any.py13
6 files changed, 46 insertions, 6 deletions
diff --git a/lib/filter_cli.c b/lib/filter_cli.c
index 3b896e3aa2..f85f120140 100644
--- a/lib/filter_cli.c
+++ b/lib/filter_cli.c
@@ -1545,6 +1545,7 @@ DEFPY_YANG(
vty, "./ipv6-prefix-length-lesser-or-equal",
NB_OP_DESTROY, NULL);
}
+ nb_cli_enqueue_change(vty, "./any", NB_OP_DESTROY, NULL);
} else {
nb_cli_enqueue_change(vty, "./any", NB_OP_CREATE, NULL);
}
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
"""
)