summaryrefslogtreecommitdiffstats
path: root/mgmtd
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2024-08-29 17:51:53 +0200
committerGitHub <noreply@github.com>2024-08-29 17:51:53 +0200
commit77e1a26faa3c153abf6a8abb858f435914b62625 (patch)
tree1dd71e3d2cdb29b7c406b6a21351b2e89cb50831 /mgmtd
parentMerge pull request #16685 from opensourcerouting/fix/document_reverts (diff)
parentlib: common debug status output (diff)
downloadfrr-77e1a26faa3c153abf6a8abb858f435914b62625.tar.xz
frr-77e1a26faa3c153abf6a8abb858f435914b62625.zip
Merge pull request #16664 from mjstapp/igor_debug_simplify
*: simplify frrlib debug
Diffstat (limited to 'mgmtd')
-rw-r--r--mgmtd/mgmt.c16
-rw-r--r--mgmtd/mgmt_vty.c42
2 files changed, 12 insertions, 46 deletions
diff --git a/mgmtd/mgmt.c b/mgmtd/mgmt.c
index fe0357e7e..cfadad482 100644
--- a/mgmtd/mgmt.c
+++ b/mgmtd/mgmt.c
@@ -15,10 +15,14 @@
#include "mgmtd/mgmt_history.h"
#include "mgmtd/mgmt_memory.h"
-struct debug mgmt_debug_be = { .desc = "Management backend adapter" };
-struct debug mgmt_debug_ds = {.desc = "Management datastore"};
-struct debug mgmt_debug_fe = { .desc = "Management frontend adapter" };
-struct debug mgmt_debug_txn = {.desc = "Management transaction"};
+struct debug mgmt_debug_be = { .conf = "debug mgmt backend",
+ .desc = "Management backend adapter" };
+struct debug mgmt_debug_ds = { .conf = "debug mgmt datastore",
+ .desc = "Management datastore" };
+struct debug mgmt_debug_fe = { .conf = "debug mgmt frontend",
+ .desc = "Management frontend adapter" };
+struct debug mgmt_debug_txn = { .conf = "debug mgmt transaction",
+ .desc = "Management transaction" };
/* MGMTD process wide configuration. */
static struct mgmt_master mgmt_master;
@@ -39,6 +43,10 @@ void mgmt_master_init(struct event_loop *master, const int buffer_size)
void mgmt_init(void)
{
+ debug_install(&mgmt_debug_be);
+ debug_install(&mgmt_debug_ds);
+ debug_install(&mgmt_debug_fe);
+ debug_install(&mgmt_debug_txn);
/* Initialize datastores */
mgmt_ds_init(mm);
diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c
index 8ccb46357..876f70356 100644
--- a/mgmtd/mgmt_vty.c
+++ b/mgmtd/mgmt_vty.c
@@ -557,52 +557,11 @@ DEFPY(mgmt_rollback,
return CMD_SUCCESS;
}
-int config_write_mgmt_debug(struct vty *vty);
-static struct cmd_node debug_node = {
- .name = "mgmt debug",
- .node = DEBUG_NODE,
- .prompt = "",
- .config_write = config_write_mgmt_debug,
-};
-
-static int write_mgmt_debug_helper(struct vty *vty, bool config)
-{
- uint32_t mode = config ? DEBUG_MODE_CONF : DEBUG_MODE_ALL;
- bool be = DEBUG_MODE_CHECK(&mgmt_debug_be, mode);
- bool ds = DEBUG_MODE_CHECK(&mgmt_debug_ds, mode);
- bool fe = DEBUG_MODE_CHECK(&mgmt_debug_fe, mode);
- bool txn = DEBUG_MODE_CHECK(&mgmt_debug_txn, mode);
-
- if (!(be || ds || fe || txn))
- return 0;
-
- vty_out(vty, "debug mgmt");
- if (be)
- vty_out(vty, " backend");
- if (ds)
- vty_out(vty, " datastore");
- if (fe)
- vty_out(vty, " frontend");
- if (txn)
- vty_out(vty, " transaction");
-
- vty_out(vty, "\n");
-
- return 0;
-}
-
-int config_write_mgmt_debug(struct vty *vty)
-{
- return write_mgmt_debug_helper(vty, true);
-}
-
DEFPY_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");
- write_mgmt_debug_helper(vty, false);
-
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
@@ -696,7 +655,6 @@ void mgmt_vty_init(void)
event_add_event(mm->master, mgmt_config_read_in, NULL, 0,
&mgmt_daemon_info->read_in);
- install_node(&debug_node);
install_node(&mgmtd_node);
install_element(VIEW_NODE, &show_mgmt_be_adapter_cmd);