diff options
-rwxr-xr-x | smoketest/scripts/cli/test_service_dhcp-server.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py index 4493534be..2ee26c8bb 100755 --- a/smoketest/scripts/cli/test_service_dhcp-server.py +++ b/smoketest/scripts/cli/test_service_dhcp-server.py @@ -127,17 +127,40 @@ class TestServiceDHCPServer(unittest.TestCase): self.session.set(pool + ['static-route', 'destination-subnet', '10.0.0.0/24']) self.session.set(pool + ['static-route', 'router', '192.0.2.1']) - # check validate() - No DHCP address range or active static-mapping set with self.assertRaises(ConfigSessionError): self.session.commit() self.session.set(pool + ['range', '0', 'start', range_0_start]) self.session.set(pool + ['range', '0', 'stop', range_0_stop]) + # failover + failover_local = router + failover_remote = inc_ip(router, 1) + + self.session.set(pool + ['failover', 'local-address', failover_local]) + self.session.set(pool + ['failover', 'name', shared_net_name]) + self.session.set(pool + ['failover', 'peer-address', failover_remote]) + self.session.set(pool + ['failover', 'status', 'primary']) + # commit changes self.session.commit() config = read_file(DHCPD_CONF) + + self.assertIn(f'failover peer "{shared_net_name}"' + r' {', config) + self.assertIn(f'primary;', config) + self.assertIn(f'mclt 1800;', config) + self.assertIn(f'mclt 1800;', config) + self.assertIn(f'split 128;', config) + self.assertIn(f'port 520;', config) + self.assertIn(f'peer port 520;', config) + self.assertIn(f'max-response-delay 30;', config) + self.assertIn(f'max-unacked-updates 10;', config) + self.assertIn(f'load balance max seconds 3;', config) + self.assertIn(f'peer port 520;', config) + self.assertIn(f'address {failover_local};', config) + self.assertIn(f'peer address {failover_remote};', config) + network = address_from_cidr(subnet) netmask = netmask_from_cidr(subnet) self.assertIn(f'ddns-update-style none;', config) @@ -160,6 +183,8 @@ class TestServiceDHCPServer(unittest.TestCase): self.assertIn(f'max-lease-time 86400;', config) self.assertIn(f'range {range_0_start} {range_0_stop};', config) self.assertIn(f'set shared-networkname = "{shared_net_name}";', config) + self.assertIn(f'failover peer "{shared_net_name}";', config) + self.assertIn(f'deny dynamic bootp clients;', config) # weird syntax for those static routes self.assertIn(f'option rfc3442-static-route 24,10,0,0,192,0,2,1, 0,192,0,2,1;', config) |