vty: Add 'show bts pdch' command
This allows to see which channels have been enabled according to PCU.
Change-Id: If72e67ba80aab4e0c68408e6996d74d2ff70c322
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 99c92b7..0756136 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -828,6 +828,14 @@
return CMD_SUCCESS;
}
+DEFUN(show_bts_pdch,
+ show_bts_pdch_cmd,
+ "show bts pdch",
+ SHOW_STR "BTS related functionality\nPDCH timeslots\n")
+{
+ return pcu_vty_show_bts_pdch(vty, bts_main_data());
+}
+
#define IDLE_TIME_STR "keep an idle DL TBF alive for the time given\n"
DEFUN_DEPRECATED(cfg_pcu_dl_tbf_idle_time,
cfg_pcu_dl_tbf_idle_time_cmd,
@@ -1273,6 +1281,7 @@
install_element(PCU_NODE, &cfg_pcu_timer_cmd);
install_element_ve(&show_bts_stats_cmd);
+ install_element_ve(&show_bts_pdch_cmd);
install_element_ve(&show_tbf_cmd);
install_element_ve(&show_ms_all_cmd);
install_element_ve(&show_ms_tlli_cmd);
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index 3e9973c..33a4637 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -239,3 +239,31 @@
return show_ms(vty, ms);
}
+
+int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts_data)
+{
+ unsigned int trx_nr, ts_nr;
+
+ vty_out(vty, "BTS (%s)%s", bts_data->active ? "active" : "disabled", VTY_NEWLINE);
+ for (trx_nr = 0; trx_nr < ARRAY_SIZE(bts_data->trx); trx_nr++) {
+ const struct gprs_rlcmac_trx *trx = &bts_data->trx[trx_nr];
+
+ for (ts_nr = 0; ts_nr < ARRAY_SIZE(trx->pdch); ts_nr++) {
+ if (trx->pdch[ts_nr].is_enabled())
+ break;
+ }
+ if (ts_nr == ARRAY_SIZE(trx->pdch))
+ continue; /* no pdch active, skip */
+
+ vty_out(vty, " TRX%u%s", trx->trx_no, VTY_NEWLINE);
+ for (ts_nr = 0; ts_nr < ARRAY_SIZE(trx->pdch); ts_nr++) {
+ const struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts_nr];
+
+ vty_out(vty, " TS%u: PDCH %s, %u UL TBFs, %u DL TBFs%s", pdch->ts_no,
+ pdch->is_enabled() ? "enabled" : "disabled",
+ pdch->num_tbfs(GPRS_RLCMAC_DL_TBF),
+ pdch->num_tbfs(GPRS_RLCMAC_UL_TBF), VTY_NEWLINE);
+ }
+ }
+ return CMD_SUCCESS;
+}
diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h
index 6fbc366..4528fb2 100644
--- a/src/pcu_vty_functions.h
+++ b/src/pcu_vty_functions.h
@@ -33,7 +33,7 @@
uint32_t tlli);
int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts_data,
const char *imsi);
-
+int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts_data);
#ifdef __cplusplus
}
#endif