From d871fe9c4c65de87232802ed54b263c9b2824391 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 28 Aug 2025 14:46:48 +0200 Subject: bgp: T7760: deprecate per bgp vrf instance system-as node Originating from the bug in T7665. To avoid potential issues down the line - and given that there's no compelling technical reason to retain the system-as CLI node under per-VRF BGP configuration, which cannot be achieved through alternative means - the maintainers have collectively decided to deprecate the following command: set vrf name protocols bgp system-as Starting with VyOS 1.4.4, this CLI command will be considered deprecated. While it will still be accepted, it will no longer have any operational effect. A deprecation warning will be displayed at commit time, indicating that the BGP ASN from the global BGP configuration is now used instead. A migration script will handle the transition and perform the following actions: * Ensure a global BGP configuration exists; if not, initialize one. * Iterate over all configured VRFs to determine whether a BGP instance exists * For any insance, update the configuration to use the global system-as and apply the local-as ASN no-prepend replace-as option on all affected neighbors to preserve existing behavior. * If a neighbor is already configured with a local-as directive, that neighbor will be excluded from the migration process, as it already follows a custom configuration. * Add allowas-in per neighbor option. Required to not deny prefix received updates due to as-path contains our own global ASN. --- interface-definitions/include/version/bgp-version.xml.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'interface-definitions/include/version') diff --git a/interface-definitions/include/version/bgp-version.xml.i b/interface-definitions/include/version/bgp-version.xml.i index c90276151..21fddf9ae 100644 --- a/interface-definitions/include/version/bgp-version.xml.i +++ b/interface-definitions/include/version/bgp-version.xml.i @@ -1,3 +1,3 @@ - + -- cgit v1.2.3 From 85fe32f0e1a91a47fe4a6d4a5cdd6ac516dcc3b9 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Tue, 9 Sep 2025 17:57:44 +0200 Subject: bgp: T7760: remove per vrf instance system-as node VyOS 1.5 and onwards will no longer have the following CLI node available: set vrf name protocols bgp system-as --- .../include/version/bgp-version.xml.i | 2 +- interface-definitions/vrf.xml.in | 12 --------- src/conf_mode/protocols_bgp.py | 8 ------ src/migration-scripts/bgp/7-to-8 | 30 ++++++++++++++++++++++ 4 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 src/migration-scripts/bgp/7-to-8 (limited to 'interface-definitions/include/version') diff --git a/interface-definitions/include/version/bgp-version.xml.i b/interface-definitions/include/version/bgp-version.xml.i index 21fddf9ae..a283b9dd2 100644 --- a/interface-definitions/include/version/bgp-version.xml.i +++ b/interface-definitions/include/version/bgp-version.xml.i @@ -1,3 +1,3 @@ - + diff --git a/interface-definitions/vrf.xml.in b/interface-definitions/vrf.xml.in index 0d1033e25..3fa95076e 100644 --- a/interface-definitions/vrf.xml.in +++ b/interface-definitions/vrf.xml.in @@ -57,18 +57,6 @@ #include - - - Autonomous System Number (ASN) - DEPRECATED - - u32:1-4294967294 - Autonomous System Number - - - - - - diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py index ab0e7e44a..4e7f09d0e 100755 --- a/src/conf_mode/protocols_bgp.py +++ b/src/conf_mode/protocols_bgp.py @@ -18,7 +18,6 @@ from sys import exit from sys import argv from vyos.base import Warning -from vyos.base import DeprecationWarning from vyos.config import Config from vyos.configverify import has_frr_protocol_in_dict from vyos.configverify import verify_prefix_list @@ -219,13 +218,6 @@ def verify(config_dict): if not system_as: raise ConfigError(ERR_MSG_GLOBAL_VRF_AS_MISSING) - if 'system_as' in bgp: - tmp_as = bgp['system_as'] - DeprecationWarning(f'CLI command "vrf name {vrf} protocols bgp system-as ' \ - f'{tmp_as}" is ignored and will be removed in VyOS 1.5! ' \ - f'\n\nGlobal "protocols bgp system-as {system_as}" option ' \ - 'applies, use per neighbor "local-as" option to override.') - elif 'system_as' not in bgp: raise ConfigError(ERR_MSG_GLOBAL_VRF_AS_MISSING) diff --git a/src/migration-scripts/bgp/7-to-8 b/src/migration-scripts/bgp/7-to-8 new file mode 100644 index 000000000..ced4f837e --- /dev/null +++ b/src/migration-scripts/bgp/7-to-8 @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# +# Copyright VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# T7760: Remove per VRF setting for system-as option in VyOS 1.5 and onwards + +from vyos.configtree import ConfigTree + +def migrate(config: ConfigTree) -> None: + vrf_base = ['vrf', 'name'] + if not config.exists(vrf_base): + return + + for vrf in config.list_nodes(vrf_base): + # bail out early if there is no per VRF BGP instance defined + vrf_bgp_base = vrf_base + [vrf, 'protocols', 'bgp'] + if config.exists(vrf_bgp_base + ['system-as']): + config.delete(vrf_bgp_base + ['system-as']) -- cgit v1.2.3