summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-12-11 21:22:41 +0100
committerChristian Breunig <christian@breunig.cc>2024-12-16 22:24:50 +0100
commit147751ec59527800e956b7ea689805ba80769abe (patch)
tree7a07ee6b6b6ad4b8cdff30c9698149a839f2b95e /src/migration-scripts
parent2e4725cd77a33f91e091d86d94056f43dafd153d (diff)
downloadvyos-1x-147751ec59527800e956b7ea689805ba80769abe.tar.gz
vyos-1x-147751ec59527800e956b7ea689805ba80769abe.zip
static: T6746: migrate BFD CLI nodes
Migrate "set protocols static route <x.x.x.x/x> next-hop <y.y.y.y> bfd multi-hop source <z.z.z.z> profile <NAME>" to: "set protocols static route <x.x.x.x/x> next-hop <y.y.y.y> bfd profile bar" FRR supports only one source IP address per BFD multi-hop session. VyOS had CLI cupport for multiple source addresses which made no sense.
Diffstat (limited to 'src/migration-scripts')
-rw-r--r--src/migration-scripts/quagga/11-to-1254
1 files changed, 54 insertions, 0 deletions
diff --git a/src/migration-scripts/quagga/11-to-12 b/src/migration-scripts/quagga/11-to-12
new file mode 100644
index 000000000..becc44162
--- /dev/null
+++ b/src/migration-scripts/quagga/11-to-12
@@ -0,0 +1,54 @@
+# 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
+ 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)