22! DO NOT EDIT MANUALLY
33!
44!
5- {% if switch_item .bgp_peers %}
5+ {% macro vrf_lite_ebgp_vrf_config (item , switch_item , defaults ) %}
6+
7+ {% if switch_item .router_id %}
8+ router-id {{ switch_item.router_id }}
9+ {% endif %}
10+ {% if switch_item .bgp .best_path_as_path_relax %}
11+ bestpath as-path multipath-relax
12+ {% elif switch_item .bgp .best_path_as_path_relax is not defined and (item .bgp .best_path_as_path_relax | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .best_path_as_path_relax )) %}
13+ bestpath as-path multipath-relax
14+ {% endif %}
15+ {% if (switch_item .bgp .graceful_restart is defined and switch_item .bgp .graceful_restart == false ) or (item .bgp .graceful_restart is defined and item .bgp .graceful_restart == false ) %}
16+ no graceful-restart
17+ {% endif %}
18+ {% if switch_item .bgp .graceful_restart_helper %}
19+ graceful-restart-helper
20+ {% elif switch_item .bgp .graceful_restart_helper is not defined and (item .bgp .graceful_restart_helper | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .graceful_restart_helper )) %}
21+ graceful-restart-helper
22+ {% endif %}
23+ {% if switch_item .bgp .local_as %}
24+ local-as {{ switch_item.bgp.local_as }}
25+ {% elif item .bgp .local_as %}
26+ local-as {{ item.bgp.local_as }}
27+ {% endif %}
28+ {% set address_family = {'address_family_v4' : false , 'address_family_v6' : false } %}
29+ {% if switch_item .bgp_peers is defined %}
630 {% for peer in switch_item .bgp_peers %}
7- {% if peer .bfd .enabled | default (defaults .vxlan .overlay_extensions .vrf_lites .switches .bgp_peers .bfd .enabled ) %}
8- feature bfd
31+ {% if "address_family_ipv4_unicast" in peer %}
32+ {% set _ = address_family .update ({'address_family_v4' : true }) %}
33+ {% elif "address_family_ipv6_unicast" in peer %}
34+ {% set _ = address_family .update ({'address_family_v6' : true }) %}
935 {% endif %}
1036 {% endfor %}
11- !
1237{% endif %}
13- !
14- router bgp {{ MD_Extended.vxlan.global.bgp_asn }}
15- vrf {{ item.vrf }}
16- {% if switch_item .router_id %}
17- router-id {{ switch_item.router_id }}
38+ {% if switch_item .bgp .address_family_ipv 4_unicast or address_family ["address_family_v4" ] is true %}
39+ address-family ipv4 unicast
40+ {% if (switch_item .bgp .address_family_ipv 4_unicast .ebgp_distance or switch_item .bgp .address_family_ipv 4_unicast .ibgp_distance or switch_item .bgp .address_family_ipv 4_unicast .local_distance ) %}
41+ distance {{ switch_item.bgp.address_family_ipv4_unicast.ebgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.ebgp_distance) }} {{ switch_item.bgp.address_family_ipv4_unicast.ibgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.ibgp_distance) }} {{ switch_item.bgp.address_family_ipv4_unicast.local_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.local_distance) }}
1842 {% endif %}
19- {% if switch_item .bgp .best_path_as_path_relax %}
20- bestpath as-path multipath-relax
21- {% elif switch_item .bgp .best_path_as_path_relax is not defined and (item .bgp .best_path_as_path_relax | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .best_path_as_path_relax )) %}
22- bestpath as-path multipath-relax
43+ {% if switch_item .bgp .address_family_ipv 4_unicast .default_originate | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 4_unicast .default_originate ) %}
44+ default-information originate
2345 {% endif %}
24- {% if ( switch_item .bgp .graceful_restart is defined and switch_item . bgp . graceful_restart == false ) or ( item . bgp . graceful_restart is defined and item . bgp .graceful_restart == false ) %}
25- no graceful-restart
46+ {% if switch_item .bgp .address_family_ipv 4 _unicast . additional_paths_send | default ( defaults . vxlan . overlay_extensions . vrf_lites . bgp .address_family_ipv 4 _unicast . additional_paths_send ) %}
47+ additional-paths send
2648 {% endif %}
27- {% if switch_item .bgp .graceful_restart_helper %}
28- graceful-restart-helper
29- {% elif switch_item .bgp .graceful_restart_helper is not defined and (item .bgp .graceful_restart_helper | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .graceful_restart_helper )) %}
30- graceful-restart-helper
49+ {% if switch_item .bgp .address_family_ipv 4_unicast .additional_paths_receive | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 4_unicast .additional_paths_receive ) %}
50+ additional-paths receive
3151 {% endif %}
32- {# #}
33- {% if switch_item .bgp .local_as %}
34- local-as {{ switch_item.bgp.local_as }}
35- {% elif item .bgp .local_as %}
36- local-as {{ item.bgp.local_as }}
52+ {% if switch_item .bgp .address_family_ipv 4_unicast .additional_paths_selection_route_map %}
53+ additional-paths selection route-map {{ switch_item.bgp.address_family_ipv4_unicast.additional_paths_selection_route_map }}
3754 {% endif %}
38- {# Check if address_family is enabled for redistribution #}
39- {% set address_family = {'address_family_v4' : false , 'address_family_v6' : false } %}
40- {% if switch_item .bgp_peers is defined %}
41- {% for peer in switch_item .bgp_peers %}
42- {% if "address_family_ipv4_unicast" in peer %}
43- {% set _ = address_family .update ({'address_family_v4' : true }) %}
44- {% elif "address_family_ipv6_unicast" in peer %}
45- {% set _ = address_family .update ({'address_family_v6' : true }) %}
55+ {% if switch_item .redistribution %}
56+ {% for switch_redist in switch_item .redistribution %}
57+ {% if switch_redist .source == 'static' and switch_redist .route_map_ipv 4 %}
58+ redistribute static route-map {{ switch_redist.route_map_ipv4 }}
4659 {% endif %}
4760 {% endfor %}
4861 {% endif %}
49- {% if switch_item .bgp .address_family_ipv 4_unicast or address_family ["address_family_v4" ] is true %}
50- address-family ipv4 unicast
51- {% if (switch_item .bgp .address_family_ipv 4_unicast .ebgp_distance or switch_item .bgp .address_family_ipv 4_unicast .ibgp_distance or switch_item .bgp .address_family_ipv 4_unicast .local_distance ) %}
52- distance {{ switch_item.bgp.address_family_ipv4_unicast.ebgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.ebgp_distance) }} {{ switch_item.bgp.address_family_ipv4_unicast.ibgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.ibgp_distance) }} {{ switch_item.bgp.address_family_ipv4_unicast.local_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv4_unicast.local_distance) }}
53- {% endif %}
54- {% if switch_item .bgp .address_family_ipv 4_unicast .default_originate | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 4_unicast .default_originate ) %}
55- default-information originate
56- {% endif %}
57- {% if switch_item .bgp .address_family_ipv 4_unicast .additional_paths_send | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 4_unicast .additional_paths_send ) %}
58- additional-paths send
59- {% endif %}
60- {% if switch_item .bgp .address_family_ipv 4_unicast .additional_paths_receive | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 4_unicast .additional_paths_receive ) %}
61- additional-paths receive
62- {% endif %}
63- {% if switch_item .bgp .address_family_ipv 4_unicast .additional_paths_selection_route_map %}
64- additional-paths selection route-map {{ switch_item.bgp.address_family_ipv4_unicast.additional_paths_selection_route_map }}
65- {% endif %}
66- {% if switch_item .redistribution %}
67- {% for switch_redist in switch_item .redistribution %}
68- {% if switch_redist .source == 'static' and switch_redist .route_map_ipv 4 %}
69- redistribute static route-map {{ switch_redist.route_map_ipv4 }}
70- {% endif %}
71- {% endfor %}
72- {% endif %}
7362!
63+ {% endif %}
64+ {% if switch_item .bgp .address_family_ipv 6_unicast or address_family ["address_family_v6" ] is true %}
65+ address-family ipv6 unicast
66+ {% if (switch_item .bgp .address_family_ipv 6_unicast .ebgp_distance or switch_item .bgp .address_family_ipv 6_unicast .ibgp_distance or switch_item .bgp .address_family_ipv 6_unicast .local_distance ) %}
67+ distance {{ switch_item.bgp.address_family_ipv6_unicast.ebgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.ebgp_distance) }} {{ switch_item.bgp.address_family_ipv6_unicast.ibgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.ibgp_distance) }} {{ switch_item.bgp.address_family_ipv6_unicast.local_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.local_distance) }}
7468 {% endif %}
75- {% if switch_item .bgp .address_family_ipv 6_unicast or address_family ["address_family_v6" ] is true %}
76- address-family ipv6 unicast
77- {% if (switch_item .bgp .address_family_ipv 6_unicast .ebgp_distance or switch_item .bgp .address_family_ipv 6_unicast .ibgp_distance or switch_item .bgp .address_family_ipv 6_unicast .local_distance ) %}
78- distance {{ switch_item.bgp.address_family_ipv6_unicast.ebgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.ebgp_distance) }} {{ switch_item.bgp.address_family_ipv6_unicast.ibgp_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.ibgp_distance) }} {{ switch_item.bgp.address_family_ipv6_unicast.local_distance | default(defaults.vxlan.overlay_extensions.vrf_lites.bgp.address_family_ipv6_unicast.local_distance) }}
79- {% endif %}
80- {% if switch_item .bgp .address_family_ipv 6_unicast .default_originate | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .default_originate ) %}
81- default-information originate
82- {% endif %}
83- {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_send | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .additional_paths_send ) %}
84- additional-paths send
85- {% endif %}
86- {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_receive | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .additional_paths_receive ) %}
87- additional-paths receive
88- {% endif %}
89- {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_selection_route_map %}
90- additional-paths selection route-map {{ switch_item.bgp.address_family_ipv6_unicast.additional_paths_selection_route_map }}
91- {% endif %}
92- {% if switch_item .redistribution %}
93- {% for switch_redist in switch_item .redistribution %}
94- {% if switch_redist .source == 'static' and switch_redist .route_map_ipv 6 %}
95- redistribute static route-map {{ switch_redist.route_map_ipv6 }}
96- {% endif %}
97- {% endfor %}
98- {% endif %}
99- !
69+ {% if switch_item .bgp .address_family_ipv 6_unicast .default_originate | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .default_originate ) %}
70+ default-information originate
71+ {% endif %}
72+ {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_send | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .additional_paths_send ) %}
73+ additional-paths send
74+ {% endif %}
75+ {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_receive | default (defaults .vxlan .overlay_extensions .vrf_lites .bgp .address_family_ipv 6_unicast .additional_paths_receive ) %}
76+ additional-paths receive
77+ {% endif %}
78+ {% if switch_item .bgp .address_family_ipv 6_unicast .additional_paths_selection_route_map %}
79+ additional-paths selection route-map {{ switch_item.bgp.address_family_ipv6_unicast.additional_paths_selection_route_map }}
10080 {% endif %}
81+ {% if switch_item .redistribution %}
82+ {% for switch_redist in switch_item .redistribution %}
83+ {% if switch_redist .source == 'static' and switch_redist .route_map_ipv 6 %}
84+ redistribute static route-map {{ switch_redist.route_map_ipv6 }}
85+ {% endif %}
86+ {% endfor %}
87+ {% endif %}
88+ !
89+ {% endif %}
10190{% if switch_item .bgp_peers %}
10291 {% for peer in switch_item .bgp_peers %}
10392 neighbor {{ peer.address }}
@@ -193,3 +182,24 @@ router bgp {{ MD_Extended.vxlan.global.bgp_asn }}
193182 {% endif %}
194183 {% endfor %}
195184{% endif %}
185+ {% endmacro %}
186+
187+ {% if switch_item .bgp_peers %}
188+ {% for peer in switch_item .bgp_peers %}
189+ {% if peer .bfd .enabled | default (defaults .vxlan .overlay_extensions .vrf_lites .switches .bgp_peers .bfd .enabled ) %}
190+ feature bfd
191+ {% endif %}
192+ {% endfor %}
193+ !
194+ {% endif %}
195+ !
196+ {% if item .vrf .lower () == "default" %}
197+ router bgp {{ MD_Extended.vxlan.global.bgp_asn }}
198+ {# GRT #}
199+ {{- vrf_lite_ebgp_vrf_config(item, switch_item, defaults) -}}
200+ {% else %}
201+ router bgp {{ MD_Extended.vxlan.global.bgp_asn }}
202+ {# Other VRFs #}
203+ vrf {{ item.vrf }}
204+ {{- vrf_lite_ebgp_vrf_config(item, switch_item, defaults) | indent(2) -}}
205+ {% endif %}
0 commit comments