Change in osmo-bts[master]: vty: add 'show gprs' command to show GPRS related info

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu Oct 8 15:38:48 UTC 2020


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/20484 )


Change subject: vty: add 'show gprs' command to show GPRS related info
......................................................................

vty: add 'show gprs' command to show GPRS related info

Here is a sample output:

  OsmoBTS# show gprs
  BTS 0, RAC 0, NSEI 101, BVCI 2
    Cell NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
    NSE NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
    NSVC0 (NSVCI 101) NM state: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
      Address: r=127.0.0.1:23010<->l=0.0.0.0:55385
    NSVC1 (NSVCI 0) NM state: Oper 'Disabled', Admin 'Locked', Avail 'Off line'

This command is useful for debugging NS connection problems.

Change-Id: I149eea0b1c109020406eb67c9082c335a77aab06
---
M src/common/vty.c
1 file changed, 66 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/84/20484/1

diff --git a/src/common/vty.c b/src/common/vty.c
index d3926b6..48b4359 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -39,6 +39,7 @@
 #include <osmocom/vty/ports.h>
 #include <osmocom/core/gsmtap.h>
 #include <osmocom/core/utils.h>
+#include <osmocom/core/sockaddr_str.h>
 #include <osmocom/trau/osmo_ortp.h>
 
 
@@ -961,6 +962,69 @@
 	return CMD_SUCCESS;
 }
 
+static void gprs_dump_vty(struct vty *vty, const struct gsm_bts *bts)
+{
+	unsigned int i;
+
+	/* GPRS parameters received from the BSC */
+	vty_out(vty, "BTS %u, RAC %u, NSEI %u, BVCI %u%s",
+		bts->nr, bts->gprs.rac,
+		bts->gprs.nse.nsei,
+		bts->gprs.cell.bvci,
+		VTY_NEWLINE);
+
+	vty_out(vty, "  Cell NM state: ");
+	net_dump_nmstate(vty, &bts->gprs.cell.mo.nm_state);
+	vty_out(vty, "  NSE NM state: ");
+	net_dump_nmstate(vty, &bts->gprs.nse.mo.nm_state);
+
+	for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
+		const struct gsm_bts_gprs_nsvc *nsvc = &bts->gprs.nsvc[i];
+		struct osmo_sockaddr_str remote = { };
+		struct osmo_sockaddr_str local = { };
+
+		vty_out(vty, "  NSVC%u (NSVCI %u) NM state: ", i, nsvc->nsvci);
+		net_dump_nmstate(vty, &nsvc->mo.nm_state);
+
+		if (nsvc->mo.nm_state.operational == NM_OPSTATE_ENABLED) {
+			osmo_sockaddr_str_from_sockaddr(&remote, &nsvc->remote.u.sas);
+			osmo_sockaddr_str_from_sockaddr(&local, &nsvc->local.u.sas);
+			vty_out(vty, "    Address: r=" OSMO_SOCKADDR_STR_FMT
+					       "<->l=" OSMO_SOCKADDR_STR_FMT "%s",
+				OSMO_SOCKADDR_STR_FMT_ARGS(&remote),
+				OSMO_SOCKADDR_STR_FMT_ARGS(&local),
+				VTY_NEWLINE);
+		}
+	}
+}
+
+DEFUN(show_gprs, show_gprs_cmd, "show gprs [<0-255>]",
+      SHOW_STR "Display information about GPRS/EGPRS\n"
+      BTS_NR_STR)
+{
+	const struct gsm_network *net = gsmnet_from_vty(vty);
+	const struct gsm_bts *bts;
+	int bts_nr;
+
+	if (argc > 0) {
+		bts = gsm_bts_num(net, atoi(argv[0]));
+		if (bts == NULL) {
+			vty_out(vty, "%% can't find BTS '%s'%s",
+				argv[0], VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+
+		gprs_dump_vty(vty, bts);
+		return CMD_SUCCESS;
+	}
+
+	for (bts_nr = 0; bts_nr < net->num_bts; bts_nr++)
+		gprs_dump_vty(vty, gsm_bts_num(net, bts_nr));
+
+	/* TODO: also print info about PCUIF connection */
+	return CMD_SUCCESS;
+}
+
 DEFUN(test_send_failure_event_report, test_send_failure_event_report_cmd, "test send-failure-event-report <0-255>",
       "Various testing commands\n"
       "Send a test OML failure event report to the BSC\n" BTS_NR_STR)
@@ -1750,6 +1814,8 @@
 	install_element_ve(&show_ts_cmd);
 	install_element_ve(&show_lchan_cmd);
 	install_element_ve(&show_lchan_summary_cmd);
+	install_element_ve(&show_gprs_cmd);
+
 	install_element_ve(&logging_fltr_l1_sapi_cmd);
 	install_element_ve(&no_logging_fltr_l1_sapi_cmd);
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/20484
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I149eea0b1c109020406eb67c9082c335a77aab06
Gerrit-Change-Number: 20484
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201008/595d8a71/attachment.htm>


More information about the gerrit-log mailing list