From 9816fd9b301fb0d763d602884a043921167d5572 Mon Sep 17 00:00:00 2001 From: J vanBemmel Date: Wed, 4 Dec 2024 09:38:23 -0600 Subject: [PATCH] Cumulus NVUE: Fix BGP communities being advertised (#1607) --- netsim/ansible/templates/bgp/cumulus_nvue.j2 | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/netsim/ansible/templates/bgp/cumulus_nvue.j2 b/netsim/ansible/templates/bgp/cumulus_nvue.j2 index 5ffd145c4..c3b82acb6 100644 --- a/netsim/ansible/templates/bgp/cumulus_nvue.j2 +++ b/netsim/ansible/templates/bgp/cumulus_nvue.j2 @@ -1,3 +1,10 @@ +{% macro advertise_communities(comms) %} + community-advertise: +{% for c in ['standard', 'extended', 'large'] %} + {{ c.replace("standard","regular") }}: {{ 'on' if c in comms else 'off' }} +{% endfor %} +{% endmacro %} + - set: router: bgp: @@ -53,6 +60,7 @@ {% endif %} {% for af in ('ipv4','ipv6') if af in n and n[af] is string %} {{ n[af] }}: + description: "{{ n.name }}" {% if n._source_ifname is defined %} update-source: {{ n._source_ifname }} {% endif %} @@ -65,24 +73,16 @@ {% endif %} {{ af }}-unicast: enable: {{ 'on' if n.activate[af]|default(False) else 'off' }} -{% if n.type == 'ibgp' %} +{% if 'ibgp' in n.type %} +{% if bgp.next_hop_self|default(False) %} nexthop-setting: self +{% endif %} {% if bgp.rr|default('') and not n.rr|default('') %} route-reflector-client: on {% endif %} -{% if bgp.community.ibgp|default([]) %} - community-advertise: -{% for ibgp_community in bgp.community.ibgp %} - {{ ibgp_community.replace("standard","regular") }}: on -{% endfor %} -{% endif %} -{% else %} -{% if bgp.community.ebgp|default([]) %} - community-advertise: -{% for ebgp_community in bgp.community.ebgp %} - {{ ebgp_community.replace("standard","regular") }}: on -{% endfor %} -{% endif %} +{% endif %} +{% if n.type in bgp.community|default({}) %} +{{ advertise_communities( bgp.community[n.type] ) }} {% endif %} {% endfor %} {% endfor %}