Change in osmo-bsc[master]: OML: ip.access: move NSVC MO into a fsm

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Wed Dec 2 03:01:27 UTC 2020


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


Change subject: OML: ip.access: move NSVC MO into a fsm
......................................................................

OML: ip.access: move NSVC MO into a fsm

It now waits for feature negotiation before configuring
the NSVC MO.

Todo: need to be tested with nanobts!
Change-Id: I381472532c2622a8dba7c81ae00ea873c2e58ae1
---
M include/osmocom/bsc/nm_common_fsm.h
M src/ipaccess/Makefile.am
M src/osmo-bsc/Makefile.am
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/bts.c
M src/osmo-bsc/bts_ipaccess_nanobts.c
M src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
A src/osmo-bsc/nm_nsvc_fsm.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/acc/Makefile.am
M tests/bsc/Makefile.am
M tests/gsm0408/Makefile.am
M tests/handover/Makefile.am
M tests/nanobts_omlattr/Makefile.am
15 files changed, 412 insertions(+), 21 deletions(-)



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

diff --git a/include/osmocom/bsc/nm_common_fsm.h b/include/osmocom/bsc/nm_common_fsm.h
index 00031fb..58bc8c9 100644
--- a/include/osmocom/bsc/nm_common_fsm.h
+++ b/include/osmocom/bsc/nm_common_fsm.h
@@ -35,6 +35,7 @@
 	NM_EV_OPSTART_NACK,
 	NM_EV_OML_DOWN,
 	NM_EV_FORCE_LOCK, /* Only supported by RadioCarrier so far */
+	NM_EV_FEATURE_NEGOTIATED,
 };
 extern const struct value_string nm_fsm_event_names[];
 
@@ -82,3 +83,12 @@
 	NM_CHAN_ST_OP_ENABLED,
 };
 extern struct osmo_fsm nm_chan_fsm;
+
+/* NSVC */
+enum nm_nsvc_fsm_states {
+	NM_NSVC_ST_OP_DISABLED_NOTINSTALLED,
+	NM_NSVC_ST_OP_DISABLED_DEPENDENCY,
+	NM_NSVC_ST_OP_DISABLED_OFFLINE,
+	NM_NSVC_ST_OP_ENABLED,
+};
+extern struct osmo_fsm nm_nsvc_fsm;
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 1574a8b..a39186b 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -59,6 +59,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(OSMO_LIBS) \
 	$(NULL)
@@ -80,6 +81,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(OSMO_LIBS) \
 	$(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index 5739885..51292d7 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -81,6 +81,7 @@
 	nm_bts_sm_fsm.c \
 	nm_bts_fsm.c \
 	nm_channel_fsm.c \
+	nm_nsvc_fsm.c \
 	nm_rcarrier_fsm.c \
 	gsm_08_08.c \
 	osmo_bsc_bssap.c \
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index dab5bb6..b0ef649 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -49,6 +49,7 @@
 #include <osmocom/abis/e1_input.h>
 #include <osmocom/bsc/chan_alloc.h>
 #include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/nm_common_fsm.h>
 #include <osmocom/gsm/bts_features.h>
 
 #define OM_ALLOC_SIZE		1024
@@ -598,6 +599,8 @@
 		}
 
 		bts->ip_access.feature_negotiated = true;
+		for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++)
+			osmo_fsm_inst_dispatch(bts->gprs.nsvc[i].mo.fi, NM_EV_FEATURE_NEGOTIATED, NULL);
 	}
 
 	/* Parse Attribute Response Info content for 3GPP TS 52.021 §9.4.28 Manufacturer Dependent State */
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 065b8ab..6837925 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -195,6 +195,10 @@
 	for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
 		bts->gprs.nsvc[i].bts = bts;
 		bts->gprs.nsvc[i].id = i;
+		bts->gprs.nsvc[i].mo.fi = osmo_fsm_inst_alloc(
+					&nm_nsvc_fsm, bts, &bts->gprs.nsvc[i],
+					LOGL_INFO, NULL);
+		osmo_fsm_inst_update_id_f(bts->mo.fi, "bts%d-nsvc%d", bts->nr, i);
 		gsm_mo_init(&bts->gprs.nsvc[i].mo, bts, NM_OC_GPRS_NSVC,
 				bts->nr, i, 0xff);
 	}
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 32823bb..e397c5f 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -214,30 +214,12 @@
 		bts = nsvc->bts;
 		if (bts->gprs.mode == BTS_GPRS_NONE)
 			break;
+
 		/* We skip NSVC1 since we only use NSVC0 */
 		if (nsvc->id == 1)
 			break;
-		if (!osmo_bts_has_feature(&bts->features, BTS_FEAT_IPV6_NSVC) &&
-		    nsvc->remote.u.sa.sa_family == AF_INET6) {
-			LOGP(DLINP, LOGL_ERROR, "BTS %d does not support IPv6 but an IPv6 address was configured!\n", bts->nr);
-			break;
-		}
-
-		if ((new_state->availability == NM_AVSTATE_OFF_LINE) ||
-		    (new_state->availability == NM_AVSTATE_DEPENDENCY)) {
-			msgb = nanobts_attr_nscv_get(bts);
-			if (!msgb)
-				break;
-			abis_nm_ipaccess_set_attr(bts, obj_class, bts->bts_nr,
-						  nsvc->id, 0xff,
-						  msgb->data, msgb->len);
-			msgb_free(msgb);
-			abis_nm_chg_adm_state(bts, obj_class, bts->bts_nr,
-					      nsvc->id, 0xff,
-					      NM_STATE_UNLOCKED);
-			abis_nm_opstart(bts, obj_class, bts->bts_nr,
-					nsvc->id, 0xff);
-		}
+		osmo_fsm_inst_dispatch(nsvc->mo.fi, NM_EV_STATE_CHG_REP, nsd);
+		break;
 	default:
 		break;
 	}
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
index 6d64a4b..48dd613 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.c
@@ -202,6 +202,13 @@
 {
 	struct msgb *msgb;
 	uint8_t buf[256];
+
+	if (!osmo_bts_has_feature(&bts->features, BTS_FEAT_IPV6_NSVC) &&
+	    bts->gprs.nsvc[0].remote.u.sa.sa_family == AF_INET6) {
+		LOGP(DLINP, LOGL_ERROR, "BTS %d does not support IPv6 but an IPv6 address was configured!\n", bts->nr);
+		return NULL;
+	}
+
 	msgb = msgb_alloc(1024, "nanobts_attr_bts");
 	if (!msgb)
 		return NULL;
diff --git a/src/osmo-bsc/nm_nsvc_fsm.c b/src/osmo-bsc/nm_nsvc_fsm.c
new file mode 100644
index 0000000..131fb54
--- /dev/null
+++ b/src/osmo-bsc/nm_nsvc_fsm.c
@@ -0,0 +1,374 @@
+/* NM NSVC FSM */
+
+/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info at sysmocom.de>
+ * Author: Alexander Couzens <lynxis at fe80.eu>
+ *
+ * based on the nm_bts_fsm.c
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <inttypes.h>
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/tdef.h>
+#include <osmocom/gsm/protocol/gsm_12_21.h>
+
+#include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/signal.h>
+#include <osmocom/bsc/abis_nm.h>
+#include <osmocom/bsc/bts_ipaccess_nanobts_omlattr.h>
+#include <osmocom/bsc/nm_common_fsm.h>
+#include <osmocom/bsc/debug.h>
+
+#define X(s) (1 << (s))
+
+#define nm_nsvc_fsm_state_chg(fi, NEXT_STATE) \
+	osmo_fsm_inst_state_chg(fi, NEXT_STATE, 0, 0)
+
+//////////////////////////
+// FSM STATE ACTIONS
+//////////////////////////
+
+static void st_op_disabled_notinstalled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+
+	nsvc->mo.set_attr_sent = false;
+	nsvc->mo.set_attr_sent = false;
+	nsvc->mo.set_attr_ack_received = false;
+	nsvc->mo.adm_unlock_sent = false;
+	nsvc->mo.opstart_sent = false;
+}
+
+static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+	struct nm_statechg_signal_data *nsd;
+	struct gsm_nm_state *new_state;
+
+	switch (event) {
+	case NM_EV_SW_ACT_REP:
+	case NM_EV_FEATURE_NEGOTIATED:
+		break;
+	case NM_EV_STATE_CHG_REP:
+		nsd = (struct nm_statechg_signal_data *)data;
+		new_state = nsd->new_state;
+		if (new_state->operational == NM_OPSTATE_ENABLED) {
+			/*should not happen... */
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_ENABLED);
+			return;
+		}
+		switch (new_state->availability) { /* operational = DISABLED */
+		case NM_AVSTATE_DEPENDENCY:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_DEPENDENCY);
+			return;
+		case NM_AVSTATE_OFF_LINE:
+		case NM_AVSTATE_OK:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_OFFLINE);
+			return;
+		default:
+			return;
+		}
+	default:
+		OSMO_ASSERT(0);
+	}
+}
+
+static void configure_loop(struct gsm_bts_gprs_nsvc *nsvc, struct gsm_nm_state *state, bool allow_opstart) {
+	struct msgb *msgb;
+
+	if (!nsvc->mo.set_attr_sent && !nsvc->mo.set_attr_ack_received) {
+		/* IPv6 require to wait for negotiated features */
+		if (nsvc->bts->ip_access.feature_dynamic &&
+				!nsvc->bts->ip_access.feature_negotiated)
+			return;
+
+		nsvc->mo.set_attr_sent = true;
+		msgb = nanobts_attr_nscv_get(nsvc->bts);
+		if (!msgb)
+			return;
+		abis_nm_ipaccess_set_attr(nsvc->bts, NM_OC_GPRS_NSVC, nsvc->bts->bts_nr,
+					  nsvc->id, 0xff,
+					  msgb->data, msgb->len);
+		msgb_free(msgb);
+	}
+
+	if (state->administrative != NM_STATE_UNLOCKED && !nsvc->mo.adm_unlock_sent) {
+		nsvc->mo.adm_unlock_sent = true;
+		abis_nm_chg_adm_state(nsvc->bts, NM_OC_GPRS_NSVC,
+				      nsvc->bts->bts_nr, nsvc->id, 0xff,
+				      NM_STATE_UNLOCKED);
+	}
+
+	if (allow_opstart && state->administrative == NM_STATE_UNLOCKED &&
+	    nsvc->mo.set_attr_ack_received) {
+		    if (!nsvc->mo.opstart_sent) {
+			    nsvc->mo.opstart_sent = true;
+			    abis_nm_opstart(nsvc->bts, NM_OC_GPRS_NSVC, nsvc->bts->bts_nr,  nsvc->id, 0xff);
+		    }
+	    }
+}
+
+static void st_op_disabled_dependency_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+
+	/* nanoBTS is broken, doesn't follow TS 12.21. Opstart MUST be sent
+	   during Dependency, so we simply move to OFFLINE state here to avoid
+	   duplicating code */
+	if (nsvc->bts->site_mgr.peer_has_no_avstate_offline) {
+		nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_OFFLINE);
+		return;
+	}
+	configure_loop(nsvc, &nsvc->mo.nm_state, false);
+}
+
+static void st_op_disabled_dependency(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+	struct nm_statechg_signal_data *nsd;
+	struct gsm_nm_state *new_state;
+
+	switch (event) {
+	case NM_EV_FEATURE_NEGOTIATED:
+		configure_loop(nsvc, &nsvc->mo.nm_state, false);
+		return;
+	case NM_EV_SET_ATTR_ACK:
+		nsvc->mo.set_attr_ack_received = true;
+		nsvc->mo.set_attr_sent = false;
+		configure_loop(nsvc, &nsvc->mo.nm_state, false);
+		return;
+	case NM_EV_STATE_CHG_REP:
+		nsd = (struct nm_statechg_signal_data *)data;
+		new_state = nsd->new_state;
+		if (new_state->operational == NM_OPSTATE_ENABLED) {
+			/* should not happen... */
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_ENABLED);
+			return;
+		}
+		switch (new_state->availability) { /* operational = DISABLED */
+		case NM_AVSTATE_NOT_INSTALLED:
+		case NM_AVSTATE_POWER_OFF:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_NOTINSTALLED);
+			return;
+		case NM_AVSTATE_OFF_LINE:
+		case NM_AVSTATE_OK:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_OFFLINE);
+			return;
+		case NM_AVSTATE_DEPENDENCY:
+			configure_loop(nsvc, new_state, false);
+			return;
+		default:
+			return;
+		}
+	default:
+		OSMO_ASSERT(0);
+	}
+}
+
+static void st_op_disabled_offline_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+
+	/* Warning: In here we may be acessing an state older than new_state
+	   from prev (syncrhonous) FSM state */
+	configure_loop(nsvc, &nsvc->mo.nm_state, true);
+}
+
+static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+	struct nm_statechg_signal_data *nsd;
+	struct gsm_nm_state *new_state;
+
+	switch (event) {
+	case NM_EV_FEATURE_NEGOTIATED:
+		configure_loop(nsvc, &nsvc->mo.nm_state, true);
+		return;
+	case NM_EV_SET_ATTR_ACK:
+		nsvc->mo.set_attr_ack_received = true;
+		nsvc->mo.set_attr_sent = false;
+		configure_loop(nsvc, &nsvc->mo.nm_state, true);
+		return;
+	case NM_EV_STATE_CHG_REP:
+		nsd = (struct nm_statechg_signal_data *)data;
+		new_state = nsd->new_state;
+		if (new_state->operational == NM_OPSTATE_ENABLED) {
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_ENABLED);
+			return;
+		}
+		switch (new_state->availability) { /* operational = DISABLED */
+		case NM_AVSTATE_NOT_INSTALLED:
+		case NM_AVSTATE_POWER_OFF:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_NOTINSTALLED);
+			return;
+		case NM_AVSTATE_DEPENDENCY:
+			/* There's no point in moving back to Dependency, since it's broken
+			   and it acts actually as if it was in Offline state */
+			if (!nsvc->bts->site_mgr.peer_has_no_avstate_offline) {
+				nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_DEPENDENCY);
+			} else {
+				/* Moreover, in nanoBTS we need to check here for tx
+				   Opstart since we may have gone Unlocked state
+				   in this event, which means Opstart may be txed here. */
+				configure_loop(nsvc, new_state, true);
+			}
+			return;
+		case NM_AVSTATE_OFF_LINE:
+		case NM_AVSTATE_OK:
+			configure_loop(nsvc, new_state, true);
+			return;
+		default:
+			return;
+		}
+	default:
+		OSMO_ASSERT(0);
+	}
+}
+
+static void st_op_enabled_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+
+	/* Reset state, we don't need it in this state and it will need to be
+	  reused as soon as we move back to Disabled */
+	nsvc->mo.opstart_sent = false;
+	nsvc->mo.adm_unlock_sent = false;
+	nsvc->mo.set_attr_sent = false;
+	nsvc->mo.set_attr_ack_received = false;
+}
+
+static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+	struct nm_statechg_signal_data *nsd;
+	struct gsm_nm_state *new_state;
+
+	switch (event) {
+	case NM_EV_STATE_CHG_REP:
+		nsd = (struct nm_statechg_signal_data *)data;
+		new_state = nsd->new_state;
+		if (new_state->operational == NM_OPSTATE_ENABLED)
+			return;
+		switch (new_state->availability) { /* operational = DISABLED */
+		case NM_AVSTATE_NOT_INSTALLED:
+		case NM_AVSTATE_POWER_OFF:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_NOTINSTALLED);
+			return;
+		case NM_AVSTATE_DEPENDENCY:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_DEPENDENCY);
+			return;
+		case NM_AVSTATE_OFF_LINE:
+		case NM_AVSTATE_OK:
+			nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_OFFLINE);
+			return;
+		default:
+			return;
+		}
+	default:
+		OSMO_ASSERT(0);
+	}
+}
+
+static void st_op_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+	struct gsm_bts_gprs_nsvc *nsvc = (struct gsm_bts_gprs_nsvc *)fi->priv;
+
+	switch (event) {
+	case NM_EV_OPSTART_ACK:
+	case NM_EV_OPSTART_NACK:
+		/* TODO: if on state OFFLINE and rx NACK, try again? */
+		nsvc->mo.opstart_sent = false;
+		break;
+	case NM_EV_OML_DOWN:
+		nm_nsvc_fsm_state_chg(fi, NM_NSVC_ST_OP_DISABLED_NOTINSTALLED);
+		break;
+	default:
+		OSMO_ASSERT(0);
+	}
+}
+
+static struct osmo_fsm_state nm_nsvc_fsm_states[] = {
+	[NM_NSVC_ST_OP_DISABLED_NOTINSTALLED] = {
+		.in_event_mask =
+			X(NM_EV_SW_ACT_REP) |
+			X(NM_EV_STATE_CHG_REP) |
+			X(NM_EV_FEATURE_NEGOTIATED),
+		.out_state_mask =
+			X(NM_NSVC_ST_OP_DISABLED_DEPENDENCY) |
+			X(NM_NSVC_ST_OP_DISABLED_OFFLINE) |
+			X(NM_NSVC_ST_OP_ENABLED),
+		.name = "DISABLED_NOTINSTALLED",
+		.onenter = st_op_disabled_notinstalled_on_enter,
+		.action = st_op_disabled_notinstalled,
+	},
+	[NM_NSVC_ST_OP_DISABLED_DEPENDENCY] = {
+		.in_event_mask =
+			X(NM_EV_STATE_CHG_REP) |
+			X(NM_EV_SET_ATTR_ACK) |
+			X(NM_EV_FEATURE_NEGOTIATED),
+		.out_state_mask =
+			X(NM_NSVC_ST_OP_DISABLED_NOTINSTALLED) |
+			X(NM_NSVC_ST_OP_DISABLED_OFFLINE) |
+			X(NM_NSVC_ST_OP_ENABLED),
+		.name = "DISABLED_DEPENDENCY",
+		.onenter = st_op_disabled_dependency_on_enter,
+		.action = st_op_disabled_dependency,
+	},
+	[NM_NSVC_ST_OP_DISABLED_OFFLINE] = {
+		.in_event_mask =
+			X(NM_EV_STATE_CHG_REP) |
+			X(NM_EV_SET_ATTR_ACK) |
+			X(NM_EV_FEATURE_NEGOTIATED),
+		.out_state_mask =
+			X(NM_NSVC_ST_OP_DISABLED_NOTINSTALLED) |
+			X(NM_NSVC_ST_OP_DISABLED_DEPENDENCY) |
+			X(NM_NSVC_ST_OP_ENABLED),
+		.name = "DISABLED_OFFLINE",
+		.onenter = st_op_disabled_offline_on_enter,
+		.action = st_op_disabled_offline,
+	},
+	[NM_NSVC_ST_OP_ENABLED] = {
+	.in_event_mask =
+		X(NM_EV_STATE_CHG_REP),
+	.out_state_mask =
+		X(NM_NSVC_ST_OP_DISABLED_NOTINSTALLED) |
+		X(NM_NSVC_ST_OP_DISABLED_DEPENDENCY) |
+		X(NM_NSVC_ST_OP_DISABLED_OFFLINE),
+	.name = "ENABLED",
+	.onenter = st_op_enabled_on_enter,
+	.action = st_op_enabled,
+	},
+};
+
+struct osmo_fsm nm_nsvc_fsm = {
+	.name = "NM_NSVC_OP",
+	.states = nm_nsvc_fsm_states,
+	.num_states = ARRAY_SIZE(nm_nsvc_fsm_states),
+	.allstate_event_mask =
+		X(NM_EV_OPSTART_ACK) |
+		X(NM_EV_OPSTART_NACK) |
+		X(NM_EV_OML_DOWN),
+	.allstate_action = st_op_allstate,
+	.event_names = nm_fsm_event_names,
+	.log_subsys = DNM,
+};
+
+static __attribute__((constructor)) void nm_nsvc_fsm_init(void)
+{
+	OSMO_ASSERT(osmo_fsm_register(&nm_nsvc_fsm) == 0);
+}
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 65fd8fa..6a3ab00 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -61,6 +61,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
@@ -138,6 +139,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index d7d53b7..f13d64a 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -37,6 +37,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
diff --git a/tests/acc/Makefile.am b/tests/acc/Makefile.am
index b1315e3..c8399c2 100644
--- a/tests/acc/Makefile.am
+++ b/tests/acc/Makefile.am
@@ -37,6 +37,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOABIS_LIBS) \
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index f040cbc..8f6893f 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -51,6 +51,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index de38747..75ad1b5 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -40,6 +40,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 42bb937..b4d40c1 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -85,6 +85,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(top_builddir)/src/osmo-bsc/osmo_bsc_ctrl.o \
 	$(top_builddir)/src/osmo-bsc/osmo_bsc_lcls.o \
diff --git a/tests/nanobts_omlattr/Makefile.am b/tests/nanobts_omlattr/Makefile.am
index 3dd7f2f..7fd6ed3 100644
--- a/tests/nanobts_omlattr/Makefile.am
+++ b/tests/nanobts_omlattr/Makefile.am
@@ -34,6 +34,7 @@
 	$(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_bb_transc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_channel_fsm.o \
+	$(top_builddir)/src/osmo-bsc/nm_nsvc_fsm.o \
 	$(top_builddir)/src/osmo-bsc/nm_rcarrier_fsm.o \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I381472532c2622a8dba7c81ae00ea873c2e58ae1
Gerrit-Change-Number: 21452
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201202/b9bccdbd/attachment.htm>


More information about the gerrit-log mailing list