Skip to content

Commit

Permalink
Cumulus NVUE: Add initial limited bgp.session support for allowas_in (#…
Browse files Browse the repository at this point in the history
…1968)

Used by one of the EVPN test cases
  • Loading branch information
jbemmel authored Feb 22, 2025
1 parent 3572aa0 commit 3202988
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/plugins/bgp.session.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ The plugin implements AS-path-mangling nerd knobs for the following platforms:
| Cisco IOSv/IOSvL2 ||||||
| Cisco IOS-XE[^18v] ||||||
| Cisco Nexus OS ||||||
| Cumulus Linux ||||||
| Cumulus Linux 4.x ||||||
| Cumulus 5.x (NVUE) ||||||
| FRR ||||||
| Junos[^Junos] ||||||
| Mikrotik RouterOS 7 ||||||
Expand Down
42 changes: 42 additions & 0 deletions netsim/extra/bgp.session/cumulus_nvue.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
{% macro ebgp_neighbor(n) -%}
aspath:
allow-my-asn:
enable: {{ 'on' if n.allowas_in|default(False) else 'off' }}
{% if n.allowas_in|default(0) > 0 %}
occurrences: {{ n.allowas_in }}
{% endif %}
{% endmacro %}

{% macro ebgp_config(vrf,vrf_bgp) -%}
{% for n in vrf_bgp.neighbors %}
{% if loop.first %}
- set:
vrf:
{{ vrf }}:
router:
bgp:
neighbor:
{% endif %}
{% for a in ['ipv4','ipv6','local_if'] if a in n and n[a] is string %}
{{ n[a] }}:
address-family:
{% for af in ['ipv4','ipv6'] if af in vrf_bgp %}
{{ af }}-unicast:
{{ ebgp_neighbor(n)|indent(20,first=True) }}
{% endfor %}
{% if 'evpn' in n %}
l2vpn-evpn:
{{ ebgp_neighbor(n)|indent(20,first=True) }}
{% endif %}
{% endfor %}
{% endfor %}
{% endmacro %}

{{ ebgp_config('default',bgp) }}

{% if vrfs is defined %}
{% for vname,vdata in vrfs.items() if vdata.bgp is defined and vdata.bgp.neighbors is defined %}
{{ ebgp_config(vname,vdata.bgp) }}
{% endfor %}
{% endif %}
2 changes: 2 additions & 0 deletions netsim/extra/bgp.session/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ devices:
timers: True
cumulus:
copy: frr
cumulus_nvue.features.bgp:
allowas_in: True
iosv.features.bgp:
allowas_in: True
as_override: True
Expand Down

0 comments on commit 3202988

Please sign in to comment.