From 12a0987b360f6825217aa25249719f1ef85f4a1c Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 1 Feb 2018 16:07:33 +0100 Subject: vty: add commands to show TBF of a certain kind Add vty commands to show only TBFs allocated via PACCH or CCCH. Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Related: OS#1759 --- src/pcu_vty.c | 15 ++++++++++++--- src/pcu_vty_functions.cpp | 14 ++++++++++---- src/pcu_vty_functions.h | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 960c90d9..3a733ef8 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -1083,11 +1083,20 @@ DEFUN(cfg_pcu_gb_dialect, DEFUN(show_tbf, show_tbf_cmd, - "show tbf all", - SHOW_STR "information about TBFs\n" "All TBFs\n") + "show tbf (all|ccch|pacch)", + SHOW_STR "information about TBFs\n" + "All TBFs\n" + "TBFs allocated via CCCH\n" + "TBFs allocated via PACCH\n") { struct gprs_rlcmac_bts *bts = bts_main_data(); - return pcu_vty_show_tbf_all(vty, bts); + if (!strcmp(argv[0], "all")) + return pcu_vty_show_tbf_all(vty, bts, true, true); + + if (!strcmp(argv[0], "ccch")) + return pcu_vty_show_tbf_all(vty, bts_main_data(), true, false); + + return pcu_vty_show_tbf_all(vty, bts_main_data(), false, true); } DEFUN(show_ms_all, diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index c93935d9..98e81850 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -44,11 +44,17 @@ extern "C" { #include "coding_scheme.h" } -static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf) +static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf, bool show_ccch, bool show_pacch) { gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf); gprs_rlcmac_dl_tbf *dl_tbf = as_dl_tbf(tbf); + if (show_ccch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))) + return; + + if (show_pacch && !(tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH))) + return; + vty_out(vty, "TBF: TFI=%d TLLI=0x%08x (%s) TA=%u DIR=%s IMSI=%s%s", tbf->tfi(), tbf->tlli(), tbf->is_tlli_valid() ? "valid" : "invalid", tbf->ta(), @@ -101,18 +107,18 @@ static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf) vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE); } -int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data) +int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, bool show_ccch, bool show_pacch) { BTS *bts = bts_data->bts; LListHead *ms_iter; vty_out(vty, "UL TBFs%s", VTY_NEWLINE); llist_for_each(ms_iter, &bts->ul_tbfs()) - tbf_print_vty_info(vty, ms_iter->entry()); + tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch); vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE); llist_for_each(ms_iter, &bts->dl_tbfs()) - tbf_print_vty_info(vty, ms_iter->entry()); + tbf_print_vty_info(vty, ms_iter->entry(), show_ccch, show_pacch); return CMD_SUCCESS; } diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h index 470df0eb..3fef2082 100644 --- a/src/pcu_vty_functions.h +++ b/src/pcu_vty_functions.h @@ -27,7 +27,7 @@ extern "C" { struct vty; struct gprs_rlcmac_bts; -int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data); +int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data, bool show_ccch, bool show_pacch); 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); -- cgit v1.2.3