summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-route-vrf.network7
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py18
2 files changed, 25 insertions, 0 deletions
diff --git a/test/test-network/conf/25-route-vrf.network b/test/test-network/conf/25-route-vrf.network
new file mode 100644
index 0000000000..e786066d3f
--- /dev/null
+++ b/test/test-network/conf/25-route-vrf.network
@@ -0,0 +1,7 @@
+[Match]
+Name=dummy98
+
+[Network]
+VRF=vrf99
+Address=192.168.100.2/24
+Gateway=192.168.100.1
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index b30385ce56..6cdc96daf7 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -1589,6 +1589,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'ip6gretun97',
'test1',
'veth99',
+ 'vrf99',
]
units = [
@@ -1628,12 +1629,14 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-qdisc-teql.network',
'25-route-ipv6-src.network',
'25-route-static.network',
+ '25-route-vrf.network',
'25-gateway-static.network',
'25-gateway-next-static.network',
'25-sysctl-disable-ipv6.network',
'25-sysctl.network',
'25-veth-peer.network',
'25-veth.netdev',
+ '25-vrf.netdev',
'26-link-local-addressing-ipv6.network',
'configure-without-carrier.network',
'routing-policy-rule-dummy98.network',
@@ -1910,6 +1913,21 @@ 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')
+ @expectedFailureIfModuleIsNotAvailable('vrf')
+ def test_route_vrf(self):
+ copy_unit_to_networkd_unit_path('25-route-vrf.network', '12-dummy.netdev',
+ '25-vrf.netdev', '25-vrf.network')
+ start_networkd()
+ self.wait_online(['dummy98:routable', 'vrf99:carrier'])
+
+ output = check_output('ip route show vrf vrf99')
+ print(output)
+ self.assertRegex(output, 'default via 192.168.100.1')
+
+ output = check_output('ip route show')
+ print(output)
+ self.assertNotRegex(output, 'default via 192.168.100.1')
+
def test_gateway_reconfigure(self):
copy_unit_to_networkd_unit_path('25-gateway-static.network', '12-dummy.netdev')
start_networkd()