2e87a16941
Changes made to support multi-asic platform. Added multi-instance support for swss, syncd, database, bgp, teamd and lldp.
181 lines
5.8 KiB
Django/Jinja
181 lines
5.8 KiB
Django/Jinja
!
|
|
{% if DEVICE_METADATA['localhost'].has_key('bgp_asn') %}
|
|
{% block bgp_init %}
|
|
!
|
|
! bgp multiple-instance
|
|
!
|
|
route-map FROM_BGP_SPEAKER_V4 permit 10
|
|
!
|
|
route-map TO_BGP_SPEAKER_V4 deny 10
|
|
!
|
|
{# generate loopback prefix-lists #}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 and name == 'Loopback0' %}
|
|
ip prefix-list PL_LoopbackV4 permit {{ prefix | ip }}/32
|
|
{% elif prefix | ipv6 and name == 'Loopback0' %}
|
|
ipv6 prefix-list PL_LoopbackV6 permit {{ prefix | replace('/128', '/64') | ip_network }}/64
|
|
{% endif %}
|
|
{% endfor %}
|
|
!
|
|
{# generate default peer route-maps #}
|
|
!
|
|
route-map TO_BGP_PEER_V4 permit 100
|
|
!
|
|
route-map TO_BGP_PEER_V6 permit 100
|
|
!
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'InternalFrontend' %}
|
|
route-map HIDE_INTERNAL permit 10
|
|
set community local-AS
|
|
!
|
|
{% endif %}
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'InternalBackend' %}
|
|
route-map OVERRIDE_ORIGINATOR_ID permit 10
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 and name == 'Loopback0' %}
|
|
set originator-id {{ prefix | ip }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
!
|
|
{% endif %}
|
|
{% if BGP_MONITORS is defined and BGP_MONITORS|length > 0 %}
|
|
route-map FROM_BGPMON deny 10
|
|
!
|
|
route-map TO_BGPMON permit 10
|
|
!
|
|
{% endif %}
|
|
!
|
|
route-map ISOLATE permit 10
|
|
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
!
|
|
route-map set-next-hop-global-v6 permit 10
|
|
set ipv6 next-hop prefer-global
|
|
!
|
|
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'InternalFrontend' %}
|
|
redistribute connected route-map HIDE_INTERNAL
|
|
{% endif %}
|
|
bgp log-neighbor-changes
|
|
bgp bestpath as-path multipath-relax
|
|
no bgp default ipv4-unicast
|
|
bgp graceful-restart restart-time 240
|
|
bgp graceful-restart
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
|
bgp graceful-restart preserve-fw-state
|
|
{% endif %}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 and name == 'Loopback0' %}
|
|
bgp router-id {{ prefix | ip }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{# advertise loopback #}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 and name == 'Loopback0' %}
|
|
network {{ prefix | ip }}/32
|
|
{% elif prefix | ipv6 and name == 'Loopback0' %}
|
|
address-family ipv6
|
|
network {{ prefix | ip }}/64
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock bgp_init %}
|
|
{% endif %}
|
|
{% block vlan_advertisement %}
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 %}
|
|
network {{ prefix }}
|
|
{% elif prefix | ipv6 %}
|
|
address-family ipv6
|
|
network {{ prefix }}
|
|
exit-address-family
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endblock vlan_advertisement %}
|
|
{% block maximum_paths %}
|
|
address-family ipv4
|
|
maximum-paths 64
|
|
exit-address-family
|
|
address-family ipv6
|
|
maximum-paths 64
|
|
exit-address-family
|
|
{% endblock maximum_paths %}
|
|
{% block peers_peer_group %}
|
|
neighbor PEER_V4 peer-group
|
|
neighbor PEER_V6 peer-group
|
|
address-family ipv4
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
|
neighbor PEER_V4 allowas-in 1
|
|
{% endif %}
|
|
neighbor PEER_V4 soft-reconfiguration inbound
|
|
neighbor PEER_V4 route-map TO_BGP_PEER_V4 out
|
|
exit-address-family
|
|
address-family ipv6
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
|
neighbor PEER_V6 allowas-in 1
|
|
{% endif %}
|
|
neighbor PEER_V6 soft-reconfiguration inbound
|
|
neighbor PEER_V6 route-map TO_BGP_PEER_V6 out
|
|
exit-address-family
|
|
{% endblock peers_peer_group %}
|
|
{% block bgp_peers_with_range %}
|
|
{% if BGP_PEER_RANGE %}
|
|
{% for bgp_peer in BGP_PEER_RANGE.values() %}
|
|
neighbor {{ bgp_peer['name'] }} peer-group
|
|
neighbor {{ bgp_peer['name'] }} passive
|
|
{% if bgp_peer['peer_asn'] is defined %}
|
|
neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }}
|
|
{% else %}
|
|
neighbor {{ bgp_peer['name'] }} remote-as {{ constants.deployment_id_asn_map[DEVICE_METADATA['localhost']['deployment_id']] }}
|
|
{% endif %}
|
|
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
|
|
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
|
|
{% if bgp_peer['src_address'] is defined %}
|
|
neighbor {{ bgp_peer['name'] }} update-source {{ bgp_peer['src_address'] | ip }}
|
|
{% else %}
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if name == 'Loopback1' %}
|
|
neighbor {{ bgp_peer['name'] }} update-source {{ prefix | ip }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
neighbor {{ bgp_peer['name'] }} route-map FROM_BGP_SPEAKER_V4 in
|
|
neighbor {{ bgp_peer['name'] }} route-map TO_BGP_SPEAKER_V4 out
|
|
{% for ip_range in bgp_peer['ip_range'] %}
|
|
bgp listen range {{ip_range}} peer-group {{ bgp_peer['name'] }}
|
|
{% endfor %}
|
|
address-family ipv4
|
|
neighbor {{ bgp_peer['name'] }} activate
|
|
exit-address-family
|
|
address-family ipv6
|
|
neighbor {{ bgp_peer['name'] }} activate
|
|
exit-address-family
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endblock bgp_peers_with_range %}
|
|
{% block bgp_monitors %}
|
|
{% if BGP_MONITORS is defined and BGP_MONITORS|length > 0 %}
|
|
neighbor BGPMON peer-group
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 and name == 'Loopback0' %}
|
|
neighbor BGPMON update-source {{ prefix | ip }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
neighbor BGPMON route-map FROM_BGPMON in
|
|
neighbor BGPMON route-map TO_BGPMON out
|
|
neighbor BGPMON send-community
|
|
neighbor BGPMON maximum-prefix 1
|
|
{% for neighbor_addr, bgp_session in BGP_MONITORS.items() %}
|
|
neighbor {{ neighbor_addr }} remote-as {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
neighbor {{ neighbor_addr }} peer-group BGPMON
|
|
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
|
neighbor {{ neighbor_addr }} activate
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'InternalBackend' %}
|
|
neighbor {{ neighbor_addr }} route-map OVERRIDE_ORIGINATOR_ID in
|
|
{% endif %}
|
|
address-family ipv6
|
|
neighbor {{ neighbor_addr }} activate
|
|
exit-address-family
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endblock bgp_monitors %}
|
|
!
|