diff options
author | Christian Breunig <christian@breunig.cc> | 2025-06-08 09:26:20 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-06-08 09:29:09 +0200 |
commit | 323ef231bd06650de1405daf6d04b59c1b7b4285 (patch) | |
tree | 1fd1f243d52edf3602296609dd71070336f30157 | |
parent | 0fd742c9d46a50e0f4922038f01b52b40f4106f7 (diff) | |
download | vyos-1x-323ef231bd06650de1405daf6d04b59c1b7b4285.tar.gz vyos-1x-323ef231bd06650de1405daf6d04b59c1b7b4285.zip |
T7510: add commit warnings about invalid use of OSPF area-types
To keep existing CLI behavior use a Warning() to prompt the user for an invalid
configuration. It is not possible to have more the one area-type defined per
area logically - the CLI does support it. In addition the backbone area cannot
be of type STUB or NSSA.
CLI configuration should be cleaned up using a migrator in the future.
-rwxr-xr-x | src/conf_mode/protocols_ospf.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index c06c0aafc..467c9611b 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2021-2024 VyOS maintainers and contributors +# Copyright (C) 2021-2025 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -17,6 +17,7 @@ from sys import exit from sys import argv +from vyos.base import Warning from vyos.config import Config from vyos.configverify import verify_common_route_maps from vyos.configverify import verify_route_map @@ -62,6 +63,16 @@ def verify(config_dict): if 'area' in ospf: networks = [] for area, area_config in ospf['area'].items(): + # Implemented as warning to not break existing configurations + if area == '0' and dict_search('area_type.nssa', area_config) != None: + Warning('You cannot configure NSSA to backbone!') + # Implemented as warning to not break existing configurations + if area == '0' and dict_search('area_type.stub', area_config) != None: + Warning('You cannot configure STUB to backbone!') + # Implemented as warning to not break existing configurations + if len(area_config['area_type']) > 1: + Warning(f'Only one area-type is supported for area "{area}"!') + if 'import_list' in area_config: acl_import = area_config['import_list'] if acl_import: verify_access_list(acl_import, ospf) |