From: Yu Watanabe Date: Mon, 31 Oct 2022 05:00:29 +0000 (+0900) Subject: test-network: resolve interface name from alternative name X-Git-Tag: v253-rc1~614^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b95d35b5ed4d6d47ad68314f68cb7887546cb41d;p=thirdparty%2Fsystemd.git test-network: resolve interface name from alternative name --- diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 62bd1d2d1e7..b255eeba6d2 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -413,6 +413,9 @@ def create_service_dropin(service, command, reload_command=None, additional_sett def link_exists(link): return call_quiet(f'ip link show {link}') == 0 +def link_resolve(link): + return check_output(f'ip link show {link}').split(':')[1].strip() + def remove_link(*links, protect=False): for link in links: if protect and link in protected_links: @@ -4236,6 +4239,9 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities): start_networkd() self.wait_online(['eni99np1:routable']) + # the name eni99np1 may be an alternative name. + ifname = link_resolve('eni99np1') + output = check_output('ip link show dev eni99np1') print(output) self.assertRegex(output, @@ -4250,7 +4256,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities): f.write('[Link]\nSR-IOVVirtualFunctions=4\n') udev_reload() - call(*udevadm_cmd, 'trigger', '--action=add', '--settle', '/sys/devices/netdevsim99/net/eni99np1') + check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}') output = check_output('ip link show dev eni99np1') print(output) @@ -4266,7 +4272,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities): f.write('[Link]\nSR-IOVVirtualFunctions=\n') udev_reload() - call(*udevadm_cmd, 'trigger', '--action=add', '--settle', '/sys/devices/netdevsim99/net/eni99np1') + check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}') output = check_output('ip link show dev eni99np1') print(output) @@ -4282,7 +4288,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities): f.write('[Link]\nSR-IOVVirtualFunctions=2\n') udev_reload() - call(*udevadm_cmd, 'trigger', '--action=add', '--settle', '/sys/devices/netdevsim99/net/eni99np1') + check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}') output = check_output('ip link show dev eni99np1') print(output) @@ -4298,7 +4304,7 @@ class NetworkdSRIOVTests(unittest.TestCase, Utilities): f.write('[Link]\nSR-IOVVirtualFunctions=\n') udev_reload() - call(*udevadm_cmd, 'trigger', '--action=add', '--settle', '/sys/devices/netdevsim99/net/eni99np1') + check_output(*udevadm_cmd, 'trigger', '--action=add', '--settle', f'/sys/devices/netdevsim99/net/{ifname}') output = check_output('ip link show dev eni99np1') print(output)