summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-10-14 21:18:01 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-10-14 21:55:57 +0900
commit086bcf5dca17167d86870736a876bc8a0376361d (patch)
tree836bbedd92df3f9e14cc0c647591fb9396703755 /test
parent4abcdaa08ccca77053e4664b3395e9513a36ff3b (diff)
downloadsystemd-086bcf5dca17167d86870736a876bc8a0376361d.tar.gz
systemd-086bcf5dca17167d86870736a876bc8a0376361d.tar.bz2
systemd-086bcf5dca17167d86870736a876bc8a0376361d.zip
test-network: add a test case for nexthop
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-nexthop.network11
-rw-r--r--test/test-network/conf/25-veth-peer.network7
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py26
3 files changed, 43 insertions, 1 deletions
diff --git a/test/test-network/conf/25-nexthop.network b/test/test-network/conf/25-nexthop.network
new file mode 100644
index 0000000000..3eea077345
--- /dev/null
+++ b/test/test-network/conf/25-nexthop.network
@@ -0,0 +1,11 @@
+[Match]
+Name=veth99
+
+[Network]
+IPv6AcceptRA=no
+Address=192.168.5.10/24
+Gateway=192.168.5.1
+
+[NextHop]
+Id=1
+Gateway=192.168.5.1
diff --git a/test/test-network/conf/25-veth-peer.network b/test/test-network/conf/25-veth-peer.network
new file mode 100644
index 0000000000..f24956fe4e
--- /dev/null
+++ b/test/test-network/conf/25-veth-peer.network
@@ -0,0 +1,7 @@
+[Match]
+Name=veth-peer
+
+[Network]
+IPv6AcceptRA=no
+Address=2600::1/0
+Address=192.168.5.1/24
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 87a76a502c..d100921709 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -113,6 +113,16 @@ def expectedFailureIfLinkFileFieldIsNotSet():
return f
+def expectedFailureIfNexthopIsNotAvailable():
+ def f(func):
+ rc = call('ip nexthop list')
+ if rc == 0:
+ return func
+ else:
+ return unittest.expectedFailure(func)
+
+ return f
+
def setUpModule():
global running_units
@@ -1402,7 +1412,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'dummy99',
'gretun97',
'ip6gretun97',
- 'test1'
+ 'test1',
+ 'veth99',
]
units = [
@@ -1426,6 +1437,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-neighbor-ipv6.network',
'25-neighbor-ip-dummy.network',
'25-neighbor-ip.network',
+ '25-nexthop.network',
'25-link-local-addressing-no.network',
'25-link-local-addressing-yes.network',
'25-link-section-unmanaged.network',
@@ -1435,6 +1447,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-gateway-next-static.network',
'25-sysctl-disable-ipv6.network',
'25-sysctl.network',
+ '25-veth-peer.network',
+ '25-veth.netdev',
'26-link-local-addressing-ipv6.network',
'configure-without-carrier.network',
'routing-policy-rule-dummy98.network',
@@ -1974,6 +1988,16 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'inet 10.1.2.3/16 scope global dummy98')
self.assertNotRegex(output, 'inet 10.2.3.4/16 scope global dynamic dummy98')
+ @expectedFailureIfNexthopIsNotAvailable()
+ def test_nexthop(self):
+ copy_unit_to_networkd_unit_path('25-nexthop.network', '25-veth.netdev', '25-veth-peer.network')
+ start_networkd()
+ self.wait_online(['veth99:routable', 'veth-peer:routable'])
+
+ output = check_output('ip nexthop list dev veth99')
+ print(output)
+ self.assertRegex(output, '192.168.5.1')
+
class NetworkdStateFileTests(unittest.TestCase, Utilities):
links = [
'dummy98',