Change in osmo-bsc[master]: om2k: Properly update the 'fake' 12.21 states using OM2000 status

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

tnt gerrit-no-reply at lists.osmocom.org
Fri May 8 11:59:00 UTC 2020


tnt has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18125 )


Change subject: om2k: Properly update the 'fake' 12.21 states using OM2000 status
......................................................................

om2k: Properly update the 'fake' 12.21 states using OM2000 status

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
Change-Id: I1caafa2e87c6198bf3b1a77f0fa1edc774deeef9
---
M src/osmo-bsc/abis_om2000.c
1 file changed, 39 insertions(+), 3 deletions(-)



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

diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index 41b2317..72aa04c 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -310,6 +310,13 @@
 	OM2K_DEI_MCTR_FEAT_STATUS_BMAP		= 0xab,
 };
 
+enum abis_om2k_mostate {
+	OM2K_MOSTATE_RESET			= 0x00,
+	OM2K_MOSTATE_STARTED			= 0x01,
+	OM2K_MOSTATE_ENABLED			= 0x02,
+	OM2K_MOSTATE_DISABLED			= 0x03,
+};
+
 const struct tlv_definition om2k_att_tlvdef = {
 	.def = {
 		[OM2K_DEI_ACCORDANCE_IND] =	{ TLV_TYPE_TV },
@@ -782,7 +789,6 @@
 	case OM2K_MO_CLS_MCTR:
 		mo = &bts->rbs2000.mctr.om2k_mo;
 		break;
-
 	case OM2K_MO_CLS_TRXC:
 		trx = gsm_bts_trx_num(bts, abis_mo->inst);
 		if (!trx)
@@ -874,6 +880,9 @@
 			return NULL;
 		nm_state = &trx->ts[mo->inst].mo.nm_state;
 		break;
+	case OM2K_MO_CLS_MCTR:
+		nm_state = &bts->rbs2000.mctr.mo.nm_state;
+		break;
 	case OM2K_MO_CLS_TF:
 		nm_state = &bts->rbs2000.tf.mo.nm_state;
 		break;
@@ -922,6 +931,7 @@
 		if (mo->inst >= ARRAY_SIZE(trx->ts))
 			return NULL;
 		return &trx->ts[mo->inst];
+	case OM2K_MO_CLS_MCTR:
 	case OM2K_MO_CLS_TF:
 	case OM2K_MO_CLS_IS:
 	case OM2K_MO_CLS_CON:
@@ -939,13 +949,39 @@
 	struct gsm_nm_state *nm_state = mo2nm_state(bts, mo);
 	struct gsm_nm_state new_state;
 	struct nm_statechg_signal_data nsd;
+	bool has_enabled_state;
 
 	if (!nm_state)
 		return;
 
+	switch (mo->class) {
+	case OM2K_MO_CLS_CF:
+	case OM2K_MO_CLS_TRXC:
+		has_enabled_state = false;
+		break;
+	default:
+		has_enabled_state = true;
+		break;
+	}
+
 	new_state = *nm_state;
-	/* NOTICE: 12.21 Availability state values != OM2000 */
-	new_state.availability = mo_state;
+	switch (mo_state) {
+	case OM2K_MOSTATE_RESET:
+		new_state.availability = NM_AVSTATE_POWER_OFF;
+		break;
+	case OM2K_MOSTATE_STARTED:
+		new_state.availability = has_enabled_state ? NM_AVSTATE_OFF_LINE : NM_AVSTATE_OK;
+		break;
+	case OM2K_MOSTATE_ENABLED:
+		new_state.availability = NM_AVSTATE_OK;
+		break;
+	case OM2K_MOSTATE_DISABLED:
+		new_state.availability = NM_AVSTATE_POWER_OFF;
+		break;
+	default:
+		new_state.availability = NM_AVSTATE_DEGRADED;
+		break;
+	}
 
 	memset(&nsd, 0, sizeof(nsd));
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18125
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I1caafa2e87c6198bf3b1a77f0fa1edc774deeef9
Gerrit-Change-Number: 18125
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt at 246tNt.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200508/7ce73c12/attachment.htm>


More information about the gerrit-log mailing list