summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-22 17:38:22 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-23 11:03:03 +0100
commit4ed4d822cfd1d1aad19982783066a5e2431889b4 (patch)
treeff838b1c170d656048d6b4ab5932dbe59024b0b2 /src/conf_mode
parent93c0416efc685424a0750fe9cb9728d5e6450073 (diff)
downloadvyos-1x-4ed4d822cfd1d1aad19982783066a5e2431889b4.tar.gz
vyos-1x-4ed4d822cfd1d1aad19982783066a5e2431889b4.zip
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!
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py21
1 files changed, 21 insertions, 0 deletions
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):