5e6620e19e
* [bgp] Save admin state and set default state to shutdown * Set default behavior to no shutdown * Add build option SHUTDOWN_BGP_ON_START * Script change for default admin state to be on * Address CR comments to bgp_neighbor script * Fix script bug
76 lines
2.4 KiB
Django/Jinja
76 lines
2.4 KiB
Django/Jinja
!
|
|
{% block banner %}
|
|
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
|
! generated by templates/quagga/bgpd.conf.j2 using minigraph_facts.py
|
|
! file: bgpd.conf
|
|
!
|
|
{% endblock banner %}
|
|
!
|
|
{% block system_init %}
|
|
hostname {{ inventory_hostname }}
|
|
password zebra
|
|
log syslog informational
|
|
log facility local4
|
|
! enable password {# {{ en_passwd }} TODO: param needed #}
|
|
{% endblock system_init %}
|
|
!
|
|
{% if minigraph_bgp_asn is not none %}
|
|
{% block bgp_init %}
|
|
!
|
|
! bgp multiple-instance
|
|
!
|
|
router bgp {{ minigraph_bgp_asn }}
|
|
bgp log-neighbor-changes
|
|
bgp bestpath as-path multipath-relax
|
|
{# Advertise graceful restart capability for ToR #}
|
|
{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %}
|
|
bgp graceful-restart
|
|
{% endif %}
|
|
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
|
|
bgp router-id {{ minigraph_lo_interfaces[0]['addr'] }}
|
|
{# advertise loopback #}
|
|
{% for lo in minigraph_lo_interfaces %}
|
|
{% if lo['addr'] | ipv4 %}
|
|
network {{ lo['addr'] }}/32
|
|
{% elif lo['addr'] | ipv6 %}
|
|
address-family ipv6
|
|
network {{ lo['addr'] }}/128
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock bgp_init %}
|
|
{% endif %}
|
|
{% block vlan_advertisement %}
|
|
{% for vlan_interface in minigraph_vlan_interfaces %}
|
|
network {{ vlan_interface['subnet'] }}
|
|
{% endfor %}
|
|
{% endblock vlan_advertisement %}
|
|
{% block bgp_sessions %}
|
|
{% for bgp_session in minigraph_bgp %}
|
|
{% if bgp_session['asn'] != 0 %}
|
|
neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }}
|
|
neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }}
|
|
{% if bgp_admin_state and bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state[bgp_session['addr']]==False or bgp_admin_state and not bgp_admin_state.has_key(bgp_session['addr']) and bgp_admin_state.has_key('all') and bgp_admin_state['all']==False %}
|
|
neighbor {{ bgp_session['addr'] }} shutdown
|
|
{% endif %}
|
|
{% if minigraph_devices[inventory_hostname]['type'] == 'ToRRouter' %}
|
|
neighbor {{ bgp_session['addr'] }} allowas-in 1
|
|
{% endif %}
|
|
{% if bgp_session['addr'] | ipv6 %}
|
|
address-family ipv6
|
|
neighbor {{ bgp_session['addr'] }} activate
|
|
maximum-paths 64
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock bgp_sessions %}
|
|
!
|
|
{% if minigraph_bgp_asn is not none %}
|
|
maximum-paths 64
|
|
!
|
|
route-map ISOLATE permit 10
|
|
set as-path prepend {{ minigraph_bgp_asn }}
|
|
{% endif %}
|
|
!
|