Change in osmo-bts[master]: Allow setting administrative state through oml_mo_state_chg()

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

pespin gerrit-no-reply at lists.osmocom.org
Wed Sep 15 16:16:06 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25473 )


Change subject: Allow setting administrative state through oml_mo_state_chg()
......................................................................

Allow setting administrative state through oml_mo_state_chg()

This way it can be changed together with operative/availability state,
and changes announced to the BSC if present.

This commit presents no real change in osmo-bts behavior, since the only
place where adm_state is passed different than -1 is in
st_op_disabled_notinstalled_on_enter(), which is actually never called
(yet) since it's the initial state and no other states transition later
to it.

However, this will change in the future once we support re-connecting to
a (possibly different) BSC, which means objects will need to be moved to
that state to restart the whole OML install procedure on the new BSC.

Change-Id: Ifdc6a1dfb673c0ab915ddf2a9d372928f4f86b4c
---
M include/osmo-bts/oml.h
M src/common/nm_bb_transc_fsm.c
M src/common/nm_bts_fsm.c
M src/common/nm_bts_sm_fsm.c
M src/common/nm_channel_fsm.c
M src/common/nm_radio_carrier_fsm.c
M src/common/oml.c
M src/osmo-bts-lc15/oml.c
M src/osmo-bts-oc2g/oml.c
M src/osmo-bts-octphy/l1_oml.c
M src/osmo-bts-omldummy/bts_model.c
M src/osmo-bts-sysmo/oml.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/bts_model.c
14 files changed, 47 insertions(+), 38 deletions(-)



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

diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 27afc53..42284f9 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -47,7 +47,7 @@
 int oml_mo_statechg_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause);
 
 /* Change the state and send STATE CHG REP */
-int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state);
+int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state, int adm_state);
 
 /* First initialization of MO, does _not_ generate state changes */
 void oml_mo_state_init(struct gsm_abis_mo *mo, int op_state, int avail_state);
diff --git a/src/common/nm_bb_transc_fsm.c b/src/common/nm_bb_transc_fsm.c
index 5d38db7..2897675 100644
--- a/src/common/nm_bb_transc_fsm.c
+++ b/src/common/nm_bb_transc_fsm.c
@@ -49,7 +49,7 @@
 {
 	struct gsm_bts_bb_trx *bb_transc = (struct gsm_bts_bb_trx *)fi->priv;
 	bb_transc->mo.opstart_success = false;
-	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
 }
 
 static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -89,7 +89,7 @@
 	int i;
 
 	bb_transc->mo.opstart_success = false;
-	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
 
 	if (prev_state == NM_BBTRANSC_ST_OP_ENABLED) {
 		for (i = 0; i < TRX_NR_TS; i++) {
@@ -157,7 +157,7 @@
 	struct gsm_bts_trx *trx = gsm_bts_bb_trx_get_trx(bb_transc);
 	uint8_t tn;
 
-	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+	oml_mo_state_chg(&bb_transc->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 	/* Mark Dependency TS as Offline (ready to be Opstarted) */
 	for (tn = 0; tn < TRX_NR_TS; tn++) {
 		struct gsm_bts_trx_ts *ts = &trx->ts[tn];
diff --git a/src/common/nm_bts_fsm.c b/src/common/nm_bts_fsm.c
index 12f1a61..6575b54 100644
--- a/src/common/nm_bts_fsm.c
+++ b/src/common/nm_bts_fsm.c
@@ -49,7 +49,7 @@
 {
 	struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
 	bts->mo.opstart_success = false;
-	oml_mo_state_chg(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+	oml_mo_state_chg(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
 }
 
 static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -70,7 +70,7 @@
 {
 	struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
 	bts->mo.opstart_success = false;
-	oml_mo_state_chg(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+	oml_mo_state_chg(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
 }
 
 static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -95,7 +95,7 @@
 static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
 	struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
-	oml_mo_state_chg(&bts->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+	oml_mo_state_chg(&bts->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 }
 
 static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/common/nm_bts_sm_fsm.c b/src/common/nm_bts_sm_fsm.c
index dedbacb..864aeab 100644
--- a/src/common/nm_bts_sm_fsm.c
+++ b/src/common/nm_bts_sm_fsm.c
@@ -49,7 +49,7 @@
 {
 	struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
 	site_mgr->mo.opstart_success = false;
-	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
 }
 
 static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -70,7 +70,7 @@
 {
 	struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
 	site_mgr->mo.opstart_success = false;
-	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
 }
 
 static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -95,7 +95,7 @@
 static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
 	struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
-	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+	oml_mo_state_chg(&site_mgr->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 }
 
 static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/common/nm_channel_fsm.c b/src/common/nm_channel_fsm.c
index 15be6c6..4983c27 100644
--- a/src/common/nm_channel_fsm.c
+++ b/src/common/nm_channel_fsm.c
@@ -56,7 +56,7 @@
 {
 	struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
 	ts->mo.opstart_success = false;
-	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
 }
 
 static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -80,7 +80,7 @@
 {
 	struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
 	ts->mo.opstart_success = false;
-	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY);
+	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY, -1);
 }
 
 static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -117,7 +117,7 @@
 {
 	struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
 	ts->mo.opstart_success = false;
-	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+	oml_mo_state_chg(&ts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
 }
 
 static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -147,7 +147,7 @@
 static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
 {
 	struct gsm_bts_trx_ts *ts = (struct gsm_bts_trx_ts *)fi->priv;
-	oml_mo_state_chg(&ts->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+	oml_mo_state_chg(&ts->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 }
 
 static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/common/nm_radio_carrier_fsm.c b/src/common/nm_radio_carrier_fsm.c
index 21e1ac1..9070737 100644
--- a/src/common/nm_radio_carrier_fsm.c
+++ b/src/common/nm_radio_carrier_fsm.c
@@ -49,7 +49,7 @@
 {
 	struct gsm_bts_trx *trx = (struct gsm_bts_trx *)fi->priv;
 	trx->mo.opstart_success = false;
-	oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+	oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED, NM_STATE_LOCKED);
 }
 
 static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -82,7 +82,7 @@
 	unsigned int i;
 
 	trx->mo.opstart_success = false;
-	oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+	oml_mo_state_chg(&trx->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE, -1);
 
 	if (prev_state == NM_RCARRIER_ST_OP_ENABLED) {
 		for (i = 0; i < TRX_NR_TS; i++) {
@@ -147,7 +147,7 @@
 	struct gsm_bts_trx *trx = (struct gsm_bts_trx *)fi->priv;
 	unsigned int tn;
 
-	oml_mo_state_chg(&trx->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+	oml_mo_state_chg(&trx->mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 	/* Mark Dependency TS as Offline (ready to be Opstarted) */
 	for (tn = 0; tn < TRX_NR_TS; tn++) {
 		struct gsm_bts_trx_ts *ts = &trx->ts[tn];
diff --git a/src/common/oml.c b/src/common/oml.c
index 819b033..d2cf877 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -340,12 +340,13 @@
 	mo->nm_state.operational = op_state;
 }
 
-int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state)
+int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state, int adm_state)
 {
 	int rc = 0;
 
 	if ((op_state != -1 && mo->nm_state.operational != op_state) ||
-	    (avail_state != -1 && mo->nm_state.availability != avail_state)) {
+	    (avail_state != -1 && mo->nm_state.availability != avail_state) ||
+	    (adm_state != -1 && mo->nm_state.administrative != adm_state)) {
 		if (avail_state != -1) {
 			LOGP(DOML, LOGL_INFO, "%s AVAIL STATE %s -> %s\n",
 				gsm_abis_mo_name(mo),
@@ -361,6 +362,14 @@
 			mo->nm_state.operational = op_state;
 			osmo_signal_dispatch(SS_GLOBAL, S_NEW_OP_STATE, NULL);
 		}
+		if (adm_state != -1) {
+			LOGP(DOML, LOGL_INFO, "%s ADMIN STATE %s -> %s\n",
+				gsm_abis_mo_name(mo),
+				abis_nm_admin_name(mo->nm_state.administrative),
+				abis_nm_admin_name(adm_state));
+			mo->nm_state.administrative = adm_state;
+		}
+
 
 		/* send state change report */
 		rc = oml_tx_state_changed(mo);
diff --git a/src/osmo-bts-lc15/oml.c b/src/osmo-bts-lc15/oml.c
index b4945be..9d0d99a 100644
--- a/src/osmo-bts-lc15/oml.c
+++ b/src/osmo-bts-lc15/oml.c
@@ -1906,13 +1906,13 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
 		rc = oml_mo_opstart_ack(mo);
 		if (mo->obj_class == NM_OC_BTS) {
-			oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK);
-			oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK);
-			oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK);
-			oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK);
+			oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK, -1);
+			oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK, -1);
+			oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK, -1);
+			oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK, -1);
 		}
 		break;
 	default:
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index 9791ab8..ea344fb 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -1898,10 +1898,10 @@
 		break;
 	case NM_OC_BTS:
 		rc = osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OPSTART_ACK, NULL);
-		oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK);
+		oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK, -1);
+		oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK, -1);
+		oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK), -1;
+		oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK, -1);
 		break;
 	case NM_OC_RADIO_CARRIER:
 		trx = (struct gsm_bts_trx *) obj;
@@ -1918,7 +1918,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 1e2f89d..1830599 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -1788,7 +1788,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index 46558a1..5bfcfca 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -143,7 +143,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 93ecf90..194afcd 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -1776,10 +1776,10 @@
 		break;
 	case NM_OC_BTS:
 		rc = osmo_fsm_inst_dispatch(bts->mo.fi, NM_EV_OPSTART_ACK, NULL);
-		oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK);
-		oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK);
+		oml_mo_state_chg(&bts->mo, -1, NM_AVSTATE_OK, -1);
+		oml_mo_state_chg(&bts->gprs.nse.mo, -1, NM_AVSTATE_OK, -1);
+		oml_mo_state_chg(&bts->gprs.cell.mo, -1, NM_AVSTATE_OK, -1);
+		oml_mo_state_chg(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_OK, -1);
 		break;
 	case NM_OC_RADIO_CARRIER:
 		trx = (struct gsm_bts_trx *) obj;
@@ -1796,7 +1796,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -1, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 754e9d7..6b417f4 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -604,7 +604,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index af8a6f2..48e9400 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -156,7 +156,7 @@
 	case NM_OC_GPRS_NSE:
 	case NM_OC_GPRS_CELL:
 	case NM_OC_GPRS_NSVC:
-		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+		oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK, -1);
 		rc = oml_mo_opstart_ack(mo);
 		break;
 	default:

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ifdc6a1dfb673c0ab915ddf2a9d372928f4f86b4c
Gerrit-Change-Number: 25473
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210915/87c647e4/attachment.htm>


More information about the gerrit-log mailing list