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
This commit is contained in:
Harald Welte 2017-12-22 21:48:55 +01:00
parent 09653a0a19
commit 7c29b094d5
1 changed files with 23 additions and 0 deletions

View File

@ -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);