Change in osmo-bsc[master]: abis_nm: Add support to parse OML IP and Unit Id in Get Attributes

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Nov 9 15:50:46 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/11694 )

Change subject: abis_nm: Add support to parse OML IP and Unit Id in Get Attributes
......................................................................

abis_nm: Add support to parse OML IP and Unit Id in Get Attributes

Change-Id: Ia05e0b8fe3e28aaf2b2253d018f0614e83e23caa
---
M include/osmocom/bsc/abis_nm.h
M src/osmo-bsc/abis_nm.c
2 files changed, 49 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h
index ef9e4f5..45bbe2c 100644
--- a/include/osmocom/bsc/abis_nm.h
+++ b/include/osmocom/bsc/abis_nm.h
@@ -67,6 +67,8 @@
 extern int abis_nm_rcvmsg(struct msgb *msg);
 
 int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len);
+int abis_nm_tlv_attr_primary_oml(struct tlv_parsed *tp, struct in_addr *ia, uint16_t *oml_port);
+int abis_nm_tlv_attr_unit_id(struct tlv_parsed *tp, char* unit_id, size_t buf_len);
 int abis_nm_rx(struct msgb *msg);
 int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2);
 int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0,
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 005c417..89a6d82 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -64,6 +64,39 @@
 	return tlv_parse(tp, &bts->model->nm_att_tlvdef, buf, len, 0, 0);
 }
 
+/* Parse OML Primary IP and port from tlv_parsed containing list of Reported Attributes */
+int abis_nm_tlv_attr_primary_oml(struct tlv_parsed *tp, struct in_addr *ia, uint16_t *oml_port)
+{
+	const uint8_t* data;
+	if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_PRIM_OML_CFG_LIST, 7)) {
+		data = TLVP_VAL(tp, NM_ATT_IPACC_PRIM_OML_CFG_LIST);
+		if (NM_ATT_IPACC_PRIM_OML_CFG == *data) {
+			ia->s_addr = htonl(osmo_load32be(data+1));
+			*oml_port = osmo_load16be(data+5);
+			return 0;
+		}else {
+			LOGP(DNM, LOGL_ERROR,
+			     "Get Attributes Response: PRIM_OML_CFG_LIST has unexpected format: %s\n",
+			     osmo_hexdump(data, TLVP_LEN(tp, NM_ATT_IPACC_PRIM_OML_CFG_LIST)));
+		}
+	}
+	return -1;
+}
+
+/* Parse OML Primary IP and port from tlv_parsed containing list of Reported Attributes */
+int abis_nm_tlv_attr_unit_id(struct tlv_parsed *tp, char* unit_id, size_t buf_len)
+{
+	const uint8_t* data;
+	uint16_t len;
+	if (TLVP_PRES_LEN(tp, NM_ATT_IPACC_UNIT_ID, 1)) {
+		data = TLVP_VAL(tp, NM_ATT_IPACC_UNIT_ID);
+		len = TLVP_LEN(tp, NM_ATT_IPACC_UNIT_ID);
+		osmo_strlcpy(unit_id, (char*)data, OSMO_MIN(len, buf_len));
+		return 0;
+	}
+	return -1;
+}
+
 static int is_in_arr(enum abis_nm_msgtype mt, const enum abis_nm_msgtype *arr, int size)
 {
 	int i;
@@ -473,6 +506,9 @@
 	uint16_t len;
 	int i;
 	int rc;
+	uint16_t port;
+	struct in_addr ia = {0};
+	char unit_id[40];
 	struct abis_nm_sw_desc sw_descr[MAX_BTS_ATTR];
 
 	/* Parse Attribute Response Info content for 3GPP TS 52.021 §9.4.30 Manufacturer Id */
@@ -528,6 +564,17 @@
 		}
 	}
 
+	if (abis_nm_tlv_attr_primary_oml(tp, &ia, &port) == 0) {
+		LOGPFOH(DNM, LOGL_NOTICE, foh,
+			"BTS%u Get Attributes Response: Primary OML IP is %s:%u\n",
+			bts->nr, inet_ntoa(ia), port);
+	}
+
+	if (abis_nm_tlv_attr_unit_id(tp, unit_id, sizeof(unit_id)) == 0) {
+		LOGPFOH(DNM, LOGL_NOTICE, foh, "BTS%u Get Attributes Response: Unit ID is %s\n",
+			bts->nr, unit_id);
+	}
+
 	return 0;
 }
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia05e0b8fe3e28aaf2b2253d018f0614e83e23caa
Gerrit-Change-Number: 11694
Gerrit-PatchSet: 3
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181109/2a96c71f/attachment.htm>


More information about the gerrit-log mailing list