From: Yu Watanabe Date: Wed, 20 Feb 2019 06:04:15 +0000 (+0900) Subject: test-network: testing with two bond slaves X-Git-Tag: v242-rc1~253^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc3e488c7d1fa8ec165db68d13d5dfc5ac33d314;p=thirdparty%2Fsystemd.git test-network: testing with two bond slaves --- diff --git a/test/test-network/conf/veth-bond.network b/test/test-network/conf/bond-slave.network similarity index 89% rename from test/test-network/conf/veth-bond.network rename to test/test-network/conf/bond-slave.network index d715d365636..4eeeae201c9 100644 --- a/test/test-network/conf/veth-bond.network +++ b/test/test-network/conf/bond-slave.network @@ -1,5 +1,5 @@ [Match] -Name=veth99 +Name=dummy98 test1 [Network] Bond=bond99 diff --git a/test/test-network/conf/bond99.network b/test/test-network/conf/bond99.network index 9c18eeb80c2..c5b417abbcd 100644 --- a/test/test-network/conf/bond99.network +++ b/test/test-network/conf/bond99.network @@ -3,4 +3,4 @@ Name=bond99 [Network] IPv6AcceptRA=no -DHCP=yes +Address=192.168.123.45/24 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index dae370c0175..bc90aaeb26c 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -1058,14 +1058,15 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities): class NetworkdNetWorkBondTests(unittest.TestCase, Utilities): links = [ 'bond99', - 'veth99'] + 'dummy98', + 'test1'] units = [ + '11-dummy.netdev', + '12-dummy.netdev', '25-bond.netdev', - '25-veth.netdev', 'bond99.network', - 'dhcp-server.network', - 'veth-bond.network'] + 'bond-slave.network'] def setUp(self): self.link_remove(self.links) @@ -1074,20 +1075,20 @@ class NetworkdNetWorkBondTests(unittest.TestCase, Utilities): self.link_remove(self.links) self.remove_unit_from_networkd_path(self.units) - def test_bridge_property(self): - self.copy_unit_to_networkd_unit_path('25-bond.netdev', '25-veth.netdev', 'bond99.network', - 'dhcp-server.network', 'veth-bond.network') + def test_bond_operstate(self): + self.copy_unit_to_networkd_unit_path('25-bond.netdev', '11-dummy.netdev', '12-dummy.netdev', + 'bond99.network','bond-slave.network') self.start_networkd() self.assertTrue(self.link_exits('bond99')) - self.assertTrue(self.link_exits('veth99')) - self.assertTrue(self.link_exits('veth-peer')) + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('test1')) - output = subprocess.check_output(['ip', '-d', 'link', 'show', 'veth-peer']).rstrip().decode('utf-8') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'dummy98']).rstrip().decode('utf-8') print(output) - self.assertRegex(output, 'UP,LOWER_UP') + self.assertRegex(output, 'SLAVE,UP,LOWER_UP') - output = subprocess.check_output(['ip', '-d', 'link', 'show', 'veth99']).rstrip().decode('utf-8') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'test1']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'SLAVE,UP,LOWER_UP') @@ -1095,11 +1096,11 @@ class NetworkdNetWorkBondTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'MASTER,UP,LOWER_UP') - output = subprocess.check_output(['networkctl', 'status', 'veth-peer']).rstrip().decode('utf-8') + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') print(output) - self.assertRegex(output, 'State: routable \(configured\)') + self.assertRegex(output, 'State: enslaved \(configured\)') - output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'State: enslaved \(configured\)') @@ -1107,21 +1108,29 @@ class NetworkdNetWorkBondTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'State: routable \(configured\)') - self.assertEqual(subprocess.call(['ip', 'link', 'set', 'veth99', 'down']), 0) + self.assertEqual(subprocess.call(['ip', 'link', 'set', 'dummy98', 'down']), 0) time.sleep(2) - output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'State: off \(configured\)') + output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'State: enslaved \(configured\)') + output = subprocess.check_output(['networkctl', 'status', 'bond99']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'State: degraded \(configured\)') - self.assertEqual(subprocess.call(['ip', 'link', 'set', 'veth99', 'up']), 0) + self.assertEqual(subprocess.call(['ip', 'link', 'set', 'dummy98', 'up']), 0) time.sleep(2) - output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8') + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'State: enslaved \(configured\)') + + output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'State: enslaved \(configured\)') @@ -1129,6 +1138,22 @@ class NetworkdNetWorkBondTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'State: routable \(configured\)') + self.assertEqual(subprocess.call(['ip', 'link', 'set', 'dummy98', 'down']), 0) + self.assertEqual(subprocess.call(['ip', 'link', 'set', 'test1', 'down']), 0) + time.sleep(2) + + output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'State: off \(configured\)') + + output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'State: off \(configured\)') + + output = subprocess.check_output(['networkctl', 'status', 'bond99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'State: degraded \(configured\)') + class NetworkdNetWorkBridgeTests(unittest.TestCase, Utilities): links = [ 'bridge99',