From b2027b99e82a7c9b113dc529e39f8aebac3dda02 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Fri, 9 Apr 2021 11:33:43 +0200
Subject: bgp: T3463: Jinja2 template re-ordering fir ebgp-requires-policy

This is a fix for commit 6f6f45c5 ("bgp: T3463: change no-ipv4-unicast order
when applying configuration") as this changed the handling of the "else" path,
which lead to failing smoketests as the "no bgp ebgp-requires-policy" option
was no longer set.
---
 data/templates/frr/bgp.frr.tmpl | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index 1cc876f20..cbf83e3fd 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -186,16 +186,14 @@
 {% endmacro %}
 !
 router bgp {{ local_as }} {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
-{% if parameters is defined %}
-{%   if parameters.ebgp_requires_policy is defined %}
+{% if parameters is defined and parameters.ebgp_requires_policy is defined %}
  bgp ebgp-requires-policy
-{%   else %}
+{% else %}
  no bgp ebgp-requires-policy
-{%   endif %}
-{%   if parameters.default is defined and parameters.default.no_ipv4_unicast is defined %}
+{% endif %}
+{% if parameters is defined and parameters.default is defined and parameters.default.no_ipv4_unicast is defined %}
 {#   Option must be set before any neighbor - see https://phabricator.vyos.net/T3463 #}
  no bgp default ipv4-unicast
-{%   endif %}
 {% endif %}
 {# Workaround for T2100 until we have decided about a migration script #}
  no bgp network import-check
-- 
cgit v1.2.3