Skip to content

Commit 8af53df

Browse files
authored
Implement bgp.advertise on VyOS (#3272)
1 parent 77ded90 commit 8af53df

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

netsim/ansible/templates/bgp/vyos.j2

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,15 @@ set protocols bgp parameters cluster-id {{ bgp.rr_cluster_id }}
2121

2222
# Work on Family {{ af }}
2323

24-
{% if bgp.import is defined %}
25-
{% for s_proto,s_data in bgp.import.items() %}
24+
{% if bgp.import is defined %}
25+
{% for s_proto,s_data in bgp.import.items() %}
2626
set protocols bgp address-family {{ af }}-unicast redistribute {{ s_proto }}{%
2727
if s_proto == 'ospf' and af == 'ipv6' %}v3{% endif %}{%
2828
if 'policy' in s_data %} route-map {{ s_data.policy }}-{{ af }}{% endif +%}
29-
{% endfor %}
30-
{% endif %}
31-
32-
{% if loopback[af] is defined and bgp.advertise_loopback %}
33-
{{ bgpcfg.bgp_network(af,loopback[af]) }}
29+
{% endfor %}
3430
{% endif %}
35-
36-
{% for l in interfaces|default([]) if l.bgp.advertise|default("") and l[af] is defined and not 'vrf' in l %}
37-
{{ bgpcfg.bgp_network(af,l[af]) }}
38-
{% endfor %}
39-
40-
{% for pfx in bgp.originate|default([]) if af == 'ipv4' %}
41-
{{ bgpcfg.bgp_network(af,pfx) }}
31+
{% for pfx in bgp.advertise|default([]) if af in pfx %}
32+
{{ bgpcfg.bgp_network(af,pfx[af]) }}
4233
{% endfor %}
4334

4435
{% for n in bgp.neighbors if n[af] is defined and n.activate[af] is defined and n.activate[af] %}

netsim/ansible/templates/vrf/vyos.bgp.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ set protocols bgp address-family {{ af }}-unicast redistribute {{ s_proto }}{%
2525
{% endfor %}
2626
{% endif %}
2727

28-
# Define networks for VRF Loopback
29-
{% for n in vdata.networks|default([]) if af in n %}
30-
{{ bgpcfg.bgp_network(af,n[af]) }}
28+
# Configure advertised BGP networks
29+
{% for pfx in vdata.bgp.advertise|default([]) if af in pfx %}
30+
{{ bgpcfg.bgp_network(af,pfx[af]) }}
3131
{% endfor %}
3232
{% endfor %}
3333

netsim/devices/vyos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ features:
2121
bfd: true
2222
bgp:
2323
activate_af: true
24+
advertise: true
2425
ipv6_lla: true
2526
local_as: true
2627
vrf_local_as: true

0 commit comments

Comments
 (0)