From 39e301c701c4d636df33546dcf879948e9869c81 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Sat, 27 Dec 2025 20:23:57 +0200 Subject: bgp: T7664: add 'no bgp reject-as-sets' In FRR 10.5 'bgp reject-as-sets' became default (https://frrouting.org/release/10.5.0/): > BGP rejects AS_SET by default > Until 10.5.0, it was disabled by default, and since RFC 9774 was > published, we switched this on by default (to reject). Add 'no bgp reject-as-sets' when VyOS option reject_as_sets is not set. --- smoketest/scripts/cli/test_protocols_bgp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py index 23c2bf592..9bed10615 100755 --- a/smoketest/scripts/cli/test_protocols_bgp.py +++ b/smoketest/scripts/cli/test_protocols_bgp.py @@ -398,7 +398,9 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): self.assertIn(f' bgp bestpath compare-routerid', frrconfig) self.assertIn(f' bgp bestpath peer-type multipath-relax', frrconfig) self.assertIn(f' bgp minimum-holdtime {min_hold_time}', frrconfig) - self.assertIn(f' bgp reject-as-sets', frrconfig) + self.assertNotIn( + f'bgp reject-as-sets', frrconfig + ) # default was changed in FRR 10.5 to 'reject-as-sets' self.assertIn(f' bgp route-reflector allow-outbound-policy', frrconfig) self.assertIn(f' no bgp ipv6-auto-ra', frrconfig) self.assertIn(f' bgp shutdown', frrconfig) @@ -425,6 +427,12 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): self.assertIn(f' maximum-paths {max_path_v6}', afiv6_config) self.assertIn(f' maximum-paths ibgp {max_path_v6ibgp}', afiv6_config) + # Verify reject-as-sets + self.cli_delete(base_path + ['parameters', 'reject-as-sets']) + self.cli_commit() + frrconfig = self.getFRRconfig(f'router bgp {ASN}', stop_section='^exit') + self.assertIn(f'no bgp reject-as-sets', frrconfig) + def test_bgp_02_neighbors(self): # Test out individual neighbor configuration items, not all of them are # also available to a peer-group! -- cgit v1.2.3 From e8080f2412a0eeeeea40f12c164213468bca1957 Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Sun, 28 Dec 2025 12:57:00 +0200 Subject: tests: T7664: segment-routing, remove defaults In FRR 10.5 block-len, node-len and func-bits are not shown if they have default values. Fix test smoketest/scripts/cli/test_protocols_segment-routing.py accordingly (update expected + change func-bits 16 -> 12 so that they are shown). Relevant commits in FRR: 44e67d2d3dabdc1492448e6a3c7024bd0309c244 84c807a3b300f4c9fcda55bccd93dcb64716f5d7 --- .../scripts/cli/test_protocols_segment-routing.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'smoketest/scripts/cli') diff --git a/smoketest/scripts/cli/test_protocols_segment-routing.py b/smoketest/scripts/cli/test_protocols_segment-routing.py index 8d826f07c..a5c0d5983 100755 --- a/smoketest/scripts/cli/test_protocols_segment-routing.py +++ b/smoketest/scripts/cli/test_protocols_segment-routing.py @@ -57,7 +57,7 @@ class TestProtocolsSegmentRouting(VyOSUnitTestSHIM.TestCase): 'prefix': '2001:d::/48', 'block-len': '32', 'node-len': '16', - 'func-bits': '16', + 'func-bits': '12', 'usid': {}, 'format': 'usid-f3216', }, @@ -131,13 +131,25 @@ class TestProtocolsSegmentRouting(VyOSUnitTestSHIM.TestCase): self.assertIn(' locators', frrconfig) for locator, locator_config in locators.items(): prefix = locator_config['prefix'] - block_len = locator_config.get('block-len', '40') - node_len = locator_config.get('node-len', '24') - func_bits = locator_config.get('func-bits', '16') + block_len = ( + f' block-len {locator_config["block-len"]}' + if 'block-len' in locator_config + else '' + ) + node_len = ( + f' node-len {locator_config["node-len"]}' + if 'node-len' in locator_config + else '' + ) + func_bits = ( + f' func-bits {locator_config["func-bits"]}' + if 'func-bits' in locator_config + else '' + ) self.assertIn(f' locator {locator}', frrconfig) self.assertIn( - f' prefix {prefix} block-len {block_len} node-len {node_len} func-bits {func_bits}', + f' prefix {prefix}{block_len}{node_len}{func_bits}', frrconfig, ) -- cgit v1.2.3 From 2471f686979fd83bd015f124b6faa66f27b8c9ba Mon Sep 17 00:00:00 2001 From: Kyrylo Yatsenko Date: Sun, 28 Dec 2025 17:21:11 +0200 Subject: T7664: ip protocol 'kernel' etc removed In FRR 10.5 ip protocols * connected * kernel * local * table * table-direct are removed. First three in fb8e399e4f66d09780f176fbecb99168089e64eb, table* in 7fd030504be060387694e8a2af7f19ddd7dee39d. In `ip protocols`, `ipv6 protocols` and `vrf` VyOS supports * connected * kernel * table Remove these from CLI, add migration scripts, update tests. --- .../include/system-ip-protocol.xml.i | 14 +- .../include/system-ipv6-protocol.xml.i | 12 +- .../include/version/system-version.xml.i | 2 +- .../include/version/vrf-version.xml.i | 2 +- smoketest/configs/assert/basic-system-ip-protocol | 30 ++ smoketest/configs/basic-system-ip-protocol | 302 +++++++++++++++++++++ smoketest/scripts/cli/test_system_ip.py | 3 +- smoketest/scripts/cli/test_system_ipv6.py | 3 +- smoketest/scripts/cli/test_vrf.py | 4 +- src/migration-scripts/system/30-to-31 | 42 +++ src/migration-scripts/vrf/3-to-4 | 50 ++++ 11 files changed, 435 insertions(+), 29 deletions(-) create mode 100644 smoketest/configs/assert/basic-system-ip-protocol create mode 100644 smoketest/configs/basic-system-ip-protocol create mode 100644 src/migration-scripts/system/30-to-31 create mode 100644 src/migration-scripts/vrf/3-to-4 (limited to 'smoketest/scripts/cli') diff --git a/interface-definitions/include/system-ip-protocol.xml.i b/interface-definitions/include/system-ip-protocol.xml.i index c630eb3f7..30d7ab04e 100644 --- a/interface-definitions/include/system-ip-protocol.xml.i +++ b/interface-definitions/include/system-ip-protocol.xml.i @@ -3,7 +3,7 @@ Filter routing info exchanged between routing protocol and zebra - any babel bgp connected eigrp isis kernel ospf rip static table + any babel bgp eigrp isis ospf rip static any @@ -17,10 +17,6 @@ bgp Border Gateway Protocol - - connected - Connected routes (directly attached subnet or host) - eigrp Enhanced Interior Gateway Routing Protocol @@ -29,10 +25,6 @@ isis Intermediate System to Intermediate System - - kernel - Kernel routes (not installed via the zebra RIB) - ospf Open Shortest Path First (OSPFv2) @@ -46,11 +38,11 @@ Statically configured routes - (any|babel|bgp|connected|eigrp|isis|kernel|ospf|rip|static|table) + (any|babel|bgp|eigrp|isis|ospf|rip|static) #include - \ No newline at end of file + diff --git a/interface-definitions/include/system-ipv6-protocol.xml.i b/interface-definitions/include/system-ipv6-protocol.xml.i index 485776a71..1a8123cb2 100644 --- a/interface-definitions/include/system-ipv6-protocol.xml.i +++ b/interface-definitions/include/system-ipv6-protocol.xml.i @@ -3,7 +3,7 @@ Filter routing info exchanged between routing protocol and zebra - any babel bgp connected isis kernel ospfv3 ripng static table + any babel bgp isis ospfv3 ripng static any @@ -17,18 +17,10 @@ bgp Border Gateway Protocol - - connected - Connected routes (directly attached subnet or host) - isis Intermediate System to Intermediate System - - kernel - Kernel routes (not installed via the zebra RIB) - ospfv3 Open Shortest Path First (OSPFv3) @@ -42,7 +34,7 @@ Statically configured routes - (any|babel|bgp|connected|isis|kernel|ospfv3|ripng|static|table) + (any|babel|bgp|isis|ospfv3|ripng|static) diff --git a/interface-definitions/include/version/system-version.xml.i b/interface-definitions/include/version/system-version.xml.i index a9987e8e4..55764fc40 100644 --- a/interface-definitions/include/version/system-version.xml.i +++ b/interface-definitions/include/version/system-version.xml.i @@ -1,3 +1,3 @@ - + diff --git a/interface-definitions/include/version/vrf-version.xml.i b/interface-definitions/include/version/vrf-version.xml.i index 9d7ff35fe..1c7c81155 100644 --- a/interface-definitions/include/version/vrf-version.xml.i +++ b/interface-definitions/include/version/vrf-version.xml.i @@ -1,3 +1,3 @@ - + diff --git a/smoketest/configs/assert/basic-system-ip-protocol b/smoketest/configs/assert/basic-system-ip-protocol new file mode 100644 index 000000000..870ffa8f5 --- /dev/null +++ b/smoketest/configs/assert/basic-system-ip-protocol @@ -0,0 +1,30 @@ +set system ip protocol any route-map 'stub' +set system ip protocol babel route-map 'stub' +set system ip protocol bgp route-map 'stub' +set system ip protocol eigrp route-map 'stub' +set system ip protocol isis route-map 'stub' +set system ip protocol ospf route-map 'stub' +set system ip protocol rip route-map 'stub' +set system ip protocol static route-map 'stub' +set system ipv6 protocol any route-map 'stub' +set system ipv6 protocol babel route-map 'stub' +set system ipv6 protocol bgp route-map 'stub' +set system ipv6 protocol isis route-map 'stub' +set system ipv6 protocol ospfv3 route-map 'stub' +set system ipv6 protocol ripng route-map 'stub' +set system ipv6 protocol static route-map 'stub' +set vrf name red ip protocol any route-map 'stub' +set vrf name red ip protocol babel route-map 'stub' +set vrf name red ip protocol bgp route-map 'stub' +set vrf name red ip protocol eigrp route-map 'stub' +set vrf name red ip protocol isis route-map 'stub' +set vrf name red ip protocol ospf route-map 'stub' +set vrf name red ip protocol rip route-map 'stub' +set vrf name red ip protocol static route-map 'stub' +set vrf name red ipv6 protocol any route-map 'stub' +set vrf name red ipv6 protocol babel route-map 'stub' +set vrf name red ipv6 protocol bgp route-map 'stub' +set vrf name red ipv6 protocol isis route-map 'stub' +set vrf name red ipv6 protocol ospfv3 route-map 'stub' +set vrf name red ipv6 protocol ripng route-map 'stub' +set vrf name red ipv6 protocol static route-map 'stub' diff --git a/smoketest/configs/basic-system-ip-protocol b/smoketest/configs/basic-system-ip-protocol new file mode 100644 index 000000000..84c2c8da7 --- /dev/null +++ b/smoketest/configs/basic-system-ip-protocol @@ -0,0 +1,302 @@ +interfaces { + ethernet eth0 { + address "192.168.0.1/24" + address "fe88::1/56" + duplex "auto" + offload { + gro + gso + sg + tso + } + speed "auto" + } + loopback lo { + } +} +policy { + route-map stub { + } +} +protocols { + static { + arp { + interface eth0 { + address 192.168.0.20 { + mac "00:50:00:00:00:20" + } + address 192.168.0.30 { + mac "00:50:00:00:00:30" + } + address 192.168.0.40 { + mac "00:50:00:00:00:40" + } + } + interface eth2.100 { + address 100.100.0.2 { + mac "00:50:00:00:02:02" + } + address 100.100.0.3 { + mac "00:50:00:00:02:03" + } + address 100.100.0.4 { + mac "00:50:00:00:02:04" + } + } + interface eth2.200 { + address 100.64.200.1 { + mac "00:50:00:00:00:01" + } + address 100.64.200.2 { + mac "00:50:00:00:00:02" + } + } + interface eth2.200.201 { + address 100.64.201.10 { + mac "00:50:00:00:00:10" + } + address 100.64.201.20 { + mac "00:50:00:00:00:20" + } + } + interface eth2.200.202 { + address 100.64.202.30 { + mac "00:50:00:00:00:30" + } + address 100.64.202.40 { + mac "00:50:00:00:00:40" + } + } + } + route 0.0.0.0/0 { + next-hop 100.64.0.1 { + } + } + } +} +system { + config-management { + commit-revisions "100" + } + conntrack { + ignore { + ipv4 { + rule 1 { + destination { + address "192.0.2.2" + } + source { + address "192.0.2.1" + } + } + } + } + modules { + ftp + h323 + nfs + pptp + sip + sqlnet + tftp + } + } + console { + device ttyS0 { + speed "115200" + } + } + host-name "vyos" + ip { + protocol any { + route-map "stub" + } + protocol babel { + route-map "stub" + } + protocol bgp { + route-map "stub" + } + protocol connected { + route-map "stub" + } + protocol eigrp { + route-map "stub" + } + protocol isis { + route-map "stub" + } + protocol kernel { + route-map "stub" + } + protocol ospf { + route-map "stub" + } + protocol rip { + route-map "stub" + } + protocol static { + route-map "stub" + } + protocol table { + route-map "stub" + } + } + ipv6 { + protocol any { + route-map "stub" + } + protocol babel { + route-map "stub" + } + protocol bgp { + route-map "stub" + } + protocol connected { + route-map "stub" + } + protocol isis { + route-map "stub" + } + protocol kernel { + route-map "stub" + } + protocol ospfv3 { + route-map "stub" + } + protocol ripng { + route-map "stub" + } + protocol static { + route-map "stub" + } + protocol table { + route-map "stub" + } + } + login { + user vyos { + authentication { + encrypted-password "$6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0" + plaintext-password "" + } + } + } + name-server "192.168.0.1" + syslog { + console { + facility all { + level "emerg" + } + facility mail { + level "info" + } + } + global { + facility all { + level "info" + } + facility auth { + level "info" + } + facility local7 { + level "debug" + } + marker { + interval "1000" + } + preserve-fqdn + } + host syslog.vyos.net { + facility auth { + level "warning" + } + facility local7 { + level "notice" + } + format { + octet-counted + } + port "8000" + protocol "tcp" + } + } + time-zone "Europe/Berlin" +} +vrf { + name red { + ip { + protocol any { + route-map "stub" + } + protocol babel { + route-map "stub" + } + protocol bgp { + route-map "stub" + } + protocol connected { + route-map "stub" + } + protocol eigrp { + route-map "stub" + } + protocol isis { + route-map "stub" + } + protocol kernel { + route-map "stub" + } + protocol ospf { + route-map "stub" + } + protocol rip { + route-map "stub" + } + protocol static { + route-map "stub" + } + protocol table { + route-map "stub" + } + } + ipv6 { + protocol any { + route-map "stub" + } + protocol babel { + route-map "stub" + } + protocol bgp { + route-map "stub" + } + protocol connected { + route-map "stub" + } + protocol isis { + route-map "stub" + } + protocol kernel { + route-map "stub" + } + protocol ospfv3 { + route-map "stub" + } + protocol ripng { + route-map "stub" + } + protocol static { + route-map "stub" + } + protocol table { + route-map "stub" + } + } + table "1234" + } +} + + +// Warning: Do not remove the following line. +// vyos-config-version: "bgp@6:broadcast-relay@1:cluster@2:config-management@1:conntrack@6:conntrack-sync@2:container@2:dhcp-relay@2:dhcp-server@8:dhcpv6-server@1:dns-dynamic@4:dns-forwarding@4:firewall@15:flow-accounting@1:https@6:ids@1:interfaces@32:ipoe-server@3:ipsec@13:isis@3:l2tp@9:lldp@2:mdns@1:monitoring@1:nat@8:nat66@3:ntp@3:openconnect@3:ospf@2:pim@1:policy@8:pppoe-server@10:pptp@5:qos@2:quagga@11:reverse-proxy@1:rip@1:rpki@2:salt@1:snmp@3:ssh@2:sstp@6:system@27:vrf@3:vrrp@4:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2" +// Release version: 1.4.3 diff --git a/smoketest/scripts/cli/test_system_ip.py b/smoketest/scripts/cli/test_system_ip.py index 3784d4630..25dbeef1d 100755 --- a/smoketest/scripts/cli/test_system_ip.py +++ b/smoketest/scripts/cli/test_system_ip.py @@ -83,8 +83,7 @@ class TestSystemIP(VyOSUnitTestSHIM.TestCase): _verify_gc_thres(size) def test_system_ip_protocol_route_map(self): - protocols = ['any', 'babel', 'bgp', 'connected', 'eigrp', 'isis', - 'kernel', 'ospf', 'rip', 'static', 'table'] + protocols = ['any', 'babel', 'bgp', 'eigrp', 'isis', 'ospf', 'rip', 'static'] rule_num = '10' diff --git a/smoketest/scripts/cli/test_system_ipv6.py b/smoketest/scripts/cli/test_system_ipv6.py index 0f94765bd..f7d74eb58 100755 --- a/smoketest/scripts/cli/test_system_ipv6.py +++ b/smoketest/scripts/cli/test_system_ipv6.py @@ -97,8 +97,7 @@ class TestSystemIPv6(VyOSUnitTestSHIM.TestCase): _verify_gc_thres(size) def test_system_ipv6_protocol_route_map(self): - protocols = ['any', 'babel', 'bgp', 'connected', 'isis', - 'kernel', 'ospfv3', 'ripng', 'static', 'table'] + protocols = ['any', 'babel', 'bgp', 'isis', 'ospfv3', 'ripng', 'static'] for protocol in protocols: route_map = 'route-map-' + protocol.replace('ospfv3', 'ospf6') diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index 468b859c3..fee5312e8 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -40,8 +40,8 @@ from vyos.xml_ref import default_value base_path = ['vrf'] vrfs = ['red', 'green', 'blue', 'foo-bar', 'baz_foo'] -v4_protocols = ['any', 'babel', 'bgp', 'connected', 'eigrp', 'isis', 'kernel', 'ospf', 'rip', 'static', 'table'] -v6_protocols = ['any', 'babel', 'bgp', 'connected', 'isis', 'kernel', 'ospfv3', 'ripng', 'static', 'table'] +v4_protocols = ['any', 'babel', 'bgp', 'eigrp', 'isis', 'ospf', 'rip', 'static'] +v6_protocols = ['any', 'babel', 'bgp', 'isis', 'ospfv3', 'ripng', 'static'] class VRFTest(VyOSUnitTestSHIM.TestCase): _interfaces = [] diff --git a/src/migration-scripts/system/30-to-31 b/src/migration-scripts/system/30-to-31 new file mode 100644 index 000000000..3e57b3db6 --- /dev/null +++ b/src/migration-scripts/system/30-to-31 @@ -0,0 +1,42 @@ +# Copyright VyOS maintainers and contributors +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +# T7644: +# FRR 10.5 doesn't have ip protocols: +# - connected +# - kernel +# - table +# +# Remove them from +# - system ip protocol +# - system ipv6 protocol + +from vyos.configtree import ConfigTree + +bases = [ + ['system', 'ip', 'protocol'], + ['system', 'ipv6', 'protocol'], +] +remove_ip_protocols = ['connected', 'kernel', 'table'] + +def migrate(config: ConfigTree) -> None: + for base in bases: + if not config.exists(base): + continue + + # Iterate over all ip protocols to remove + for protocol in remove_ip_protocols: + if config.exists(base + [protocol]): + config.delete(base + [protocol]) diff --git a/src/migration-scripts/vrf/3-to-4 b/src/migration-scripts/vrf/3-to-4 new file mode 100644 index 000000000..959b736e5 --- /dev/null +++ b/src/migration-scripts/vrf/3-to-4 @@ -0,0 +1,50 @@ +# Copyright VyOS maintainers and contributors +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +# T7664: +# FRR 10.5 doesn't have ip protocols: +# - connected +# - kernel +# - table +# +# Remove them from +# - vrf name VRF ip protocol +# - vrf name VRF ipv6 protocol + +from vyos.configtree import ConfigTree + +subbases = [ + ['ip', 'protocol'], + ['ipv6', 'protocol'], +] +remove_ip_protocols = ['connected', 'kernel', 'table'] + +base = ['vrf', 'name'] + +def migrate(config: ConfigTree) -> None: + if not config.exists(base): + # Nothing to do + return + + for vrf in config.list_nodes(base): + for subbase in subbases: + protocol_base = base + [vrf] + subbase + + if not config.exists(protocol_base): + continue + + for protocol in remove_ip_protocols: + if config.exists(protocol_base + [protocol]): + config.delete(protocol_base + [protocol]) -- cgit v1.2.3