diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-01-07 08:33:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-07 08:33:04 +0100 |
commit | 04a02d938dc2975eac240819f930e4f047cc0e97 (patch) | |
tree | 4fbf08c9caa3b9d5ee98bcf1c81a5526a25babc5 | |
parent | 470d8f1fc555dc12251152b3dc620f611be604c0 (diff) | |
parent | 98ec1ce377ea2d21323991af3eae8ab784eb9d02 (diff) | |
download | vyos-1x-04a02d938dc2975eac240819f930e4f047cc0e97.tar.gz vyos-1x-04a02d938dc2975eac240819f930e4f047cc0e97.zip |
Merge pull request #671 from bstepler/T3193
dhcpv6-pd: verify: T3193: fix DHCPv6 PD verification issues
-rw-r--r-- | python/vyos/configverify.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index a425ca671..b4447306e 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -187,15 +187,17 @@ def verify_dhcpv6(config): # assigned IPv6 subnet from a delegated prefix for pd in dict_search('dhcpv6_options.pd', config): sla_ids = [] + interfaces = dict_search(f'dhcpv6_options.pd.{pd}.interface', config) - if not dict_search(f'dhcpv6_options.pd.{pd}.interface', config): + if not interfaces: raise ConfigError('DHCPv6-PD requires an interface where to assign ' 'the delegated prefix!') - for interface in dict_search(f'dhcpv6_options.pd.{pd}.interface', config): - sla_id = dict_search( - f'dhcpv6_options.pd.{pd}.interface.{interface}.sla_id', config) - sla_ids.append(sla_id) + for count, interface in enumerate(interfaces): + if 'sla_id' in interfaces[interface]: + sla_ids.append(interfaces[interface]['sla_id']) + else: + sla_ids.append(str(count)) # Check for duplicates duplicates = [x for n, x in enumerate(sla_ids) if x in sla_ids[:n]] |