summaryrefslogtreecommitdiff
path: root/test/test-network/systemd-networkd-tests.py
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-09-08 20:35:05 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-10-24 14:23:17 +0900
commitdcd9f07ccfc010c9e4984124c70821bb81d6745a (patch)
tree4f14cffc12a94020d3022ca93f90043381de0316 /test/test-network/systemd-networkd-tests.py
parent8dc85c5ef13f5876aa52d35103feb74612db61bb (diff)
downloadsystemd-dcd9f07ccfc010c9e4984124c70821bb81d6745a.tar.gz
network: add tests for "networkctl reconfigure"
Diffstat (limited to 'test/test-network/systemd-networkd-tests.py')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 20b047c191..1cd623482f 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -380,6 +380,7 @@ class Utilities():
class NetworkctlTests(unittest.TestCase, Utilities):
links = [
+ 'dummy98',
'test1',
'veth99',
]
@@ -388,6 +389,8 @@ class NetworkctlTests(unittest.TestCase, Utilities):
'11-dummy.netdev',
'11-dummy-mtu.netdev',
'11-dummy.network',
+ '12-dummy.netdev',
+ '25-address-static.network',
'25-veth.netdev',
'netdev-link-local-addressing-yes.network',
]
@@ -401,6 +404,30 @@ class NetworkctlTests(unittest.TestCase, Utilities):
remove_unit_from_networkd_path(self.units)
stop_networkd(show_logs=True)
+ def test_reconfigure(self):
+ copy_unit_to_networkd_unit_path('25-address-static.network', '12-dummy.netdev')
+ start_networkd()
+ self.wait_online(['dummy98:routable'])
+
+ output = check_output('ip -4 address show dev dummy98')
+ print(output)
+ self.assertRegex(output, 'inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98')
+ self.assertRegex(output, 'inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98')
+ self.assertRegex(output, 'inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98')
+
+ check_output('ip address del 10.1.2.3/16 dev dummy98')
+ check_output('ip address del 10.1.2.4/16 dev dummy98')
+ check_output('ip address del 10.2.2.4/16 dev dummy98')
+
+ check_output(*networkctl_cmd, 'reconfigure', 'dummy98', env=env)
+ self.wait_online(['dummy98:routable'])
+
+ output = check_output('ip -4 address show dev dummy98')
+ print(output)
+ self.assertRegex(output, 'inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98')
+ self.assertRegex(output, 'inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98')
+ self.assertRegex(output, 'inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98')
+
def test_reload(self):
start_networkd(3)