Change in osmo-bsc[master]: vty: add command to show TRX selectively

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Sun Nov 11 21:46:18 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/11721


Change subject: vty: add command to show TRX selectively
......................................................................

vty: add command to show TRX selectively

Add following commands showing only TRX with appropriate RSL link
status:
* show trx connected
* show trx disconnected

This simplifies troubleshooting of complex setup with multiple BTS with
several TRX each.

Change-Id: I48866ce311a3e2c63235f60a497efe97bbd05a4a
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 54 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/21/11721/1

diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 410cdac..cf361bf 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1073,8 +1073,14 @@
 	return CMD_SUCCESS;
 }
 
-static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
+static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx, bool print_rsl, bool show_connected)
 {
+	if (show_connected && !trx->rsl_link)
+		return;
+
+	if (!show_connected && trx->rsl_link)
+		return;
+
 	vty_out(vty, "TRX %u of BTS %u is on ARFCN %u%s",
 		trx->nr, trx->bts->nr, trx->arfcn, VTY_NEWLINE);
 	vty_out(vty, "Description: %s%s",
@@ -1085,7 +1091,8 @@
 		trx->nominal_power - trx->max_power_red, VTY_NEWLINE);
 	vty_out(vty, "  NM State: ");
 	net_dump_nmstate(vty, &trx->mo.nm_state);
-	vty_out(vty, "  RSL State: %s%s", trx->rsl_link? "connected" : "disconnected", VTY_NEWLINE);
+	if (print_rsl)
+		vty_out(vty, "  RSL State: %s%s", trx->rsl_link? "connected" : "disconnected", VTY_NEWLINE);
 	vty_out(vty, "  Baseband Transceiver NM State: ");
 	net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
 	if (is_ipaccess_bts(trx->bts)) {
@@ -1097,11 +1104,17 @@
 	}
 }
 
+static void trx_dump_vty_all(struct vty *vty, struct gsm_bts_trx *trx)
+{
+	trx_dump_vty(vty, trx, true, true);
+	trx_dump_vty(vty, trx, true, false);
+}
+
 static inline void print_all_trx(struct vty *vty, const struct gsm_bts *bts)
 {
 	uint8_t trx_nr;
 	for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++)
-		trx_dump_vty(vty, gsm_bts_trx_num(bts, trx_nr));
+		trx_dump_vty_all(vty, gsm_bts_trx_num(bts, trx_nr));
 }
 
 DEFUN(show_trx,
@@ -1131,7 +1144,8 @@
 				VTY_NEWLINE);
 			return CMD_WARNING;
 		}
-		trx_dump_vty(vty, gsm_bts_trx_num(bts, trx_nr));
+		trx_dump_vty_all(vty, gsm_bts_trx_num(bts, trx_nr));
+
 		return CMD_SUCCESS;
 	}
 	if (bts) {
@@ -1146,6 +1160,40 @@
 	return CMD_SUCCESS;
 }
 
+static inline void print_all_trx_ext(struct vty *vty, bool show_connected)
+{
+	struct gsm_network *net = gsmnet_from_vty(vty);
+	struct gsm_bts *bts = NULL;
+	uint8_t bts_nr;
+	for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
+		uint8_t trx_nr;
+		bts = gsm_bts_num(net, bts_nr);
+		for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++)
+			trx_dump_vty(vty, gsm_bts_trx_num(bts, trx_nr), false, show_connected);
+	}
+}
+
+DEFUN(show_trx_con,
+      show_trx_con_cmd,
+      "show trx connected",
+      SHOW_STR "Display information about a TRX\n"
+      "Show TRX with RSL connected\n")
+{
+	print_all_trx_ext(vty, true);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(show_trx_dis,
+      show_trx_dis_cmd,
+      "show trx disconnected",
+      SHOW_STR "Display information about a TRX\n"
+      "Show TRX with RSL disconnected\n")
+{
+	print_all_trx_ext(vty, false);
+
+	return CMD_SUCCESS;
+}
 
 static void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts)
 {
@@ -4896,6 +4944,8 @@
 	install_element_ve(&show_bts_cmd);
 	install_element_ve(&show_rejected_bts_cmd);
 	install_element_ve(&show_trx_cmd);
+	install_element_ve(&show_trx_con_cmd);
+	install_element_ve(&show_trx_dis_cmd);
 	install_element_ve(&show_ts_cmd);
 	install_element_ve(&show_lchan_cmd);
 	install_element_ve(&show_lchan_summary_cmd);

-- 
To view, visit https://gerrit.osmocom.org/11721
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I48866ce311a3e2c63235f60a497efe97bbd05a4a
Gerrit-Change-Number: 11721
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181111/9ec5317e/attachment.htm>


More information about the gerrit-log mailing list