summaryrefslogtreecommitdiff
path: root/src/migration-scripts/dhcpv6-server
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2024-02-14 13:17:03 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2024-02-14 16:40:53 +0100
commit324c8a5d5b9883a50a01e23ab0f2c3967253023e (patch)
tree5381c1c74e9c9cd68533c79844f77daef2add8b9 /src/migration-scripts/dhcpv6-server
parent04bf9ee39f8243207ec777d6a5aeec78e3c9d66f (diff)
downloadvyos-1x-324c8a5d5b9883a50a01e23ab0f2c3967253023e.tar.gz
vyos-1x-324c8a5d5b9883a50a01e23ab0f2c3967253023e.zip
dhcpv6-server: T5993: Extend interface migrator to check VLAN/QinQ
Updates smoketest config to test migrator change
Diffstat (limited to 'src/migration-scripts/dhcpv6-server')
-rwxr-xr-xsrc/migration-scripts/dhcpv6-server/4-to-528
1 files changed, 24 insertions, 4 deletions
diff --git a/src/migration-scripts/dhcpv6-server/4-to-5 b/src/migration-scripts/dhcpv6-server/4-to-5
index e808edbe0..ae506b9c5 100755
--- a/src/migration-scripts/dhcpv6-server/4-to-5
+++ b/src/migration-scripts/dhcpv6-server/4-to-5
@@ -39,14 +39,34 @@ if not config.exists(base):
def find_subnet_interface(subnet):
subnet_net = ip_network(subnet)
+ def check_addr(if_path):
+ if config.exists(if_path + ['address']):
+ for addr in config.return_values(if_path + ['address']):
+ if ip_network(addr, strict=False) == subnet_net:
+ return True
+ return None
+
for iftype in config.list_nodes(['interfaces']):
for ifname in config.list_nodes(['interfaces', iftype]):
if_base = ['interfaces', iftype, ifname]
- if config.exists(if_base + ['address']):
- for addr in config.return_values(if_base + ['address']):
- if ip_network(addr, strict=False) == subnet_net:
- return ifname
+ if check_addr(if_base):
+ return ifname
+
+ if config.exists(if_base + ['vif']):
+ for vif in config.list_nodes(if_base + ['vif']):
+ if check_addr(if_base + ['vif', vif]):
+ return f'{ifname}.{vif}'
+
+ if config.exists(if_base + ['vif-s']):
+ for vifs in config.list_nodes(if_base + ['vif-s']):
+ if check_addr(if_base + ['vif-s', vifs]):
+ return f'{ifname}.{vifs}'
+
+ if config.exists(if_base + ['vif-s', vifs, 'vif-c']):
+ for vifc in config.list_nodes(if_base + ['vif-s', vifs, 'vif-c']):
+ if check_addr(if_base + ['vif-s', vifs, 'vif-c', vifc]):
+ return f'{ifname}.{vifs}.{vifc}'
return False