From c038cb790309c4970980d6811456c3ed6bc4d896 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 2 Jan 2017 20:16:22 +0100 Subject: Add Abis OML failure event reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Send 3GPP TS 12.21 § 8.8.2 Abis/OML failure event report. Change-Id: Ib1170edca2207752984a554d7a6a57c224f6d5f5 Related: OS#1615 --- include/osmo-bts/oml.h | 6 ++++++ src/common/main.c | 11 ++++++++++- src/common/oml.c | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h index 9f494447..217ec64c 100644 --- a/include/osmo-bts/oml.h +++ b/include/osmo-bts/oml.h @@ -1,6 +1,8 @@ #ifndef _OML_H #define _OML_H +#include + struct gsm_bts; struct gsm_abis_mo; struct msgb; @@ -42,4 +44,8 @@ int oml_mo_fom_ack_nack(struct gsm_abis_mo *mo, uint8_t orig_msg_type, int oml_set_lchan_t200(struct gsm_lchan *lchan); extern const unsigned int oml_default_t200_ms[7]; +/* Transmit failure event report */ +int oml_tx_failure_event_rep(struct gsm_abis_mo *mo, uint16_t cause_value, + const char *fmt, ...); + #endif // _OML_H */ diff --git a/src/common/main.c b/src/common/main.c index 1b2549e0..f99f196a 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -50,6 +50,7 @@ #include #include #include +#include int quit = 0; static const char *config_file = "osmo-bts.cfg"; @@ -181,13 +182,21 @@ static void signal_handler(int signal) switch (signal) { case SIGINT: //osmo_signal_dispatch(SS_GLOBAL, S_GLOBAL_SHUTDOWN, NULL); - if (!quit) + if (!quit) { + oml_tx_failure_event_rep(&bts->mo, + OSMO_EVT_CRIT_PROC_STOP, + "BTS: SIGINT received -> " + "shutdown\n"); bts_shutdown(bts, "SIGINT"); + } quit++; break; case SIGABRT: case SIGUSR1: case SIGUSR2: + oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_CRIT_PROC_STOP, + "BTS: signal %s received\n", + strsignal(signal)); talloc_report_full(tall_bts_ctx, stderr); break; default: diff --git a/src/common/oml.c b/src/common/oml.c index 0700aa23..870ef3c7 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -1140,6 +1140,25 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg) return ret; } +/* 3GPP TS 12.21 § 8.8.2 */ +int oml_tx_failure_event_rep(struct gsm_abis_mo *mo, uint16_t cause_value, + const char *fmt, ...) +{ + struct msgb *nmsg; + va_list ap; + + va_start(ap, fmt); + nmsg = abis_nm_fail_evt_rep(NM_EVT_PROC_FAIL, NM_SEVER_CRITICAL, + NM_PCAUSE_T_MANUF, cause_value, fmt, ap); + LOGP(DOML, LOGL_INFO, fmt, ap); + va_end(ap); + + if (!nmsg) + return -ENOMEM; + + return oml_mo_send_msg(mo, nmsg, NM_MT_FAILURE_EVENT_REP); +} + int oml_init(void) { DEBUGP(DOML, "Initializing OML attribute definitions\n"); -- cgit v1.2.3