summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-15 14:54:57 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-15 14:54:57 +0200
commitae1994f1452377bf523973f2048b52590bcbad8b (patch)
tree4d265a6a4161143c7cd7c550908edf3bebf16a8d
parent95acc6ab1d2f4fec08d013473435e187461ca07a (diff)
downloadvyos-1x-ae1994f1452377bf523973f2048b52590bcbad8b.tar.gz
vyos-1x-ae1994f1452377bf523973f2048b52590bcbad8b.zip
ospf: T3236: improve Jinja2 template - always use if before a loop
-rw-r--r--data/templates/frr/ospfd.frr.tmpl18
1 files changed, 11 insertions, 7 deletions
diff --git a/data/templates/frr/ospfd.frr.tmpl b/data/templates/frr/ospfd.frr.tmpl
index 67b679d66..be39519c3 100644
--- a/data/templates/frr/ospfd.frr.tmpl
+++ b/data/templates/frr/ospfd.frr.tmpl
@@ -158,15 +158,19 @@ router ospf {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
ospf router-id {{ parameters.router_id }}
{% endif %}
{% endif %}
-{% for interface in passive_interface if passive_interface is defined and passive_interface == 'default' %}
- passive-interface default
-{% endfor %}
-{% for interface in passive_interface_exclude if passive_interface_exclude is defined %}
-{% if interface.startswith('vlink') %}
+{% if passive_interface is defined and passive_interface is not none %}
+{% for interface in passive_interface %}
+ passive-interface {{ interface }}
+{% endfor %}
+{% endif %}
+{% if passive_interface_exclude is defined and passive_interface_exclude is not none %}
+{% for interface in passive_interface_exclude if passive_interface_exclude is defined %}
+{% if interface.startswith('vlink') %}
{% set interface = interface.upper() %}
-{% endif %}
+{% endif %}
no passive-interface {{ interface }}
-{% endfor %}
+{% endfor %}
+{% endif %}
{% if redistribute is defined and redistribute is not none %}
{% for protocol, options in redistribute.items() %}
redistribute {{ protocol }} {{ 'metric ' + options.metric if options.metric is defined }} {{ 'metric-type ' + options.metric_type if options.metric_type is defined }} {{ 'route-map ' + options.route_map if options.route_map is defined }}