Reputation: 39
Yaml template
bgp:
local: 109
remote: 109
site:
- neighbor:
peer_ip: [ 172.16.110.3, 172.16.110.4 ]
vpnv4:
vrf: Site-1
network: 109.10.1.1
mask: 255.255.255.0
- neighbor:
peer_ip: [ 172.16.120.3, 172.16.120.4 ]
vpnv4:
vrf: Site-2
network: 109.10.1.1
mask: 255.255.255.0
Jinja2 template
router bgp {{ item.bgp.local }}
{% for i in item.bgp.site %}
address-family ipv4 vrf {{ i.vpnv4.vrf }}
network {{ i.vpnv4.network }} mask {{ i.vpnv4.mask }}
{% for b in item.bgp.site.neighbor.peer_ip %}
neighbor {{ b }} remote-as {{ item.bgp.remote }}
neighbor {{ b }} activate
{% endfor %}
{% endfor %}
If I remove this it works. I am suspecting an issue with "list" but no idea how to fix it.
{% for b in item.bgp.site.neighbor.peer_ip %}
neighbor {{ b }} remote-as {{ item.bgp.remote }}
neighbor {{ b }} activate
{% endfor %}
Upvotes: 0
Views: 10492
Reputation: 68239
item.bgp.site
is actually i
of your outer loop.
Try: {% for b in i.neighbor.peer_ip %}
Upvotes: 1