mirror of
https://github.com/systemd/systemd.git
synced 2025-05-27 21:05:55 +03:00
test-network: resolve interface name from alternative name
This commit is contained in:
parent
d7ff72ec9c
commit
b95d35b5ed
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user