diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-26 10:06:02 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-05-26 10:27:46 +0200 |
commit | ccd564c2328a086b326957fdde8b07ca560bd6b2 (patch) | |
tree | cd4c9f5546473a6868ecffa8fbee57606381c602 /smoketest/scripts/cli | |
parent | b6c343c363bf471fc78bd8dec885c88f1dd90cb5 (diff) | |
download | vyos-1x-ccd564c2328a086b326957fdde8b07ca560bd6b2.tar.gz vyos-1x-ccd564c2328a086b326957fdde8b07ca560bd6b2.zip |
dhcpv6-server: T3493: add proper validation for prefix-delegation start/stop address
ISC DHCP server expects a string: "prefix6 2001:db8:290:: 2001:db8:29f:: /64;"
where the IPv6 prefix/range must be :: terminaated with a delegated prefix
length at the end.
This commit changes the validator that the IPv6 address defined on the CLI must
always end with ::. In addition a verify() step is added to check that the
stop address is greater than start address.
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-x | smoketest/scripts/cli/test_service_dhcpv6-server.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py index cb6206632..c07d8509e 100755 --- a/smoketest/scripts/cli/test_service_dhcpv6-server.py +++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py @@ -18,6 +18,7 @@ import unittest from base_vyostest_shim import VyOSUnitTestSHIM +from vyos.configsession import ConfigSessionError from vyos.template import inc_ip from vyos.utils.process import process_named_running from vyos.utils.file import read_file @@ -143,9 +144,14 @@ class TestServiceDHCPv6Server(VyOSUnitTestSHIM.TestCase): pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet] self.cli_set(pool + ['address-range', 'start', range_start, 'stop', range_stop]) - self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_stop]) self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'prefix-length', delegate_len]) + self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_start]) + # Prefix delegation stop address must be greater then start address + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_stop]) + # commit changes self.cli_commit() |