2e3975d6ed
* Fix an issue that bgp asn data type is not consistent from minigraph parser and DB * Fix test typo
84 lines
2.4 KiB
Django/Jinja
84 lines
2.4 KiB
Django/Jinja
!
|
|
{% block banner %}
|
|
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
|
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
|
! file: bgpd.conf
|
|
!
|
|
{% endblock banner %}
|
|
!
|
|
{% block system_init %}
|
|
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
|
password zebra
|
|
log syslog informational
|
|
log facility local4
|
|
! enable password {# {{ en_passwd }} TODO: param needed #}
|
|
{% endblock system_init %}
|
|
!
|
|
{% block bgp_init %}
|
|
!
|
|
! bgp multiple-instance
|
|
!
|
|
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
bgp log-neighbor-changes
|
|
bgp bestpath as-path multipath-relax
|
|
no bgp default ipv4-unicast
|
|
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
|
|
bgp router-id {{ LOOPBACK_INTERFACE.keys()[0][1] }}
|
|
{# advertise loopback #}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
|
{% if prefix | ipv4 %}
|
|
network {{ prefix | ip }}/32
|
|
{% elif prefix | ipv6 %}
|
|
address-family ipv6
|
|
network {{ prefix | ip }}/128
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock bgp_init %}
|
|
{% block vlan_advertisement %}
|
|
{% for (name, prefix) in VLAN_INTERFACE %}
|
|
{% if prefix | ipv4 %}
|
|
network {{ prefix }}
|
|
{% elif prefix | ipv6 %}
|
|
address-family ipv6
|
|
network {{ prefix }}
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock vlan_advertisement %}
|
|
{% block bgp_sessions %}
|
|
{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %}
|
|
{% if bgp_session['asn'] | int != 0 %}
|
|
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
|
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
|
neighbor {{ neighbor_addr }} allowas-in 1
|
|
{% endif %}
|
|
{% if neighbor_addr | ipv4 %}
|
|
address-family ipv4
|
|
neighbor {{ neighbor_addr }} activate
|
|
{% if bgp_session['rrclient'] | int != 0 %}
|
|
neighbor {{ neighbor_addr }} route-reflector-client
|
|
{% endif %}
|
|
maximum-paths 64
|
|
exit-address-family
|
|
{% endif %}
|
|
{% if neighbor_addr | ipv6 %}
|
|
address-family ipv6
|
|
neighbor {{ neighbor_addr }} activate
|
|
{% if bgp_session['rrclient'] | int != 0 %}
|
|
neighbor {{ neighbor_addr }} route-reflector-client
|
|
{% endif %}
|
|
maximum-paths 64
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock bgp_sessions %}
|
|
!
|
|
maximum-paths 64
|
|
!
|
|
route-map ISOLATE permit 10
|
|
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
!
|