diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-05-25 21:15:38 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-05-26 17:09:33 +0200 |
commit | 8ff6d2ed6025fb113a180e3c23be83dac7169658 (patch) | |
tree | 2a2a767c00a8d1af67c509c36dcfb2481362729e | |
parent | 7dddfa338800303335673df637a05d8aaaccdaa2 (diff) | |
download | vyos-1x-8ff6d2ed6025fb113a180e3c23be83dac7169658.tar.gz vyos-1x-8ff6d2ed6025fb113a180e3c23be83dac7169658.zip |
dhcpv6-pd: T2506: use common dictionary definition for config parameters
-rw-r--r-- | python/vyos/configdict.py | 16 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-pppoe.py | 6 |
2 files changed, 13 insertions, 9 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 3e1f22d09..c89447163 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -103,17 +103,21 @@ def get_ethertype(ethertype_val): else: raise ConfigError('invalid ethertype "{}"'.format(ethertype_val)) +dhcpv6_pd_default_data = { + 'dhcpv6_prm_only': False, + 'dhcpv6_temporary': False, + 'dhcpv6_pd_length': '', + 'dhcpv6_pd_interfaces': [] +} + interface_default_data = { + **dhcpv6_pd_default_data, 'address': [], 'address_remove': [], 'description': '', 'dhcp_client_id': '', 'dhcp_hostname': '', 'dhcp_vendor_class_id': '', - 'dhcpv6_prm_only': False, - 'dhcpv6_temporary': False, - 'dhcpv6_pd_length': '', - 'dhcpv6_pd_interfaces': [], 'disable': False, 'disable_link_detect': 1, 'ip_disable_arp_filter': 1, @@ -246,8 +250,8 @@ def intf_to_dict(conf, default): if conf.exists(['sla-len']): pd['sla_len'] = conf.return_value(['sla-len']) - if conf.exists(['interface-id']): - pd['if_id'] = conf.return_value(['interface-id']) + if conf.exists(['address']): + pd['if_id'] = conf.return_value(['address']) intf['dhcpv6_pd_interfaces'].append(pd) diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index eaa61cdb6..08c129bf0 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -21,13 +21,15 @@ from copy import deepcopy from netifaces import interfaces from vyos.config import Config +from vyos.configdict import dhcpv6_pd_default_data from vyos.ifconfig import Interface +from vyos.template import render from vyos.util import chown, chmod_755, call from vyos import ConfigError -from vyos.template import render default_config_data = { + **dhcpv6_pd_default_data, 'access_concentrator': '', 'auth_username': '', 'auth_password': '', @@ -36,8 +38,6 @@ default_config_data = { 'deleted': False, 'description': '\0', 'disable': False, - 'dhcpv6_pd_length': '', - 'dhcpv6_pd_interfaces': [], 'intf': '', 'idle_timeout': '', 'ipv6_autoconf': False, |