9
0
Fork 0

stats: Print some statistics about the state of the current set

This commit is contained in:
Holger Hans Peter Freyther 2011-01-22 16:16:52 +01:00
parent 51b9e7a396
commit 60af5dd57a
1 changed files with 33 additions and 0 deletions

View File

@ -300,6 +300,38 @@ DEFUN(show_stats, show_stats_cmd,
return CMD_SUCCESS;
}
static void dump_state(struct vty *vty, const char *name, struct mtp_link_set *set)
{
struct mtp_link *link;
if (!set) {
vty_out(vty, "LinkSet for %s is not configured.%s", name, VTY_NEWLINE);
return;
}
vty_out(vty, "LinkSet for %s is %s, remote sccp is %s.%s",
name,
set->available == 0 ? "not available" : "available",
set->sccp_up == 0? "not established" : "established",
VTY_NEWLINE);
llist_for_each_entry(link, &set->links, entry) {
vty_out(vty, " Link %d is %s.%s",
link->link_no,
link->available == 0 ? "not available" : "available",
VTY_NEWLINE);
}
}
DEFUN(show_linksets, show_linksets_cmd,
"show link-sets",
SHOW_STR "Display current state of linksets\n")
{
dump_state(vty, "MTP ", bsc.link_set);
dump_state(vty, "M2UA", bsc.m2ua_set);
return CMD_SUCCESS;
}
void cell_vty_init(void)
{
cmd_init(1);
@ -332,6 +364,7 @@ void cell_vty_init(void)
/* show commands */
install_element_ve(&show_stats_cmd);
install_element_ve(&show_linksets_cmd);
}
const char *openbsc_copyright = "";