mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
test-network: add tests for Mode= setting in [MACVTAP] section
This commit is contained in:
parent
dff9792b15
commit
460feb6127
@ -509,10 +509,20 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, 'inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99')
|
||||
|
||||
def test_macvtap(self):
|
||||
self.copy_unit_to_networkd_unit_path('21-macvtap.netdev', '11-dummy.netdev', 'macvtap.network')
|
||||
self.start_networkd(0)
|
||||
for mode in ['private', 'vepa', 'bridge', 'passthru']:
|
||||
with self.subTest(mode=mode):
|
||||
if mode != 'private':
|
||||
self.tearDown()
|
||||
self.copy_unit_to_networkd_unit_path('21-macvtap.netdev', '11-dummy.netdev', 'macvtap.network')
|
||||
with open(os.path.join(network_unit_file_path, '21-macvtap.netdev'), mode='a') as f:
|
||||
f.write('[MACVTAP]\nMode=' + mode)
|
||||
self.start_networkd(0)
|
||||
|
||||
self.wait_online(['macvtap99:off', 'test1:degraded'])
|
||||
self.wait_online(['macvtap99:off', 'test1:degraded'])
|
||||
|
||||
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'macvtap99'], universal_newlines=True).rstrip()
|
||||
print(output)
|
||||
self.assertRegex(output, 'macvtap mode ' + mode + ' ')
|
||||
|
||||
def test_macvlan(self):
|
||||
for mode in ['private', 'vepa', 'bridge', 'passthru']:
|
||||
|
Loading…
Reference in New Issue
Block a user