Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions netsim/ansible/templates/bgp/junos.policy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ policy-options {

policy-options {

route-filter-list bgp-announce {
{% for pfx in bgp.originate|default([]) %}
{{ pfx|ansible.utils.ipaddr('0') }} exact;
{% endfor %}
{% for bgp_af in af %}
{% for pfx in bgp.advertise|default([]) if bgp_af in pfx %}
{% if loop.first %}
route-filter-list bgp-announce-{{ bgp_af }} {
{% endif %}
{{ pfx[bgp_af] }} exact;
{% if loop.last %}
}
{% endif %}
{% endfor %}
{% endfor %}

{% for af in ('ipv4','ipv6') %}
{% for nh in ['ebgp','all'] %}
Expand All @@ -53,32 +59,21 @@ policy-options {
{% endfor %}

policy-statement bgp-advertise {
term advertise {
from {
protocol direct;
interface [
{% if bgp.advertise_loopback %} lo0.0 {% endif %}
{%- for l in interfaces if l.bgp.advertise|default("") and not 'vrf' in l %}
{{ l.ifname }}
{% endfor %} ];
}
then {
community add x-route-permit-mark;
next policy;
}
}

term originate {
{% for bgp_af in af %}
{% for pfx in bgp.advertise|default([]) if bgp_af in pfx %}
{% if loop.first %}
term advertise-{{ bgp_af }} {
from {
protocol static;
route-filter-list bgp-announce;
route-filter-list bgp-announce-{{ bgp_af }};
}
then {
community add x-route-permit-mark;
next policy;
}
}

{% endif %}
{% endfor %}
{% endfor %}
}

policy-statement bgp-redistribute {
Expand Down
Loading