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

2021-01-07 Thread fixeria
fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/20484 )

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

vty: add a command to show GPRS related info

Here is a sample output:

  OsmoBTS# show bts 0 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, 70 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/common/vty.c b/src/common/vty.c
index 326e332..1c3b496 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 


@@ -1104,6 +1105,73 @@
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, >gprs.cell.mo.nm_state);
+   vty_out(vty, "  NSE NM state: ");
+   net_dump_nmstate(vty, >gprs.nse.mo.nm_state);
+
+   for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
+   const struct gsm_bts_gprs_nsvc *nsvc = >gprs.nsvc[i];
+
+   vty_out(vty, "  NSVC%u (NSVCI %u) NM state: ", i, nsvc->nsvci);
+   net_dump_nmstate(vty, >mo.nm_state);
+
+   if (nsvc->mo.nm_state.operational == NM_OPSTATE_ENABLED) {
+   struct osmo_sockaddr_str remote;
+   struct osmo_sockaddr_str local;
+
+   if (osmo_sockaddr_str_from_sockaddr(, 
>remote.u.sas) != 0)
+   remote = (struct osmo_sockaddr_str) { .ip = 
"" };
+   if (osmo_sockaddr_str_from_sockaddr(, 
>local.u.sas) != 0)
+   local = (struct osmo_sockaddr_str) { .ip = 
"" };
+
+   /* Work around for over-defensiveness of 
OSMO_SOCKADDR_STR_FMT_ARGS():
+*  error: the address of ‘remote’ will always evaluate 
as ‘true’
+*  error: the address of ‘local’ will always evaluate 
as ‘true’ */
+   const struct osmo_sockaddr_str *r = 
+   const struct osmo_sockaddr_str *l = 
+
+   /* Getting remote/local address info has never been so 
easy, right? */
+   vty_out(vty, "Address: r=" OSMO_SOCKADDR_STR_FMT
+  "<->l=" OSMO_SOCKADDR_STR_FMT 
"%s",
+   OSMO_SOCKADDR_STR_FMT_ARGS(r),
+   OSMO_SOCKADDR_STR_FMT_ARGS(l),
+   VTY_NEWLINE);
+   }
+   }
+}
+
+DEFUN(show_bts_gprs, show_bts_gprs_cmd,
+  "show bts <0-255> gprs",
+  SHOW_STR "Display information about a BTS\n"
+  BTS_NR_STR "GPRS/EGPRS configuration\n")
+{
+   const struct gsm_network *net = gsmnet_from_vty(vty);
+   const struct gsm_bts *bts;
+
+   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;
+   }
+
+   /* TODO: also print info about PCUIF connection */
+   gprs_dump_vty(vty, bts);
+   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)
@@ -2032,6 +2100,8 @@
install_element_ve(_ts_cmd);
install_element_ve(_lchan_cmd);
install_element_ve(_lchan_summary_cmd);
+   install_element_ve(_bts_gprs_cmd);
+
install_element_ve(_fltr_l1_sapi_cmd);
install_element_ve(_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: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder

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

2021-01-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/20484 )

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


Patch Set 4: Code-Review+2


--
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: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 07 Jan 2021 13:22:22 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2021-01-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/20484 )

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


Patch Set 4: Code-Review+1


--
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: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 07 Jan 2021 13:14:52 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2021-01-07 Thread fixeria
Hello Jenkins Builder, pespin,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bts/+/20484

to look at the new patch set (#4).

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

vty: add a command to show GPRS related info

Here is a sample output:

  OsmoBTS# show bts 0 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, 70 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/84/20484/4
--
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: 4
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


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

2021-01-07 Thread fixeria
Hello Jenkins Builder, pespin,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bts/+/20484

to look at the new patch set (#3).

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

vty: add a command to show GPRS related info

Here is a sample output:

  OsmoBTS# show bts 0 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, 59 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/84/20484/3
--
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: 3
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset