Page Menu
Home
VyOS Platform
Search
Configure Global Search
Log In
Files
F117521423
9-to-10
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
9-to-10
View Options
# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
#
# 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/>.
# - rename CLI node 'dhcpv6-options delgate' to 'dhcpv6-options prefix-delegation
# interface'
# - rename CLI node 'interface-id' for prefix-delegation to 'address' as it
# represents the local interface IPv6 address assigned by DHCPv6-PD
from vyos.configtree import ConfigTree
def migrate(config: ConfigTree) -> None:
for intf_type in config.list_nodes(['interfaces']):
for intf in config.list_nodes(['interfaces', intf_type]):
# cache current config tree
base_path = ['interfaces', intf_type, intf, 'dhcpv6-options',
'delegate']
if config.exists(base_path):
# cache new config tree
new_path = ['interfaces', intf_type, intf, 'dhcpv6-options',
'prefix-delegation']
if not config.exists(new_path):
config.set(new_path)
# copy to new node
config.copy(base_path, new_path + ['interface'])
# rename interface-id to address
for interface in config.list_nodes(new_path + ['interface']):
config.rename(new_path + ['interface', interface, 'interface-id'], 'address')
# delete old noe
config.delete(base_path)
File Metadata
Details
Attached
Mime Type
text/x-script.python
Expires
Sat, Sep 26, 3:01 PM (1 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4285505
Default Alt Text
9-to-10 (1 KB)
Attached To
Mode
rVYOSONEX vyos-1x
Attached
Detach File
Event Timeline
Log In to Comment