From c6e80f7ab8a241f75fab25f14d64ccb6750d6efe Mon Sep 17 00:00:00 2001 From: Nicolas Fort Date: Wed, 3 Apr 2024 15:54:39 +0000 Subject: T6068: T6171: change node from dhcp-server to . Also, add parameter in order to configure active-active or active-passive behavior for HA. --- src/conf_mode/service_dhcp-server.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/conf_mode/service_dhcp-server.py') diff --git a/src/conf_mode/service_dhcp-server.py b/src/conf_mode/service_dhcp-server.py index e910ecdf7..3cfd74a19 100755 --- a/src/conf_mode/service_dhcp-server.py +++ b/src/conf_mode/service_dhcp-server.py @@ -131,6 +131,10 @@ def get_config(config=None): dhcp['shared_network_name'][network]['subnet'][subnet].update( {'range' : new_range_dict}) + if len(dhcp['high_availability']) == 1: + ## only default value for mode is set, need to remove ha node + del dhcp['high_availability'] + return dhcp def verify(dhcp): @@ -178,9 +182,9 @@ def verify(dhcp): # DHCP failover needs at least one subnet that uses it if 'enable_failover' in subnet_config: - if 'failover' not in dhcp: - raise ConfigError(f'Can not enable failover for "{subnet}" in "{network}".\n' \ - 'Failover is not configured globally!') + if 'high_availability' not in dhcp: + raise ConfigError(f'Can not enable high availability for "{subnet}" in "{network}".\n' \ + 'High availability is not configured globally!') failover_ok = True # Check if DHCP address range is inside configured subnet declaration @@ -270,12 +274,12 @@ def verify(dhcp): if (shared_networks - disabled_shared_networks) < 1: raise ConfigError(f'At least one shared network must be active!') - if 'failover' in dhcp: + if 'high_availability' in dhcp: if not failover_ok: raise ConfigError('DHCP failover must be enabled for at least one subnet!') for key in ['name', 'remote', 'source_address', 'status']: - if key not in dhcp['failover']: + if key not in dhcp['high_availability']: tmp = key.replace('_', '-') raise ConfigError(f'DHCP failover requires "{tmp}" to be specified!') -- cgit v1.2.3