1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

test-network: add test for MTUBytes= in vlan or macvlan devices

This commit is contained in:
Yu Watanabe 2019-02-23 19:25:01 +09:00
parent 40288ecea1
commit 72b7f1b976
3 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
[NetDev]
Name=macvlan99
Kind=macvlan
MTUBytes=2000

View File

@ -1,3 +1,6 @@
[NetDev]
MTUBytes=2000
[VLAN]
Id=99
GVRP=true

View File

@ -343,15 +343,21 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.copy_unit_to_networkd_unit_path('21-vlan.netdev', '11-dummy.netdev', '21-vlan.network')
self.start_networkd()
self.assertTrue(self.link_exits('test1'))
self.assertTrue(self.link_exits('vlan99'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'test1']).rstrip().decode('utf-8')
print(output)
self.assertTrue(output, ' mtu 2004 ')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vlan99']).rstrip().decode('utf-8')
print(output)
self.assertTrue(output, ' mtu 2000 ')
self.assertTrue(output, 'REORDER_HDR')
self.assertTrue(output, 'LOOSE_BINDING')
self.assertTrue(output, 'GVRP')
self.assertTrue(output, 'MVRP')
self.assertTrue(output, '99')
self.assertTrue(output, ' id 99 ')
def test_macvtap(self):
self.copy_unit_to_networkd_unit_path('21-macvtap.netdev', '11-dummy.netdev', 'macvtap.network')
@ -363,8 +369,17 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.copy_unit_to_networkd_unit_path('21-macvlan.netdev', '11-dummy.netdev', 'macvlan.network')
self.start_networkd()
self.assertTrue(self.link_exits('test1'))
self.assertTrue(self.link_exits('macvlan99'))
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'test1']).rstrip().decode('utf-8')
print(output)
self.assertTrue(output, ' mtu 2000 ')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'macvlan99']).rstrip().decode('utf-8')
print(output)
self.assertTrue(output, ' mtu 2000 ')
@expectedFailureIfModuleIsNotAvailable('ipvlan')
def test_ipvlan(self):
self.copy_unit_to_networkd_unit_path('25-ipvlan.netdev', '11-dummy.netdev', 'ipvlan.network')