[PATCH] osmo-bts[master]: Alarm on various errors

Max gerrit-no-reply at lists.osmocom.org
Mon Jan 2 20:45:12 UTC 2017


Review at  https://gerrit.osmocom.org/1525

Alarm on various errors

Send OML Failure Report for unsupported BTS attributes and other errors.

Change-Id: Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e
Related: OS#1615
---
M src/common/bts.c
M src/common/l1sap.c
M src/common/oml.c
M src/common/rsl.c
4 files changed, 85 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/25/1525/1

diff --git a/src/common/bts.c b/src/common/bts.c
index 9c2f0e0..cfd4c7e 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -255,6 +255,7 @@
 {
 	struct e1inp_sign_link *link = trx->rsl_link;
 	uint8_t radio_state = link ?  NM_OPSTATE_ENABLED : NM_OPSTATE_DISABLED;
+	int rc;
 
 	LOGP(DSUM, LOGL_INFO, "RSL link (TRX %02x) state changed to %s, sending Status'.\n",
 		trx->nr, link ? "up" : "down");
@@ -262,10 +263,13 @@
 	oml_mo_state_chg(&trx->mo, radio_state, NM_AVSTATE_OK);
 
 	if (link)
-		rsl_tx_rf_res(trx);
+		rc = rsl_tx_rf_res(trx);
 	else
-		bts_model_trx_deact_rf(trx);
-
+		rc = bts_model_trx_deact_rf(trx);
+	if(rc < 0)
+		oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_RSL_FAIL, link ?
+					 "Failed to establish RSL link (%d)\n" :
+					 "Failed to deactivate RF (%d)\n", rc);
 	return 0;
 }
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e9c94f0..2408d84 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -44,6 +44,7 @@
 #include <osmo-bts/measurement.h>
 #include <osmo-bts/bts.h>
 #include <osmo-bts/rsl.h>
+#include <osmo-bts/oml.h>
 #include <osmo-bts/bts_model.h>
 #include <osmo-bts/handover.h>
 #include <osmo-bts/power_control.h>
@@ -1024,6 +1025,10 @@
 	default:
 		LOGP(DL1P, LOGL_NOTICE, "unknown prim %d op %d\n",
 			l1sap->oph.primitive, l1sap->oph.operation);
+		oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
+					 "unknown prim %d op %d\n",
+					 l1sap->oph.primitive,
+					 l1sap->oph.operation);
 		break;
 	}
 
diff --git a/src/common/oml.c b/src/common/oml.c
index 870ef3c..26d425d 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -345,19 +345,28 @@
 	DEBUGPC(DOML, "Rx SET BTS ATTR\n");
 
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
-	if (rc < 0)
+	if (rc < 0) {
+		oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UNSUP_ATTR,
+					 "New value for Attribute not supported\n");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+	}
 
 	/* Test for globally unsupported stuff here */
 	if (TLVP_PRESENT(&tp, NM_ATT_BCCH_ARFCN)) {
 		uint16_t arfcn = ntohs(tlvp_val16_unal(&tp, NM_ATT_BCCH_ARFCN));
 		if (arfcn > 1024) {
+			oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_WARN_SW_WARN,
+						 "Given ARFCN %d is not supported.\n",
+						 arfcn);
 			LOGP(DOML, LOGL_NOTICE, "Given ARFCN %d is not supported.\n", arfcn);
 			return oml_fom_ack_nack(msg, NM_NACK_FREQ_NOTAVAIL);
 		}
 	}
 	/* 9.4.52 Starting Time */
 	if (TLVP_PRESENT(&tp, NM_ATT_START_TIME)) {
+		oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UNSUP_ATTR,
+					 "NM_ATT_START_TIME Attribute not "
+					 "supported\n");
 		return oml_fom_ack_nack(msg, NM_NACK_SPEC_IMPL_NOTSUPP);
 	}
 
@@ -494,8 +503,12 @@
 	DEBUGPC(DOML, "Rx SET RADIO CARRIER ATTR\n");
 
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
-	if (rc < 0)
+	if (rc < 0) {
+		oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UNSUP_ATTR,
+					 "New value for Set Radio Attribute not"
+					 " supported\n");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+	}
 
 	/* merge existing BTS attributes with new attributes */
 	tp_merged = osmo_tlvp_copy(trx->mo.nm_attr, trx->bts);
@@ -656,8 +669,12 @@
 	DEBUGPC(DOML, "Rx SET CHAN ATTR\n");
 
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
-	if (rc < 0)
+	if (rc < 0) {
+		oml_tx_failure_event_rep(&ts->mo, OSMO_EVT_MAJ_UNSUP_ATTR,
+					 "New value for Set Channel Attribute "
+					 "not supported\n");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+	}
 
 	/* 9.4.21 HSN... */
 	/* 9.4.27 MAIO */
@@ -791,11 +808,29 @@
 
 	if (msgb_l2len(msg) < sizeof(*foh)) {
 		LOGP(DOML, LOGL_NOTICE, "Formatted O&M message too short\n");
+		trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
+		if (trx) {
+			trx->mo.obj_inst.bts_nr = 0;
+			trx->mo.obj_inst.trx_nr = foh->obj_inst.trx_nr;
+			trx->mo.obj_inst.ts_nr = 0xff;
+			oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
+						 "Formatted O&M message too short\n");
+		}
 		return -EIO;
 	}
 
 	if (foh->obj_inst.bts_nr != 0 && foh->obj_inst.bts_nr != 0xff) {
 		LOGP(DOML, LOGL_INFO, "Formatted O&M with BTS %d out of range.\n", foh->obj_inst.bts_nr);
+		trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
+		if (trx){
+			trx->mo.obj_inst.bts_nr = 0;
+			trx->mo.obj_inst.trx_nr = foh->obj_inst.trx_nr;
+			trx->mo.obj_inst.ts_nr = 0xff;
+			oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
+						 "Formatted O&M with BTS %d out"
+						 " of range (0:0xFF).\n",
+						 foh->obj_inst.bts_nr);
+		}
 		return oml_fom_ack_nack(msg, NM_NACK_BTSNR_UNKN);
 	}
 
@@ -829,6 +864,20 @@
 	default:
 		LOGP(DOML, LOGL_INFO, "unknown Formatted O&M msg_type 0x%02x\n",
 			foh->msg_type);
+		trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
+		if (trx) {
+			trx->mo.obj_inst.bts_nr = 0;
+			trx->mo.obj_inst.trx_nr = foh->obj_inst.trx_nr;
+			trx->mo.obj_inst.ts_nr = 0xff;
+			oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
+						 "unknown Formatted O&M "
+						 "msg_type 0x%02x\n",
+						 foh->msg_type);
+		} else
+			oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UKWN_MSG,
+						 "unknown Formatted O&M "
+						 "msg_type 0x%02x\n",
+						 foh->msg_type);
 		ret = oml_fom_ack_nack(msg, NM_NACK_MSGTYPE_INVAL);
 	}
 
@@ -997,8 +1046,13 @@
 	DEBUGPC(DOML, "Rx IPA SET ATTR\n");
 
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
-	if (rc < 0)
+	if (rc < 0) {
+		mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
+		oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UNSUP_ATTR,
+					 "New value for IPAC Set Attribute not "
+					 "supported\n");
 		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+	}
 
 	/* Resolve MO by obj_class/obj_inst */
 	mo = gsm_objclass2mo(bts, foh->obj_class, &foh->obj_inst);
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 9e9cbb6..0f237e8 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -401,7 +401,11 @@
 	rc = paging_add_identity(btsb->paging_state, paging_group,
 				 identity_lv, chan_needed);
 	if (rc < 0) {
-		/* FIXME: notfiy the BSC somehow ?*/
+		/* FIXME: notfiy the BSC on other errors? */
+		if(rc == -ENOSPC && trx)
+			oml_tx_failure_event_rep(&trx->mo,
+						 OSMO_EVT_MIN_PAG_TAB_FULL,
+						 "BTS page table is full\n");
 	}
 
 	pcu_tx_pag_req(identity_lv, chan_needed);
@@ -1649,6 +1653,11 @@
 			LOGP(DRSL, LOGL_ERROR,
 			     "%s IPAC Failed to create RTP/RTCP sockets\n",
 			     gsm_lchan_name(lchan));
+			oml_tx_failure_event_rep(&lchan->ts->trx->mo,
+						 OSMO_EVT_CRIT_RTP_TOUT,
+						 "%s IPAC Failed to create "
+						 "RTP/RTCP sockets\n",
+						 gsm_lchan_name(lchan));
 			return tx_ipac_XXcx_nack(lchan, RSL_ERR_RES_UNAVAIL,
 						 inc_ip_port, dch->c.msg_type);
 		}
@@ -1688,6 +1697,11 @@
 			LOGP(DRSL, LOGL_ERROR,
 			     "%s IPAC Failed to bind RTP/RTCP sockets\n",
 			     gsm_lchan_name(lchan));
+			oml_tx_failure_event_rep(&lchan->ts->trx->mo,
+						 OSMO_EVT_CRIT_RTP_TOUT,
+						 "%s IPAC Failed to bind "
+						 "RTP/RTCP sockets\n",
+						 gsm_lchan_name(lchan));
 			osmo_rtp_socket_free(lchan->abis_ip.rtp_socket);
 			lchan->abis_ip.rtp_socket = NULL;
 			msgb_queue_flush(&lchan->dl_tch_queue);

-- 
To view, visit https://gerrit.osmocom.org/1525
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic163bcfb6361a8ebd39e0bc0f238ef51e2cb214e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>


More information about the gerrit-log mailing list