Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. 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 --- M src/pcu_vty.c M src/pcu_vty_functions.cpp M src/pcu_vty_functions.h 3 files changed, 23 insertions(+), 8 deletions(-) Approvals: Harald Welte: Looks good to me, approved Pau Espin Pedrol: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 960c90d..3a733ef 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -1083,11 +1083,20 @@ 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 c93935d..98e8185 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -44,11 +44,17 @@ #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 @@ 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 470df0e..3fef208 100644 --- a/src/pcu_vty_functions.h +++ b/src/pcu_vty_functions.h @@ -27,7 +27,7 @@ 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); -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 7 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol
Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. Patch Set 6: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 6 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Mon, 08 Apr 2019 07:34:59 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 6 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Tue, 26 Mar 2019 18:35:02 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Max has posted comments on this change. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. Patch Set 6: (1 comment) Doh! Somehow lost it during patch rebase before submission. Thanks! https://gerrit.osmocom.org/#/c/6239/4/src/pcu_vty_functions.cpp File src/pcu_vty_functions.cpp: https://gerrit.osmocom.org/#/c/6239/4/src/pcu_vty_functions.cpp@46 PS4, Line 46: > looks like these parameters added in this commit are not used in this > function. Done -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 6 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Tue, 26 Mar 2019 13:15:00 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. Patch Set 4: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/6239/4/src/pcu_vty_functions.cpp File src/pcu_vty_functions.cpp: https://gerrit.osmocom.org/#/c/6239/4/src/pcu_vty_functions.cpp@46 PS4, Line 46: static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf, bool show_ccch, bool show_pacch) looks like these parameters added in this commit are not used in this function. -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 4 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Wed, 05 Dec 2018 10:36:39 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Max has posted comments on this change. ( https://gerrit.osmocom.org/6239 ) Change subject: vty: add commands to show TBF of a certain kind .. Set Ready For Review -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-Change-Number: 6239 Gerrit-PatchSet: 4 Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Max Gerrit-Comment-Date: Wed, 05 Dec 2018 10:00:42 + Gerrit-HasComments: No Gerrit-HasLabels: No
osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Patch Set 2: > > Could be one command with (all|pacch|...) > > Sure. What would be advantage of such approach? In case of separate > commands it's trivial 1-liner functions. If we use single command > with parameters than we have to check for parameter value using > switch or if ladder. A signle command with !strmcp if-clauses is more in line to what we have at many other places in the code. At least those instances of VTY code that I wrote or I can remember implement the previous approach. I think ultimately, you end up with less lines. But then I agree, it's not a blocking issue, which is why I wrote "could". Also, note the replication of things like SHOW_STR "information about TBFs\n in your approach, where actually you should add a #define like TBF_STR and then re-use that. If you go for a single DEFUN this comes for free. Also, if one later e.g. introduces something like an optional [stats] argument or whatever other argument to show more information, a single function would be easier to change, than multiple. -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Patch Set 1: > Could be one command with (all|pacch|...) Sure. What would be advantage of such approach? In case of separate commands it's trivial 1-liner functions. If we use single command with parameters than we have to check for parameter value using switch or if ladder. -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max Gerrit-HasComments: No
osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Patch Set 1: Could be one command with (all|pacch|...) -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-pcu[master]: vty: add commands to show TBF of a certain kind
Review at https://gerrit.osmocom.org/6239 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 --- M src/pcu_vty.c M src/pcu_vty_functions.cpp M src/pcu_vty_functions.h 3 files changed, 24 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/39/6239/1 diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 5c3f625..47d87f9 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -1065,7 +1065,23 @@ SHOW_STR "information about TBFs\n" "All TBFs\n") { struct gprs_rlcmac_bts *bts = bts_main_data(); - return pcu_vty_show_tbf_all(vty, bts); + return pcu_vty_show_tbf_all(vty, bts, true, true); +} + +DEFUN(show_tbf_ccch, + show_tbf_ccch_cmd, + "show tbf ccch", + SHOW_STR "information about TBFs\n" "TBFs allocated via CCCH\n") +{ + return pcu_vty_show_tbf_all(vty, bts_main_data(), true, false); +} + +DEFUN(show_tbf_pacch, + show_tbf_pacch_cmd, + "show tbf pacch", + SHOW_STR "information about TBFs\n" "TBFs allocated via PACCH\n") +{ + return pcu_vty_show_tbf_all(vty, bts_main_data(), false, true); } DEFUN(show_ms_all, @@ -1192,6 +1208,8 @@ install_element_ve(&show_bts_stats_cmd); install_element_ve(&show_tbf_cmd); + install_element_ve(&show_tbf_ccch_cmd); + install_element_ve(&show_tbf_pacch_cmd); install_element_ve(&show_ms_all_cmd); install_element_ve(&show_ms_tlli_cmd); install_element_ve(&show_ms_imsi_cmd); diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 41165f3..6c078f2 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -34,7 +34,7 @@ #include } -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); @@ -91,18 +91,18 @@ 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 470df0e..3fef208 100644 --- a/src/pcu_vty_functions.h +++ b/src/pcu_vty_functions.h @@ -27,7 +27,7 @@ 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); -- To view, visit https://gerrit.osmocom.org/6239 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I80f8df4fe663a0346f4289a4220b761e39726312 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max