From 903f4a3deee33c5836d67e3ada962887dc8bf945 Mon Sep 17 00:00:00 2001 From: Brandon Stepler Date: Wed, 6 Jan 2021 23:44:00 -0500 Subject: dhcpv6-pd: verify: T3193: allow more than one VLAN interface VLAN interfaces contain periods, which make them incompatible with dict_search(). --- python/vyos/configverify.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python/vyos/configverify.py') diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index a425ca671..bbaf5e861 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -187,14 +187,14 @@ 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) + for interface in interfaces: + sla_id = interfaces[interface].get('sla_id', None) sla_ids.append(sla_id) # Check for duplicates -- cgit v1.2.3 From 0a1c218d010df4568d4c35ee9cf68c9affe24498 Mon Sep 17 00:00:00 2001 From: Brandon Stepler Date: Wed, 6 Jan 2021 23:44:00 -0500 Subject: dhcpv6-pd: verify: T3193: allow multiple auto-assigned SLA-IDs "data/templates/dhcp-client/ipv6.tmpl" handles the auto-assigning of SLA-IDs on lines 39, 46, and 52. --- python/vyos/configverify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python/vyos/configverify.py') diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index bbaf5e861..48c858ba4 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -194,8 +194,8 @@ def verify_dhcpv6(config): 'the delegated prefix!') for interface in interfaces: - sla_id = interfaces[interface].get('sla_id', None) - sla_ids.append(sla_id) + if 'sla_id' in interfaces[interface]: + sla_ids.append(interfaces[interface]['sla_id']) # Check for duplicates duplicates = [x for n, x in enumerate(sla_ids) if x in sla_ids[:n]] -- cgit v1.2.3 From 98ec1ce377ea2d21323991af3eae8ab784eb9d02 Mon Sep 17 00:00:00 2001 From: Brandon Stepler Date: Wed, 6 Jan 2021 23:44:00 -0500 Subject: dhcpv6-pd: verify: T3193: detect conflict between auto-assigned and configured SLA-IDs "data/templates/dhcp-client/ipv6.tmpl" handles the auto-assigning of SLA-IDs on lines 39, 46, and 52. --- python/vyos/configverify.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python/vyos/configverify.py') diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 48c858ba4..b4447306e 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -193,9 +193,11 @@ def verify_dhcpv6(config): raise ConfigError('DHCPv6-PD requires an interface where to assign ' 'the delegated prefix!') - for interface in interfaces: + 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]] -- cgit v1.2.3