diff options
Diffstat (limited to 'src/conf_mode/interface-bonding.py')
-rwxr-xr-x | src/conf_mode/interface-bonding.py | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py index 19817da8d..8a0f9f84d 100755 --- a/src/conf_mode/interface-bonding.py +++ b/src/conf_mode/interface-bonding.py @@ -99,6 +99,18 @@ def apply_vlan_config(vlan, config): # store DHCP config dictionary - used later on when addresses are aquired vlan.set_dhcp_options(opt) + # get DHCPv6 config dictionary and update values + opt = vlan.get_dhcpv6_options() + + if config['dhcpv6_prm_only']: + opt['dhcpv6_prm_only'] = True + + if config['dhcpv6_temporary']: + opt['dhcpv6_temporary'] = True + + # store DHCPv6 config dictionary - used later on when addresses are aquired + vlan.set_dhcpv6_options(opt) + # update interface description used e.g. within SNMP vlan.set_alias(config['description']) # ignore link state changes @@ -186,11 +198,11 @@ def get_config(): # DHCPv6 only acquire config parameters, no address if conf.exists('dhcpv6-options parameters-only'): - bond['dhcpv6_prm_only'] = conf.return_value('dhcpv6-options parameters-only') + bond['dhcpv6_prm_only'] = True # DHCPv6 temporary IPv6 address if conf.exists('dhcpv6-options temporary'): - bond['dhcpv6_temporary'] = conf.return_value('dhcpv6-options temporary') + bond['dhcpv6_temporary'] = True # ignore link state changes if conf.exists('disable-link-detect'): @@ -280,6 +292,21 @@ def verify(bond): raise ConfigError('Interface "{}" is not part of the bond' \ .format(bond['primary'])) + + # DHCPv6 parameters-only and temporary address are mutually exclusive + for vif_s in bond['vif_s']: + if vif_s['dhcpv6_prm_only'] and vif_s['dhcpv6_temporary']: + raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!') + + for vif_c in vif_s['vif_c']: + if vif_c['dhcpv6_prm_only'] and vif_c['dhcpv6_temporary']: + raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!') + + for vif in bond['vif']: + if vif['dhcpv6_prm_only'] and vif['dhcpv6_temporary']: + raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!') + + for vif_s in bond['vif_s']: for vif in bond['vif']: if vif['id'] == vif_s['id']: @@ -403,6 +430,18 @@ def apply(bond): # store DHCP config dictionary - used later on when addresses are aquired b.set_dhcp_options(opt) + # get DHCPv6 config dictionary and update values + opt = b.get_dhcpv6_options() + + if bond['dhcpv6_prm_only']: + opt['dhcpv6_prm_only'] = True + + if bond['dhcpv6_temporary']: + opt['dhcpv6_temporary'] = True + + # store DHCPv6 config dictionary - used later on when addresses are aquired + b.set_dhcpv6_options(opt) + # ignore link state changes b.set_link_detect(bond['disable_link_detect']) # Bonding transmit hash policy |