Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions smoketest/config-tests/basic-ipv6
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ set interfaces ethernet eth0 vif-s 10 vif-c 20 address 'dhcpv6'
set interfaces ethernet eth0 vif-s 10 vif-c 20 ipv6 address autoconf
set interfaces ethernet eth1 duplex 'auto'
set interfaces ethernet eth1 speed 'auto'
set interfaces ethernet eth1 vif 50
set interfaces ethernet eth1 vif-s 60 vif-c 70
set interfaces ethernet eth1 vif 50 address '1.2.3.4/31'
set interfaces ethernet eth1 vif-s 60 vif-c 70 address '2.3.4.5/31'
set interfaces ethernet eth2 address 'dhcpv6'
set interfaces ethernet eth2 duplex 'auto'
set interfaces ethernet eth2 ipv6 address autoconf
set interfaces ethernet eth2 speed 'auto'
set interfaces loopback lo
set interfaces pppoe pppoe0 authentication password 'vyos'
Expand Down
3 changes: 3 additions & 0 deletions smoketest/configs/basic-ipv6
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ interfaces {
duplex auto
speed auto
vif 50 {
address 1.2.3.4/31
}
vif-s 60 {
vif-c 70 {
address 2.3.4.5/31
}
}
}
ethernet eth2 {
address dhcpv6
duplex auto
speed auto
}
Expand Down
31 changes: 18 additions & 13 deletions src/migration-scripts/interfaces/32-to-33
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,36 @@ def migrate(config: ConfigTree) -> None:
for type in config.list_nodes(['interfaces']):
for interface in config.list_nodes(['interfaces', type]):
iface_base_path = ['interfaces', type, interface]
dhcpv6_addr_path = iface_base_path + ['address', 'dhcpv6']
autoconf_path = iface_base_path + ['ipv6', 'address', 'autoconf']
if config.exists(dhcpv6_addr_path) and not config.exists(autoconf_path):
config.set(autoconf_path)
dhcpv6_addr_path = iface_base_path + ['address']

if config.exists(dhcpv6_addr_path) and 'dhcpv6' in config.return_values(dhcpv6_addr_path):
autoconf_path = iface_base_path + ['ipv6', 'address', 'autoconf']
if not config.exists(autoconf_path):
config.set(autoconf_path)

vif_path = iface_base_path + ['vif']
if config.exists(vif_path):
for vif in config.list_nodes(vif_path):
vif_dhcpv6_addr_path = vif_path + [vif, 'address']
vif_autoconf_path = vif_path + [vif, 'ipv6', 'address', 'autoconf']
if config.exists(vif_dhcpv6_addr_path) and not config.exists(vif_autoconf_path):
config.set(vif_autoconf_path)
if config.exists(vif_dhcpv6_addr_path) and 'dhcpv6' in config.return_values(vif_dhcpv6_addr_path):
vif_autoconf_path = vif_path + [vif, 'ipv6', 'address', 'autoconf']
if not config.exists(vif_autoconf_path):
config.set(vif_autoconf_path)

vif_s_path = iface_base_path + ['vif-s']
if config.exists(vif_s_path):
for vif_s in config.list_nodes(vif_s_path):
vif_s_dhcpv6_addr_path = vif_s_path + [vif_s, 'address']
vif_s_autoconf_path = vif_s_path + [vif_s, 'ipv6', 'address', 'autoconf']
if config.exists(vif_s_dhcpv6_addr_path) and not config.exists(vif_s_autoconf_path):
config.set(vif_s_autoconf_path)
if config.exists(vif_s_dhcpv6_addr_path) and 'dhcpv6' in config.return_values(vif_s_dhcpv6_addr_path):
vif_s_autoconf_path = vif_s_path + [vif_s, 'ipv6', 'address', 'autoconf']
if not config.exists(vif_s_autoconf_path):
config.set(vif_s_autoconf_path)

vif_c_path = iface_base_path + ['vif-s', vif_s, 'vif-c']
if config.exists(vif_c_path):
for vif_c in config.list_nodes(vif_c_path):
vif_c_dhcpv6_addr_path = vif_c_path + [vif_c, 'address']
vif_c_autoconf_path = vif_c_path + [vif_c, 'ipv6', 'address', 'autoconf']
if config.exists(vif_c_dhcpv6_addr_path) and not config.exists(vif_c_autoconf_path):
config.set(vif_c_autoconf_path)
if config.exists(vif_c_dhcpv6_addr_path) and 'dhcpv6' in config.return_values(vif_c_dhcpv6_addr_path):
vif_c_autoconf_path = vif_c_path + [vif_c, 'ipv6', 'address', 'autoconf']
if not config.exists(vif_c_autoconf_path):
config.set(vif_c_autoconf_path)
Loading