From 66f1cc458dd2277013f6c1d0567b536b57c91127 Mon Sep 17 00:00:00 2001 From: Caitlin Choate <114622132+cchoate54@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:53:14 -0800 Subject: [PATCH] Bugfix #9739: Support when 'bgp_asn' is set to 'None', 'Null', or missing. (#12588) bgpd.main.conf.j2: bugfix-9739 * Update bgpd.main.conf.j2 to gracefully handle the bgp configuration cases for when 'bgp_asn' is set to 'None', 'Null', or missing. How I did it Include a conditional statement to avoid configuring bgp in FRR when 'bgp_asn' is missing or set to 'None' or 'Null' How to verify it Configure 'bgp_asn' as 'None', 'Null' or have it missing from configurations and verify that /etc/frr/bgpd.conf does not have invalid bgp configurations like 'router bgp None' Description for the changelog Update bgpd.main.conf.j2 to gracefully handle the bgp configuration cases for when 'bgp_asn' is set to 'None', 'Null', or missing for bugfix 9739. Signed-off-by: cchoate54@gmail.com --- dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 index b5891b9695..4cee01ac97 100644 --- a/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 +++ b/dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2 @@ -61,6 +61,7 @@ route-map HIDE_INTERNAL permit 20 ! {% endif %} ! +{% if (DEVICE_METADATA is defined) and ('localhost' in DEVICE_METADATA) and ('bgp_asn' in DEVICE_METADATA['localhost']) and (DEVICE_METADATA['localhost']['bgp_asn'].lower() != 'none') and (DEVICE_METADATA['localhost']['bgp_asn'].lower() != 'null') %} router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} ! {% block bgp_init %} @@ -143,6 +144,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} exit-address-family {% endblock maximum_paths %} {% endif %} +{% endif %} ! ! end of template: bgpd/bgpd.main.conf.j2 !