Change in osmo-bsc[master]: [WIP] ctrl: Send TRAP in case of OML FAIL EVT REP

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat May 25 09:01:21 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/14177


Change subject: [WIP] ctrl: Send TRAP in case of OML FAIL EVT REP
......................................................................

[WIP] ctrl: Send TRAP in case of OML FAIL EVT REP

A BTS sending a FAILURE EVENT REPORT is certainly something that
we'd want to make external listeners aware of.

Change-Id: I4f8a9737c6ef1b951ea8e742cdbd3689371a99d5
---
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/osmo_bsc_ctrl.c
2 files changed, 36 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/77/14177/1

diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index da41c70..a53b82b 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -399,7 +399,8 @@
 		rc = -EINVAL;
 	}
 
-	sd.bts = mb->trx->bts;
+	memset(&sd, 0, sizeof(sd));
+	sd.bts = sign_link->trx->bts;
 	sd.msg = mb;
 	sd.tp = &tp;
 	if (e_type)
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c
index 80699f8..bc359bb 100644
--- a/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -734,6 +734,37 @@
 	return 0;
 }
 
+static int nm_signal_handler(unsigned int subsys, unsigned int signal,
+			void *handler_data, void *signal_data)
+{
+	struct nm_fail_rep_signal_data *sd;
+	struct gsm_network *net;
+	struct ctrl_cmd *cmd;
+
+	if (subsys != SS_NM)
+		return 0;
+	if (signal != S_NM_FAIL_REP)
+		return 0;
+
+	sd = signal_data;
+	net = sd->bts->network;
+
+	cmd = ctrl_cmd_create(tall_bsc_ctx, CTRL_TYPE_TRAP);
+	if (!cmd) {
+		LOGP(DCTRL, LOGL_ERROR, "Trap creation failed.\n");
+		return 0;
+	}
+
+	cmd->id = "0";
+	cmd->variable = talloc_asprintf(cmd, "bts.%d.oml_failure_report", sd->bts->nr);
+	cmd->reply = talloc_asprintf(cmd, "\"%s\",\"%s\",\"%s\"", sd->parsed.event_type,
+				     sd->parsed.severity, sd->parsed.additional_text);
+
+	ctrl_cmd_send_to_all(net->ctrl, cmd);
+
+	return 0;
+}
+
 int bsc_ctrl_cmds_install(struct gsm_network *net)
 {
 	int rc;
@@ -759,6 +790,9 @@
 	rc = osmo_signal_register_handler(SS_MSC, msc_signal_handler, NULL);
 	if (rc)
 		goto end;
+	rc = osmo_signal_register_handler(SS_NM, nm_signal_handler, NULL);
+	if (rc)
+		goto end;
 	rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_bts_connection_status);
 	if (rc)
 		goto end;

-- 
To view, visit https://gerrit.osmocom.org/14177
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f8a9737c6ef1b951ea8e742cdbd3689371a99d5
Gerrit-Change-Number: 14177
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190525/1831040a/attachment.html>


More information about the gerrit-log mailing list