laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/35567?usp=email )

Change subject: VTY: Add command `show bts brief`
......................................................................

VTY: Add command `show bts brief`

This line shows all BTS an their OML states in a single line.
Additionally the uptime or downtime is displayed, if there was a connect
or disconnect of the OML link.

Related: OS#6018
Change-Id: I003fd32e589ddf53b7dd42089f904cfb598e3625
---
M include/osmocom/bsc/vty.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/bts_vty.c
3 files changed, 47 insertions(+), 9 deletions(-)

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




diff --git a/include/osmocom/bsc/vty.h b/include/osmocom/bsc/vty.h
index a54b18e..092bc20 100644
--- a/include/osmocom/bsc/vty.h
+++ b/include/osmocom/bsc/vty.h
@@ -51,6 +51,7 @@

 int bts_vty_init(void);
 void bts_dump_vty(struct vty *vty, struct gsm_bts *bts);
+void bts_dump_vty_oml_link_state(struct vty *vty, struct gsm_bts *bts);
 void trx_dump_vty(struct vty *vty, struct gsm_bts_trx *trx, bool print_rsl, 
bool show_connected);
 void ts_dump_vty(struct vty *vty, struct gsm_bts_trx_ts *ts);
 void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 8a0747c..8690a47 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -257,6 +257,22 @@
        return CMD_SUCCESS;
 }

+DEFUN(show_bts_brief, show_bts_brief_cmd, "show bts brief",
+       SHOW_STR "Display information about a BTS\n"
+               "Display availability status of all BTS\n")
+{
+       struct gsm_network *net = gsmnet_from_vty(vty);
+       struct gsm_bts *bts;
+
+       /* Print OML state of BTSs. */
+       llist_for_each_entry(bts, &net->bts_list, list) {
+               vty_out(vty, "BTS %d:", bts->nr);
+               bts_dump_vty_oml_link_state(vty, bts);
+       }
+
+       return CMD_SUCCESS;
+}
+
 DEFUN(show_bts_fail_rep, show_bts_fail_rep_cmd, "show bts <0-255> fail-rep 
[reset]",
        SHOW_STR "Display information about a BTS\n"
                "BTS number\n" "OML failure reports\n"
@@ -3634,6 +3650,7 @@

        install_element_ve(&bsc_show_net_cmd);
        install_element_ve(&show_bts_cmd);
+       install_element_ve(&show_bts_brief_cmd);
        install_element_ve(&show_bts_fail_rep_cmd);
        install_element_ve(&show_rejected_bts_cmd);
        install_element_ve(&show_trx_cmd);
diff --git a/src/osmo-bsc/bts_vty.c b/src/osmo-bsc/bts_vty.c
index 8aa1f89..e38ec94 100644
--- a/src/osmo-bsc/bts_vty.c
+++ b/src/osmo-bsc/bts_vty.c
@@ -3992,7 +3992,6 @@
 void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
 {
        struct pchan_load pl;
-       unsigned long long sec;
        struct gsm_bts_trx *trx;
        int ts_hopping_total;
        int ts_non_hopping_total;
@@ -4124,14 +4123,7 @@
        if (is_ipa_abisip_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));
-               if (bts_setup_ramp_active(bts->network))
-                       vty_out(vty, "  BTS Ramping: %s", 
bts_setup_ramp_get_state_str(bts));
-               sec = bts_updowntime(bts);
-               if (sec)
-                       vty_out(vty, " %llu days %llu hours %llu min. %llu 
sec.",
-                               OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), 
OSMO_SEC2MIN(sec), sec % 60);
-               vty_out(vty, "%s", VTY_NEWLINE);
+               bts_dump_vty_oml_link_state(vty, bts);
        } else {
                vty_out(vty, "  E1 Signalling Link:%s", VTY_NEWLINE);
                e1isl_dump_vty(vty, bts->oml_link);
@@ -4209,6 +4201,20 @@
        bts_dump_vty_features(vty, bts);
 }

+void bts_dump_vty_oml_link_state(struct vty *vty, struct gsm_bts *bts)
+{
+       unsigned long long sec;
+
+       vty_out(vty, "  OML Link state: %s", get_model_oml_status(bts));
+       if (bts_setup_ramp_active(bts->network))
+               vty_out(vty, "  BTS Ramping: %s", 
bts_setup_ramp_get_state_str(bts));
+       sec = bts_updowntime(bts);
+       if (sec)
+               vty_out(vty, " %llu days %llu hours %llu min. %llu sec.",
+                       OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), 
OSMO_SEC2MIN(sec), sec % 60);
+       vty_out(vty, "%s", VTY_NEWLINE);
+}
+
 static void config_write_bts_gprs(struct vty *vty, struct gsm_bts *bts)
 {
        unsigned int i;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/35567?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I003fd32e589ddf53b7dd42089f904cfb598e3625
Gerrit-Change-Number: 35567
Gerrit-PatchSet: 4
Gerrit-Owner: jolly <andr...@eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: lynxis lazus <lyn...@fe80.eu>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to