]> git.puffer.fish Git - mirror/frr.git/commit
tools: fix bgp instances deletion in frr-reload
authorChirag Shah <chirag@nvidia.com>
Sat, 4 Dec 2021 21:27:29 +0000 (13:27 -0800)
committerChirag Shah <chirag@nvidia.com>
Sat, 23 Apr 2022 19:49:47 +0000 (12:49 -0700)
commitd2acc328bd776f31638d957444ea610eb7e4d132
tree8e29c477aa042fb63fc774c2b24d47e4cf48b1cc
parentc27892b24d21762f3cd4276fa2cca75c958f9b15
tools: fix bgp instances deletion in frr-reload

BGPd does not allow default instance deletion
in presence of bgp vrf instance;
frr-reload script fails if delete list contains
default instance followed by vrf instance.

Fix:
frr-reload scans lines_to_delete to look for
'router bgp' and 'router bgp vrf ...' line.
If both are present switch the order to delete
bgp vrf instance(s) than default instance at the end.

Testing Done:

Before:

  INFO: Loading Config object from file /etc/frr/frr.conf
  INFO: Loading Config object from vtysh show running
  INFO: Failed to execute no router bgp 40201 <-- Failed to delete
  INFO: Failed to execute no router bgp
  INFO: Failed to execute no router
 ERROR: "no router" we failed to remove this command
 ERROR: % Cannot delete default BGP instance. Dependent VRF instances exist

  INFO: Executed "no router bgp 40201 vrf bgp-test" <-- vrf instance deleted
  INFO: Loading Config object from vtysh show running

After:
  order of deletion switched

  INFO: Loading Config object from file /etc/frr/frr.conf
  INFO: Loading Config object from vtysh show running
  INFO: Executed "no router bgp 40201 vrf bgp-test"
  INFO: Executed "no router bgp 40201"
  INFO: Loading Config object from vtysh show running

Signed-off-by: Chirag Shah <chirag@nvidia.com>
tools/frr-reload.py