Skip to content

Commit 323ef23

Browse files
committed
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.
1 parent 0fd742c commit 323ef23

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/conf_mode/protocols_ospf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (C) 2021-2024 VyOS maintainers and contributors
3+
# Copyright (C) 2021-2025 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
@@ -17,6 +17,7 @@
1717
from sys import exit
1818
from sys import argv
1919

20+
from vyos.base import Warning
2021
from vyos.config import Config
2122
from vyos.configverify import verify_common_route_maps
2223
from vyos.configverify import verify_route_map
@@ -62,6 +63,16 @@ def verify(config_dict):
6263
if 'area' in ospf:
6364
networks = []
6465
for area, area_config in ospf['area'].items():
66+
# Implemented as warning to not break existing configurations
67+
if area == '0' and dict_search('area_type.nssa', area_config) != None:
68+
Warning('You cannot configure NSSA to backbone!')
69+
# Implemented as warning to not break existing configurations
70+
if area == '0' and dict_search('area_type.stub', area_config) != None:
71+
Warning('You cannot configure STUB to backbone!')
72+
# Implemented as warning to not break existing configurations
73+
if len(area_config['area_type']) > 1:
74+
Warning(f'Only one area-type is supported for area "{area}"!')
75+
6576
if 'import_list' in area_config:
6677
acl_import = area_config['import_list']
6778
if acl_import: verify_access_list(acl_import, ospf)

0 commit comments

Comments
 (0)