From e2e597fe518c95fdc0b717d98cf3354e28889ef5 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Tue, 26 Mar 2024 19:24:45 +0200 Subject: [PATCH] lib: common debug config output Implement common code for debug config output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov --- lib/command.h | 4 +-- lib/debug.c | 21 ++++++++++++ lib/debug.h | 4 +++ lib/mgmt_be_client.c | 17 +--------- lib/mgmt_fe_client.c | 17 +--------- lib/northbound.h | 1 - lib/northbound_cli.c | 57 ++++++++------------------------ lib/northbound_sysrepo.c | 14 ++------ mgmtd/mgmt.c | 12 ++++--- mgmtd/mgmt_vty.c | 14 -------- pathd/path_cli.c | 12 ------- pathd/path_pcep.c | 8 ++--- pathd/path_pcep_cli.c | 17 ---------- pathd/path_ted.c | 15 ++------- pathd/pathd.c | 5 ++- pbrd/pbr_debug.c | 14 +++----- pbrd/pbr_debug.h | 8 ----- pbrd/pbr_vty.c | 8 ----- staticd/static_debug.c | 11 ++---- staticd/static_debug.h | 8 ----- staticd/static_vty.c | 8 ----- tests/lib/cli/test_cli.refout.in | 2 -- vrrpd/vrrp_debug.c | 19 ++++------- vrrpd/vrrp_debug.h | 8 ----- vrrpd/vrrp_vty.c | 8 ----- vtysh/vtysh_config.c | 15 ++------- 26 files changed, 79 insertions(+), 248 deletions(-) diff --git a/lib/command.h b/lib/command.h index ef1815c0bd51..288443ad77a6 100644 --- a/lib/command.h +++ b/lib/command.h @@ -84,14 +84,12 @@ enum node_type { CONFIG_NODE, /* Config node. Default mode of config file. */ PREFIX_NODE, /* ip prefix-list node. */ PREFIX_IPV6_NODE, /* ipv6 prefix-list node. */ + LIB_DEBUG_NODE, /* frrlib debug node. */ DEBUG_NODE, /* Debug node. */ VRF_DEBUG_NODE, /* Vrf Debug node. */ - NORTHBOUND_DEBUG_NODE, /* Northbound Debug node. */ DEBUG_VNC_NODE, /* Debug VNC node. */ RMAP_DEBUG_NODE, /* Route-map debug node */ RESOLVER_DEBUG_NODE, /* Resolver debug node */ - MGMT_BE_DEBUG_NODE, /* mgmtd backend-client debug node */ - MGMT_FE_DEBUG_NODE, /* mgmtd frontend-client debug node */ AAA_NODE, /* AAA node. */ EXTLOG_NODE, /* RFC5424 & co. extended syslog */ KEYCHAIN_NODE, /* Key-chain node. */ diff --git a/lib/debug.c b/lib/debug.c index 4a0dfb893727..043fad345099 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -35,6 +35,25 @@ DEFUN_NOSH(debug_all, debug_all_cmd, "[no] debug all", /* ------------------------------------------------------------------------- */ +static int config_write_debug(struct vty *vty) +{ + struct debug *debug; + + frr_each (debug_list, &debug_head, debug) { + if (DEBUG_MODE_CHECK(debug, DEBUG_MODE_CONF)) + vty_out(vty, "%s\n", debug->conf); + } + + return 0; +} + +static struct cmd_node debug_node = { + .name = "debug", + .node = LIB_DEBUG_NODE, + .prompt = "", + .config_write = config_write_debug, +}; + void debug_install(struct debug *debug) { debug_list_add_tail(&debug_head, debug); @@ -44,6 +63,8 @@ void debug_init(void) { debug_list_init(&debug_head); + install_node(&debug_node); + install_element(ENABLE_NODE, &debug_all_cmd); install_element(CONFIG_NODE, &debug_all_cmd); } diff --git a/lib/debug.h b/lib/debug.h index 90385d87d94f..60f42e30712b 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -64,11 +64,15 @@ PREDECL_LIST(debug_list); * manipulate the flags field in a multithreaded environment results in * undefined behavior. * + * conf + * The configuration string that will be written to the config file. + * * desc * Human-readable description of this debugging record. */ struct debug { atomic_uint_fast32_t flags; + const char *conf; const char *desc; struct debug_list_item item; diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index 45defa8bbb81..91f2208f96f0 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -116,6 +116,7 @@ struct mgmt_be_client { frr_each_safe (mgmt_be_txns, &(client_ctx)->txn_head, (txn)) struct debug mgmt_dbg_be_client = { + .conf = "debug mgmt client backend", .desc = "Management backend client operations" }; @@ -1115,27 +1116,12 @@ DEFPY(debug_mgmt_client_be, debug_mgmt_client_be_cmd, return CMD_SUCCESS; } -static int mgmt_debug_be_client_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&mgmt_dbg_be_client, DEBUG_MODE_CONF)) - vty_out(vty, "debug mgmt client backend\n"); - - return 1; -} - void mgmt_debug_be_client_show_debug(struct vty *vty) { if (debug_check_be_client()) vty_out(vty, "debug mgmt client backend\n"); } -static struct cmd_node mgmt_dbg_node = { - .name = "debug mgmt client backend", - .node = MGMT_BE_DEBUG_NODE, - .prompt = "", - .config_write = mgmt_debug_be_client_config_write, -}; - struct mgmt_be_client *mgmt_be_client_create(const char *client_name, struct mgmt_be_client_cbs *cbs, uintptr_t user_data, @@ -1183,7 +1169,6 @@ void mgmt_be_client_lib_vty_init(void) { debug_install(&mgmt_dbg_be_client); - install_node(&mgmt_dbg_node); install_element(ENABLE_NODE, &debug_mgmt_client_be_cmd); install_element(CONFIG_NODE, &debug_mgmt_client_be_cmd); } diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index 8c12722b6339..0308d70a7eaa 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -49,6 +49,7 @@ struct mgmt_fe_client { frr_each_safe (mgmt_sessions, &(client)->sessions, (session)) struct debug mgmt_dbg_fe_client = { + .conf = "debug mgmt client frontend", .desc = "Management frontend client operations" }; @@ -706,27 +707,12 @@ DEFPY(debug_mgmt_client_fe, debug_mgmt_client_fe_cmd, return CMD_SUCCESS; } -static int mgmt_debug_fe_client_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&mgmt_dbg_fe_client, DEBUG_MODE_CONF)) - vty_out(vty, "debug mgmt client frontend\n"); - - return CMD_SUCCESS; -} - void mgmt_debug_fe_client_show_debug(struct vty *vty) { if (debug_check_fe_client()) vty_out(vty, "debug mgmt client frontend\n"); } -static struct cmd_node mgmt_dbg_node = { - .name = "debug mgmt client frontend", - .node = MGMT_FE_DEBUG_NODE, - .prompt = "", - .config_write = mgmt_debug_fe_client_config_write, -}; - /* * Initialize library and try connecting with MGMTD. */ @@ -769,7 +755,6 @@ void mgmt_fe_client_lib_vty_init(void) { debug_install(&mgmt_dbg_fe_client); - install_node(&mgmt_dbg_node); install_element(ENABLE_NODE, &debug_mgmt_client_fe_cmd); install_element(CONFIG_NODE, &debug_mgmt_client_fe_cmd); } diff --git a/lib/northbound.h b/lib/northbound.h index 9dd6d38ebb5b..1f7af65612cb 100644 --- a/lib/northbound.h +++ b/lib/northbound.h @@ -805,7 +805,6 @@ DECLARE_HOOK(nb_notification_send, (const char *xpath, struct list *arguments), (xpath, arguments)); DECLARE_HOOK(nb_notification_tree_send, (const char *xpath, const struct lyd_node *tree), (xpath, tree)); -DECLARE_HOOK(nb_client_debug_config_write, (struct vty *vty), (vty)); /* Northbound debugging records */ extern struct debug nb_dbg_cbs_config; diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 49f4cf8ec06b..39c092a20733 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -22,13 +22,19 @@ #include "northbound_db.h" #include "lib/northbound_cli_clippy.c" -struct debug nb_dbg_cbs_config = {0, "Northbound callbacks: configuration"}; -struct debug nb_dbg_cbs_state = {0, "Northbound callbacks: state"}; -struct debug nb_dbg_cbs_rpc = {0, "Northbound callbacks: RPCs"}; -struct debug nb_dbg_cbs_notify = {0, "Northbound callbacks: notifications"}; -struct debug nb_dbg_notif = {0, "Northbound notifications"}; -struct debug nb_dbg_events = {0, "Northbound events"}; -struct debug nb_dbg_libyang = {0, "libyang debugging"}; +struct debug nb_dbg_cbs_config = { 0, "debug northbound callbacks configuration", + "Northbound callbacks: configuration" }; +struct debug nb_dbg_cbs_state = { 0, "debug northbound callbacks state", + "Northbound callbacks: state" }; +struct debug nb_dbg_cbs_rpc = { 0, "debug northbound callbacks rpc", + "Northbound callbacks: RPCs" }; +struct debug nb_dbg_cbs_notify = { 0, "debug northbound callbacks notify", + "Northbound callbacks: notifications" }; +struct debug nb_dbg_notif = { 0, "debug northbound notifications", + "Northbound notifications" }; +struct debug nb_dbg_events = { 0, "debug northbound events", + "Northbound events" }; +struct debug nb_dbg_libyang = { 0, "debug northbound libyang", "libyang" }; struct nb_config *vty_shared_candidate_config; static struct event_loop *master; @@ -1771,22 +1777,6 @@ DEFPY (rollback_config, } /* Debug CLI commands. */ -static struct debug *nb_debugs[] = { - &nb_dbg_cbs_config, &nb_dbg_cbs_state, &nb_dbg_cbs_rpc, - &nb_dbg_cbs_notify, &nb_dbg_notif, &nb_dbg_events, - &nb_dbg_libyang, -}; - -static const char *const nb_debugs_conflines[] = { - "debug northbound callbacks configuration", - "debug northbound callbacks state", - "debug northbound callbacks rpc", - "debug northbound callbacks notify", - "debug northbound notifications", - "debug northbound events", - "debug northbound libyang", -}; - DEFPY (debug_nb, debug_nb_cmd, "[no] debug northbound\ @@ -1839,26 +1829,6 @@ DEFPY (debug_nb, return CMD_SUCCESS; } -DEFINE_HOOK(nb_client_debug_config_write, (struct vty *vty), (vty)); - -static int nb_debug_config_write(struct vty *vty) -{ - for (unsigned int i = 0; i < array_size(nb_debugs); i++) - if (DEBUG_MODE_CHECK(nb_debugs[i], DEBUG_MODE_CONF)) - vty_out(vty, "%s\n", nb_debugs_conflines[i]); - - hook_call(nb_client_debug_config_write, vty); - - return 1; -} - -static struct cmd_node nb_debug_node = { - .name = "northbound debug", - .node = NORTHBOUND_DEBUG_NODE, - .prompt = "", - .config_write = nb_debug_config_write, -}; - void nb_cli_install_default(int node) { _install_element(node, &show_config_candidate_section_cmd); @@ -1927,7 +1897,6 @@ void nb_cli_init(struct event_loop *tm) debug_install(&nb_dbg_events); debug_install(&nb_dbg_libyang); - install_node(&nb_debug_node); install_element(ENABLE_NODE, &debug_nb_cmd); install_element(CONFIG_NODE, &debug_nb_cmd); diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 21291857adf3..23cc0e2b92ec 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -19,7 +19,9 @@ #include #include -static struct debug nb_dbg_client_sysrepo = {0, "Northbound client: Sysrepo"}; +static struct debug nb_dbg_client_sysrepo = { 0, + "debug northbound client sysrepo", + "Northbound client: Sysrepo" }; static struct event_loop *master; static sr_session_ctx_t *session; @@ -606,18 +608,8 @@ DEFUN (debug_nb_sr, return CMD_SUCCESS; } -static int frr_sr_debug_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&nb_dbg_client_sysrepo, DEBUG_MODE_CONF)) - vty_out(vty, "debug northbound client sysrepo\n"); - - return 0; -} - static void frr_sr_cli_init(void) { - hook_register(nb_client_debug_config_write, frr_sr_debug_config_write); - debug_install(&nb_dbg_client_sysrepo); install_element(ENABLE_NODE, &debug_nb_sr_cmd); diff --git a/mgmtd/mgmt.c b/mgmtd/mgmt.c index b73649bab0be..846c58f270e9 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 adapater"}; -struct debug mgmt_debug_ds = {.desc = "Management datastore"}; -struct debug mgmt_debug_fe = {.desc = "Management frontend adapater"}; -struct debug mgmt_debug_txn = {.desc = "Management transaction"}; +struct debug mgmt_debug_be = { .conf = "debug mgmt backend", + .desc = "Management backend adapater" }; +struct debug mgmt_debug_ds = { .conf = "debug mgmt datastore", + .desc = "Management datastore" }; +struct debug mgmt_debug_fe = { .conf = "debug mgmt frontend", + .desc = "Management frontend adapater" }; +struct debug mgmt_debug_txn = { .conf = "debug mgmt transaction", + .desc = "Management transaction" }; /* MGMTD process wide configuration. */ static struct mgmt_master mgmt_master; diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c index 2cd24719bc04..8b0b2efee28b 100644 --- a/mgmtd/mgmt_vty.c +++ b/mgmtd/mgmt_vty.c @@ -484,14 +484,6 @@ 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; @@ -518,11 +510,6 @@ static int write_mgmt_debug_helper(struct vty *vty, bool config) 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") { @@ -623,7 +610,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); diff --git a/pathd/path_cli.c b/pathd/path_cli.c index 700d1db8cbd2..754fdf7a62a0 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -1305,20 +1305,8 @@ int config_write_segment_routing(struct vty *vty) return 1; } -static int path_policy_cli_debug_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&path_policy_debug, DEBUG_MODE_CONF)) { - vty_out(vty, "debug pathd policy\n"); - return 1; - } - return 0; -} - void path_cli_init(void) { - hook_register(nb_client_debug_config_write, - path_policy_cli_debug_config_write); - debug_install(&path_policy_debug); install_node(&segment_routing_node); diff --git a/pathd/path_pcep.c b/pathd/path_pcep.c index 65ee2b5a5f5c..a0a53b0d8475 100644 --- a/pathd/path_pcep.c +++ b/pathd/path_pcep.c @@ -32,10 +32,10 @@ DEFINE_MTYPE(PATHD, PCEP, "PCEP module"); * Globals. */ static struct pcep_glob pcep_glob_space = { - .dbg_basic = {0, "PCEP basic"}, - .dbg_path = {0, "PCEP path"}, - .dbg_msg = {0, "PCEP message"}, - .dbg_lib = {0, "PCEP lib"}, + .dbg_basic = { 0, "debug pathd pcep basic", "PCEP basic" }, + .dbg_path = { 0, "debug pathd pcep path", "PCEP path" }, + .dbg_msg = { 0, "debug pathd pcep message", "PCEP message" }, + .dbg_lib = { 0, "debug pathd pcep pceplib", "PCEP lib" }, }; struct pcep_glob *pcep_g = &pcep_glob_space; diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 1e0d52e38d79..4294b51c57dc 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -46,7 +46,6 @@ #define BUFFER_PCC_PCE_SIZE 1024 /* CLI Function declarations */ -static int pcep_cli_debug_config_write(struct vty *vty); static int pcep_cli_pcep_config_write(struct vty *vty); static int pcep_cli_pcc_config_write(struct vty *vty); static int pcep_cli_pce_config_write(struct vty *vty); @@ -1695,20 +1694,6 @@ static int path_pcep_cli_clear_srte_pcep_session(struct vty *vty, * Config Write functions */ -int pcep_cli_debug_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&pcep_g->dbg_basic, DEBUG_MODE_CONF)) - vty_out(vty, "debug pathd pcep basic\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_path, DEBUG_MODE_CONF)) - vty_out(vty, "debug pathd pcep path\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_msg, DEBUG_MODE_CONF)) - vty_out(vty, "debug pathd pcep message\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_lib, DEBUG_MODE_CONF)) - vty_out(vty, "debug pathd pcep pceplib\n"); - - return 0; -} - int pcep_cli_pcep_config_write(struct vty *vty) { vty_out(vty, " pcep\n"); @@ -2331,8 +2316,6 @@ DEFPY(pcep_cli_clear_srte_pcep_session, void pcep_cli_init(void) { hook_register(pathd_srte_config_write, pcep_cli_pcep_config_write); - hook_register(nb_client_debug_config_write, - pcep_cli_debug_config_write); debug_install(&pcep_g->dbg_basic); debug_install(&pcep_g->dbg_path); diff --git a/pathd/path_ted.c b/pathd/path_ted.c index 470a973ae29e..88cda791870c 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -30,11 +30,11 @@ static uint32_t path_ted_stop_importing_igp(void); static enum zclient_send_status path_ted_link_state_sync(void); static void path_ted_timer_handler_sync(struct event *thread); static void path_ted_timer_handler_refresh(struct event *thread); -static int path_ted_cli_debug_config_write(struct vty *vty); extern struct zclient *zclient; -struct ted_state ted_state_g = {}; +struct ted_state ted_state_g = { .dbg = { .conf = "debug pathd mpls-te", + .desc = "Pathd TED" } }; /* * path_path_ted public API function implementations @@ -467,14 +467,6 @@ DEFPY (show_pathd_ted_db, * Config Write functions */ -int path_ted_cli_debug_config_write(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&ted_state_g.dbg, DEBUG_MODE_CONF)) { - vty_out(vty, "debug pathd mpls-te\n"); - return 1; - } - return 0; -} void path_ted_show_debugging(struct vty *vty) { @@ -528,9 +520,6 @@ static void path_ted_register_vty(void) install_element(CONFIG_NODE, &debug_path_ted_cmd); install_element(ENABLE_NODE, &debug_path_ted_cmd); - hook_register(nb_client_debug_config_write, - path_ted_cli_debug_config_write); - debug_install(&ted_state_g.dbg); } diff --git a/pathd/pathd.c b/pathd/pathd.c index 97c081708c28..65442cdd16df 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -33,7 +33,10 @@ DEFINE_HOOK(pathd_candidate_updated, (struct srte_candidate * candidate), DEFINE_HOOK(pathd_candidate_removed, (struct srte_candidate * candidate), (candidate)); -struct debug path_policy_debug; +struct debug path_policy_debug = { + .conf = "debug pathd policy", + .desc = "Pathd policy", +}; #define PATH_POLICY_DEBUG(fmt, ...) \ DEBUGD(&path_policy_debug, "policy: " fmt, ##__VA_ARGS__) diff --git a/pbrd/pbr_debug.c b/pbrd/pbr_debug.c index eca2802e98f9..027f1e2c5c17 100644 --- a/pbrd/pbr_debug.c +++ b/pbrd/pbr_debug.c @@ -13,10 +13,11 @@ #include "pbrd/pbr_debug_clippy.c" #include "pbrd/pbr_debug.h" -struct debug pbr_dbg_map = {0, "PBR map"}; -struct debug pbr_dbg_zebra = {0, "PBR Zebra communications"}; -struct debug pbr_dbg_nht = {0, "PBR nexthop tracking"}; -struct debug pbr_dbg_event = {0, "PBR events"}; +struct debug pbr_dbg_map = { 0, "debug pbr map", "PBR map" }; +struct debug pbr_dbg_zebra = { 0, "debug pbr zebra", + "PBR Zebra communications" }; +struct debug pbr_dbg_nht = { 0, "debug pbr nht", "PBR nexthop tracking" }; +struct debug pbr_dbg_event = { 0, "debug pbr events", "PBR events" }; struct debug *pbr_debugs[] = {&pbr_dbg_map, &pbr_dbg_zebra, &pbr_dbg_nht, &pbr_dbg_event}; @@ -41,11 +42,6 @@ int pbr_debug_config_write_helper(struct vty *vty, bool config) return 0; } -int pbr_debug_config_write(struct vty *vty) -{ - return pbr_debug_config_write_helper(vty, true); -} - void pbr_debug_init(void) { debug_install(&pbr_dbg_map); diff --git a/pbrd/pbr_debug.h b/pbrd/pbr_debug.h index 09109971d2ab..101c6986b3af 100644 --- a/pbrd/pbr_debug.h +++ b/pbrd/pbr_debug.h @@ -49,12 +49,4 @@ void pbr_debug_set_all(uint32_t flags, bool set); */ int pbr_debug_config_write_helper(struct vty *vty, bool config); -/* - * Print PBR debugging configuration. - * - * vty - * VTY to print debugging configuration to. - */ -int pbr_debug_config_write(struct vty *vty); - #endif /* __PBR_DEBUG_H__ */ diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 4378a3f414a4..d08310ca8194 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -1954,13 +1954,6 @@ DEFPY (show_pbr_interface, /* PBR debugging CLI ------------------------------------------------------- */ -static struct cmd_node debug_node = { - .name = "debug", - .node = DEBUG_NODE, - .prompt = "", - .config_write = pbr_debug_config_write, -}; - DEFPY(debug_pbr, debug_pbr_cmd, "[no] debug pbr [{map$map|zebra$zebra|nht$nht|events$events}]", @@ -2195,7 +2188,6 @@ void pbr_vty_init(void) install_node(&pbr_map_node); /* debug */ - install_node(&debug_node); install_element(ENABLE_NODE, &debug_pbr_cmd); install_element(CONFIG_NODE, &debug_pbr_cmd); install_element(ENABLE_NODE, &show_debugging_pbr_cmd); diff --git a/staticd/static_debug.c b/staticd/static_debug.c index 045c0d5b05fb..7e70271063cd 100644 --- a/staticd/static_debug.c +++ b/staticd/static_debug.c @@ -19,9 +19,9 @@ */ /* clang-format off */ -struct debug static_dbg_events = {0, "Staticd events"}; -struct debug static_dbg_route = {0, "Staticd route"}; -struct debug static_dbg_bfd = {0, "Staticd bfd"}; +struct debug static_dbg_events = {0, "debug static events", "Staticd events"}; +struct debug static_dbg_route = {0, "debug static route", "Staticd route"}; +struct debug static_dbg_bfd = {0, "debug static bfd", "Staticd bfd"}; struct debug *static_debug_arr[] = { &static_dbg_events, @@ -50,11 +50,6 @@ static int static_debug_config_write_helper(struct vty *vty, bool config) return 0; } -int static_config_write_debug(struct vty *vty) -{ - return static_debug_config_write_helper(vty, true); -} - int static_debug_status_write(struct vty *vty) { return static_debug_config_write_helper(vty, false); diff --git a/staticd/static_debug.h b/staticd/static_debug.h index c9100680f714..347f38b63956 100644 --- a/staticd/static_debug.h +++ b/staticd/static_debug.h @@ -28,14 +28,6 @@ extern struct debug static_dbg_bfd; */ void static_debug_init(void); -/* - * Print staticd debugging configuration. - * - * vty - * VTY to print debugging configuration to. - */ -int static_config_write_debug(struct vty *vty); - /* * Print staticd debugging configuration, human readable form. * diff --git a/staticd/static_vty.c b/staticd/static_vty.c index a18028ed087c..65c87368822d 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -1646,19 +1646,11 @@ DEFUN_NOSH (show_debugging_static, return CMD_SUCCESS; } -static struct cmd_node debug_node = { - .name = "debug", - .node = DEBUG_NODE, - .prompt = "", - .config_write = static_config_write_debug, -}; - #endif /* ifndef INCLUDE_MGMTD_CMDDEFS_ONLY */ void static_vty_init(void) { #ifndef INCLUDE_MGMTD_CMDDEFS_ONLY - install_node(&debug_node); install_element(ENABLE_NODE, &debug_staticd_cmd); install_element(CONFIG_NODE, &debug_staticd_cmd); install_element(ENABLE_NODE, &show_debugging_static_cmd); diff --git a/tests/lib/cli/test_cli.refout.in b/tests/lib/cli/test_cli.refout.in index 84365810d511..222abcdadec2 100644 --- a/tests/lib/cli/test_cli.refout.in +++ b/tests/lib/cli/test_cli.refout.in @@ -409,7 +409,6 @@ domainname test.domain ! ! ! -! end test# conf t test(config)# hostname foohost @@ -425,7 +424,6 @@ domainname test.domain ! ! ! -! end foohost(config)# end. diff --git a/vrrpd/vrrp_debug.c b/vrrpd/vrrp_debug.c index ebaeca27d398..ccb0803c0c81 100644 --- a/vrrpd/vrrp_debug.c +++ b/vrrpd/vrrp_debug.c @@ -13,13 +13,13 @@ #include "vrrp_debug.h" /* clang-format off */ -struct debug vrrp_dbg_arp = {0, "VRRP ARP"}; -struct debug vrrp_dbg_auto = {0, "VRRP autoconfiguration events"}; -struct debug vrrp_dbg_ndisc = {0, "VRRP Neighbor Discovery"}; -struct debug vrrp_dbg_pkt = {0, "VRRP packets"}; -struct debug vrrp_dbg_proto = {0, "VRRP protocol events"}; -struct debug vrrp_dbg_sock = {0, "VRRP sockets"}; -struct debug vrrp_dbg_zebra = {0, "VRRP Zebra events"}; +struct debug vrrp_dbg_arp = {0, "debug vrrp arp", "VRRP ARP"}; +struct debug vrrp_dbg_auto = {0, "debug vrrp autoconfigure", "VRRP autoconfiguration events"}; +struct debug vrrp_dbg_ndisc = {0, "debug vrrp ndisc", "VRRP Neighbor Discovery"}; +struct debug vrrp_dbg_pkt = {0, "debug vrrp packets", "VRRP packets"}; +struct debug vrrp_dbg_proto = {0, "debug vrrp protocol", "VRRP protocol events"}; +struct debug vrrp_dbg_sock = {0, "debug vrrp sockets", "VRRP sockets"}; +struct debug vrrp_dbg_zebra = {0, "debug vrrp zebra", "VRRP Zebra events"}; struct debug *vrrp_debugs[] = { &vrrp_dbg_arp, @@ -56,11 +56,6 @@ static int vrrp_debug_config_write_helper(struct vty *vty, bool config) return 0; } -int vrrp_config_write_debug(struct vty *vty) -{ - return vrrp_debug_config_write_helper(vty, true); -} - int vrrp_debug_status_write(struct vty *vty) { return vrrp_debug_config_write_helper(vty, false); diff --git a/vrrpd/vrrp_debug.h b/vrrpd/vrrp_debug.h index c1421ebbaa7f..c8b4c897f0f2 100644 --- a/vrrpd/vrrp_debug.h +++ b/vrrpd/vrrp_debug.h @@ -27,14 +27,6 @@ extern struct debug vrrp_dbg_zebra; */ void vrrp_debug_init(void); -/* - * Print VRRP debugging configuration. - * - * vty - * VTY to print debugging configuration to. - */ -int vrrp_config_write_debug(struct vty *vty); - /* * Print VRRP debugging configuration, human readable form. * diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index fd6cbc8b6740..53f66c79c9b6 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -747,13 +747,6 @@ DEFUN_NOSH (show_debugging_vrrp, /* clang-format on */ -static struct cmd_node debug_node = { - .name = "debug", - .node = DEBUG_NODE, - .prompt = "", - .config_write = vrrp_config_write_debug, -}; - static struct cmd_node vrrp_node = { .name = "vrrp", .node = VRRP_NODE, @@ -763,7 +756,6 @@ static struct cmd_node vrrp_node = { void vrrp_vty_init(void) { - install_node(&debug_node); install_node(&vrrp_node); vrf_cmd_init(NULL); if_cmd_init_default(); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index c207e4d42759..3eb00d1987be 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -453,10 +453,6 @@ void vtysh_config_parse_line(void *arg, const char *line) config = config_get(FORWARDING_NODE, line); else if (strncmp(line, "debug vrf", strlen("debug vrf")) == 0) config = config_get(VRF_DEBUG_NODE, line); - else if (strncmp(line, "debug northbound", - strlen("debug northbound")) - == 0) - config = config_get(NORTHBOUND_DEBUG_NODE, line); else if (strncmp(line, "debug route-map", strlen("debug route-map")) == 0) @@ -464,12 +460,6 @@ void vtysh_config_parse_line(void *arg, const char *line) else if (strncmp(line, "debug resolver", strlen("debug resolver")) == 0) config = config_get(RESOLVER_DEBUG_NODE, line); - else if (strncmp(line, "debug mgmt client frontend", - strlen("debug mgmt client frontend")) == 0) - config = config_get(MGMT_FE_DEBUG_NODE, line); - else if (strncmp(line, "debug mgmt client backend", - strlen("debug mgmt client backend")) == 0) - config = config_get(MGMT_BE_DEBUG_NODE, line); else if (strncmp(line, "debug", strlen("debug")) == 0) config = config_get(DEBUG_NODE, line); else if (strncmp(line, "password", strlen("password")) == 0 @@ -532,9 +522,8 @@ void vtysh_config_parse_line(void *arg, const char *line) (I) == ACCESS_IPV6_NODE || (I) == ACCESS_MAC_NODE || \ (I) == PREFIX_IPV6_NODE || (I) == FORWARDING_NODE || \ (I) == DEBUG_NODE || (I) == AAA_NODE || (I) == VRF_DEBUG_NODE || \ - (I) == NORTHBOUND_DEBUG_NODE || (I) == RMAP_DEBUG_NODE || \ - (I) == RESOLVER_DEBUG_NODE || (I) == MPLS_NODE || \ - (I) == KEYCHAIN_KEY_NODE) + (I) == RMAP_DEBUG_NODE || (I) == RESOLVER_DEBUG_NODE || \ + (I) == MPLS_NODE || (I) == KEYCHAIN_KEY_NODE) static void configvec_dump(vector vec, bool nested) {