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
Fri Nov 23 00:03:40 UTC 2018


Max has submitted this change and it was merged. ( 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, 46 insertions(+), 4 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Stefan Sperling: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 4f18d47..983dcb9 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1079,8 +1079,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",
@@ -1091,7 +1097,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)) {
@@ -1103,11 +1110,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,
@@ -1137,7 +1150,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) {
@@ -1320,6 +1334,33 @@
 	meas_rep_dump_uni_vty(vty, &mr->ul, prefix, "ul");
 }
 
+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|disconnected)",
+      SHOW_STR "Display information about a TRX\n"
+      "Show TRX with RSL connected\n"
+      "Show TRX with RSL disconnected\n")
+{
+	if (!strcmp(argv[0], "connected"))
+		print_all_trx_ext(vty, true);
+	else
+		print_all_trx_ext(vty, false);
+
+	return CMD_SUCCESS;
+}
 
 static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
 {
@@ -4956,6 +4997,7 @@
 	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_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: merged
Gerrit-Change-Id: I48866ce311a3e2c63235f60a497efe97bbd05a4a
Gerrit-Change-Number: 11721
Gerrit-PatchSet: 4
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181123/d4e6683d/attachment.htm>


More information about the gerrit-log mailing list