8457248d01
Now it's possible to add and remove peers based on ConfigDB - What I did Fixed functionality for dynamically adding/removing static bgp peers. - How I did it Split the bgp default template on bgp part and bgp peer part Changed bgpcfgd to use 1. - How to verify it Build an image and run on your DUT
61 lines
1.3 KiB
Django/Jinja
61 lines
1.3 KiB
Django/Jinja
!
|
|
{% block vrf %}
|
|
{% if VNET is defined %}
|
|
{% for vnet_name, vnet_metadata in VNET.iteritems() %}
|
|
vrf {{ vnet_name }}
|
|
vni {{ vnet_metadata['vni'] }}
|
|
!
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endblock vrf %}
|
|
!
|
|
{% block interfaces %}
|
|
! Enable link-detect (default disabled)
|
|
{% for (name, prefix) in INTERFACE|pfx_filter %}
|
|
interface {{ name }}
|
|
link-detect
|
|
!
|
|
{% endfor %}
|
|
{% for pc in PORTCHANNEL %}
|
|
interface {{ pc }}
|
|
link-detect
|
|
!
|
|
{% endfor %}
|
|
{% endblock interfaces %}
|
|
!
|
|
{% block source_loopback %}
|
|
{% set lo_ipv4_addrs = [] %}
|
|
{% set lo_ipv6_addrs = [] %}
|
|
{% if LOOPBACK_INTERFACE %}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if name == 'Loopback0' %}
|
|
{% if prefix | ipv6 %}
|
|
{% if lo_ipv6_addrs.append(prefix) %}
|
|
{% endif %}
|
|
{% else %}
|
|
{% if lo_ipv4_addrs.append(prefix) %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
! Set ip source to loopback for bgp learned routes
|
|
{% if lo_ipv4_addrs|length > 0 -%}
|
|
route-map RM_SET_SRC permit 10
|
|
set src {{ lo_ipv4_addrs[0] | ip }}
|
|
!
|
|
{% endif %}
|
|
{% if lo_ipv6_addrs|length > 0 %}
|
|
route-map RM_SET_SRC6 permit 10
|
|
set src {{ lo_ipv6_addrs[0] | ip }}
|
|
!
|
|
{% endif %}
|
|
ip protocol bgp route-map RM_SET_SRC
|
|
!
|
|
{% if lo_ipv6_addrs|length > 0 %}
|
|
ipv6 protocol bgp route-map RM_SET_SRC6
|
|
!
|
|
{% endif %}
|
|
{% endblock source_loopback %}
|
|
!
|