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

test-network: add more tests for Bridge=

This commit is contained in:
Yu Watanabe 2019-02-20 11:33:00 +09:00
parent 45e11abfff
commit 2be6c5d2ec
3 changed files with 27 additions and 2 deletions

View File

@ -4,4 +4,5 @@ Name=bridge99
[Network]
Address=192.168.0.15/24
Gateway=192.168.0.1
IPv6AcceptRA=no
IgnoreCarrierLoss=true

View File

@ -4,3 +4,4 @@ Name=bridge99
[Network]
Address=192.168.0.15/24
Gateway=192.168.0.1
IPv6AcceptRA=no

View File

@ -1198,8 +1198,7 @@ class NetworkdNetWorkBridgeTests(unittest.TestCase, Utilities):
output = subprocess.check_output(['ip', 'addr', 'show', 'bridge99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, '192.168.0.15')
self.assertRegex(output, '192.168.0.1')
self.assertRegex(output, '192.168.0.15/24')
output = subprocess.check_output(['bridge', '-d', 'link', 'show', 'dummy98']).rstrip().decode('utf-8')
print(output)
@ -1212,13 +1211,37 @@ class NetworkdNetWorkBridgeTests(unittest.TestCase, Utilities):
if (os.path.exists('/sys/devices/virtual/net/bridge00/lower_dummy98/brport/multicast_to_unicast')):
self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'multicast_to_unicast'), '1')
output = subprocess.check_output(['networkctl', 'status', 'test1']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: enslaved \(configured\)')
output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: enslaved \(configured\)')
output = subprocess.check_output(['networkctl', 'status', 'bridge99']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: routable \(configured\)')
self.assertEqual(subprocess.call(['ip', 'address', 'add', '192.168.0.16/24', 'dev', 'bridge99']), 0)
time.sleep(1)
output = subprocess.check_output(['ip', 'addr', 'show', 'bridge99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, '192.168.0.16/24')
output = subprocess.check_output(['networkctl', 'status', 'bridge99']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: routable \(configured\)')
self.assertEqual(subprocess.call(['ip', 'link', 'del', 'test1']), 0)
time.sleep(3)
output = subprocess.check_output(['networkctl', 'status', 'bridge99']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: degraded \(configured\)')
self.assertEqual(subprocess.call(['ip', 'link', 'del', 'dummy98']), 0)
time.sleep(3)
output = subprocess.check_output(['networkctl', 'status', 'bridge99']).rstrip().decode('utf-8')
self.assertRegex(output, 'State: no-carrier \(configured\)')
output = subprocess.check_output(['ip', 'address', 'show', 'bridge99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'NO-CARRIER')