summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-07-07 21:57:22 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-07-12 09:39:43 +0900
commit6d60f9dbe6d1399fa820b36716518fb9cb4ee2bb (patch)
treeaf02786b15d758a5843cccb366864bd68edc8fc8 /test
parentd3e291fd62bdffab9fd3c71beb25aa8876f77178 (diff)
downloadsystemd-6d60f9dbe6d1399fa820b36716518fb9cb4ee2bb.tar.gz
systemd-6d60f9dbe6d1399fa820b36716518fb9cb4ee2bb.tar.bz2
systemd-6d60f9dbe6d1399fa820b36716518fb9cb4ee2bb.zip
test-network: add tests for route with type local, multicast, anycast, or broadcast
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-route-static.network16
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py17
2 files changed, 33 insertions, 0 deletions
diff --git a/test/test-network/conf/25-route-static.network b/test/test-network/conf/25-route-static.network
index 9e12480a65..9c8269e3b8 100644
--- a/test/test-network/conf/25-route-static.network
+++ b/test/test-network/conf/25-route-static.network
@@ -46,3 +46,19 @@ Destination=202.54.1.3
[Route]
Type=prohibit
Destination=202.54.1.4
+
+[Route]
+Type=local
+Destination=149.10.123.1
+
+[Route]
+Type=anycast
+Destination=149.10.123.2
+
+[Route]
+Type=broadcast
+Destination=149.10.123.3
+
+[Route]
+Type=multicast
+Destination=149.10.123.4
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 17ec04cbdb..e396af05da 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -1552,14 +1552,18 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
start_networkd()
wait_online(['dummy98:routable'])
+ print('### ip -6 route show dev dummy98')
output = check_output('ip -6 route show dev dummy98')
print(output)
self.assertRegex(output, '2001:1234:5:8fff:ff:ff:ff:ff proto static')
self.assertRegex(output, '2001:1234:5:8f63::1 proto kernel')
+ print('### ip -6 route show dev dummy98 default')
output = check_output('ip -6 route show dev dummy98 default')
+ print(output)
self.assertRegex(output, 'default via 2001:1234:5:8fff:ff:ff:ff:ff proto static metric 1024 pref medium')
+ print('### ip -4 route show dev dummy98')
output = check_output('ip -4 route show dev dummy98')
print(output)
self.assertRegex(output, '149.10.124.48/28 proto kernel scope link src 149.10.124.58')
@@ -1567,20 +1571,33 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, '169.254.0.0/16 proto static scope link metric 2048')
self.assertRegex(output, '192.168.1.1 proto static initcwnd 20')
self.assertRegex(output, '192.168.1.2 proto static initrwnd 30')
+ self.assertRegex(output, 'multicast 149.10.123.4 proto static')
+ print('### ip -4 route show dev dummy98 default')
output = check_output('ip -4 route show dev dummy98 default')
+ print(output)
self.assertRegex(output, 'default via 149.10.125.65 proto static onlink')
self.assertRegex(output, 'default via 149.10.124.64 proto static')
self.assertRegex(output, 'default proto static')
+ print('### ip -4 route show table local dev dummy98')
+ output = check_output('ip -4 route show table local dev dummy98')
+ print(output)
+ self.assertRegex(output, 'local 149.10.123.1 proto static scope host')
+ self.assertRegex(output, 'anycast 149.10.123.2 proto static scope link')
+ self.assertRegex(output, 'broadcast 149.10.123.3 proto static scope link')
+
+ 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')