diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-06-07 19:36:12 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-06-07 19:36:12 +0200 |
commit | af76ccbe603e239ad75bfd269758723e585863e6 (patch) | |
tree | 788a7883eb77f6326c50c52ccc2ca36a5719718b /data/templates/nhrp | |
parent | eee2bb6c242f9fdb83fd19eb6eeac3ae6a50aa4b (diff) | |
download | vyos-1x-af76ccbe603e239ad75bfd269758723e585863e6.tar.gz vyos-1x-af76ccbe603e239ad75bfd269758723e585863e6.zip |
nhrp: T3599: adjust Jinja2 template to common style pattern
Diffstat (limited to 'data/templates/nhrp')
-rw-r--r-- | data/templates/nhrp/opennhrp.conf.tmpl | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/data/templates/nhrp/opennhrp.conf.tmpl b/data/templates/nhrp/opennhrp.conf.tmpl index 308459407..948327198 100644 --- a/data/templates/nhrp/opennhrp.conf.tmpl +++ b/data/templates/nhrp/opennhrp.conf.tmpl @@ -1,41 +1,41 @@ # Created by VyOS - manual changes will be overwritten -{% if tunnel is defined %} -{% for name, tunnel_conf in tunnel.items() %} -{% set type = 'spoke' if 'map' in tunnel_conf or 'dynamic_map' in tunnel_conf else 'hub' %} -{% set profile_name = profile_map[name] if profile_map is defined and name in profile_map else '' %} +{% if tunnel is defined and tunnel is not none %} +{% for name, tunnel_conf in tunnel.items() %} +{% set type = 'spoke' if tunnel_conf.map is defined or tunnel_conf.dynamic_map is defined else 'hub' %} +{% set profile_name = profile_map[name] if profile_map is defined and name in profile_map else '' %} interface {{ name }} #{{ type }} {{ profile_name }} -{% if 'map' in tunnel_conf %} -{% for map, map_conf in tunnel_conf.map.items() %} -{% set cisco = ' cisco' if 'cisco' in map_conf else '' %} -{% set register = ' register' if 'register' in map_conf else '' %} +{% if tunnel_conf.map is defined and tunnel_conf.map is not none %} +{% for map, map_conf in tunnel_conf.map.items() %} +{% set cisco = ' cisco' if map_conf.cisco is defined else '' %} +{% set register = ' register' if map_conf.register is defined else '' %} map {{ map }} {{ map_conf.nbma_address }}{{ register }}{{ cisco }} -{% endfor %} -{% endif %} -{% if 'dynamic_map' in tunnel_conf %} -{% for map, map_conf in tunnel_conf.dynamic_map.items() %} +{% endfor %} +{% endif %} +{% if tunnel_conf.dynamic_map is defined and tunnel_conf.dynamic_map is not none %} +{% for map, map_conf in tunnel_conf.dynamic_map.items() %} dynamic-map {{ map }} {{ map_conf.nbma_domain_name }} -{% endfor %} -{% endif %} -{% if 'cisco_authentication' in tunnel_conf %} +{% endfor %} +{% endif %} +{% if tunnel_conf.cisco_authentication is defined and tunnel_conf.cisco_authentication is not none %} cisco-authentication {{ tunnel_conf.cisco_authentication }} -{% endif %} -{% if 'holding_time' in tunnel_conf %} +{% endif %} +{% if tunnel_conf.holding_time is defined and tunnel_conf.holding_time is not none %} holding-time {{ tunnel_conf.holding_time }} -{% endif %} -{% if 'multicast' in tunnel_conf %} +{% endif %} +{% if tunnel_conf.multicast is defined and tunnel_conf.multicast is not none %} multicast {{ tunnel_conf.multicast }} -{% endif %} -{% for key in ['non_caching', 'redirect', 'shortcut', 'shortcut_destination'] %} -{% if key in tunnel_conf %} +{% endif %} +{% for key in ['non_caching', 'redirect', 'shortcut', 'shortcut_destination'] %} +{% if key in tunnel_conf %} {{ key | replace("_", "-") }} -{% endif %} -{% endfor %} -{% if 'shortcut_target' in tunnel_conf %} -{% for target, shortcut_conf in tunnel_conf.shortcut_target.items() %} - shortcut-target {{ target }} {{ shortcut_conf.holding_time if 'holding_time' in shortcut_conf else '' }} -{% endfor %} -{% endif %} +{% endif %} +{% endfor %} +{% if tunnel_conf.shortcut_target is defined and tunnel_conf.shortcut_target is not none %} +{% for target, shortcut_conf in tunnel_conf.shortcut_target.items() %} + shortcut-target {{ target }} {{ shortcut_conf.holding_time if shortcut_conf.holding_time is defined else '' }} +{% endfor %} +{% endif %} -{% endfor %} -{% endif %} +{% endfor %} +{% endif %} |