test-network: add a test case for nexthop
This commit is contained in:
parent
4abcdaa08c
commit
086bcf5dca
11
test/test-network/conf/25-nexthop.network
Normal file
11
test/test-network/conf/25-nexthop.network
Normal file
|
@ -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
|
7
test/test-network/conf/25-veth-peer.network
Normal file
7
test/test-network/conf/25-veth-peer.network
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Match]
|
||||||
|
Name=veth-peer
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=2600::1/0
|
||||||
|
Address=192.168.5.1/24
|
|
@ -113,6 +113,16 @@ def expectedFailureIfLinkFileFieldIsNotSet():
|
||||||
|
|
||||||
return f
|
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():
|
def setUpModule():
|
||||||
global running_units
|
global running_units
|
||||||
|
|
||||||
|
@ -1402,7 +1412,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
'dummy99',
|
'dummy99',
|
||||||
'gretun97',
|
'gretun97',
|
||||||
'ip6gretun97',
|
'ip6gretun97',
|
||||||
'test1'
|
'test1',
|
||||||
|
'veth99',
|
||||||
]
|
]
|
||||||
|
|
||||||
units = [
|
units = [
|
||||||
|
@ -1426,6 +1437,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
'25-neighbor-ipv6.network',
|
'25-neighbor-ipv6.network',
|
||||||
'25-neighbor-ip-dummy.network',
|
'25-neighbor-ip-dummy.network',
|
||||||
'25-neighbor-ip.network',
|
'25-neighbor-ip.network',
|
||||||
|
'25-nexthop.network',
|
||||||
'25-link-local-addressing-no.network',
|
'25-link-local-addressing-no.network',
|
||||||
'25-link-local-addressing-yes.network',
|
'25-link-local-addressing-yes.network',
|
||||||
'25-link-section-unmanaged.network',
|
'25-link-section-unmanaged.network',
|
||||||
|
@ -1435,6 +1447,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
'25-gateway-next-static.network',
|
'25-gateway-next-static.network',
|
||||||
'25-sysctl-disable-ipv6.network',
|
'25-sysctl-disable-ipv6.network',
|
||||||
'25-sysctl.network',
|
'25-sysctl.network',
|
||||||
|
'25-veth-peer.network',
|
||||||
|
'25-veth.netdev',
|
||||||
'26-link-local-addressing-ipv6.network',
|
'26-link-local-addressing-ipv6.network',
|
||||||
'configure-without-carrier.network',
|
'configure-without-carrier.network',
|
||||||
'routing-policy-rule-dummy98.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.assertRegex(output, 'inet 10.1.2.3/16 scope global dummy98')
|
||||||
self.assertNotRegex(output, 'inet 10.2.3.4/16 scope global dynamic 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):
|
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
||||||
links = [
|
links = [
|
||||||
'dummy98',
|
'dummy98',
|
||||||
|
|
Loading…
Reference in a new issue