!
router bgp {{ bgp.as }}
{% for af in ['ipv4','ipv6'] if mpls.vpn[af] is defined %}
{%   set vpnaf = 'vpn' + af.replace('ip','') %}
 address-family {{ vpnaf }}
!
{%   for n in bgp.neighbors if n[vpnaf] is defined %}
  neighbor {{ n[vpnaf] }} activate
  neighbor {{ n[vpnaf] }} send-community both
{%   endfor %}
{% endfor %}
