Skip to content

Commit 20a4de7

Browse files
committed
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 <name> protocols bgp system-as <asn>
1 parent 78ea74a commit 20a4de7

File tree

4 files changed

+31
-21
lines changed

4 files changed

+31
-21
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- include start from include/version/bgp-version.xml.i -->
2-
<syntaxVersion component='bgp' version='7'></syntaxVersion>
2+
<syntaxVersion component='bgp' version='8'></syntaxVersion>
33
<!-- include end -->

interface-definitions/vrf.xml.in

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@
5757
</properties>
5858
<children>
5959
#include <include/bgp/protocol-common-config.xml.i>
60-
<leafNode name="system-as">
61-
<properties>
62-
<help>Autonomous System Number (ASN) - DEPRECATED</help>
63-
<valueHelp>
64-
<format>u32:1-4294967294</format>
65-
<description>Autonomous System Number</description>
66-
</valueHelp>
67-
<constraint>
68-
<validator name="numeric" argument="--range 1-4294967294"/>
69-
</constraint>
70-
</properties>
71-
</leafNode>
7260
</children>
7361
</node>
7462
<node name="eigrp" owner="${vyos_conf_scripts_dir}/protocols_eigrp.py $VAR(../../@)">

src/conf_mode/protocols_bgp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from sys import argv
1919

2020
from vyos.base import Warning
21-
from vyos.base import DeprecationWarning
2221
from vyos.config import Config
2322
from vyos.configverify import has_frr_protocol_in_dict
2423
from vyos.configverify import verify_prefix_list
@@ -219,13 +218,6 @@ def verify(config_dict):
219218
if not system_as:
220219
raise ConfigError(ERR_MSG_GLOBAL_VRF_AS_MISSING)
221220

222-
if 'system_as' in bgp:
223-
tmp_as = bgp['system_as']
224-
DeprecationWarning(f'CLI command "vrf name {vrf} protocols bgp system-as ' \
225-
f'{tmp_as}" is ignored and will be removed in VyOS 1.5! ' \
226-
f'\n\nGlobal "protocols bgp system-as {system_as}" option ' \
227-
'applies, use per neighbor "local-as" option to override.')
228-
229221
elif 'system_as' not in bgp:
230222
raise ConfigError(ERR_MSG_GLOBAL_VRF_AS_MISSING)
231223

src/migration-scripts/bgp/7-to-8

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright VyOS maintainers and contributors <[email protected]>
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License version 2 or later as
7+
# published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
# T7760: Remove per VRF setting for system-as option in VyOS 1.5 and onwards
18+
19+
from vyos.configtree import ConfigTree
20+
21+
def migrate(config: ConfigTree) -> None:
22+
vrf_base = ['vrf', 'name']
23+
if not config.exists(vrf_base):
24+
return
25+
26+
for vrf in config.list_nodes(vrf_base):
27+
# bail out early if there is no per VRF BGP instance defined
28+
vrf_bgp_base = vrf_base + [vrf, 'protocols', 'bgp']
29+
if config.exists(vrf_bgp_base + ['system-as']):
30+
config.delete(vrf_bgp_base + ['system-as'])

0 commit comments

Comments
 (0)