From 37e896dff112fda77c29de770a0d8b3fe8800a5a Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 5 Jun 2015 16:33:33 +0200 Subject: vty: Add command to show detailed MS info This commit extends the "show ms" command to display an extended set of information for a single MS. The following VTY commands are added: - show ms tlli TLLI - show ms imsi IMSI Sponsored-by: On-Waves ehf --- src/pcu_vty.c | 26 ++++++++++++++++++++++++ src/pcu_vty_functions.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++ src/pcu_vty_functions.h | 4 ++++ 3 files changed, 81 insertions(+) diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 6dba18cd..355f5440 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -630,6 +630,30 @@ DEFUN(show_ms_all, return pcu_vty_show_ms_all(vty, bts); } +DEFUN(show_ms_tlli, + show_ms_tlli_cmd, + "show ms tlli TLLI", + SHOW_STR "information about MSs\n" "Select MS by TLLI\n" "TLLI as hex\n") +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + char *endp = NULL; + unsigned long long tlli = strtoll(argv[0], &endp, 16); + if ((endp != NULL && *endp != 0) || tlli > 0xffffffffULL) { + vty_out(vty, "Invalid TLLI.%s", VTY_NEWLINE); + return CMD_WARNING; + } + return pcu_vty_show_ms_by_tlli(vty, bts, (uint32_t)tlli); +} + +DEFUN(show_ms_imsi, + show_ms_imsi_cmd, + "show ms imsi IMSI", + SHOW_STR "information about MSs\n" "Select MS by IMSI\n" "IMSI\n") +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + return pcu_vty_show_ms_by_imsi(vty, bts, argv[0]); +} + static const char pcu_copyright[] = "Copyright (C) 2012 by Ivan Kluchnikov and \r\n" " Andreas Eversberg \r\n" @@ -691,6 +715,8 @@ int pcu_vty_init(const struct log_info *cat) install_element_ve(&show_bts_stats_cmd); install_element_ve(&show_tbf_cmd); install_element_ve(&show_ms_all_cmd); + install_element_ve(&show_ms_tlli_cmd); + install_element_ve(&show_ms_imsi_cmd); return 0; } diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 9783c4d2..39c5ee44 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -55,3 +55,54 @@ int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data) } return CMD_SUCCESS; } + +static int show_ms(struct vty *vty, GprsMs *ms) +{ + vty_out(vty, "MS TLLI=%08x, IMSI=%s%s", ms->tlli(), ms->imsi(), VTY_NEWLINE); + vty_out(vty, " Timing advance (TA): %d%s", ms->ta(), VTY_NEWLINE); + vty_out(vty, " Coding scheme uplink: CS-%d%s", ms->current_cs_ul(), + VTY_NEWLINE); + vty_out(vty, " Coding scheme downlink: CS-%d%s", ms->current_cs_dl(), + VTY_NEWLINE); + vty_out(vty, " MS class: %d%s", ms->ms_class(), VTY_NEWLINE); + vty_out(vty, " LLC queue length: %d%s", ms->llc_queue()->size(), + VTY_NEWLINE); + if (ms->ul_tbf()) + vty_out(vty, " Uplink TBF: TFI=%d, state=%s%s", + ms->ul_tbf()->tfi(), + ms->ul_tbf()->state_name(), + VTY_NEWLINE); + if (ms->dl_tbf()) + vty_out(vty, " Downlink TBF: TFI=%d, state=%s%s", + ms->dl_tbf()->tfi(), + ms->dl_tbf()->state_name(), + VTY_NEWLINE); + + return CMD_SUCCESS; +} + +int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data, + uint32_t tlli) +{ + BTS *bts = bts_data->bts; + GprsMs *ms = bts->ms_store().get_ms(tlli); + if (!ms) { + vty_out(vty, "Unknown TLLI %08x.%s", tlli, VTY_NEWLINE); + return CMD_WARNING; + } + + return show_ms(vty, ms); +} + +int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts_data, + const char *imsi) +{ + BTS *bts = bts_data->bts; + GprsMs *ms = bts->ms_store().get_ms(0, 0, imsi); + if (!ms) { + vty_out(vty, "Unknown IMSI '%s'.%s", imsi, VTY_NEWLINE); + return CMD_WARNING; + } + + return show_ms(vty, ms); +} diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h index 89c5f821..1f4ad916 100644 --- a/src/pcu_vty_functions.h +++ b/src/pcu_vty_functions.h @@ -29,6 +29,10 @@ struct gprs_rlcmac_bts; int pcu_vty_config_write_pcu_ext(struct vty *vty); int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data); +int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data, + uint32_t tlli); +int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts_data, + const char *imsi); #ifdef __cplusplus } -- cgit v1.2.3