From 324c8a5d5b9883a50a01e23ab0f2c3967253023e Mon Sep 17 00:00:00 2001 From: sarthurdev <965089+sarthurdev@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:17:03 +0100 Subject: dhcpv6-server: T5993: Extend interface migrator to check VLAN/QinQ Updates smoketest config to test migrator change --- src/migration-scripts/dhcpv6-server/4-to-5 | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/migration-scripts/dhcpv6-server') 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 -- cgit v1.2.3