diff options
-rw-r--r-- | packages/frr/patches/0002-tools-Mark-reload-failure-when-no-form-cli-fails.patch | 34 | ||||
-rw-r--r-- | packages/frr/patches/0003-tools-frr-reload-capture-vtysh-msg-upon-failure.patch | 76 |
2 files changed, 110 insertions, 0 deletions
diff --git a/packages/frr/patches/0002-tools-Mark-reload-failure-when-no-form-cli-fails.patch b/packages/frr/patches/0002-tools-Mark-reload-failure-when-no-form-cli-fails.patch new file mode 100644 index 00000000..f56b7509 --- /dev/null +++ b/packages/frr/patches/0002-tools-Mark-reload-failure-when-no-form-cli-fails.patch @@ -0,0 +1,34 @@ +From b094c63ef001019ce4da0d3677df3e2c526a6f97 Mon Sep 17 00:00:00 2001 +From: Chirag Shah <chirag@nvidia.com> +Date: Fri, 26 Feb 2021 08:31:07 -0800 +Subject: [PATCH] tools: Mark reload failure when no form cli fails + +if no form of the cli fails to execute, mark frr-reload +as failure so return code can be nonzero. +The similar approach is done for non no-form (add case) of the cli. + +Ticket:CM-33345 +Reviewed By:CCR-11287 +Testing Done: + +Signed-off-by: Chirag Shah <chirag@nvidia.com> + +(cherry picked from commit f26070fc07a279d3a616e8f2d5d05069625f6de5) +--- + tools/frr-reload.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/frr-reload.py b/tools/frr-reload.py +index a3aed7719..da240e919 100755 +--- a/tools/frr-reload.py ++++ b/tools/frr-reload.py +@@ -1575,6 +1575,7 @@ if __name__ == '__main__': + + if len(last_arg) <= 2: + log.error('"%s" we failed to remove this command', ' -- '.join(original_cmd)) ++ reload_ok = False + break + + new_last_arg = last_arg[0:-1] +-- +2.20.1 diff --git a/packages/frr/patches/0003-tools-frr-reload-capture-vtysh-msg-upon-failure.patch b/packages/frr/patches/0003-tools-frr-reload-capture-vtysh-msg-upon-failure.patch new file mode 100644 index 00000000..cbd1acb0 --- /dev/null +++ b/packages/frr/patches/0003-tools-frr-reload-capture-vtysh-msg-upon-failure.patch @@ -0,0 +1,76 @@ +From 0c202b5867a17936200e40b44a55a2c842e15bb2 Mon Sep 17 00:00:00 2001 +From: Chirag Shah <chirag@nvidia.com> +Date: Thu, 4 Mar 2021 21:21:13 -0800 +Subject: [PATCH] tools: frr-reload capture vtysh msg upon failure + +Log vtysh message for a failed command. + +Ticket:2556706 +Reviewed By: +Testing Done: + +frr reload fails to delete default bgp instance in presence of bgp vrf +instance(s), it captures vtysh message and logs in frr-reload.log + +logs backend +2021-03-05 05:16:45,623 INFO: Failed to execute no router bgp 5544 +2021-03-05 05:16:45,735 INFO: Failed to execute no router bgp +2021-03-05 05:16:45,846 INFO: Failed to execute no router +2021-03-05 05:16:45,846 ERROR: "no router" we failed to remove this +command +2021-03-05 05:16:45,847 ERROR: % Cannot delete default BGP instance. +Dependent VRF instances exist + +Signed-off-by: Chirag Shah <chirag@nvidia.com> + +(cherry picked from commit 641b032e23e614cec8dcbeb993a61f2ff08dfde2) +--- + tools/frr-reload.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tools/frr-reload.py b/tools/frr-reload.py +index da240e919..e99bd2214 100755 +--- a/tools/frr-reload.py ++++ b/tools/frr-reload.py +@@ -92,7 +92,7 @@ class Vtysh(object): + args = ['-c', command] + return self._call(args, stdin, stdout, stderr) + +- def __call__(self, command): ++ def __call__(self, command, stdouts=None): + """ + Call a CLI command (e.g. "show running-config") + +@@ -102,6 +102,8 @@ class Vtysh(object): + proc = self._call_cmd(command, stdout=subprocess.PIPE) + stdout, stderr = proc.communicate() + if proc.wait() != 0: ++ if stdouts is not None: ++ stdouts.append(stdout.decode('UTF-8')) + raise VtyshException('vtysh returned status %d for command "%s"' + % (proc.returncode, command)) + return stdout.decode('UTF-8') +@@ -1560,9 +1562,10 @@ if __name__ == '__main__': + # frr(config-if)# no ip ospf authentication + # frr(config-if)# + ++ stdouts = [] + while True: + try: +- vtysh(['configure'] + cmd) ++ vtysh(['configure'] + cmd, stdouts) + + except VtyshException: + +@@ -1575,6 +1578,9 @@ if __name__ == '__main__': + + if len(last_arg) <= 2: + log.error('"%s" we failed to remove this command', ' -- '.join(original_cmd)) ++ # Log first error msg for original_cmd ++ if stdouts: ++ log.error(stdouts[0]) + reload_ok = False + break + +-- +2.20.1 |