diff --git a/src/vty_interface.c b/src/vty_interface.c index 83d33c8..3ad2fe0 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -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 = "";