[PATCH] openbsc[master]: Get basic BTS 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/.

Max gerrit-no-reply at lists.osmocom.org
Tue May 9 12:25:41 UTC 2017


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

Get basic BTS attributes

Request BTS attributes via OML on connection and parse the response:
* make attribute list const
* expand gsm_bts-features
* add sub_model to gsm_bts
* request/parse incoming response as sw-config

Note: only basic BTS-wide KV attributes wrapped in sw-config are
supported for now.

Change-Id: I589be51daca0cb9e1f3473b93e910e46b06e23ae
Related: OS#1614
---
M openbsc/include/openbsc/abis_nm.h
M openbsc/include/openbsc/gsm_data_shared.h
M openbsc/src/libbsc/abis_nm.c
M openbsc/src/libbsc/bsc_init.c
4 files changed, 81 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/44/2544/1

diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index 0fe9d8e..56f354b 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -28,6 +28,8 @@
 
 #include <openbsc/gsm_data.h>
 
+#define MAX_BTS_ATTR 4
+
 struct cell_global_id {
 	uint16_t mcc;
 	uint16_t mnc;
@@ -85,7 +87,7 @@
 			   uint8_t e1_subslot);
 int abis_nm_get_attr(struct gsm_bts *bts, uint8_t obj_class,
 		     uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
-		     uint8_t *attr, uint8_t attr_len);
+		     const uint8_t *attr, uint8_t attr_len);
 int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len);
 int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len);
 int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb);
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 0586d8a..b9923ce 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -543,6 +543,9 @@
 	BTS_FEAT_ECSD,
 	BTS_FEAT_HOPPING,
 	BTS_FEAT_MULTI_TSC,
+	BTS_FEAT_OML_ALERTS,
+	BTS_FEAT_AGCH_PCH_PROP,
+	BTS_FEAT_CBCH,
 };
 
 /*
@@ -674,6 +677,7 @@
 	struct gsm_bts_model *model;
 	enum gsm_band band;
 	char version[MAX_VERSION_LENGTH];
+	char sub_model[MAX_VERSION_LENGTH];
 
 	/* Connected PCU version (if any) */
 	char pcu_version[MAX_VERSION_LENGTH];
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index db0dbd2..19b1d9f 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -439,6 +439,66 @@
 	return res;
 }
 
+static inline bool handle_attr(struct gsm_bts *bts, enum bts_attribute id, uint8_t *val, uint8_t len)
+{
+	switch (id) {
+	case BTS_TYPE_VARIANT:
+		LOGP(DNM, LOGL_ERROR, "BTS reported variant: %s\n",  val);
+		break;
+	case BTS_SUB_MODEL:
+		LOGP(DNM, LOGL_ERROR, "BTS reported submodel: %s\n",  val);
+		break;
+	default:
+		return false;
+	}
+	return true;
+}
+
+static int abis_nm_rx_get_attr_resp(struct msgb *mb, struct gsm_bts *bts)
+{
+	struct abis_om_hdr *oh = msgb_l2(mb);
+	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
+	struct tlv_parsed tp;
+	const uint8_t *ari;
+	uint8_t count, i;
+	uint16_t ari_len;
+	int rc;
+	struct abis_nm_sw_desc sw_descr[5];
+
+	abis_nm_debugp_foh(DNM, foh);
+
+	DEBUGPC(DNM, "Get Attributes Response\n");
+
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
+
+	if (!TLVP_PRESENT(&tp, NM_ATT_GET_ARI)) {
+		LOGP(DNM, LOGL_ERROR, "Get Attributes Response without Response Info?!\n");
+		return -EINVAL;
+	}
+
+	ari = TLVP_VAL(&tp, NM_ATT_GET_ARI);
+	ari_len = TLVP_LEN(&tp, NM_ATT_GET_ARI);
+	count = ari[0];
+	DEBUGP(DNM, "Found Get Attributes Response Info: %u bytes total with %u unreported attributes\n",
+	       ari_len, count);
+
+	for (i = 0; i < count; i++)
+		LOGP(DNM, LOGL_ERROR, "Attribute %s is unreported\n", get_value_string(abis_nm_att_names, ari[i + 1]));
+
+	rc = abis_nm_get_sw_conf(ari + count + 1, ari_len - (count + 2), &sw_descr[0], ARRAY_SIZE(sw_descr));
+	if (rc) {
+		for (i = 0; i < rc; i++) {
+			if (!handle_attr(bts, str2btsattr((const char *)sw_descr[i].file_id), sw_descr[i].file_version,
+					 sw_descr[i].file_version_len))
+				LOGP(DNM, LOGL_NOTICE, "ARI reported sw[%d/%d]: %s is %s\n",
+				     i, rc, sw_descr[i].file_id, sw_descr[i].file_version);
+		}
+	}
+
+	return 0;
+}
+
 static int abis_nm_rx_sw_act_req(struct msgb *mb)
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
@@ -447,7 +507,7 @@
 	struct tlv_parsed tp;
 	const uint8_t *sw_config;
 	int ret, sw_config_len, len;
-	struct abis_nm_sw_desc sw_descr[5];
+	struct abis_nm_sw_desc sw_descr[MAX_BTS_ATTR];
 
 	abis_nm_debugp_foh(DNM, foh);
 
@@ -649,6 +709,9 @@
 		osmo_signal_dispatch(SS_NM, S_NM_IPACC_RESTART_NACK, NULL);
 		break;
 	case NM_MT_SET_BTS_ATTR_ACK:
+		break;
+	case NM_MT_GET_ATTR_RESP:
+		ret = abis_nm_rx_get_attr_resp(mb, bts);
 		break;
 	default:
 		abis_nm_debugp_foh(DNM, foh);
@@ -1441,10 +1504,9 @@
 }
 #endif
 
-/* Chapter 8.11.1 */
-int abis_nm_get_attr(struct gsm_bts *bts, uint8_t obj_class,
-			uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
-			uint8_t *attr, uint8_t attr_len)
+/* 3GPP TS 52.021 § 8.11.1 */
+int abis_nm_get_attr(struct gsm_bts *bts, uint8_t obj_class, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
+		     const uint8_t *attr, uint8_t attr_len)
 {
 	struct abis_om_hdr *oh;
 	struct msgb *msg = nm_msgb_alloc();
@@ -1452,8 +1514,7 @@
 	DEBUGP(DNM, "Get Attr (bts=%d)\n", bts->nr);
 
 	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
-	fill_om_fom_hdr(oh, attr_len, NM_MT_GET_ATTR, obj_class,
-			bts_nr, trx_nr, ts_nr);
+	fill_om_fom_hdr(oh, attr_len, NM_MT_GET_ATTR, obj_class, bts_nr, trx_nr, ts_nr);
 	msgb_tl16v_put(msg, NM_ATT_LIST_REQ_ATTR, attr_len, attr);
 
 	return abis_nm_sendmsg(bts, msg);
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 521fc89..a5c347f 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -310,6 +310,10 @@
 	struct input_signal_data *isd = signal_data;
 	struct gsm_bts_trx *trx = isd->trx;
 	int ts_no, lchan_no;
+	const uint8_t attr[] = { NM_ATT_SW_CONFIG, };
+
+	/* we should not request more attributes than we're ready to handle */
+	OSMO_ASSERT(sizeof(attr) < MAX_BTS_ATTR);
 
 	if (subsys != SS_L_INPUT)
 		return -EINVAL;
@@ -333,6 +337,8 @@
 				for (i = 0; i < ARRAY_SIZE(cur_trx->ts); i++)
 					generate_ma_for_ts(&cur_trx->ts[i]);
 			}
+
+			abis_nm_get_attr(trx->bts, NM_OC_SITE_MANAGER, trx->bts->nr, trx->nr, 0, attr, sizeof(attr));
 		}
 		if (isd->link_type == E1INP_SIGN_RSL)
 			bootstrap_rsl(trx);

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

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



More information about the gerrit-log mailing list