From 3445bb57a4a0aeec259d60c6bfa5ab8c7988f6c2 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Mon, 10 Nov 2025 02:14:25 +0100 Subject: [PATCH] Wrap some sanity stats/warnings around the apply command --- vppcfg/vpp/applier.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/vppcfg/vpp/applier.py b/vppcfg/vpp/applier.py index 51b4525..7297383 100644 --- a/vppcfg/vpp/applier.py +++ b/vppcfg/vpp/applier.py @@ -45,13 +45,29 @@ class Applier(VPPApi): """Apply the commands from self.cli to the cli_inband API call. Will eventually be replaced with actual API calls.""" + cli_calls = 0 + cli_success = 0 for phase, cmds in self.cli.items(): for cmd in cmds: + cli_calls += 1 + self.logger.debug(f"{phase}: {cmd}") ret = self.cli_inband(cmd=cmd) - if ret == False: - self.logger.error("VPP returned error, bailing") - return ret self.logger.debug(f"Retval: {ret}") + if ret is False: + self.logger.error("VPP returned error") + elif ret.retval == 0: + cli_success += 1 + else: + self.logger.warning(f"VPP {cmd} returned {ret}") + + if cli_calls == 0: + self.logger.info("Nothing to do") + return True + + self.logger.info(f"VPP API calls: {cli_calls}, success: {cli_success}") + if cli_calls != cli_success: + self.logger.warning("Not all VPP calls were successful!") + return False return True