Merge pull request #1009 from donaldsharp/show_cmds

Show cmds
This commit is contained in:
David Lamparter 2017-08-21 14:30:41 +02:00 committed by GitHub
commit add57540ba
14 changed files with 129 additions and 93 deletions

View File

@ -310,6 +310,20 @@ debug_babel_config_write (struct vty * vty)
#endif /* NO_DEBUG */ #endif /* NO_DEBUG */
} }
DEFUN_NOSH (show_debugging_babel,
show_debugging_babel_cmd,
"show debugging [babel]",
SHOW_STR
DEBUG_STR
"Babel")
{
vty_out(vty, "BABEL debugging status\n");
debug_babel_config_write(vty);
return CMD_SUCCESS;
}
static void static void
babel_zebra_connected (struct zclient *zclient) babel_zebra_connected (struct zclient *zclient)
{ {
@ -339,6 +353,8 @@ void babelz_zebra_init(void)
install_element(ENABLE_NODE, &no_debug_babel_cmd); install_element(ENABLE_NODE, &no_debug_babel_cmd);
install_element(CONFIG_NODE, &debug_babel_cmd); install_element(CONFIG_NODE, &debug_babel_cmd);
install_element(CONFIG_NODE, &no_debug_babel_cmd); install_element(CONFIG_NODE, &no_debug_babel_cmd);
install_element(VIEW_NODE, &show_debugging_babel_cmd);
} }
static int static int

View File

@ -1615,12 +1615,12 @@ DEFUN (no_debug_bgp,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (show_debugging_bgp, DEFUN_NOSH (show_debugging_bgp,
show_debugging_bgp_cmd, show_debugging_bgp_cmd,
"show debugging bgp", "show debugging [bgp]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
BGP_STR) BGP_STR)
{ {
vty_out(vty, "BGP debugging status:\n"); vty_out(vty, "BGP debugging status:\n");

View File

@ -142,13 +142,13 @@ DEFUN (no_debug_bgp_vnc_all,
* show/save * show/save
***********************************************************************/ ***********************************************************************/
DEFUN (show_debugging_bgp_vnc, DEFUN_NOSH (show_debugging_bgp_vnc,
show_debugging_bgp_vnc_cmd, show_debugging_bgp_vnc_cmd,
"show debugging bgp vnc", "show debugging bgp vnc",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
BGP_STR BGP_STR
VNC_STR) VNC_STR)
{ {
size_t i; size_t i;

View File

@ -323,12 +323,12 @@ void show_ip_eigrp_neighbor_entry(struct vty *vty, struct eigrp *eigrp,
} }
DEFUN (show_debugging_eigrp, DEFUN_NOSH (show_debugging_eigrp,
show_debugging_eigrp_cmd, show_debugging_eigrp_cmd,
"show debugging eigrp", "show debugging [eigrp]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
EIGRP_STR) EIGRP_STR)
{ {
int i; int i;

View File

@ -758,17 +758,18 @@ void print_debug(struct vty *vty, int flags, int onoff)
vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs); vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
} }
DEFUN (show_debugging, DEFUN_NOSH (show_debugging,
show_debugging_isis_cmd, show_debugging_isis_cmd,
"show debugging isis", "show debugging [isis]",
SHOW_STR SHOW_STR
"State of each debugging option\n" "State of each debugging option\n"
ISIS_STR) ISIS_STR)
{ {
if (isis->debugs) { vty_out (vty, "IS-IS debugging status:\n");
vty_out(vty, "IS-IS:\n");
if (isis->debugs)
print_debug(vty, isis->debugs, 1); print_debug(vty, isis->debugs, 1);
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -684,13 +684,13 @@ DEFPY (ldp_show_l2vpn_atom_vc,
return (ldp_vty_show_atom_vc(vty, json)); return (ldp_vty_show_atom_vc(vty, json));
} }
DEFPY (ldp_show_debugging_mpls_ldp, DEFUN_NOSH (ldp_show_debugging_mpls_ldp,
ldp_show_debugging_mpls_ldp_cmd, ldp_show_debugging_mpls_ldp_cmd,
"show debugging mpls ldp", "show debugging [mpls ldp]",
"Show running system information\n" "Show running system information\n"
"Debugging functions\n" "Debugging functions\n"
"MPLS information\n" "MPLS information\n"
"Label Distribution Protocol\n") "Label Distribution Protocol\n")
{ {
return (ldp_vty_show_debugging(vty)); return (ldp_vty_show_debugging(vty));
} }

View File

@ -110,11 +110,11 @@ static int toggle_flag(
#ifndef NO_DEBUG #ifndef NO_DEBUG
DEFUN(show_debugging_nhrp, show_debugging_nhrp_cmd, DEFUN_NOSH(show_debugging_nhrp, show_debugging_nhrp_cmd,
"show debugging nhrp", "show debugging [nhrp]",
SHOW_STR SHOW_STR
"Debugging information\n" "Debugging information\n"
"NHRP configuration\n") "NHRP configuration\n")
{ {
int i; int i;

View File

@ -85,10 +85,24 @@ static int config_write_ospf6_debug(struct vty *vty)
config_write_ospf6_debug_asbr(vty); config_write_ospf6_debug_asbr(vty);
config_write_ospf6_debug_abr(vty); config_write_ospf6_debug_abr(vty);
config_write_ospf6_debug_flood(vty); config_write_ospf6_debug_flood(vty);
vty_out(vty, "!\n");
return 0; return 0;
} }
DEFUN_NOSH (show_debugging_ospf6,
show_debugging_ospf6_cmd,
"show debugging [ospf6]",
SHOW_STR
DEBUG_STR
OSPF6_STR)
{
vty_out(vty, "OSPF6 debugging status:");
config_write_ospf6_debug(vty);
return CMD_SUCCESS;
}
#define AREA_LSDB_TITLE_FORMAT \ #define AREA_LSDB_TITLE_FORMAT \
"\n Area Scoped Link State Database (Area %s)\n\n" "\n Area Scoped Link State Database (Area %s)\n\n"
#define IF_LSDB_TITLE_FORMAT \ #define IF_LSDB_TITLE_FORMAT \
@ -1157,6 +1171,8 @@ void ospf6_init(void)
install_element_ospf6_clear_interface(); install_element_ospf6_clear_interface();
install_element(VIEW_NODE, &show_debugging_ospf6_cmd);
install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd);
install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd);

View File

@ -1597,12 +1597,12 @@ static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf)
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (show_debugging_ospf, DEFUN_NOSH (show_debugging_ospf,
show_debugging_ospf_cmd, show_debugging_ospf_cmd,
"show debugging ospf", "show debugging [ospf]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
OSPF_STR) OSPF_STR)
{ {
struct ospf *ospf; struct ospf *ospf;
@ -1612,13 +1612,13 @@ DEFUN (show_debugging_ospf,
return show_debugging_ospf_common(vty, ospf); return show_debugging_ospf_common(vty, ospf);
} }
DEFUN (show_debugging_ospf_instance, DEFUN_NOSH (show_debugging_ospf_instance,
show_debugging_ospf_instance_cmd, show_debugging_ospf_instance_cmd,
"show debugging ospf (1-65535)", "show debugging ospf (1-65535)",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
OSPF_STR OSPF_STR
"Instance ID\n") "Instance ID\n")
{ {
int idx_number = 3; int idx_number = 3;
struct ospf *ospf; struct ospf *ospf;

View File

@ -7254,14 +7254,17 @@ DEFUN (no_debug_msdp_packets,
ALIAS(no_debug_msdp_packets, undebug_msdp_packets_cmd, "undebug msdp packets", ALIAS(no_debug_msdp_packets, undebug_msdp_packets_cmd, "undebug msdp packets",
UNDEBUG_STR DEBUG_MSDP_STR DEBUG_MSDP_PACKETS_STR) UNDEBUG_STR DEBUG_MSDP_STR DEBUG_MSDP_PACKETS_STR)
DEFUN (show_debugging_pim, DEFUN_NOSH (show_debugging_pim,
show_debugging_pim_cmd, show_debugging_pim_cmd,
"show debugging pim", "show debugging [pim]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
PIM_STR) PIM_STR)
{ {
vty_out(vty, "PIM debugging status\n");
pim_debug_config_write(vty); pim_debug_config_write(vty);
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -27,12 +27,12 @@ unsigned long rip_debug_event = 0;
unsigned long rip_debug_packet = 0; unsigned long rip_debug_packet = 0;
unsigned long rip_debug_zebra = 0; unsigned long rip_debug_zebra = 0;
DEFUN (show_debugging_rip, DEFUN_NOSH (show_debugging_rip,
show_debugging_rip_cmd, show_debugging_rip_cmd,
"show debugging rip", "show debugging [rip]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
RIP_STR) RIP_STR)
{ {
vty_out(vty, "RIP debugging status:\n"); vty_out(vty, "RIP debugging status:\n");

View File

@ -28,12 +28,12 @@ unsigned long ripng_debug_event = 0;
unsigned long ripng_debug_packet = 0; unsigned long ripng_debug_packet = 0;
unsigned long ripng_debug_zebra = 0; unsigned long ripng_debug_zebra = 0;
DEFUN (show_debugging_ripng, DEFUN_NOSH (show_debugging_ripng,
show_debugging_ripng_cmd, show_debugging_ripng_cmd,
"show debugging ripng", "show debugging [ripng]",
SHOW_STR SHOW_STR
DEBUG_STR DEBUG_STR
"RIPng configuration\n") "RIPng configuration\n")
{ {
vty_out(vty, "RIPng debugging status:\n"); vty_out(vty, "RIPng debugging status:\n");

View File

@ -1915,6 +1915,16 @@ static int show_per_daemon(const char *line, const char *headline)
return ret; return ret;
} }
DEFUN (vtysh_show_debugging,
vtysh_show_debugging_cmd,
"show debugging",
SHOW_STR
DEBUG_STR)
{
return show_per_daemon("do show debugging\n",
"Debugging Information for %s:\n");
}
/* Memory */ /* Memory */
DEFUN (vtysh_show_memory, DEFUN (vtysh_show_memory,
vtysh_show_memory_cmd, vtysh_show_memory_cmd,
@ -1922,7 +1932,8 @@ DEFUN (vtysh_show_memory,
SHOW_STR SHOW_STR
"Memory statistics\n") "Memory statistics\n")
{ {
return show_per_daemon("show memory\n", "Memory statistics for %s:\n"); return show_per_daemon("show memory\n",
"Memory statistics for %s:\n");
} }
DEFUN (vtysh_show_modules, DEFUN (vtysh_show_modules,
@ -1942,20 +1953,8 @@ DEFUN (vtysh_show_logging,
SHOW_STR SHOW_STR
"Show current logging configuration\n") "Show current logging configuration\n")
{ {
unsigned int i; return show_per_daemon("do show logging\n",
int ret = CMD_SUCCESS; "Logging configuration for %s:\n");
char line[] = "do show logging\n";
for (i = 0; i < array_size(vtysh_client); i++)
if (vtysh_client[i].fd >= 0) {
fprintf(stdout, "Logging configuration for %s:\n",
vtysh_client[i].name);
ret = vtysh_client_execute(&vtysh_client[i], line,
stdout);
fprintf(stdout, "\n");
}
return ret;
} }
DEFUNSH(VTYSH_ALL, vtysh_log_stdout, vtysh_log_stdout_cmd, "log stdout", DEFUNSH(VTYSH_ALL, vtysh_log_stdout, vtysh_log_stdout_cmd, "log stdout",
@ -3233,6 +3232,7 @@ void vtysh_init_vty(void)
install_element(ENABLE_NODE, &vtysh_start_zsh_cmd); install_element(ENABLE_NODE, &vtysh_start_zsh_cmd);
#endif #endif
install_element(VIEW_NODE, &vtysh_show_debugging_cmd);
install_element(VIEW_NODE, &vtysh_show_memory_cmd); install_element(VIEW_NODE, &vtysh_show_memory_cmd);
install_element(VIEW_NODE, &vtysh_show_modules_cmd); install_element(VIEW_NODE, &vtysh_show_modules_cmd);

View File

@ -34,12 +34,12 @@ unsigned long zebra_debug_mpls;
unsigned long zebra_debug_vxlan; unsigned long zebra_debug_vxlan;
unsigned long zebra_debug_pw; unsigned long zebra_debug_pw;
DEFUN (show_debugging_zebra, DEFUN_NOSH (show_debugging_zebra,
show_debugging_zebra_cmd, show_debugging_zebra_cmd,
"show debugging zebra", "show debugging [zebra]",
SHOW_STR SHOW_STR
"Debugging information\n" "Debugging information\n"
"Zebra configuration\n") "Zebra configuration\n")
{ {
vty_out(vty, "Zebra debugging status:\n"); vty_out(vty, "Zebra debugging status:\n");