From ed1a7a51af5da7b87b1073709ec2d10066c9329d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 6 Dec 2020 15:52:44 +0100 Subject: smoketest: dhcpv6: T3100: verify prefix-delegation config --- .../scripts/cli/test_service_dhcpv6-server.py | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py index 278524585..56fc16d2b 100755 --- a/smoketest/scripts/cli/test_service_dhcpv6-server.py +++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py @@ -48,7 +48,7 @@ class TestServiceDHCPServer(unittest.TestCase): self.session.commit() del self.session - def test_single_pool_range(self): + def test_single_pool(self): shared_net_name = 'SMOKE-1' search_domains = ['foo.vyos.net', 'bar.vyos.net'] lease_time = '1200' @@ -125,5 +125,31 @@ class TestServiceDHCPServer(unittest.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) + + def test_prefix_delegation(self): + shared_net_name = 'SMOKE-2' + range_start = inc_ip(subnet, 256) # ::100 + range_stop = inc_ip(subnet, 65535) # ::ffff + delegate_start = '2001:db8:ee::' + delegate_stop = '2001:db8:ee:ff00::' + delegate_len = '56' + + pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet] + + self.session.set(pool + ['address-range', 'start', range_start, 'stop', range_stop]) + self.session.set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_stop]) + self.session.set(pool + ['prefix-delegation', 'start', delegate_start, 'prefix-length', delegate_len]) + + # commit changes + self.session.commit() + + config = read_file(DHCPD_CONF) + self.assertIn(f'subnet6 {subnet}' + r' {', config) + self.assertIn(f'range6 {range_start} {range_stop};', config) + self.assertIn(f'prefix6 {delegate_start} {delegate_stop} /{delegate_len};', config) + + # Check for running process + self.assertTrue(process_named_running(PROCESS_NAME)) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3