{% if ospf.router_id|ipv4 %}
set protocols ospf parameters router-id {{ ospf.router_id }}
{% endif %}

{% if ospf.reference_bandwidth is defined %}
set protocols ospf auto-cost reference-bandwidth {{ ospf.reference_bandwidth }}
{% endif %}

set protocols ospf interface dum0 passive
set protocols ospf interface dum0 area {{ ospf.area }}

{% for l in interfaces|default([]) if 'ospf' in l and 'ipv4' in l %}

set protocols ospf interface {{ l.ifname }} area {{ l.ospf.area }}

{% if l.ospf.passive|default(False) %}
set protocols ospf interface {{ l.ifname }} passive
{% endif %}
{%   if l.ospf.network_type is defined %}
set protocols ospf interface {{ l.ifname }} network {{ l.ospf.network_type }}
{%   endif %}
{%   if l.ospf.cost is defined %}
set protocols ospf interface {{ l.ifname }} cost {{ l.ospf.cost }}
{%   endif %}
{%   if l.ospf.bfd|default(False) %}
set protocols ospf interface {{ l.ifname }} bfd
{%   endif %}

{% endfor %}
