test-network: split out SR-IOV test to new class
This commit is contained in:
@@ -2065,7 +2065,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
'25-route-vrf.network',
|
||||
'25-gateway-static.network',
|
||||
'25-gateway-next-static.network',
|
||||
'25-sriov.network',
|
||||
'25-sysctl-disable-ipv6.network',
|
||||
'25-sysctl.network',
|
||||
'25-test1.network',
|
||||
@@ -3450,32 +3449,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, 'qdisc fq_pie 3a: root')
|
||||
self.assertRegex(output, 'limit 200000p')
|
||||
|
||||
@expectedFailureIfNetdevsimWithSRIOVIsNotAvailable()
|
||||
def test_sriov(self):
|
||||
call('rmmod netdevsim', stderr=subprocess.DEVNULL)
|
||||
call('modprobe netdevsim', stderr=subprocess.DEVNULL)
|
||||
with open('/sys/bus/netdevsim/new_device', mode='w') as f:
|
||||
f.write('99 1')
|
||||
|
||||
call('udevadm settle')
|
||||
call('udevadm info -w10s /sys/devices/netdevsim99/net/eni99np1', stderr=subprocess.DEVNULL)
|
||||
with open('/sys/class/net/eni99np1/device/sriov_numvfs', mode='w') as f:
|
||||
f.write('3')
|
||||
|
||||
copy_unit_to_networkd_unit_path('25-sriov.network')
|
||||
start_networkd()
|
||||
self.wait_online(['eni99np1:routable'])
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
'vf 1 .*00:11:22:33:44:56.*vlan 6, qos 2, spoof checking off, link-state disable, trust off, query_rss off\n *'
|
||||
'vf 2 .*00:11:22:33:44:57.*vlan 7, qos 3, spoof checking off, link-state auto, trust off, query_rss off'
|
||||
)
|
||||
|
||||
call('rmmod netdevsim', stderr=subprocess.DEVNULL)
|
||||
|
||||
def test_wait_online_ipv4(self):
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-with-ipv6-prefix.network', 'dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network')
|
||||
start_networkd()
|
||||
@@ -3999,6 +3972,44 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertIn('from all to 8.8.8.8 lookup 100', output)
|
||||
|
||||
class NetworkdSRIOVTests(unittest.TestCase, Utilities):
|
||||
units = [
|
||||
'25-sriov.network',
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
stop_networkd(show_logs=False)
|
||||
call('rmmod netdevsim', stderr=subprocess.DEVNULL)
|
||||
|
||||
def tearDown(self):
|
||||
remove_unit_from_networkd_path(self.units)
|
||||
stop_networkd(show_logs=True)
|
||||
call('rmmod netdevsim', stderr=subprocess.DEVNULL)
|
||||
|
||||
@expectedFailureIfNetdevsimWithSRIOVIsNotAvailable()
|
||||
def test_sriov(self):
|
||||
call('modprobe netdevsim', stderr=subprocess.DEVNULL)
|
||||
|
||||
with open('/sys/bus/netdevsim/new_device', mode='w') as f:
|
||||
f.write('99 1')
|
||||
|
||||
call('udevadm settle')
|
||||
call('udevadm info -w10s /sys/devices/netdevsim99/net/eni99np1', stderr=subprocess.DEVNULL)
|
||||
with open('/sys/class/net/eni99np1/device/sriov_numvfs', mode='w') as f:
|
||||
f.write('3')
|
||||
|
||||
copy_unit_to_networkd_unit_path('25-sriov.network')
|
||||
start_networkd()
|
||||
self.wait_online(['eni99np1:routable'])
|
||||
|
||||
output = check_output('ip link show dev eni99np1')
|
||||
print(output)
|
||||
self.assertRegex(output,
|
||||
'vf 0 .*00:11:22:33:44:55.*vlan 5, qos 1, vlan protocol 802.1ad, spoof checking on, link-state enable, trust on, query_rss on\n *'
|
||||
'vf 1 .*00:11:22:33:44:56.*vlan 6, qos 2, spoof checking off, link-state disable, trust off, query_rss off\n *'
|
||||
'vf 2 .*00:11:22:33:44:57.*vlan 7, qos 3, spoof checking off, link-state auto, trust off, query_rss off'
|
||||
)
|
||||
|
||||
class NetworkdLLDPTests(unittest.TestCase, Utilities):
|
||||
links = ['veth99']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user