blob: ced4f837e5c9ee1eeae33b0143a92f5f219de142 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python3
#
# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
#
# 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 <http://www.gnu.org/licenses/>.
# 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'])
|