diff --git a/smoketest/config-tests/static-route-basic b/smoketest/config-tests/static-route-basic index 4416e6b19..d2d33d043 100644 --- a/smoketest/config-tests/static-route-basic +++ b/smoketest/config-tests/static-route-basic @@ -1,35 +1,37 @@ set interfaces ethernet eth0 duplex 'auto' set interfaces ethernet eth0 speed 'auto' set interfaces ethernet eth0 vif 203 address '172.18.203.10/24' set interfaces ethernet eth1 duplex 'auto' set interfaces ethernet eth1 speed 'auto' +set protocols static mroute 224.1.0.0/24 interface eth0.203 distance '10' +set protocols static mroute 224.2.0.0/24 next-hop 172.18.203.254 distance '20' set protocols static route 10.0.0.0/8 blackhole distance '200' set protocols static route 10.0.0.0/8 blackhole tag '333' set protocols static route 10.0.0.0/8 next-hop 192.0.2.140 bfd multi-hop source-address '192.0.2.10' set protocols static route 10.0.0.0/8 next-hop 192.0.2.140 bfd profile 'vyos-test' set protocols static route 10.0.0.0/8 next-hop 192.0.2.140 distance '123' set protocols static route 10.0.0.0/8 next-hop 192.0.2.140 interface 'eth0' set protocols static route 172.16.0.0/16 next-hop 172.18.203.254 bfd multi-hop source-address '172.18.203.254' set protocols static route 172.16.0.0/16 next-hop 172.18.203.254 bfd profile 'foo' set protocols static route6 2001:db8:1::/48 next-hop fe80::1 bfd multi-hop source-address 'fe80::1' set protocols static route6 2001:db8:1::/48 next-hop fe80::1 bfd profile 'bar' set protocols static route6 2001:db8:1::/48 next-hop fe80::1 interface 'eth0.203' set protocols static route6 2001:db8:2::/48 next-hop fe80::1 bfd multi-hop source-address 'fe80::1' set protocols static route6 2001:db8:2::/48 next-hop fe80::1 bfd profile 'bar' set protocols static route6 2001:db8:2::/48 next-hop fe80::1 interface 'eth0.203' set protocols static route6 2001:db8:3::/48 next-hop fe80::1 bfd set protocols static route6 2001:db8:3::/48 next-hop fe80::1 interface 'eth0.203' set service lldp interface all set service ntp allow-client address '0.0.0.0/0' set service ntp allow-client address '::/0' set service ntp server 172.16.100.10 set service ntp server 172.16.100.20 set service ntp server 172.16.110.30 set system config-management commit-revisions '100' set system console device ttyS0 speed '115200' set system host-name 'vyos' set system login user vyos authentication encrypted-password '$6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0' set system login user vyos authentication plaintext-password '' set system syslog global facility all level 'info' set system syslog global facility local7 level 'debug' set system time-zone 'Asia/Macau' diff --git a/smoketest/configs/static-route-basic b/smoketest/configs/static-route-basic index 4bf114e33..648e19676 100644 --- a/smoketest/configs/static-route-basic +++ b/smoketest/configs/static-route-basic @@ -1,148 +1,148 @@ interfaces { ethernet eth0 { duplex "auto" speed "auto" vif 203 { address "172.18.203.10/24" } } ethernet eth1 { duplex "auto" speed "auto" } } protocols { static { multicast { - interface-route 224.0.0.0/24 { + interface-route 224.1.0.0/24 { next-hop-interface eth0.203 { distance "10" } } - route 224.0.0.0/24 { + route 224.2.0.0/24 { next-hop 172.18.203.254 { distance "20" } } } route 10.0.0.0/8 { blackhole { distance "200" tag "333" } next-hop 192.0.2.140 { bfd { multi-hop { source 192.0.2.10 { profile "vyos-test" } } } distance "123" interface "eth0" } } route 172.16.0.0/16 { next-hop 172.18.203.254 { bfd { multi-hop { source 172.18.203.254 { profile "foo" } } } } } route6 2001:db8:1::/48 { next-hop fe80::1 { bfd { multi-hop { source fe80::1 { profile "bar" } } } interface eth0.203 } } route6 2001:db8:2::/48 { next-hop fe80::1 { bfd { multi-hop { source fe80::1 { profile "bar" } } } interface eth0.203 } } route6 2001:db8:3::/48 { next-hop fe80::1 { bfd { } interface eth0.203 } } } } service { lldp { interface all { } } ntp { allow-client { address "0.0.0.0/0" address "::/0" } server 172.16.100.10 { } server 172.16.100.20 { } server 172.16.110.30 { } } } system { config-management { commit-revisions 100 } console { device ttyS0 { speed 115200 } } host-name vyos login { user vyos { authentication { encrypted-password $6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0 plaintext-password "" } } } ntp { server 0.pool.ntp.org { } server 1.pool.ntp.org { } server 2.pool.ntp.org { } } syslog { global { facility all { level info } facility local7 { level debug } } } time-zone "Asia/Macau" } // Warning: Do not remove the following line. // vyos-config-version: "bgp@5:broadcast-relay@1:cluster@2:config-management@1:conntrack@5: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.0 diff --git a/src/migration-scripts/quagga/11-to-12 b/src/migration-scripts/quagga/11-to-12 index becc44162..8ae2023a1 100644 --- a/src/migration-scripts/quagga/11-to-12 +++ b/src/migration-scripts/quagga/11-to-12 @@ -1,54 +1,75 @@ # Copyright 2024 VyOS maintainers and contributors <maintainers@vyos.io> # # 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 <http://www.gnu.org/licenses/>. # T6747: # - Migrate static BFD configuration to match FRR possibillities # - Consolidate static multicast routing configuration under a new node from vyos.configtree import ConfigTree static_base = ['protocols', 'static'] def migrate(config: ConfigTree) -> None: # Check for static route/route6 configuration + # Migrate static BFD configuration to match FRR possibillities for route_route6 in ['route', 'route6']: route_route6_base = static_base + [route_route6] if not config.exists(route_route6_base): continue for prefix in config.list_nodes(route_route6_base): next_hop_base = route_route6_base + [prefix, 'next-hop'] if not config.exists(next_hop_base): continue for next_hop in config.list_nodes(next_hop_base): multi_hop_base = next_hop_base + [next_hop, 'bfd', 'multi-hop'] if not config.exists(multi_hop_base): continue mh_source_base = multi_hop_base + ['source'] source = None profile = None for src_ip in config.list_nodes(mh_source_base): source = src_ip if config.exists(mh_source_base + [source, 'profile']): profile = config.return_value(mh_source_base + [source, 'profile']) # FRR only supports one source, we will use the first one break config.delete(multi_hop_base) config.set(multi_hop_base + ['source-address'], value=source) config.set(next_hop_base + [next_hop, 'bfd', 'profile'], value=profile) + + # Consolidate static multicast routing configuration under a new node + if config.exists(static_base + ['multicast']): + for mroute in ['interface-route', 'route']: + mroute_base = static_base + ['multicast', mroute] + if not config.exists(mroute_base): + continue + config.set(static_base + ['mroute']) + config.set_tag(static_base + ['mroute']) + for route in config.list_nodes(mroute_base): + config.copy(mroute_base + [route], static_base + ['mroute', route]) + + mroute_base = static_base + ['mroute'] + if config.exists(mroute_base): + for mroute in config.list_nodes(mroute_base): + interface_path = mroute_base + [mroute, 'next-hop-interface'] + if config.exists(interface_path): + config.rename(interface_path, 'interface') + + config.delete(static_base + ['multicast'])