Change in osmo-bts[master]: oml: Print more context from FOM Header or using MO

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri May 24 08:38:14 UTC 2019


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


Change subject: oml: Print more context from FOM Header or using MO
......................................................................

oml: Print more context from FOM Header or using MO

Some of our OML log lines were missing any context.  Try making more
sense by printing any context information about the given managed
object, TRX, ... as we have it.

Change-Id: I60d1660c6d574f206d7b8cc10082b413142365dd
---
M src/common/oml.c
1 file changed, 31 insertions(+), 28 deletions(-)



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

diff --git a/src/common/oml.c b/src/common/oml.c
index 186c2a2..63643c5 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -70,6 +70,16 @@
 	return msgb_alloc_headroom(1024, 128, "OML");
 }
 
+/* FIXME: move to gsm_data_shared */
+static char mo_buf[128];
+char *gsm_abis_mo_name(const struct gsm_abis_mo *mo)
+{
+	snprintf(mo_buf, sizeof(mo_buf), "OC=%s INST=(%02x,%02x,%02x)",
+		 get_value_string(abis_nm_obj_class_names, mo->obj_class),
+		 mo->obj_inst.bts_nr, mo->obj_inst.trx_nr, mo->obj_inst.ts_nr);
+	return mo_buf;
+}
+
 /* 3GPP TS 12.21 § 8.8.2 */
 int oml_tx_failure_event_rep(const struct gsm_abis_mo *mo, uint16_t cause_value,
 			     const char *fmt, ...)
@@ -77,7 +87,8 @@
 	struct msgb *nmsg;
 	va_list ap;
 
-	LOGP(DOML, LOGL_NOTICE, "Sending %s to BSC: ", get_value_string(abis_mm_event_cause_names, cause_value));
+	LOGP(DOML, LOGL_NOTICE, "%s: Sending %s to BSC: ", gsm_abis_mo_name(mo),
+		get_value_string(abis_mm_event_cause_names, cause_value));
 	va_start(ap, fmt);
 	osmo_vlogp(DOML, LOGL_NOTICE, __FILE__, __LINE__, 1, fmt, ap);
 	nmsg = abis_nm_fail_evt_vrep(NM_EVT_PROC_FAIL, NM_SEVER_CRITICAL,
@@ -133,16 +144,6 @@
 	return oml_send_msg(msg, 0);
 }
 
-/* FIXME: move to gsm_data_shared */
-static char mo_buf[128];
-char *gsm_abis_mo_name(const struct gsm_abis_mo *mo)
-{
-	snprintf(mo_buf, sizeof(mo_buf), "OC=%s INST=(%02x,%02x,%02x)",
-		 get_value_string(abis_nm_obj_class_names, mo->obj_class),
-		 mo->obj_inst.bts_nr, mo->obj_inst.trx_nr, mo->obj_inst.ts_nr);
-	return mo_buf;
-}
-
 static inline void add_bts_attrs(struct msgb *msg, const struct gsm_bts *bts)
 {
 	uint16_t total_len = 0;
@@ -203,7 +204,7 @@
 	int i;
 
 	if (!trx) {
-		LOGP(DOML, LOGL_ERROR, "O&M Get Attributes for unknown TRX\n");
+		LOGP(DOML, LOGL_ERROR, "%s: O&M Get Attributes for unknown TRX\n", gsm_trx_name(trx));
 		return -NM_NACK_TRXNR_UNKN;
 	}
 
@@ -213,8 +214,8 @@
 			add_trx_attr(out_msg, trx);
 			break;
 		default:
-			LOGP(DOML, LOGL_ERROR, "O&M Get Attributes [%u], %s is unsupported by TRX.\n", i,
-			     get_value_string(abis_nm_att_names, attr[i]));
+			LOGP(DOML, LOGL_ERROR, "%s: O&M Get Attributes [%u], %s is unsupported by TRX.\n",
+			     gsm_trx_name(trx), i, get_value_string(abis_nm_att_names, attr[i]));
 			/* Push this tag to the list of unsupported attributes */
 			buf = msgb_push(out_msg, 1);
 			*buf = attr[i];
@@ -273,10 +274,10 @@
 			    const uint8_t *attr, uint16_t attr_len)
 {
 	struct msgb *nmsg = oml_msgb_alloc();
+	const char *mo_name = gsm_abis_mo_name(mo);
 	int rc;
 
-	LOGP(DOML, LOGL_INFO, "%s Tx Get Attribute Response\n",
-	     get_value_string(abis_nm_obj_class_names, mo->obj_class));
+	LOGP(DOML, LOGL_INFO, "%s Tx Get Attribute Response\n", mo_name);
 
 	if (!nmsg)
 		return -NM_NACK_CANT_PERFORM;
@@ -289,13 +290,14 @@
 		rc = handle_attrs_trx(nmsg, gsm_bts_trx_num(mo->bts, mo->obj_inst.trx_nr), attr, attr_len);
 		break;
 	default:
-		LOGP(DOML, LOGL_ERROR, "Unsupported MO class %s in Get Attribute Response\n",
-		     get_value_string(abis_nm_obj_class_names, mo->obj_class));
+		LOGP(DOML, LOGL_ERROR, "%s: Unsupported MO class in Get Attribute Response\n",
+		     mo_name);
 		rc = -NM_NACK_OBJCLASS_NOTSUPP;
 	}
 
 	if (rc < 0) {
-		LOGP(DOML, LOGL_ERROR, "Tx Get Attribute Response FAILED with rc=%d\n", rc);
+		LOGP(DOML, LOGL_ERROR, "%s: Tx Get Attribute Response FAILED with rc=%d\n",
+		     mo_name, rc);
 		msgb_free(nmsg);
 		return rc;
 	}
@@ -442,7 +444,7 @@
 
 	/* alter message type */
 	if (cause) {
-		LOGP(DOML, LOGL_NOTICE, "Sending FOM NACK with cause %s.\n",
+		LOGPFOH(DOML, LOGL_NOTICE, foh, "Sending FOM NACK with cause %s.\n",
 			abis_nm_nack_cause_name(cause));
 		foh->msg_type += 2; /* nack */
 		/* add cause */
@@ -451,7 +453,7 @@
 		struct abis_om_hdr *omh = (struct abis_om_hdr *) msgb_l2(msg);
 		omh->length = msgb_l3len(msg);
 	} else {
-		LOGP(DOML, LOGL_DEBUG, "Sending FOM ACK.\n");
+		LOGPFOH(DOML, LOGL_DEBUG, foh, "Sending FOM ACK.\n");
 		foh->msg_type++; /* ack */
 	}
 
@@ -561,18 +563,18 @@
 	rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
 	if (rc < 0) {
 		oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute parsing failure");
-		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+		return oml_mo_fom_ack_nack(mo, NM_MT_GET_ATTR, NM_NACK_INCORR_STRUCT);
 	}
 
 	if (!TLVP_PRES_LEN(&tp, NM_ATT_LIST_REQ_ATTR, 1)) {
 		oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UNSUP_ATTR, "Get Attribute without Attribute List");
-		return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
+		return oml_mo_fom_ack_nack(mo, NM_MT_GET_ATTR, NM_NACK_INCORR_STRUCT);
 	}
 
 	rc = oml_tx_attr_resp(mo, TLVP_VAL(&tp, NM_ATT_LIST_REQ_ATTR), TLVP_LEN(&tp, NM_ATT_LIST_REQ_ATTR));
 	if (rc < 0) {
 		LOGPFOH(DOML, LOGL_ERROR, foh, "Responding to O&M Get Attributes message with NACK 0%x\n", -rc);
-		return oml_fom_ack_nack(msg, -rc);
+		return oml_mo_fom_ack_nack(mo, NM_MT_GET_ATTR,  -rc);
 	}
 
 	return 0;
@@ -1350,6 +1352,7 @@
 	struct e1inp_sign_link *oml_link = trx->bts->oml_link;
 	uint16_t port = IPA_TCP_PORT_RSL;
 	uint32_t ip = get_signlink_remote_ip(oml_link);
+	const char *trx_name = gsm_trx_name(trx);
 	struct in_addr in;
 	int rc;
 
@@ -1366,16 +1369,16 @@
 	}
 
 	in.s_addr = htonl(ip);
-	LOGP(DOML, LOGL_INFO, "Rx IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n", 
-		inet_ntoa(in), port, stream_id);
+	LOGP(DOML, LOGL_INFO, "%s: Rx IPA RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n", 
+		trx_name, inet_ntoa(in), port, stream_id);
 
 	if (trx->bts->variant == BTS_OSMO_OMLDUMMY) {
 		rc = 0;
-		LOGP(DOML, LOGL_NOTICE, "Not connecting RSL in OML-DUMMY!\n");
+		LOGP(DOML, LOGL_NOTICE, "%s: Not connecting RSL in OML-DUMMY!\n", trx_name);
 	} else
 		rc = e1inp_ipa_bts_rsl_connect_n(oml_link->ts->line, inet_ntoa(in), port, trx->nr);
 	if (rc < 0) {
-		LOGP(DOML, LOGL_ERROR, "Error in abis_open(RSL): %d\n", rc);
+		LOGP(DOML, LOGL_ERROR, "%s: Error in abis_open(RSL): %d\n", trx_name, rc);
 		return oml_fom_ack_nack(msg, NM_NACK_CANT_PERFORM);
 	}
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I60d1660c6d574f206d7b8cc10082b413142365dd
Gerrit-Change-Number: 14161
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/20190524/c73ab9fb/attachment.html>


More information about the gerrit-log mailing list