summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-02-14 15:19:06 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-02-21 05:16:27 +0900
commite2d9bc5cfd7fb1affd665c3f6aa57e408a6ab082 (patch)
tree66117f75bb7eef57ee686aadb165ce851544a561 /test
parent2ddd52d1e2098c801231b2af1dbcf802e5d01a31 (diff)
downloadsystemd-e2d9bc5cfd7fb1affd665c3f6aa57e408a6ab082.tar.gz
test-network: add a test for OnLink= in [NextHop] section
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-nexthop.network9
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py5
2 files changed, 14 insertions, 0 deletions
diff --git a/test/test-network/conf/25-nexthop.network b/test/test-network/conf/25-nexthop.network
index d4c7aa606c..a0b220f918 100644
--- a/test/test-network/conf/25-nexthop.network
+++ b/test/test-network/conf/25-nexthop.network
@@ -24,6 +24,11 @@ Id=4
Family=ipv4
[NextHop]
+Id=5
+Gateway=192.168.10.1
+OnLink=yes
+
+[NextHop]
Gateway=192.168.5.2
[Route]
@@ -37,3 +42,7 @@ Destination=10.10.10.11
[Route]
NextHop=2
Destination=2001:1234:5:8f62::1
+
+[Route]
+NextHop=5
+Destination=10.10.10.12
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index a5942ec4ea..38480e1ce5 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -2812,6 +2812,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertIn('id 2 via 2001:1234:5:8f63::2 dev veth99', output)
self.assertIn('id 3 dev veth99', output)
self.assertIn('id 4 dev veth99', output)
+ self.assertRegex(output, 'id 5 via 192.168.10.1 dev veth99 .*onlink')
self.assertRegex(output, r'id [0-9]* via 192.168.5.2 dev veth99')
output = check_output('ip route show dev veth99 10.10.10.10')
@@ -2822,6 +2823,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertEqual('10.10.10.11 nhid 2 via inet6 2001:1234:5:8f63::2 proto static', output)
+ output = check_output('ip route show dev veth99 10.10.10.12')
+ print(output)
+ self.assertEqual('10.10.10.12 nhid 5 via 192.168.10.1 proto static onlink', output)
+
output = check_output('ip -6 route show dev veth99 2001:1234:5:8f62::1')
print(output)
self.assertEqual('2001:1234:5:8f62::1 nhid 2 via 2001:1234:5:8f63::2 proto static metric 1024 pref medium', output)