From 4ed4d822cfd1d1aad19982783066a5e2431889b4 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 22 Jan 2021 17:38:22 +0100 Subject: ospf: T3236: provide full protocol support in XML and Python This commit provides the implementation of the OSPF CLI with a Jinja2 template that is loaded by FRR reload. It also contains some initial smoketests. There is yet no verify() implementation! --- src/conf_mode/protocols_ospf.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/conf_mode/protocols_ospf.py') diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index f47b21498..f43929b46 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -66,12 +66,33 @@ def get_config(config=None): del default_values['default_information'] if dict_search('area.area_type.nssa', ospf) is None: del default_values['area']['area_type']['nssa'] + if 'mpls_te' not in ospf: + del default_values['mpls_te'] for protocol in ['bgp', 'connected', 'kernel', 'rip', 'static']: if dict_search(f'redistribute.{protocol}', ospf) is None: del default_values['redistribute'][protocol] + # XXX: T2665: we currently have no nice way for defaults under tag nodes, + # clean them out and add them manually :( + del default_values['neighbor'] + del default_values['area']['virtual_link'] + # merge in remaining default values ospf = dict_merge(default_values, ospf) + if 'neighbor' in ospf: + default_values = defaults(base + ['neighbor']) + for neighbor in ospf['neighbor']: + ospf['neighbor'][neighbor] = dict_merge(default_values, ospf['neighbor'][neighbor]) + + if 'area' in ospf: + default_values = defaults(base + ['area', 'virtual-link']) + for area, area_config in ospf['area'].items(): + if 'virtual_link' in area_config: + print(default_values) + for virtual_link in area_config['virtual_link']: + ospf['area'][area]['virtual_link'][virtual_link] = dict_merge( + default_values, ospf['area'][area]['virtual_link'][virtual_link]) + return ospf def verify(ospf): -- cgit v1.2.3