summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-05-15 12:46:48 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-15 12:48:28 +0200
commit388413429335a64083d6850de452934f46c68fb1 (patch)
treedb5059b63d7747bea83c7efc4e00c78adddd0c96 /smoketest/scripts/cli
parentead5198e69cf0e854127b43102fd0f1f58b38924 (diff)
downloadvyos-1x-388413429335a64083d6850de452934f46c68fb1.tar.gz
vyos-1x-388413429335a64083d6850de452934f46c68fb1.zip
smoketest: dhcp: T3544: verify locig preventing invalid daemon options
As we do not allow any invalid raw options passed into ISC dhcpd we should also verify this behavior with a smoketest. (cherry picked from commit 8ab55eb237370b2152b2c0027af5cf16a69675af)
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcp-server.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py
index e74e22a5c..2a5789e70 100755
--- a/smoketest/scripts/cli/test_service_dhcp-server.py
+++ b/smoketest/scripts/cli/test_service_dhcp-server.py
@@ -417,5 +417,29 @@ class TestServiceDHCPServer(unittest.TestCase):
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
+ def test_dhcp_invalid_raw_options(self):
+ shared_net_name = 'SMOKE-5'
+
+ range_0_start = inc_ip(subnet, 10)
+ range_0_stop = inc_ip(subnet, 20)
+
+ pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
+ # we use the first subnet IP address as default gateway
+ self.session.set(pool + ['default-router', router])
+ self.session.set(pool + ['range', '0', 'start', range_0_start])
+ self.session.set(pool + ['range', '0', 'stop', range_0_stop])
+
+ self.session.set(base_path + ['global-parameters', 'this-is-crap'])
+ # check generate() - dhcpd should not acceot this garbage config
+ with self.assertRaises(ConfigSessionError):
+ self.session.commit()
+ self.session.delete(base_path + ['global-parameters'])
+
+ # commit changes
+ self.session.commit()
+
+ # Check for running process
+ self.assertTrue(process_named_running(PROCESS_NAME))
+
if __name__ == '__main__':
unittest.main(verbosity=2)