From 53cd8d4ed641b2983b0c99a0f661a47986cf858a Mon Sep 17 00:00:00 2001 From: Judy Joseph Date: Tue, 19 May 2020 12:38:30 -0700 Subject: [PATCH 1/2] Adding new BGP peer groups PEER_V4_INT and PEER_V6_INT. The internal BGP sessions will be added to this peer group while the external BGP sessions will be added to the exising PEER_V4 and PEER_V6 peer group. --- .../frr/bgpd/templates/general/instance.conf.j2 | 8 ++++++++ .../frr/bgpd/templates/general/peer-group.conf.j2 | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 index 148cfa390e01..fea6c18f5cd0 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 @@ -15,13 +15,21 @@ ! {% if neighbor_addr | ipv4 %} address-family ipv4 +{% if bgp_session["asn"] == bgp_asn %} + 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 bgp_session["asn"] == bgp_asn %} + 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 %} diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/general/peer-group.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/general/peer-group.conf.j2 index 8c02eeacbdb4..b0acd1b2a460 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/general/peer-group.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/general/peer-group.conf.j2 @@ -2,28 +2,38 @@ ! template: bgpd/templates/general/peer-group.conf.j2 ! neighbor PEER_V4 peer-group + neighbor PEER_V4_INT peer-group neighbor PEER_V6 peer-group + neighbor PEER_V6_INT peer-group address-family ipv4 {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor PEER_V4 allowas-in 1 + neighbor PEER_V4_INT allowas-in 1 {% endif %} {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} - neighbor PEER_V4 route-reflector-client + neighbor PEER_V4_INT route-reflector-client {% endif %} neighbor PEER_V4 soft-reconfiguration inbound neighbor PEER_V4 route-map FROM_BGP_PEER_V4 in neighbor PEER_V4 route-map TO_BGP_PEER_V4 out + neighbor PEER_V4_INT soft-reconfiguration inbound + neighbor PEER_V4_INT route-map FROM_BGP_PEER_V4 in + neighbor PEER_V4_INT route-map TO_BGP_PEER_V4 out exit-address-family address-family ipv6 {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor PEER_V6 allowas-in 1 + neighbor PEER_V6_INT allowas-in 1 {% endif %} {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} - neighbor PEER_V6 route-reflector-client + neighbor PEER_V6_INT route-reflector-client {% endif %} neighbor PEER_V6 soft-reconfiguration inbound neighbor PEER_V6 route-map FROM_BGP_PEER_V6 in neighbor PEER_V6 route-map TO_BGP_PEER_V6 out + neighbor PEER_V6_INT soft-reconfiguration inbound + neighbor PEER_V6_INT route-map FROM_BGP_PEER_V6 in + neighbor PEER_V6_INT route-map TO_BGP_PEER_V6 out exit-address-family ! ! end of template: bgpd/templates/general/peer-group.conf.j2 From 2616f36e3b5700a508ac6f888a0a52fbbcc40cef Mon Sep 17 00:00:00 2001 From: Judy Joseph Date: Tue, 19 May 2020 20:36:42 -0700 Subject: [PATCH 2/2] Check for "ASIC" keyword in the hostname to identify the internal neighbors. --- .../frr/bgpd/templates/general/instance.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 index fea6c18f5cd0..aed32d291c76 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/templates/general/instance.conf.j2 @@ -15,7 +15,7 @@ ! {% if neighbor_addr | ipv4 %} address-family ipv4 -{% if bgp_session["asn"] == bgp_asn %} +{% if 'ASIC' in bgp_session['name'] %} neighbor {{ neighbor_addr }} peer-group PEER_V4_INT {% else %} neighbor {{ neighbor_addr }} peer-group PEER_V4 @@ -25,7 +25,7 @@ {% endif %} {% elif neighbor_addr | ipv6 %} address-family ipv6 -{% if bgp_session["asn"] == bgp_asn %} +{% if 'ASIC' in bgp_session['name'] %} neighbor {{ neighbor_addr }} peer-group PEER_V6_INT {% else %} neighbor {{ neighbor_addr }} peer-group PEER_V6