aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/bsc_vty.c
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2018-10-23 15:35:43 +0200
committerOliver Smith <osmith@sysmocom.de>2018-10-30 16:25:29 +0100
commit8d8d710a281f5e284ce17c531e85ab5b2f1e5bce (patch)
tree9fd5226419c7598c49e4afb51494841b87d9e5bc /src/osmo-bsc/bsc_vty.c
parenta5ff9741bd56b8f4300b55909de9f4a8f89b4a44 (diff)
vty: add 'show rejected-bts'
Print IDs and IPs of recently rejected BTS devices. Example output: OsmoBSC> show rejected-bts Date Site ID BTS ID IP ------------------- ------- ------ --------------- 2018-10-25 09:36:28 1234 0 192.168.1.37 Related: OS#2841 Change-Id: Iba3bfe8fc9432b7ae8f819df8bd71b35b3ec507e
Diffstat (limited to 'src/osmo-bsc/bsc_vty.c')
-rw-r--r--src/osmo-bsc/bsc_vty.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index dd540c12f..410cdac15 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -541,6 +541,33 @@ DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]",
return CMD_SUCCESS;
}
+DEFUN(show_rejected_bts, show_rejected_bts_cmd, "show rejected-bts",
+ SHOW_STR "Display recently rejected BTS devices\n")
+{
+ struct gsm_bts_rejected *pos;
+
+ /* empty list */
+ struct llist_head *rejected = &gsmnet_from_vty(vty)->bts_rejected;
+ if (llist_empty(rejected)) {
+ vty_out(vty, "No BTS has been rejected.%s", VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ /* table head */
+ vty_out(vty, "Date Site ID BTS ID IP%s", VTY_NEWLINE);
+ vty_out(vty, "------------------- ------- ------ ---------------%s", VTY_NEWLINE);
+
+ /* table body */
+ llist_for_each_entry(pos, rejected, list) {
+ /* timestamp formatted like: "2018-10-24 15:04:52" */
+ char buf[20];
+ strftime(buf, sizeof(buf), "%F %T", localtime(&pos->time));
+
+ vty_out(vty, "%s %7u %6u %15s%s", buf, pos->site_id, pos->bts_id, pos->ip, VTY_NEWLINE);
+ }
+ return CMD_SUCCESS;
+}
+
/* utility functions */
static void parse_e1_link(struct gsm_e1_subslot *e1_link, const char *line,
const char *ts, const char *ss)
@@ -4867,6 +4894,7 @@ int bsc_vty_init(struct gsm_network *network)
install_element_ve(&bsc_show_net_cmd);
install_element_ve(&show_bts_cmd);
+ install_element_ve(&show_rejected_bts_cmd);
install_element_ve(&show_trx_cmd);
install_element_ve(&show_ts_cmd);
install_element_ve(&show_lchan_cmd);