aboutsummaryrefslogtreecommitdiffstats
path: root/src/vty_interface.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 16:16:52 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-22 16:22:18 +0100
commit60af5dd57a164265ac2733eaa9992161ab682552 (patch)
treebdee1ac77cf5b6ad905f7c3ad0f5ee6ad695e818 /src/vty_interface.c
parent51b9e7a396be16a8fda47d2fd891c72db7f4f4d0 (diff)
stats: Print some statistics about the state of the current set
Diffstat (limited to 'src/vty_interface.c')
-rw-r--r--src/vty_interface.c33
1 files changed, 33 insertions, 0 deletions
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 = "";