From fb943df10be084cfd7ed3e7c9666dd58ed32829b Mon Sep 17 00:00:00 2001 From: Kuldeep Kashyap Date: Mon, 23 May 2022 16:52:16 -0700 Subject: [PATCH] tests: [Topojson] Enhance CLI logging As of now we are logging only JSON output of CLIs in topotests(topojson) executions and same o/p is getting printed twice, which is of no use. Enhanced code to show both plain and JSON output of CLIs and remove duplicate logging. It will help in reducing execution logs and in verification, if sometimes there is mis-match in CLI plain and JSON outputs. Signed-off-by: Kuldeep Kashyap --- tests/topotests/lib/common_config.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 3f70dbddf7..a7d8b2c9b5 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -225,17 +225,9 @@ def run_frr_cmd(rnode, cmd, isjson=False): if cmd: ret_data = rnode.vtysh_cmd(cmd, isjson=isjson) - if True: - if isjson: - print_data = json.dumps(ret_data) - else: - print_data = ret_data - logger.info( - "Output for command [%s] on router %s:\n%s", - cmd, - rnode.name, - print_data, - ) + if isjson: + rnode.vtysh_cmd(cmd.rstrip("json"), isjson=False) + return ret_data else: -- 2.39.5