From 7c29b094d56c9c4949f05b95eff2d24cfa8f0de8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 22 Dec 2017 21:48:55 +0100 Subject: BSC: Add "show subscriber all" command This command lists the currently-active bsc_subscr and their contents, the format looks like this: OsmoBSC> show subscriber all IMSI TMSI LAC Use 001010123456789 ffffffff 65534 3 001010100000001 a1b2c301 65534 1 Change-Id: Ib9c0c31a0a5a91b42fd832fa0df3460b1a440733 --- src/osmo-bsc/osmo_bsc_vty.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c index f01e6f7e8..fb8b27541 100644 --- a/src/osmo-bsc/osmo_bsc_vty.c +++ b/src/osmo-bsc/osmo_bsc_vty.c @@ -929,6 +929,28 @@ DEFUN(logging_fltr_imsi, return CMD_SUCCESS; } +static void dump_one_sub(struct vty *vty, struct bsc_subscr *bsub) +{ + vty_out(vty, " %15s %08x %5u %d%s", bsub->imsi, bsub->tmsi, bsub->lac, bsub->use_count, + VTY_NEWLINE); +} + +DEFUN(show_subscr_all, + show_subscr_all_cmd, + "show subscriber all", + SHOW_STR "Display information about subscribers\n" "All Subscribers\n") +{ + struct bsc_subscr *bsc_subscr; + + vty_out(vty, " IMSI TMSI LAC Use%s", VTY_NEWLINE); + /* " 001010123456789 ffffffff 65534 1" */ + + llist_for_each_entry(bsc_subscr, bsc_gsmnet->bsc_subscribers, entry) + dump_one_sub(vty, bsc_subscr); + + return CMD_SUCCESS; +} + int bsc_vty_init_extra(void) { struct gsm_network *net = bsc_gsmnet; @@ -987,6 +1009,7 @@ int bsc_vty_init_extra(void) install_element_ve(&show_mscs_cmd); install_element_ve(&show_pos_cmd); install_element_ve(&logging_fltr_imsi_cmd); + install_element_ve(&show_subscr_all_cmd); install_element(ENABLE_NODE, &gen_position_trap_cmd); -- cgit v1.2.3