1+ {% set default_ospf_area = '0.0.0.0' %}
2+ {% set default_router_id = loopbacks .loopback 0 %}
13!
24! Arista EOS VXLAN/EVPN Leaf Configuration
35! Device: {{ hostname }}
@@ -19,20 +21,20 @@ interface {{ loopback_name }}
1921{% - if loopback_name == 'loopback0' %}
2022 description {{ hostname }} Underlay Loopback Interface
2123 ip address {{ loopback_ip }}/32
22- ospf area {{ ospf.area or "0.0.0.0" }}
24+ ospf area {{ ospf.area or default_ospf_area }}
2325{% - elif loopback_name == 'loopback1' %}
2426 description {{ hostname }} VTEP Loopback Interface
2527 ip address {{ loopback_ip }}/32
2628{#- loopback1 is NOT in OSPF, used only for iBGP EVPN overlay -#}
2729{% - else %}
2830 description {{ hostname }} {{ loopback_name }} Interface
2931 ip address {{ loopback_ip }}/32
30- ospf area {{ ospf.area or "0.0.0.0" }}
32+ ospf area {{ ospf.area or default_ospf_area }}
3133{% - endif %}
3234{% - endfor %}
3335! Configure OSPF
3436router ospf {{ ospf.process_id or 1 }}
35- router-id {{ ospf.router_id or loopbacks.loopback0 }}
37+ router-id {{ ospf.router_id or default_router_id }}
3638 passive-interface default
3739 no passive-interface Ethernet1
3840 no passive-interface Ethernet2
@@ -53,7 +55,7 @@ interface {{ interface.name }}
5355 mtu {{ interface.mtu or 9214 }}
5456 no switchport
5557 ip unnumbered Loopback0
56- ospf area {{ ospf.area or "0.0.0.0" }}
58+ ospf area {{ ospf.area or default_ospf_area }}
5759 ospf network point-to-point
5860{% - elif interface .vlans %}
5961{% - if interface .vlans | length == 1 %}
@@ -93,18 +95,19 @@ interface {{ interface.name }}
9395{% - endfor %}
9496! Configure BGP
9597router bgp {{ bgp.local_as }}
96- router-id {{ bgp.router_id or loopbacks.loopback0 }}
98+ router-id {{ bgp.router_id or default_router_id }}
9799 no bgp default ipv4-unicast
98100 distance bgp 20 200 200
99101 maximum-paths 4 ecmp 64
100102{# Configure BGP neighbors from enhanced transform data #}
101103{% - for neighbor in bgp .neighbors %}
104+ {% - set neihbor_ip = neighbor .remote_ip .split ('/' )[0] %}
102105 ! {{ neighbor.description or 'BGP Neighbor' }}
103- neighbor {{ neighbor.remote_ip.split('/')[ 0] }} remote-as {{ neighbor.remote_as }}
104- neighbor {{ neighbor.remote_ip.split('/')[ 0] }} update-source Loopback0
105- neighbor {{ neighbor.remote_ip.split('/')[ 0] }} description {{ neighbor.description or 'BGP Neighbor' }}
106- neighbor {{ neighbor.remote_ip.split('/')[ 0] }} send-community extended
107- neighbor {{ neighbor.remote_ip.split('/')[ 0] }} maximum-routes 0
106+ neighbor {{ neihbor_ip }} remote-as {{ neighbor.remote_as }}
107+ neighbor {{ neihbor_ip }} update-source Loopback0
108+ neighbor {{ neihbor_ip }} description {{ neighbor.description or 'BGP Neighbor' }}
109+ neighbor {{ neihbor_ip }} send-community extended
110+ neighbor {{ neihbor_ip }} maximum-routes 0
108111{% - endfor %}
109112 address-family ipv4
110113 redistribute connected route-map RM-CONN-2-BGP
@@ -118,7 +121,7 @@ router bgp {{ bgp.local_as }}
118121{# L2VPN EVPN for VLANs #}
119122{% - for vlan in vlans %}
120123 vlan {{ vlan.vlan_id }}
121- rd {{ bgp.router_id or loopbacks.loopback0 }}:{{ vlan.vni }}
124+ rd {{ bgp.router_id or default_router_id }}:{{ vlan.vni }}
122125 route-target both {{ vlan.vni }}:{{ vlan.vni }}
123126 redistribute learned
124127{% - endfor %}
0 commit comments