From f105190cc697dda640ae312a6caa8ee1ede733eb Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 9 Oct 2018 15:24:06 +0200 Subject: 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 --- src/osmo-bsc/bsc_vty.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 8e6ff3e0d..f156cc874 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3