summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-02-11 13:38:54 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-02-16 17:17:40 +0100
commit0ae7a66d1a561c2ff1c8314abcdcaeba4f4d0b8b (patch)
treeaefc84370986227e72d73e539f11061a6485da73
parenttest-network: drop unused variable (diff)
downloadsystemd-0ae7a66d1a561c2ff1c8314abcdcaeba4f4d0b8b.tar.xz
systemd-0ae7a66d1a561c2ff1c8314abcdcaeba4f4d0b8b.zip
test-network: add tests for DHCP.RouteTable=
-rw-r--r--test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network1
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py15
2 files changed, 14 insertions, 2 deletions
diff --git a/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network b/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network
index 5c4ca22ab7..ebe3b7c0dd 100644
--- a/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network
+++ b/test/test-network/conf/dhcp-client-ipv4-dhcp-settings.network
@@ -13,3 +13,4 @@ UseHostname=true
Hostname=test-hostname
ClientIdentifier=mac
VendorClassIdentifier=SusantVendorTest
+RouteTable=211
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 143fba20fb..64a3d25bd4 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -1182,16 +1182,27 @@ class NetworkdNetworkDHCPClientTests(unittest.TestCase, Utilities):
self.start_dnsmasq()
+ print('## ip address show dev veth99')
output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'veth99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, '12:34:56:78:9a:bc')
self.assertRegex(output, '192.168.5')
self.assertRegex(output, '1492')
- output = subprocess.check_output(['ip', 'route']).rstrip().decode('utf-8')
+ # issue #8726
+ print('## ip route show table main dev veth99')
+ output = subprocess.check_output(['ip', 'route', 'show', 'table', 'main', 'dev', 'veth99']).rstrip().decode('utf-8')
print(output)
- self.assertRegex(output, 'default.*dev veth99 proto dhcp')
+ self.assertNotRegex(output, 'proto dhcp')
+ print('## ip route show table 211 dev veth99')
+ output = subprocess.check_output(['ip', 'route', 'show', 'table', '211', 'dev', 'veth99']).rstrip().decode('utf-8')
+ print(output)
+ self.assertRegex(output, 'default via 192.168.5.1 proto dhcp')
+ self.assertRegex(output, '192.168.5.0/24 via 192.168.5.5 proto dhcp')
+ self.assertRegex(output, '192.168.5.1 proto dhcp scope link')
+
+ print('## dnsmasq log')
self.assertTrue(self.search_words_in_dnsmasq_log('vendor class: SusantVendorTest', True))
self.assertTrue(self.search_words_in_dnsmasq_log('DHCPDISCOVER(veth-peer) 12:34:56:78:9a:bc'))
self.assertTrue(self.search_words_in_dnsmasq_log('client provides name: test-hostname'))