From 72b7f1b97660534bfba74e5ab6e959207a278559 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 23 Feb 2019 19:25:01 +0900 Subject: [PATCH] test-network: add test for MTUBytes= in vlan or macvlan devices --- test/test-network/conf/21-macvlan.netdev | 1 + .../conf/21-vlan.netdev.d/override.conf | 3 +++ test/test-network/systemd-networkd-tests.py | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/test/test-network/conf/21-macvlan.netdev b/test/test-network/conf/21-macvlan.netdev index e9a3c5b3479..674c1f516b3 100644 --- a/test/test-network/conf/21-macvlan.netdev +++ b/test/test-network/conf/21-macvlan.netdev @@ -1,3 +1,4 @@ [NetDev] Name=macvlan99 Kind=macvlan +MTUBytes=2000 diff --git a/test/test-network/conf/21-vlan.netdev.d/override.conf b/test/test-network/conf/21-vlan.netdev.d/override.conf index cd61be53101..3b8d47d9b1d 100644 --- a/test/test-network/conf/21-vlan.netdev.d/override.conf +++ b/test/test-network/conf/21-vlan.netdev.d/override.conf @@ -1,3 +1,6 @@ +[NetDev] +MTUBytes=2000 + [VLAN] Id=99 GVRP=true diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index fa5e08e7506..e410ccb2653 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -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')