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
31 lines
1.5 KiB
Django/Jinja
31 lines
1.5 KiB
Django/Jinja
{% block bgp_peer %}
|
|
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
|
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
|
{# set the bgp neighbor timers if they have not default values #}
|
|
{% if (bgp_session['keepalive'] is defined and bgp_session['keepalive'] | int != 60)
|
|
or (bgp_session['holdtime'] is defined and bgp_session['holdtime'] | int != 180) %}
|
|
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }}
|
|
{% endif %}
|
|
{% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and DEVICE_METADATA['localhost'].has_key('default_bgp_status') and DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %}
|
|
neighbor {{ neighbor_addr }} shutdown
|
|
{% endif %}
|
|
{% if neighbor_addr | ipv4 %}
|
|
address-family ipv4
|
|
neighbor {{ neighbor_addr }} peer-group PEER_V4
|
|
{% elif neighbor_addr | ipv6 %}
|
|
address-family ipv6
|
|
{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %}
|
|
neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in
|
|
{% endif %}
|
|
neighbor {{ neighbor_addr }} peer-group PEER_V6
|
|
{% endif %}
|
|
{% if bgp_session['rrclient'] | int != 0 %}
|
|
neighbor {{ neighbor_addr }} route-reflector-client
|
|
{% endif %}
|
|
{% if bgp_session['nhopself'] | int != 0 %}
|
|
neighbor {{ neighbor_addr }} next-hop-self
|
|
{% endif %}
|
|
neighbor {{ neighbor_addr }} activate
|
|
exit-address-family
|
|
{% endblock bgp_peer %}
|