Change in osmo-bsc[master]: VTY: add show bts failure report

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Fri Mar 27 09:40:14 UTC 2020


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/17571 )

Change subject: VTY: add show bts failure report
......................................................................

VTY: add show bts failure report

Save OML failure reports from each BTS. Add a VTY command to display them
conveniently and optionally clear the list.

OsmoBSC> show bts 0 fail-rep
[2020-03-23 14:51:22] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY
[2020-03-23 14:51:19] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY

Related: OS#1605
Change-Id: I18aa17a721cd5eb1c98926dc2367229c0a50bc78
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/gsm_data.c
4 files changed, 86 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 5afc2cf..2595174 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1005,6 +1005,12 @@
 	uint8_t overflow;
 };
 
+struct bts_oml_fail_rep {
+	struct llist_head list;
+	time_t time;
+	struct msgb *mb;
+};
+
 /* One BTS */
 struct gsm_bts {
 	/* list header in net->bts_list */
@@ -1267,6 +1273,8 @@
 	struct bts_smscb_chan_state cbch_basic;
 	struct bts_smscb_chan_state cbch_extended;
 	struct osmo_timer_list etws_timer;	/* when to stop ETWS PN */
+
+	struct llist_head oml_fail_rep;
 };
 
 /* One rejected BTS */
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 07effd3..32e9a8f 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -412,6 +412,21 @@
 	int rc = 0;
 	const uint8_t *p_val;
 	const char *e_type, *severity, *p_text;
+	struct bts_oml_fail_rep *entry;
+
+	/* Store copy in bts->oml_fail_rep */
+	entry = talloc_zero(bts, struct bts_oml_fail_rep);
+	OSMO_ASSERT(entry);
+	entry->time = time(NULL);
+	entry->mb = msgb_copy_c(entry, mb, "OML failure report");
+	llist_add(&entry->list, &bts->oml_fail_rep);
+
+	/* Limit list size */
+	if (llist_count(&bts->oml_fail_rep) > 50) {
+		struct bts_oml_fail_rep *old = llist_last_entry(&bts->oml_fail_rep, struct bts_oml_fail_rep, list);
+		llist_del(&old->list);
+		talloc_free(old);
+	}
 
 	sd = abis_nm_fail_evt_rep_parse(mb, bts);
 	if (!sd) {
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 39adb21..e9085b3 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -559,6 +559,67 @@
 	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"
+		"Clear the list of failure reports after showing them\n")
+{
+	struct gsm_network *net = gsmnet_from_vty(vty);
+	struct bts_oml_fail_rep *entry;
+	struct gsm_bts *bts;
+	int bts_nr;
+
+	bts_nr = atoi(argv[0]);
+	if (bts_nr >= net->num_bts) {
+		vty_out(vty, "%% can't find BTS '%s'%s", argv[0], VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	bts = gsm_bts_num(net, bts_nr);
+	if (llist_empty(&bts->oml_fail_rep)) {
+		vty_out(vty, "No failure reports received.%s", VTY_NEWLINE);
+		return CMD_SUCCESS;
+	}
+
+	llist_for_each_entry(entry, &bts->oml_fail_rep, list) {
+		struct nm_fail_rep_signal_data *sd;
+		char timestamp[20]; /* format like 2020-03-23 14:24:00 */
+		enum abis_nm_pcause_type pcause;
+		enum abis_mm_event_causes cause;
+
+		strftime(timestamp, sizeof(timestamp), "%F %T", localtime(&entry->time));
+		sd = abis_nm_fail_evt_rep_parse(entry->mb, bts);
+		if (!sd) {
+			vty_out(vty, "[%s] (failed to parse report)%s", timestamp, VTY_NEWLINE);
+			continue;
+		}
+		pcause = sd->parsed.probable_cause[0];
+		cause = osmo_load16be(sd->parsed.probable_cause + 1);
+
+		vty_out(vty, "[%s] Type=%s, Severity=%s, ", timestamp, sd->parsed.event_type, sd->parsed.severity);
+		vty_out(vty, "Probable cause=%s: ", get_value_string(abis_nm_pcause_type_names, pcause));
+		if (pcause == NM_PCAUSE_T_MANUF)
+			vty_out(vty, "%s, ", get_value_string(abis_mm_event_cause_names, cause));
+		else
+			vty_out(vty, "%04X, ", cause);
+		vty_out(vty, "Additional text=%s%s", sd->parsed.additional_text, VTY_NEWLINE);
+
+		talloc_free(sd);
+	}
+
+	/* Optionally clear the list */
+	if (argc > 1) {
+		while (!llist_empty(&bts->oml_fail_rep)) {
+			struct bts_oml_fail_rep *old = llist_last_entry(&bts->oml_fail_rep, struct bts_oml_fail_rep,
+									list);
+			llist_del(&old->list);
+			talloc_free(old);
+		}
+	}
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(show_rejected_bts, show_rejected_bts_cmd, "show rejected-bts",
 	SHOW_STR "Display recently rejected BTS devices\n")
 {
@@ -5272,6 +5333,7 @@
 
 	install_element_ve(&bsc_show_net_cmd);
 	install_element_ve(&show_bts_cmd);
+	install_element_ve(&show_bts_fail_rep_cmd);
 	install_element_ve(&show_rejected_bts_cmd);
 	install_element_ve(&show_trx_cmd);
 	install_element_ve(&show_trx_con_cmd);
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index f12b032..fe421a4 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -881,6 +881,7 @@
 	INIT_LLIST_HEAD(&bts->abis_queue);
 	INIT_LLIST_HEAD(&bts->loc_list);
 	INIT_LLIST_HEAD(&bts->local_neighbors);
+	INIT_LLIST_HEAD(&bts->oml_fail_rep);
 
 	/* Enable all codecs by default. These get reset to a more fine grained selection IF a
 	 * 'codec-support' config appears in the config file (see bsc_vty.c). */

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I18aa17a721cd5eb1c98926dc2367229c0a50bc78
Gerrit-Change-Number: 17571
Gerrit-PatchSet: 7
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200327/12484e87/attachment.htm>


More information about the gerrit-log mailing list