aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/Makefile.am1
-rw-r--r--include/osmocom/bsc/bts.h13
-rw-r--r--include/osmocom/bsc/gsm_data.h2
-rw-r--r--include/osmocom/bsc/nm_common_fsm.h46
-rw-r--r--include/osmocom/bsc/signal.h1
-rw-r--r--src/ipaccess/Makefile.am4
-rw-r--r--src/osmo-bsc/Makefile.am2
-rw-r--r--src/osmo-bsc/abis_nm.c13
-rw-r--r--src/osmo-bsc/bts.c22
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts.c47
-rw-r--r--src/osmo-bsc/nm_bts_sm_fsm.c279
-rw-r--r--src/osmo-bsc/nm_common_fsm.c32
-rw-r--r--src/utils/Makefile.am4
-rw-r--r--tests/abis/Makefile.am2
-rw-r--r--tests/acc/Makefile.am2
-rw-r--r--tests/acc/acc_test.c1
-rw-r--r--tests/acc/acc_test.ok58
-rw-r--r--tests/bsc/Makefile.am2
-rw-r--r--tests/gsm0408/Makefile.am2
-rw-r--r--tests/handover/Makefile.am2
-rw-r--r--tests/nanobts_omlattr/Makefile.am2
21 files changed, 518 insertions, 19 deletions
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 05d71bb71..1f066b618 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -38,6 +38,7 @@ noinst_HEADERS = \
misdn.h \
neighbor_ident.h \
network_listen.h \
+ nm_common_fsm.h \
openbscdefines.h \
osmo_bsc.h \
osmo_bsc_grace.h \
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 7f369042e..a9d57a380 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -361,6 +361,11 @@ struct gsm_bts_model {
uint8_t _features_data[MAX_BTS_FEATURES/8];
};
+/* BTS Site Manager */
+struct gsm_bts_sm {
+ struct gsm_abis_mo mo;
+};
+
/* One BTS */
struct gsm_bts {
/* list header in net->bts_list */
@@ -425,9 +430,7 @@ struct gsm_bts {
/* CCCH is on C0 */
struct gsm_bts_trx *c0;
- struct {
- struct gsm_abis_mo mo;
- } site_mgr;
+ struct gsm_bts_sm site_mgr;
/* bitmask of all SI that are present/valid in si_buf */
uint32_t si_valid;
@@ -725,6 +728,10 @@ static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts)
return &lai;
}
+static inline struct gsm_bts *gsm_bts_sm_get_bts(struct gsm_bts_sm *site_mgr) {
+ return (struct gsm_bts *)container_of(site_mgr, struct gsm_bts, site_mgr);
+}
+
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num);
char *gsm_bts_name(const struct gsm_bts *bts);
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 050cd7ab8..06348be77 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -393,6 +393,8 @@ struct gsm_abis_mo {
struct gsm_nm_state nm_state;
struct tlv_parsed *nm_attr;
struct gsm_bts *bts;
+ struct osmo_fsm_inst *fi;
+ bool opstart_sent;
};
/* Ericsson OM2000 Managed Object */
diff --git a/include/osmocom/bsc/nm_common_fsm.h b/include/osmocom/bsc/nm_common_fsm.h
new file mode 100644
index 000000000..a76c19894
--- /dev/null
+++ b/include/osmocom/bsc/nm_common_fsm.h
@@ -0,0 +1,46 @@
+/* Header for all NM FSM. Following 3GPP TS 12.21 Figure 2/GSM 12.21:
+ GSM 12.21 Objects' Operational state and availability status behaviour during initialization */
+
+/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin@sysmocom.de>
+ *
+ * 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/>.
+ *
+ */
+
+#pragma once
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/utils.h>
+
+/* Common */
+enum nm_fsm_events {
+ NM_EV_SW_ACT_REP,
+ NM_EV_STATE_CHG_REP,
+ NM_EV_OPSTART_ACK,
+ NM_EV_OPSTART_NACK,
+ NM_EV_OML_DOWN,
+};
+extern const struct value_string nm_fsm_event_names[];
+
+/* BTS SiteManager */
+enum nm_bts_sm_op_fsm_states {
+ NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED,
+ NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY,
+ NM_BTS_SM_ST_OP_DISABLED_OFFLINE,
+ NM_BTS_SM_ST_OP_ENABLED,
+};
+extern struct osmo_fsm nm_bts_sm_fsm;
diff --git a/include/osmocom/bsc/signal.h b/include/osmocom/bsc/signal.h
index c7d7fe129..abda67eeb 100644
--- a/include/osmocom/bsc/signal.h
+++ b/include/osmocom/bsc/signal.h
@@ -72,6 +72,7 @@ enum signal_nm {
S_NM_STATECHG_ADM, /* Administrative State changed */
S_NM_OM2K_CONF_RES, /* OM2K Configuration Result */
S_NM_OPSTART_ACK, /* Received OPSTART ACK, arg is struct msgb *oml_msg */
+ S_NM_OPSTART_NACK, /* Received OPSTART NACK, arg is struct msgb *oml_msg */
S_NM_GET_ATTR_REP, /* Received Get Attributes Response, arg is struct msgb *oml_msg */
S_NM_SET_RADIO_ATTR_ACK, /* Received Set Radio Carrier Attributes Ack, arg is struct msgb *oml_msg */
};
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 717a6a187..0e06caabf 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -54,6 +54,8 @@ ipaccess_config_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(OSMO_LIBS) \
$(NULL)
@@ -68,5 +70,7 @@ ipaccess_proxy_LDADD = \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(OSMO_LIBS) \
$(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index 4473fc14c..ffa39a03e 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -76,6 +76,8 @@ osmo_bsc_SOURCES = \
neighbor_ident.c \
neighbor_ident_vty.c \
net_init.c \
+ nm_common_fsm.c \
+ nm_bts_sm_fsm.c \
gsm_08_08.c \
osmo_bsc_bssap.c \
osmo_bsc_ctrl.c \
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 0bcb81c98..511c4b3e2 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -826,6 +826,14 @@ static int abis_nm_rx_opstart_ack(struct msgb *mb)
return 0;
}
+static int abis_nm_rx_opstart_nack(struct msgb *mb)
+{
+ struct abis_om_fom_hdr *foh = msgb_l3(mb);
+ DEBUGPFOH(DNM, foh, "Opstart NACK\n");
+ osmo_signal_dispatch(SS_NM, S_NM_OPSTART_NACK, mb);
+ return 0;
+}
+
static int abis_nm_rx_set_radio_attr_ack(struct msgb *mb)
{
struct abis_om_fom_hdr *foh = msgb_l3(mb);
@@ -947,7 +955,10 @@ static int abis_nm_rcvmsg_fom(struct msgb *mb)
ret = abis_nm_rx_lmt_event(mb);
break;
case NM_MT_OPSTART_ACK:
- abis_nm_rx_opstart_ack(mb);
+ ret = abis_nm_rx_opstart_ack(mb);
+ break;
+ case NM_MT_OPSTART_NACK:
+ ret = abis_nm_rx_opstart_nack(mb);
break;
case NM_MT_SET_CHAN_ATTR_ACK:
DEBUGPFOH(DNM, foh, "Set Channel Attributes ACK\n");
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index ce1b20068..fe1641230 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -23,6 +23,7 @@
#include <osmocom/bsc/gsm_data.h>
#include <osmocom/bsc/bts.h>
#include <osmocom/bsc/debug.h>
+#include <osmocom/bsc/nm_common_fsm.h>
const struct value_string bts_attribute_names[] = {
OSMO_VALUE_STRING(BTS_TYPE_VARIANT),
@@ -146,6 +147,15 @@ static const struct gprs_rlc_cfg rlc_cfg_default = {
.initial_mcs = 6,
};
+static int gsm_bts_talloc_destructor(struct gsm_bts *bts)
+{
+ if (bts->site_mgr.mo.fi) {
+ osmo_fsm_inst_free(bts->site_mgr.mo.fi);
+ bts->site_mgr.mo.fi = NULL;
+ }
+ return 0;
+}
+
/* Initialize those parts that don't require osmo-bsc specific dependencies.
* This part is shared among the thin programs in osmo-bsc/src/utils/.
* osmo-bsc requires further initialization that pulls in more dependencies (see
@@ -159,6 +169,8 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
if (!bts)
return NULL;
+ talloc_set_destructor(bts, gsm_bts_talloc_destructor);
+
bts->nr = bts_num;
bts->num_trx = 0;
INIT_LLIST_HEAD(&bts->trx_list);
@@ -166,10 +178,12 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, uint8_t bts_num)
bts->ms_max_power = 15; /* dBm */
- gsm_mo_init(&bts->mo, bts, NM_OC_BTS,
- bts->nr, 0xff, 0xff);
- gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER,
- 0xff, 0xff, 0xff);
+ bts->site_mgr.mo.fi = osmo_fsm_inst_alloc(&nm_bts_sm_fsm, bts, &bts->site_mgr,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->site_mgr.mo.fi, "bts_sm");
+ gsm_mo_init(&bts->site_mgr.mo, bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
+
+ gsm_mo_init(&bts->mo, bts, NM_OC_BTS, bts->nr, 0xff, 0xff);
for (i = 0; i < ARRAY_SIZE(bts->gprs.nsvc); i++) {
bts->gprs.nsvc[i].bts = bts;
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 4c95196f8..457448cdd 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -46,6 +46,7 @@
#include <osmocom/bsc/paging.h>
#include <osmocom/bsc/timeslot_fsm.h>
#include <osmocom/bsc/bts.h>
+#include <osmocom/bsc/nm_common_fsm.h>
static int bts_model_nanobts_start(struct gsm_network *net);
static void bts_model_nanobts_e1line_bind_ops(struct e1inp_line *line);
@@ -127,6 +128,7 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
void *obj = nsd->obj;
struct gsm_nm_state *new_state = nsd->new_state;
+ struct gsm_bts_sm *bts_sm;
struct gsm_bts *bts;
struct gsm_bts_trx *trx;
struct gsm_bts_trx_ts *ts;
@@ -146,12 +148,8 @@ static int nm_statechg_event(int evt, struct nm_statechg_signal_data *nsd)
switch (obj_class) {
case NM_OC_SITE_MANAGER:
- bts = container_of(obj, struct gsm_bts, site_mgr);
- if ((new_state->operational == NM_OPSTATE_ENABLED &&
- new_state->availability == NM_AVSTATE_OK) ||
- (new_state->operational == NM_OPSTATE_DISABLED &&
- new_state->availability == NM_AVSTATE_OFF_LINE))
- abis_nm_opstart(bts, obj_class, 0xff, 0xff, 0xff);
+ bts_sm = obj;
+ osmo_fsm_inst_dispatch(bts_sm->mo.fi, NM_EV_STATE_CHG_REP, nsd);
break;
case NM_OC_BTS:
bts = obj;
@@ -258,16 +256,18 @@ static int sw_activ_rep(struct msgb *mb)
struct abis_om_fom_hdr *foh = msgb_l3(mb);
struct e1inp_sign_link *sign_link = mb->dst;
struct gsm_bts *bts = sign_link->trx->bts;
- struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
-
- if (!trx)
- return -EINVAL;
+ struct gsm_bts_trx *trx;
- if (!is_ipaccess_bts(trx->bts))
+ if (!is_ipaccess_bts(bts))
return 0;
switch (foh->obj_class) {
+ case NM_OC_SITE_MANAGER:
+ osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SW_ACT_REP, NULL);
+ break;
case NM_OC_BASEB_TRANSC:
+ if (!(trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr)))
+ return -EINVAL;
abis_nm_chg_adm_state(trx->bts, foh->obj_class,
trx->bts->bts_nr, trx->nr, 0xff,
NM_STATE_UNLOCKED);
@@ -278,6 +278,8 @@ static int sw_activ_rep(struct msgb *mb)
3003, trx->rsl_tei);
break;
case NM_OC_RADIO_CARRIER: {
+ if (!(trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr)))
+ return -EINVAL;
/*
* Locking the radio carrier will make it go
* offline again and we would come here. The
@@ -318,7 +320,12 @@ static void nm_rx_opstart_ack_chan(struct msgb *oml_msg)
static void nm_rx_opstart_ack(struct msgb *oml_msg)
{
struct abis_om_fom_hdr *foh = msgb_l3(oml_msg);
+ struct e1inp_sign_link *sign_link = oml_msg->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
switch (foh->obj_class) {
+ case NM_OC_SITE_MANAGER:
+ osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_CHANNEL:
nm_rx_opstart_ack_chan(oml_msg);
break;
@@ -327,6 +334,20 @@ static void nm_rx_opstart_ack(struct msgb *oml_msg)
}
}
+static void nm_rx_opstart_nack(struct msgb *oml_msg)
+{
+ struct abis_om_fom_hdr *foh = msgb_l3(oml_msg);
+ struct e1inp_sign_link *sign_link = oml_msg->dst;
+ struct gsm_bts *bts = sign_link->trx->bts;
+ switch (foh->obj_class) {
+ case NM_OC_SITE_MANAGER:
+ osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OPSTART_NACK, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
static void nm_rx_set_radio_attr_ack(struct msgb *oml_msg)
{
struct abis_om_fom_hdr *foh = msgb_l3(oml_msg);
@@ -358,6 +379,9 @@ static int bts_ipa_nm_sig_cb(unsigned int subsys, unsigned int signal,
case S_NM_OPSTART_ACK:
nm_rx_opstart_ack(signal_data);
return 0;
+ case S_NM_OPSTART_NACK:
+ nm_rx_opstart_nack(signal_data);
+ return 0;
case S_NM_SET_RADIO_ATTR_ACK:
nm_rx_set_radio_attr_ack(signal_data);
return 0;
@@ -442,6 +466,7 @@ void ipaccess_drop_oml(struct gsm_bts *bts, const char *reason)
llist_for_each_entry(trx, &bts->trx_list, list)
ipaccess_drop_rsl(trx, "OML link drop");
+ osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_OML_DOWN, NULL);
gsm_bts_all_ts_dispatch(bts, TS_EV_OML_DOWN, NULL);
bts->ip_access.flags = 0;
diff --git a/src/osmo-bsc/nm_bts_sm_fsm.c b/src/osmo-bsc/nm_bts_sm_fsm.c
new file mode 100644
index 000000000..94ca9d3d4
--- /dev/null
+++ b/src/osmo-bsc/nm_bts_sm_fsm.c
@@ -0,0 +1,279 @@
+/* NM BTS Site Manager FSM */
+
+/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin@sysmocom.de>
+ *
+ * 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/nm_common_fsm.h>
+#include <osmocom/bsc/debug.h>
+
+#define X(s) (1 << (s))
+
+#define nm_bts_sm_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_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
+
+ site_mgr->mo.opstart_sent = false;
+}
+
+static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_bts_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
+ struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr);
+ struct nm_statechg_signal_data *nsd;
+ struct gsm_nm_state *new_state;
+
+ switch (event) {
+ case NM_EV_SW_ACT_REP:
+ 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) {
+ /* nanobts always go directly into Reported ENABLED state during
+ startup, but we still need to OPSTART it, otherwise it won't
+ connect on RSL later on */
+ if (bts->type == GSM_BTS_TYPE_NANOBTS) {
+ site_mgr->mo.opstart_sent = true;
+ abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
+ } else {
+ LOGPFSML(fi, LOGL_NOTICE, "Received BTS Site Mgr State Report Enabled "
+ "without Opstart. You are probably using a nanoBTS but don't "
+ "have your .cfg with 'type nanobts'\n");
+ }
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_ENABLED);
+ return;
+ }
+ switch (new_state->availability) { /* operational = DISABLED */
+ case NM_AVSTATE_DEPENDENCY:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY);
+ return;
+ case NM_AVSTATE_OFF_LINE:
+ case NM_AVSTATE_OK:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_OFFLINE);
+ return;
+ default:
+ return;
+ }
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static void st_op_disabled_dependency(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) {
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_ENABLED);
+ return;
+ }
+ switch (new_state->availability) { /* operational = DISABLED */
+ case NM_AVSTATE_NOT_INSTALLED:
+ case NM_AVSTATE_POWER_OFF:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED);
+ return;
+ case NM_AVSTATE_OFF_LINE:
+ case NM_AVSTATE_OK:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_OFFLINE);
+ 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_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
+ struct gsm_bts *bts = gsm_bts_sm_get_bts(site_mgr);
+ if (!site_mgr->mo.opstart_sent) {
+ site_mgr->mo.opstart_sent = true;
+ abis_nm_opstart(bts, NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
+ }
+}
+
+static void st_op_disabled_offline(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) {
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_ENABLED);
+ return;
+ }
+ switch (new_state->availability) { /* operational = DISABLED */
+ case NM_AVSTATE_NOT_INSTALLED:
+ case NM_AVSTATE_POWER_OFF:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED);
+ return;
+ case NM_AVSTATE_DEPENDENCY:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY);
+ return;
+ case NM_AVSTATE_OFF_LINE:
+ case NM_AVSTATE_OK:
+ return;
+ default:
+ return;
+ }
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+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_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED);
+ return;
+ case NM_AVSTATE_DEPENDENCY:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY);
+ return;
+ case NM_AVSTATE_OFF_LINE:
+ case NM_AVSTATE_OK:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_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_sm *site_mgr = (struct gsm_bts_sm *)fi->priv;
+
+ switch (event) {
+ case NM_EV_OPSTART_ACK:
+ case NM_EV_OPSTART_NACK:
+ /* TODO: if on state OFFLINE and rx NACK, try again? */
+ site_mgr->mo.opstart_sent = false;
+ break;
+ case NM_EV_OML_DOWN:
+ nm_bts_sm_fsm_state_chg(fi, NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED);
+ break;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+static struct osmo_fsm_state nm_bts_sm_fsm_states[] = {
+ [NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED] = {
+ .in_event_mask =
+ X(NM_EV_SW_ACT_REP) |
+ X(NM_EV_STATE_CHG_REP),
+ .out_state_mask =
+ X(NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY) |
+ X(NM_BTS_SM_ST_OP_DISABLED_OFFLINE) |
+ X(NM_BTS_SM_ST_OP_ENABLED),
+ .name = "DISABLED_NOTINSTALLED",
+ .onenter = st_op_disabled_notinstalled_on_enter,
+ .action = st_op_disabled_notinstalled,
+ },
+ [NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY] = {
+ .in_event_mask =
+ X(NM_EV_STATE_CHG_REP),
+ .out_state_mask =
+ X(NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_BTS_SM_ST_OP_DISABLED_OFFLINE) |
+ X(NM_BTS_SM_ST_OP_ENABLED),
+ .name = "DISABLED_DEPENDENCY",
+ .action = st_op_disabled_dependency,
+ },
+ [NM_BTS_SM_ST_OP_DISABLED_OFFLINE] = {
+ .in_event_mask =
+ X(NM_EV_STATE_CHG_REP),
+ .out_state_mask =
+ X(NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY) |
+ X(NM_BTS_SM_ST_OP_ENABLED),
+ .name = "DISABLED_OFFLINE",
+ .onenter = st_op_disabled_offline_on_enter,
+ .action = st_op_disabled_offline,
+ },
+ [NM_BTS_SM_ST_OP_ENABLED] = {
+ .in_event_mask =
+ X(NM_EV_STATE_CHG_REP),
+ .out_state_mask =
+ X(NM_BTS_SM_ST_OP_DISABLED_NOTINSTALLED) |
+ X(NM_BTS_SM_ST_OP_DISABLED_DEPENDENCY) |
+ X(NM_BTS_SM_ST_OP_DISABLED_OFFLINE),
+ .name = "ENABLED",
+ .action = st_op_enabled,
+ },
+};
+
+struct osmo_fsm nm_bts_sm_fsm = {
+ .name = "NM_BTS_SM_OP",
+ .states = nm_bts_sm_fsm_states,
+ .num_states = ARRAY_SIZE(nm_bts_sm_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_bts_sm_fsm_init(void)
+{
+ OSMO_ASSERT(osmo_fsm_register(&nm_bts_sm_fsm) == 0);
+}
diff --git a/src/osmo-bsc/nm_common_fsm.c b/src/osmo-bsc/nm_common_fsm.c
new file mode 100644
index 000000000..9851f5d95
--- /dev/null
+++ b/src/osmo-bsc/nm_common_fsm.c
@@ -0,0 +1,32 @@
+/* NM FSM, common bits */
+
+/* (C) 2020 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de>
+ * Author: Pau Espin Pedrol <pespin@sysmocom.de>
+ *
+ * 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 <osmocom/bsc/nm_common_fsm.h>
+
+const struct value_string nm_fsm_event_names[] = {
+ { NM_EV_SW_ACT_REP, "SW_ACT_REP" },
+ { NM_EV_STATE_CHG_REP, "STATE_CHG_REP" },
+ { NM_EV_OPSTART_ACK, "OPSTART_ACK" },
+ { NM_EV_OPSTART_NACK, "OPSTART_NACK" },
+ { NM_EV_OML_DOWN, "OML_DOWN" },
+ { 0, NULL }
+};
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index fd03cb384..30de5b4e6 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -55,6 +55,8 @@ bs11_config_LDADD = \
$(top_builddir)/src/osmo-bsc/e1_config.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
@@ -125,6 +127,8 @@ meas_json_LDADD = \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index a245b51c8..55a133925 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -31,6 +31,8 @@ abis_test_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOGSM_LIBS) \
diff --git a/tests/acc/Makefile.am b/tests/acc/Makefile.am
index 4726ddc72..460d473c2 100644
--- a/tests/acc/Makefile.am
+++ b/tests/acc/Makefile.am
@@ -31,6 +31,8 @@ acc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
$(LIBOSMOGSM_LIBS) \
diff --git a/tests/acc/acc_test.c b/tests/acc/acc_test.c
index f463a2e64..81b9e8dd2 100644
--- a/tests/acc/acc_test.c
+++ b/tests/acc/acc_test.c
@@ -497,6 +497,7 @@ int main(int argc, char **argv)
log_set_print_category_hex(osmo_stderr_target, false);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_use_color(osmo_stderr_target, 0);
+ osmo_fsm_log_addr(false);
net = gsm_network_init(tall_bsc_ctx);
if (!net) {
diff --git a/tests/acc/acc_test.ok b/tests/acc/acc_test.ok
index 866502e81..1428e4037 100644
--- a/tests/acc/acc_test.ok
+++ b/tests/acc/acc_test.ok
@@ -1,4 +1,5 @@
===test_acc_mgr_no_ramp===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_no_ramp()
do_allowed_len_adm_loop(1)
@@ -105,8 +106,10 @@ pcu_info_update(): t2=0x03 t3=0xff, allowed:
*** Barring zero ACCs ***
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
pcu_info_update(): t2=0x00 t3=0x00, allowed: 0 1 2 3 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_no_ramp()
===test_acc_mgr_manual_ramp===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_manual_ramp()
do_allowed_len_ramp_loop(1)
@@ -343,8 +346,10 @@ pcu_info_update(): t2=0x01 t3=0xbf, allowed: 6 9
pcu_info_update(): t2=0x03 t3=0xff, allowed:
(bts=0) ACC: New ACC allowed subset 0x24c (active_len=4, ramp_len=4, adm_len=4, perm_len=4, rotation=off)
pcu_info_update(): t2=0x01 t3=0xb3, allowed: 2 3 6 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_manual_ramp()
===test_acc_mgr_rotate(true, 1)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -412,8 +417,10 @@ pcu_info_update(): t2=0x03 t3=0xfe, allowed: 0
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x001 -> 0x002 (active_len=1, ramp_len=10, adm_len=1, perm_len=9, rotation=on)
pcu_info_update(): t2=0x03 t3=0xfd, allowed: 1
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 1)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x200 (active_len=1, ramp_len=10, adm_len=1, perm_len=10, rotation=on)
@@ -478,8 +485,10 @@ pcu_info_update(): t2=0x02 t3=0xff, allowed: 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x100 -> 0x200 (active_len=1, ramp_len=10, adm_len=1, perm_len=10, rotation=on)
pcu_info_update(): t2=0x01 t3=0xff, allowed: 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 2)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -547,8 +556,10 @@ pcu_info_update(): t2=0x02 t3=0xfe, allowed: 0 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x101 -> 0x003 (active_len=2, ramp_len=10, adm_len=2, perm_len=9, rotation=on)
pcu_info_update(): t2=0x03 t3=0xfc, allowed: 0 1
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 2)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x300 (active_len=2, ramp_len=10, adm_len=2, perm_len=10, rotation=on)
@@ -613,8 +624,10 @@ pcu_info_update(): t2=0x02 t3=0x7f, allowed: 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x180 -> 0x300 (active_len=2, ramp_len=10, adm_len=2, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0xff, allowed: 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 3)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -682,8 +695,10 @@ pcu_info_update(): t2=0x02 t3=0x7e, allowed: 0 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x181 -> 0x103 (active_len=3, ramp_len=10, adm_len=3, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0xfc, allowed: 0 1 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 3)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x380 (active_len=3, ramp_len=10, adm_len=3, perm_len=10, rotation=on)
@@ -748,8 +763,10 @@ pcu_info_update(): t2=0x02 t3=0x3f, allowed: 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1c0 -> 0x380 (active_len=3, ramp_len=10, adm_len=3, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x7f, allowed: 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 4)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -817,8 +834,10 @@ pcu_info_update(): t2=0x02 t3=0x3e, allowed: 0 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1c1 -> 0x183 (active_len=4, ramp_len=10, adm_len=4, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0x7c, allowed: 0 1 7 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 4)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3c0 (active_len=4, ramp_len=10, adm_len=4, perm_len=10, rotation=on)
@@ -883,8 +902,10 @@ pcu_info_update(): t2=0x02 t3=0x1f, allowed: 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1e0 -> 0x3c0 (active_len=4, ramp_len=10, adm_len=4, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x3f, allowed: 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 5)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -952,8 +973,10 @@ pcu_info_update(): t2=0x02 t3=0x1e, allowed: 0 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1e1 -> 0x1c3 (active_len=5, ramp_len=10, adm_len=5, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0x3c, allowed: 0 1 6 7 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 5)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3e0 (active_len=5, ramp_len=10, adm_len=5, perm_len=10, rotation=on)
@@ -1018,8 +1041,10 @@ pcu_info_update(): t2=0x02 t3=0x0f, allowed: 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1f0 -> 0x3e0 (active_len=5, ramp_len=10, adm_len=5, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x1f, allowed: 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 6)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -1087,8 +1112,10 @@ pcu_info_update(): t2=0x02 t3=0x0e, allowed: 0 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1f1 -> 0x1e3 (active_len=6, ramp_len=10, adm_len=6, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0x1c, allowed: 0 1 5 6 7 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 6)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3f0 (active_len=6, ramp_len=10, adm_len=6, perm_len=10, rotation=on)
@@ -1153,8 +1180,10 @@ pcu_info_update(): t2=0x02 t3=0x07, allowed: 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1f8 -> 0x3f0 (active_len=6, ramp_len=10, adm_len=6, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x0f, allowed: 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 7)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -1222,8 +1251,10 @@ pcu_info_update(): t2=0x02 t3=0x06, allowed: 0 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1f9 -> 0x1f3 (active_len=7, ramp_len=10, adm_len=7, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0x0c, allowed: 0 1 4 5 6 7 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 7)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3f8 (active_len=7, ramp_len=10, adm_len=7, perm_len=10, rotation=on)
@@ -1288,8 +1319,10 @@ pcu_info_update(): t2=0x02 t3=0x03, allowed: 2 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1fc -> 0x3f8 (active_len=7, ramp_len=10, adm_len=7, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x07, allowed: 3 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(true, 8)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
*** Barring one ACC ***
@@ -1357,8 +1390,10 @@ pcu_info_update(): t2=0x02 t3=0x02, allowed: 0 2 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1fd -> 0x1fb (active_len=8, ramp_len=10, adm_len=8, perm_len=9, rotation=on)
pcu_info_update(): t2=0x02 t3=0x04, allowed: 0 1 3 4 5 6 7 8
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 8)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3fc (active_len=8, ramp_len=10, adm_len=8, perm_len=10, rotation=on)
@@ -1423,8 +1458,10 @@ pcu_info_update(): t2=0x02 t3=0x01, allowed: 1 2 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1fe -> 0x3fc (active_len=8, ramp_len=10, adm_len=8, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x03, allowed: 2 3 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_mgr_rotate(false, 9)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_mgr_rotate()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3fe (active_len=9, ramp_len=10, adm_len=9, perm_len=10, rotation=on)
@@ -1489,8 +1526,10 @@ pcu_info_update(): t2=0x02 t3=0x00, allowed: 0 1 2 3 4 5 6 7 8
sys={40.000000}: select()
(bts=0) ACC: rotate ACC allowed active subset 0x1ff -> 0x3fe (active_len=9, ramp_len=10, adm_len=9, perm_len=10, rotation=on)
pcu_info_update(): t2=0x00 t3=0x01, allowed: 1 2 3 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_mgr_rotate()
===test_acc_ramp===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x000 (active_len=0, ramp_len=0, adm_len=10, perm_len=10, rotation=off)
@@ -1524,8 +1563,10 @@ pcu_info_update(): t2=0x02 t3=0x00, allowed: 0 1 2 3 4 5 6 7 8
sys={450.000000}: select()
(bts=0) ACC: update ACC allowed active subset 0x1ff -> 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
pcu_info_update(): t2=0x00 t3=0x00, allowed: 0 1 2 3 4 5 6 7 8 9
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp()
===test_acc_ramp2===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp2()
(bts=0) ACC: update ACC allowed active subset 0x3ff -> 0x3f8 (active_len=7, ramp_len=10, adm_len=7, perm_len=10, rotation=on)
@@ -1541,8 +1582,10 @@ sys={10.000000}: select()
(bts=0) ACC: update ACC allowed active subset 0x03f -> 0x07f (active_len=7, ramp_len=7, adm_len=7, perm_len=10, rotation=on)
pcu_info_update(): t2=0x03 t3=0x80, allowed: 0 1 2 3 4 5 6
sys={15.000000}: select()
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp2()
===test_acc_ramp3===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp3()
*** Barring some ACCs ***
@@ -1574,8 +1617,10 @@ sys={40.000000}: select()
(bts=0) ACC: update ACC allowed active subset 0x15a -> 0x15a (active_len=5, ramp_len=9, adm_len=10, perm_len=5, rotation=off)
sys={45.000000}: select()
(bts=0) ACC: update ACC allowed active subset 0x15a -> 0x15a (active_len=5, ramp_len=10, adm_len=10, perm_len=5, rotation=off)
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp3()
===test_acc_ramp_up_rotate(0, 100, 100)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_up_rotate()
*** Barring one ACC ***
@@ -1663,8 +1708,10 @@ sys={2500.000000}: select()
sys={2750.000000}: select()
sys={3000.000000}: select()
sys={3250.000000}: select()
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_up_rotate()
===test_acc_ramp_up_rotate(0, 20, 50)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_up_rotate()
*** Barring one ACC ***
@@ -1752,8 +1799,10 @@ sys={2500.000000}: select()
sys={2750.000000}: select()
sys={3000.000000}: select()
sys={3250.000000}: select()
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_up_rotate()
===test_acc_ramp_up_rotate(70, 80, 90)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_up_rotate()
*** Barring one ACC ***
@@ -1841,8 +1890,10 @@ sys={2500.000000}: select()
sys={2750.000000}: select()
sys={3000.000000}: select()
sys={3250.000000}: select()
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_up_rotate()
===test_acc_ramp_updown_rotate(80, 90, 0, 100, 15)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_updown_rotate()
*** Barring one ACC ***
@@ -1960,8 +2011,10 @@ sys={6750.000000}: select(46): chan_load_avg=60
sys={7000.000000}: select(47): chan_load_avg=75
sys={7250.000000}: select(48): chan_load_avg=90
sys={7500.000000}: select(49): chan_load_avg=100
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_updown_rotate()
===test_acc_ramp_updown_rotate(30, 50, 10, 100, 15)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_updown_rotate()
*** Barring one ACC ***
@@ -2103,8 +2156,10 @@ pcu_info_update(): t2=0x03 t3=0xfc, allowed: 0 1
sys={4200.000000}: select(49): chan_load_avg=25
(bts=0) ACC: rotate ACC allowed active subset 0x003 -> 0x006 (active_len=2, ramp_len=2, adm_len=10, perm_len=9, rotation=on)
pcu_info_update(): t2=0x03 t3=0xf9, allowed: 1 2
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_updown_rotate()
===test_acc_ramp_updown_rotate(50, 49, 0, 100, 10)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_updown_rotate()
*** Barring one ACC ***
@@ -2256,8 +2311,10 @@ pcu_info_update(): t2=0x03 t3=0xe3, allowed: 2 3 4
sys={4200.000000}: select(49): chan_load_avg=90
(bts=0) ACC: rotate ACC allowed active subset 0x01c -> 0x038 (active_len=3, ramp_len=3, adm_len=10, perm_len=9, rotation=on)
pcu_info_update(): t2=0x03 t3=0xc7, allowed: 3 4 5
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_updown_rotate()
===test_acc_ramp_updown_rotate(30, 80, 30, 80, 5)===
+NM_BTS_SM_OP{DISABLED_NOTINSTALLED}: Allocated
(bts=0) ACC: New ACC allowed subset 0x3ff (active_len=10, ramp_len=10, adm_len=10, perm_len=10, rotation=off)
BTS allocation OK in test_acc_ramp_updown_rotate()
*** Barring one ACC ***
@@ -2315,4 +2372,5 @@ sys={11750.000000}: select(46): chan_load_avg=60
sys={12000.000000}: select(47): chan_load_avg=65
sys={12250.000000}: select(48): chan_load_avg=70
sys={12500.000000}: select(49): chan_load_avg=75
+NM_BTS_SM_OP(bts_sm){DISABLED_NOTINSTALLED}: Deallocated
BTS deallocated OK in test_acc_ramp_updown_rotate()
diff --git a/tests/bsc/Makefile.am b/tests/bsc/Makefile.am
index 468c0321e..d64915bcd 100644
--- a/tests/bsc/Makefile.am
+++ b/tests/bsc/Makefile.am
@@ -45,6 +45,8 @@ bsc_test_LDADD = \
$(top_builddir)/src/osmo-bsc/handover_logic.o \
$(top_builddir)/src/osmo-bsc/neighbor_ident.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/tests/gsm0408/Makefile.am b/tests/gsm0408/Makefile.am
index 66e407259..656498f1f 100644
--- a/tests/gsm0408/Makefile.am
+++ b/tests/gsm0408/Makefile.am
@@ -34,6 +34,8 @@ gsm0408_test_LDADD = \
$(top_builddir)/src/osmo-bsc/rest_octets.o \
$(top_builddir)/src/osmo-bsc/system_information.o \
$(top_builddir)/src/osmo-bsc/neighbor_ident.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 0f7953cd4..4b8f26915 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -80,6 +80,8 @@ handover_test_LDADD = \
$(top_builddir)/src/osmo-bsc/neighbor_ident.o \
$(top_builddir)/src/osmo-bsc/neighbor_ident_vty.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(top_builddir)/src/osmo-bsc/osmo_bsc_ctrl.o \
$(top_builddir)/src/osmo-bsc/osmo_bsc_lcls.o \
$(top_builddir)/src/osmo-bsc/osmo_bsc_mgcp.o \
diff --git a/tests/nanobts_omlattr/Makefile.am b/tests/nanobts_omlattr/Makefile.am
index 1cdcc50a1..05dc66214 100644
--- a/tests/nanobts_omlattr/Makefile.am
+++ b/tests/nanobts_omlattr/Makefile.am
@@ -29,6 +29,8 @@ nanobts_omlattr_test_LDADD = \
$(top_builddir)/src/osmo-bsc/bts.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \
$(top_builddir)/src/osmo-bsc/gsm_data.o \
+ $(top_builddir)/src/osmo-bsc/nm_common_fsm.o \
+ $(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \