From 8fa9c929a3436a73110312322d45405cbb49bccb Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 24 Mar 2024 21:01:37 +0100 Subject: ospf: T6066: can not define the same network in different areas Users can not (FRR fails) commit the same network belonging to different OSPF areas. Add verify() check to prevent this. (cherry picked from commit c6d8d9c012da1a7566eec2dff70385457f073e64) --- src/conf_mode/protocols_ospf.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/conf_mode') diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index 93fc4dba6..ee29f8198 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -129,6 +129,7 @@ def verify(ospf): # Validate if configured Access-list exists if 'area' in ospf: + networks = [] for area, area_config in ospf['area'].items(): if 'import_list' in area_config: acl_import = area_config['import_list'] @@ -137,6 +138,12 @@ def verify(ospf): acl_export = area_config['export_list'] if acl_export: verify_access_list(acl_export, ospf) + if 'network' in area_config: + for network in area_config['network']: + if network in networks: + raise ConfigError(f'Network "{network}" already defined in different area!') + networks.append(network) + if 'interface' in ospf: for interface, interface_config in ospf['interface'].items(): verify_interface_exists(interface) -- cgit v1.2.3