Skip to content

Commit a3b5108

Browse files
authored
Merge pull request #4536 from ig0rb/fix/T7510-ospf-nssa-translation-error
T7510: ospfd.frr.j2 ospf nssa translation error - fix template
2 parents 09f63fb + 323ef23 commit a3b5108

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

data/templates/frr/ospfd.frr.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}
8282
{% for area_id, area_config in area.items() %}
8383
{% if area_config.area_type is vyos_defined %}
8484
{% for type, type_config in area_config.area_type.items() if type != 'normal' %}
85-
area {{ area_id }} {{ type }} {{ 'no-summary' if type_config.no_summary is vyos_defined }}
85+
area {{ area_id }} {{ type }} {{ 'translate-' + type_config.translate if type_config.translate is vyos_defined }} {{ 'no-summary' if type_config.no_summary is vyos_defined }}
8686
{% if type_config.default_cost is vyos_defined %}
8787
area {{ area_id }} default-cost {{ type_config.default_cost }}
8888
{% endif %}

smoketest/scripts/cli/test_protocols_ospf.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,5 +574,23 @@ def test_ospf_17_duplicate_area_network(self):
574574
self.assertIn(f'router ospf', frrconfig)
575575
self.assertIn(f' network {network} area {area1}', frrconfig)
576576

577+
def test_ospf_18_area_translate_no_summary(self):
578+
area = '11'
579+
area_type = 'nssa'
580+
network = '100.64.0.0/10'
581+
582+
self.cli_set(base_path + ['area', area, 'area-type', area_type, 'no-summary'])
583+
self.cli_set(base_path + ['area', area, 'area-type', area_type, 'translate', 'never'])
584+
self.cli_set(base_path + ['area', area, 'network', network])
585+
586+
# commit changes
587+
self.cli_commit()
588+
589+
# Verify FRR ospfd configuration
590+
frrconfig = self.getFRRconfig('router ospf', endsection='^exit')
591+
self.assertIn(f'router ospf', frrconfig)
592+
self.assertIn(f' area {area} {area_type} translate-never no-summary', frrconfig)
593+
self.assertIn(f' network {network} area {area}', frrconfig)
594+
577595
if __name__ == '__main__':
578596
unittest.main(verbosity=2)

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)