{% if 'ipv4' in loopback %}
set protocols mpls ldp discovery transport-ipv4-address {{ loopback.ipv4|ipaddr('address') }}
{% endif %}

set protocols mpls ldp router-id {{ ldp.router_id }}

{% if ldp.explicit_null|default(False) %}
set protocols mpls ldp export ipv4 explicit-null
{% endif %}

set protocols mpls interface dum0
set protocols mpls ldp interface dum0

{% for l in interfaces if ('ldp' in l) and not l.ldp.passive %}
set protocols mpls interface {{ l.ifname }}
set protocols mpls ldp interface {{ l.ifname }}
{% endfor %}
