router ospf {{ vdata.vrfidx }} vrf {{ vname }}
  router-id {{ vdata.ospf.router_id|default(ospf.router_id) }}
  redistribute connected
{% if bgp.as is defined %}
 redistribute bgp {{ bgp.as }}
{% endif %}
{% if ospf.reference_bandwidth is defined %}
 auto-cost reference-bandwidth {{ ospf.reference_bandwidth }}
{% endif %}
!
{% for l in vdata.ospf.interfaces|default([]) if 'ospf' in l and 'ipv4' in l %}
interface {{ l.ifname }}
! {{ l.name|default("") }}
 ip ospf {{ vdata.vrfidx }} area {{ l.ospf.area }}
{%   if l.ospf.network_type|default("") in ["broadcast","point-to-point"] %}
 ip ospf network {{ l.ospf.network_type }}
{%   endif %}
{%   if l.ospf.cost is defined %}
 ip ospf cost {{ l.ospf.cost }}
{%   endif %}
{%   if l.ospf.bfd|default(False) %}
 ip ospf bfd all-neighbors
{%   endif %}
{%   if l.ospf.passive|default(False) %}
 ip ospf passive
{%   endif %}
!
{% endfor %}
