Fix for route-export to-evpn not working in the default VRF

In NVUE, the following config has no effect (using 5.9.2 or 5.12.0):
nv set vrf default router bgp address-family ipv4-unicast route-export to-evpn enable on

Looking at /usr/lib/python3/dist-packages/nos/funits/cue_frr_v1/templates/frr_evpn.conf.j2
there is no “advertise ipv4/6 unicast” in macro bgp_default_evpn, unlike macro bgp_vrf_evpn which has:

{# if py_.get(bgp, 'address-family.ipv4-unicast.route-export.to-evpn.enable') == 'on' #}
{% for af_k, af_v in cget(bgp, 'address-family', {}).items() | sort %}
{% if af_k == 'ipv4-unicast' or af_k == 'ipv6-unicast' %}
{% set aftype = 'ipv4' if af_k == 'ipv4-unicast' else 'ipv6' %}
{% if af_v.get('route-export', {}).get('to-evpn', {}).get('enable') == 'on' %}
{% set rmap = 'route-map %s' % af_v['route-export']['to-evpn']['route-map']
        if af_v.get('route-export', {}).get('to-evpn', {}).get('route-map') != 'none' %}
  advertise {{ aftype }} unicast {{ rmap }}
{% endif %}
{% if af_v.get('route-export', {}).get('to-evpn', {}).get('default-route-origination') == 'on' %}
  default-originate {{ aftype }}
{% endif %}
{% endif %} 
{%endfor %}

I am using the following workaround:

- set:
    system:
      config:
        snippet:
          frr.conf: |
            router bgp {{ bgp.as }}
              address-family l2vpn evpn
{% for _af in ['ipv4','ipv6'] if _af in bgp %}
                advertise {{ _af }} unicast
{% endfor %}

Could this be fixed in frr_evpn.conf.j2 please?

Thanks,
Jeroen

Let me ping a developer on this issue, thank you for the concise problem description!

Alright this looks like a bit of a mis-understanding, this command is not intended to be used on the default VRF… but instead on the tenant VRF… this will advertise the TYPE-5 Routes into the BGP process running in the Default VRF.
See an example of the intended use case here:
https://docs.nvidia.com/networking-ethernet-software/cumulus-linux-51/Network-Virtualization/Ethernet-Virtual-Private-Network-EVPN/Inter-subnet-Routing/#announce-evpn-type-5-routes

I have a use case that involves the advertisement of TYPE-5 routes from the default VRF into BGP (using asymmetric IRB).

This is supported by FRR - see workaround - but not by the NVUE templates. They could easily be generalized to support this - simply factor out the part that configures “advertise ipv4/6 unicast” and invoke it from both bgp_default_evpn and bgp_vrf_evpn.

Or you could decide not to support that - but then the nv command should throw an error.

Happy to provide a PR to implement this if desired