osmith has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11290 )

Change subject: vty 'show bts'/'show trx': display IPs and ports
......................................................................

vty 'show bts'/'show trx': display IPs and ports

This quickly allows knowing which IP a BTS is using in order to SSH
into it. Example output:

OsmoBSC> show trx
...
  Baseband Transceiver NM State: Oper 'Enabled', Admin 'Unlocked', Avail 'OK'
  ip.access stream ID: 0x00 (r=192.168.1.178:34090<->l=192.168.1.37:3003)
...

OsmoBSC> show bts
...
  Paging: 0 pending requests, 50 free slots
  OML Link: (r=192.168.1.178:57692<->l=192.168.1.37:3002)
  OML Link state: connected 0 days 0 hours 0 min. 17 sec.
...

Related: OS#3145
Change-Id: I37f020fcdb68cafcdbdb621808483d1dd996354f
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 18 insertions(+), 2 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 8e6ff3e..f156cc8 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -38,6 +38,7 @@
 #include <arpa/inet.h>

 #include <osmocom/core/linuxlist.h>
+#include <osmocom/core/socket.h>
 #include <osmocom/bsc/gsm_data.h>
 #include <osmocom/abis/e1_input.h>
 #include <osmocom/bsc/abis_nm.h>
@@ -289,6 +290,19 @@
                e1l->tei, e1l->sapi, VTY_NEWLINE);
 }

+/*! Dump the IP addresses and ports of the input signal link's timeslot.
+ *  This only makes sense for links connected with ipaccess.
+ *  Example output: "(r=10.1.42.1:55416<->l=10.1.42.123:3003)" */
+static void e1isl_dump_vty_tcp(struct vty *vty, const struct e1inp_sign_link 
*e1l)
+{
+       if (e1l) {
+               char *name = osmo_sock_get_name(NULL, 
e1l->ts->driver.ipaccess.fd.fd);
+               vty_out(vty, "%s", name);
+               talloc_free(name);
+       }
+       vty_out(vty, "%s", VTY_NEWLINE);
+}
+
 static void vty_out_neigh_list(struct vty *vty, struct bitvec *bv)
 {
        int count = 0;
@@ -445,6 +459,8 @@
                paging_pending_requests_nr(bts),
                bts->paging.available_slots, VTY_NEWLINE);
        if (is_ipaccess_bts(bts)) {
+               vty_out(vty, "  OML Link: ");
+               e1isl_dump_vty_tcp(vty, bts->oml_link);
                vty_out(vty, "  OML Link state: %s", get_model_oml_status(bts));
                sec = bts_uptime(bts);
                if (sec)
@@ -1046,8 +1062,8 @@
        vty_out(vty, "  Baseband Transceiver NM State: ");
        net_dump_nmstate(vty, &trx->bb_transc.mo.nm_state);
        if (is_ipaccess_bts(trx->bts)) {
-               vty_out(vty, "  ip.access stream ID: 0x%02x%s",
-                       trx->rsl_tei, VTY_NEWLINE);
+               vty_out(vty, "  ip.access stream ID: 0x%02x ", trx->rsl_tei);
+               e1isl_dump_vty_tcp(vty, trx->rsl_link);
        } else {
                vty_out(vty, "  E1 Signalling Link:%s", VTY_NEWLINE);
                e1isl_dump_vty(vty, trx->rsl_link);

--
To view, visit https://gerrit.osmocom.org/11290
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: I37f020fcdb68cafcdbdb621808483d1dd996354f
Gerrit-Change-Number: 11290
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>

Reply via email to