From 94ab5fc768dea1b78e50bddb7c73e6ddb971b9c6 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 12 Nov 2026 17:41:31 +0100 Subject: 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. --- src/migration-scripts/ospf/3-to-4 | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/migration-scripts/ospf/3-to-4 (limited to 'src') 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 . + +# 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']) -- cgit v1.2.3