-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
instance.conf.j2
64 lines (64 loc) · 2.44 KB
/
instance.conf.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
!
! template: bgpd/templates/general/instance.conf.j2
!
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'] | default("60") }} {{ bgp_session['holdtime'] | default("180") }}
{% endif %}
!
{% if bgp_session.has_key('admin_status') and bgp_session['admin_status'] == 'down' or not bgp_session.has_key('admin_status') and CONFIG_DB__DEVICE_METADATA['localhost'].has_key('default_bgp_status') and CONFIG_DB__DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %}
neighbor {{ neighbor_addr }} shutdown
{% endif %}
!
{% if neighbor_addr | ipv4 %}
address-family ipv4
{% if 'ASIC' in bgp_session['name'] %}
neighbor {{ neighbor_addr }} peer-group PEER_V4_INT
{% else %}
neighbor {{ neighbor_addr }} peer-group PEER_V4
{% endif %}
!
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
neighbor {{ neighbor_addr }} route-map FROM_BGP_PEER_V4_INT in
{% endif %}
!
{% elif neighbor_addr | ipv6 %}
address-family ipv6
{% if 'ASIC' in bgp_session['name'] %}
neighbor {{ neighbor_addr }} peer-group PEER_V6_INT
{% else %}
neighbor {{ neighbor_addr }} peer-group PEER_V6
{% endif %}
!
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
neighbor {{ neighbor_addr }} route-map FROM_BGP_PEER_V6_INT in
{% endif %}
{% endif %}
!
{% if bgp_session.has_key('rrclient') and bgp_session['rrclient'] | int != 0 %}
neighbor {{ neighbor_addr }} route-reflector-client
{% endif %}
!
{% if bgp_session.has_key('nhopself') and bgp_session['nhopself'] | int != 0 %}
neighbor {{ neighbor_addr }} next-hop-self
{% endif %}
!
{% if 'ASIC' in bgp_session['name'] %}
neighbor {{ neighbor_addr }} next-hop-self force
{% endif %}
!
neighbor {{ neighbor_addr }} activate
exit-address-family
!
{% if bgp_session["asn"] == bgp_asn and CONFIG_DB__DEVICE_METADATA['localhost']['type'] == "SpineChassisFrontendRouter" %}
address-family l2vpn evpn
neighbor {{ neighbor_addr }} activate
advertise-all-vni
exit-address-family
{% endif %}
!
! end of template: bgpd/templates/general/instance.conf.j2
!