Change in osmo-bsc[master]: bsc_vty: add vty command to display all lchans

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Jan 22 11:21:44 UTC 2019


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/12678


Change subject: bsc_vty: add vty command to display all lchans
......................................................................

bsc_vty: add vty command to display all lchans

Currently the VTY only displays the lchans that are currently in use
(show lchan summary). In some situations (debugging) it can be useful
to list all lchans, regardless of their state. So lets add a command
for that.

Change-Id: Ifcf5d4ca2f22f7cb994dd15135cdcc9d05aa9dab
Related: OS#3503
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 29 insertions(+), 14 deletions(-)



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

diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 791aebe..31e1c71 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1441,11 +1441,12 @@
 
 
 static int dump_lchan_trx_ts(struct gsm_bts_trx_ts *ts, struct vty *vty,
-			     void (*dump_cb)(struct vty *, struct gsm_lchan *))
+			     void (*dump_cb)(struct vty *, struct gsm_lchan *),
+			     bool all)
 {
 	struct gsm_lchan *lchan;
 	ts_for_each_lchan(lchan, ts) {
-		if (lchan_state_is(lchan, LCHAN_ST_UNUSED))
+		if (lchan_state_is(lchan, LCHAN_ST_UNUSED) && all == false)
 			continue;
 		dump_cb(vty, lchan);
 	}
@@ -1454,33 +1455,36 @@
 }
 
 static int dump_lchan_trx(struct gsm_bts_trx *trx, struct vty *vty,
-			  void (*dump_cb)(struct vty *, struct gsm_lchan *))
+			  void (*dump_cb)(struct vty *, struct gsm_lchan *),
+			  bool all)
 {
 	int ts_nr;
 
 	for (ts_nr = 0; ts_nr < TRX_NR_TS; ts_nr++) {
 		struct gsm_bts_trx_ts *ts = &trx->ts[ts_nr];
-		dump_lchan_trx_ts(ts, vty, dump_cb);
+		dump_lchan_trx_ts(ts, vty, dump_cb, all);
 	}
 
 	return CMD_SUCCESS;
 }
 
 static int dump_lchan_bts(struct gsm_bts *bts, struct vty *vty,
-			  void (*dump_cb)(struct vty *, struct gsm_lchan *))
+			  void (*dump_cb)(struct vty *, struct gsm_lchan *),
+			  bool all)
 {
 	int trx_nr;
 
 	for (trx_nr = 0; trx_nr < bts->num_trx; trx_nr++) {
 		struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_nr);
-		dump_lchan_trx(trx, vty, dump_cb);
+		dump_lchan_trx(trx, vty, dump_cb, all);
 	}
 
 	return CMD_SUCCESS;
 }
 
 static int lchan_summary(struct vty *vty, int argc, const char **argv,
-			 void (*dump_cb)(struct vty *, struct gsm_lchan *))
+			 void (*dump_cb)(struct vty *, struct gsm_lchan *),
+			 bool all)
 {
 	struct gsm_network *net = gsmnet_from_vty(vty);
 	struct gsm_bts *bts = NULL;
@@ -1500,7 +1504,7 @@
 		bts = gsm_bts_num(net, bts_nr);
 
 		if (argc == 1)
-			return dump_lchan_bts(bts, vty, dump_cb);
+			return dump_lchan_bts(bts, vty, dump_cb, all);
 	}
 	if (argc >= 2) {
 		trx_nr = atoi(argv[1]);
@@ -1512,7 +1516,7 @@
 		trx = gsm_bts_trx_num(bts, trx_nr);
 
 		if (argc == 2)
-			return dump_lchan_trx(trx, vty, dump_cb);
+			return dump_lchan_trx(trx, vty, dump_cb, all);
 	}
 	if (argc >= 3) {
 		ts_nr = atoi(argv[2]);
@@ -1524,7 +1528,7 @@
 		ts = &trx->ts[ts_nr];
 
 		if (argc == 3)
-			return dump_lchan_trx_ts(ts, vty, dump_cb);
+			return dump_lchan_trx_ts(ts, vty, dump_cb, all);
 	}
 	if (argc >= 4) {
 		lchan_nr = atoi(argv[3]);
@@ -1541,7 +1545,7 @@
 
 	for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++) {
 		bts = gsm_bts_num(net, bts_nr);
-		dump_lchan_bts(bts, vty, dump_cb);
+		dump_lchan_bts(bts, vty, dump_cb, all);
 	}
 
 	return CMD_SUCCESS;
@@ -1554,17 +1558,27 @@
 	SHOW_STR "Display information about a logical channel\n"
 	BTS_TRX_TS_LCHAN_STR)
 {
-	return lchan_summary(vty, argc, argv, lchan_dump_full_vty);
+	return lchan_summary(vty, argc, argv, lchan_dump_full_vty, true);
 }
 
 DEFUN(show_lchan_summary,
       show_lchan_summary_cmd,
       "show lchan summary [<0-255>] [<0-255>] [<0-7>] [<0-7>]",
 	SHOW_STR "Display information about a logical channel\n"
-        "Short summary\n"
+        "Short summary (in use lchans)\n"
 	BTS_TRX_TS_LCHAN_STR)
 {
-	return lchan_summary(vty, argc, argv, lchan_dump_short_vty);
+	return lchan_summary(vty, argc, argv, lchan_dump_short_vty, false);
+}
+
+DEFUN(show_lchan_all,
+      show_lchan_all_cmd,
+      "show lchan all [<0-255>] [<0-255>] [<0-7>] [<0-7>]",
+	SHOW_STR "Display information about a logical channel\n"
+        "Short summary (all lchans)\n"
+	BTS_TRX_TS_LCHAN_STR)
+{
+	return lchan_summary(vty, argc, argv, lchan_dump_short_vty, true);
 }
 
 static void dump_one_subscr_conn(struct vty *vty, const struct gsm_subscriber_connection *conn)
@@ -5085,6 +5099,7 @@
 	install_element_ve(&show_ts_cmd);
 	install_element_ve(&show_lchan_cmd);
 	install_element_ve(&show_lchan_summary_cmd);
+	install_element_ve(&show_lchan_all_cmd);
 
 	install_element_ve(&show_subscr_conn_cmd);
 

-- 
To view, visit https://gerrit.osmocom.org/12678
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: Ifcf5d4ca2f22f7cb994dd15135cdcc9d05aa9dab
Gerrit-Change-Number: 12678
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190122/e6132bfa/attachment.htm>


More information about the gerrit-log mailing list