057ced0391
The one big bgp configuration template was splitted into chunks. Currently we have three types of bgp neighbor peers: general bgp peers. They are represented by CONFIG_DB::BGP_NEIGHBOR table entries dynamic bgp peers. They are represented by CONFIG_DB::BGP_PEER_RANGE table entries monitors bgp peers. They are represented by CONFIG_DB::BGP_MONITORS table entries This PR introduces three templates for each peer type: bgp policies: represent policieas that will be applied to the bgp peer-group (ip prefix-lists, route-maps, etc) bgp peer-group: represent bgp peer group which has common configuration for the bgp peer type and uses bgp routing policy from the previous item bgp peer-group instance: represent bgp configuration, which will be used to instatiate a bgp peer-group for the bgp peer-type. Usually this one is simple, consist of the referral to the bgp peer-group, bgp peer description and bgp peer ip address. This PR redefined constant.yml file. Now this file has a setting for to use or don't use bgp_neighbor metadata. This file has more parameters for now, which are not used. They will be used in the next iteration of bgpcfgd. Currently all tests have been disabled. I'm going to create next PR with the tests right after this PR is merged. I'm going to introduce better bgpcfgd in a short time. It will include support of dynamic changes for the templates. FIX:: #4231
39 lines
1.5 KiB
Django/Jinja
39 lines
1.5 KiB
Django/Jinja
!
|
|
! template: bgpd/templates/dynamic/instance.conf.j2
|
|
!
|
|
{% from "common/functions.conf.j2" import get_ipv4_loopback_address %}
|
|
!
|
|
neighbor {{ bgp_session['name'] }} peer-group
|
|
neighbor {{ bgp_session['name'] }} passive
|
|
neighbor {{ bgp_session['name'] }} ebgp-multihop 255
|
|
neighbor {{ bgp_session['name'] }} soft-reconfiguration inbound
|
|
neighbor {{ bgp_session['name'] }} route-map FROM_BGP_SPEAKER in
|
|
neighbor {{ bgp_session['name'] }} route-map TO_BGP_SPEAKER out
|
|
!
|
|
{% if bgp_session['peer_asn'] is defined %}
|
|
neighbor {{ bgp_session['name'] }} remote-as {{ bgp_session['peer_asn'] }}
|
|
{% else %}
|
|
neighbor {{ bgp_session['name'] }} remote-as {{ constants.deployment_id_asn_map[CONFIG_DB__DEVICE_METADATA['localhost']['deployment_id']] }}
|
|
{% endif %}
|
|
!
|
|
{# FIXME: bgp_session['ip_range'] check the type #}
|
|
{% for ip_range in bgp_session['ip_range'].split(',') %}
|
|
bgp listen range {{ ip_range }} peer-group {{ bgp_session['name'] }}
|
|
{% endfor %}
|
|
!
|
|
{% if bgp_session['src_address'] is defined %}
|
|
neighbor {{ bgp_session['name'] }} update-source {{ bgp_session['src_address'] | ip }}
|
|
{% else %}
|
|
neighbor {{ bgp_session['name'] }} update-source {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback1") | ip }}
|
|
{% endif %}
|
|
!
|
|
address-family ipv4
|
|
neighbor {{ bgp_session['name'] }} activate
|
|
exit-address-family
|
|
address-family ipv6
|
|
neighbor {{ bgp_session['name'] }} activate
|
|
exit-address-family
|
|
!
|
|
! end of template: bgpd/templates/BGP_SPEAKER/instance.conf.j2
|
|
!
|