summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-10-23 23:06:13 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-10-23 23:07:12 +0900
commit43d4bc9f561e4c593abfc71324fcd6b537d01a69 (patch)
tree9709e2b2d4f238019b66ae815da38b28d1540192 /test
parent1132a714ec44c9e244e08b89744122818949ea35 (diff)
downloadsystemd-43d4bc9f561e4c593abfc71324fcd6b537d01a69.tar.gz
test-network: add tests for routes managed by Manager
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 752b2fee43..499677e6e6 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -2230,6 +2230,66 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98')
self.assertRegex(output, 'via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98')
+ copy_unit_to_networkd_unit_path('25-address-static.network')
+ check_output(*networkctl_cmd, 'reload', env=env)
+ self.wait_online(['dummy98:routable'])
+
+ # check all routes managed by Manager are removed
+ print('### ip route show type blackhole')
+ output = check_output('ip route show type blackhole')
+ print(output)
+ self.assertEqual(output, '')
+
+ print('### ip route show type unreachable')
+ output = check_output('ip route show type unreachable')
+ print(output)
+ self.assertEqual(output, '')
+
+ print('### ip route show type prohibit')
+ output = check_output('ip route show type prohibit')
+ print(output)
+ self.assertEqual(output, '')
+
+ remove_unit_from_networkd_path(['25-address-static.network'])
+ check_output(*networkctl_cmd, 'reload', env=env)
+ self.wait_online(['dummy98:routable'])
+
+ # check all routes managed by Manager are reconfigured
+ print('### ip route show type blackhole')
+ output = check_output('ip route show type blackhole')
+ print(output)
+ self.assertRegex(output, 'blackhole 202.54.1.2 proto static')
+
+ print('### ip route show type unreachable')
+ output = check_output('ip route show type unreachable')
+ print(output)
+ self.assertRegex(output, 'unreachable 202.54.1.3 proto static')
+
+ print('### ip route show type prohibit')
+ output = check_output('ip route show type prohibit')
+ print(output)
+ self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
+
+ rc = call("ip link del dummy98")
+ self.assertEqual(rc, 0)
+ time.sleep(2)
+
+ # check all routes managed by Manager are removed
+ print('### ip route show type blackhole')
+ output = check_output('ip route show type blackhole')
+ print(output)
+ self.assertEqual(output, '')
+
+ print('### ip route show type unreachable')
+ output = check_output('ip route show type unreachable')
+ print(output)
+ self.assertEqual(output, '')
+
+ print('### ip route show type prohibit')
+ output = check_output('ip route show type prohibit')
+ print(output)
+ self.assertEqual(output, '')
+
@expectedFailureIfRTA_VIAIsNotSupported()
def test_route_via_ipv6(self):
copy_unit_to_networkd_unit_path('25-route-via-ipv6.network', '12-dummy.netdev')