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
This commit is contained in:
Oliver Smith 2018-10-09 15:24:06 +02:00 committed by osmith
parent acd29192de
commit f105190cc6
1 changed files with 18 additions and 2 deletions

View File

@ -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 @@ static void e1isl_dump_vty(struct vty *vty, struct e1inp_sign_link *e1l)
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 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
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 @@ static void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx)
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);