summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-11-12 17:41:31 +0100
committerChristian Breunig <christian@breunig.cc>2026-11-12 18:13:03 +0100
commit94ab5fc768dea1b78e50bddb7c73e6ddb971b9c6 (patch)
tree70b19d713ec6f0762b13f682022d5c7efc68f54c /src/migration-scripts
parentf46c01ccdc9075602546873c4d1bbdaea8df32eb (diff)
downloadvyos-1x-94ab5fc768dea1b78e50bddb7c73e6ddb971b9c6.tar.gz
vyos-1x-94ab5fc768dea1b78e50bddb7c73e6ddb971b9c6.zip
ospf: T9606: move "parameters rfc1583-compatibility" to "compatible rfc1583"
The RFC1583 option sat under "parameters" although FRR groups it with its other "compatible" commands. It now lives under "compatible rfc1583" for the default and VRF instances. Migration moves an existing setting and drops a "parameters" node left empty by the move.
Diffstat (limited to 'src/migration-scripts')
-rw-r--r--src/migration-scripts/ospf/3-to-444
1 files changed, 44 insertions, 0 deletions
diff --git a/src/migration-scripts/ospf/3-to-4 b/src/migration-scripts/ospf/3-to-4
new file mode 100644
index 000000000..842e66896
--- /dev/null
+++ b/src/migration-scripts/ospf/3-to-4
@@ -0,0 +1,44 @@
+# Copyright (C) VyOS Inc.
+#
+# 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/>.
+
+# T9606: "parameters rfc1583-compatibility" moves to "compatible rfc1583",
+# matching FRR's "compatible" command family.
+
+from vyos.configtree import ConfigTree
+
+
+def compatible_migration(config: ConfigTree, ospf_base: list) -> None:
+ if not config.exists(ospf_base):
+ return
+
+ parameters = ospf_base + ['parameters']
+ if config.exists(parameters + ['rfc1583-compatibility']):
+ config.delete(parameters + ['rfc1583-compatibility'])
+
+ # do not leave an empty "parameters" node behind
+ if config.list_nodes(parameters) == []:
+ config.delete(parameters)
+
+ config.set(ospf_base + ['compatible', 'rfc1583'])
+
+
+def migrate(config: ConfigTree) -> None:
+ # OSPF in the default VRF
+ compatible_migration(config, ['protocols', 'ospf'])
+
+ # OSPF in every VRF
+ if config.exists(['vrf', 'name']):
+ for name in config.list_nodes(['vrf', 'name']):
+ compatible_migration(config, ['vrf', 'name', name, 'protocols', 'ospf'])