From 689e1d447ae5c774efd7ba32faccd6595cdd35ac Mon Sep 17 00:00:00 2001 From: Manoj Naragund Date: Fri, 31 Mar 2023 03:47:17 -0700 Subject: mgmtd: Fix for issue 13154. The changes involve adding show debuggin command for MGMTd which resolves command incomplete issue. issue #13154 Signed-off-by: Manoj Naragund --- mgmtd/mgmt_vty.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'mgmtd') diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c index 79fa54a79..898eb4391 100644 --- a/mgmtd/mgmt_vty.c +++ b/mgmtd/mgmt_vty.c @@ -386,12 +386,14 @@ static struct cmd_node debug_node = { .config_write = config_write_mgmt_debug, }; -static int config_write_mgmt_debug(struct vty *vty) +static int config_write_mgmt_debug_helper(struct vty *vty, bool config) { int n = mgmt_debug_be + mgmt_debug_fe + mgmt_debug_ds + mgmt_debug_txn; if (!n) return 0; - if (n == 4) { + + if (config && mgmt_debug_be && mgmt_debug_fe && mgmt_debug_ds && + mgmt_debug_txn) { vty_out(vty, "debug mgmt all\n"); return 0; } @@ -411,12 +413,26 @@ static int config_write_mgmt_debug(struct vty *vty) return 0; } -DEFPY(debug_mgmt, - debug_mgmt_cmd, +static int config_write_mgmt_debug(struct vty *vty) +{ + return config_write_mgmt_debug_helper(vty, true); +} + +DEFUN_NOSH(show_debugging_mgmt, show_debugging_mgmt_cmd, + "show debugging [mgmt]", SHOW_STR DEBUG_STR "MGMT Information\n") +{ + vty_out(vty, "MGMT debugging status:\n"); + + config_write_mgmt_debug_helper(vty, false); + + cmd_show_lib_debugs(vty); + + return CMD_SUCCESS; +} + +DEFPY(debug_mgmt, debug_mgmt_cmd, "[no$no] debug mgmt ", - NO_STR - DEBUG_STR - MGMTD_STR + NO_STR DEBUG_STR MGMTD_STR "All debug\n" "Back-end debug\n" "Datastore debug\n" @@ -479,6 +495,8 @@ void mgmt_vty_init(void) install_element(ENABLE_NODE, &mgmt_performance_measurement_cmd); install_element(ENABLE_NODE, &mgmt_reset_performance_stats_cmd); + install_element(ENABLE_NODE, &show_debugging_mgmt_cmd); + /* * TODO: Register and handlers for auto-completion here. */ -- cgit v1.2.3