aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-10-02 17:50:03 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-10-02 20:13:15 +0200
commit135068d5c8ddb5fcca3379b94eb3f777b3a14525 (patch)
treeb80e62ddb34066f1277ebbf5046744eeeb95b742
parenta97941aaca7b12f98633a3a97fd71f48b082d591 (diff)
Introduce NM BTS FSM
-rw-r--r--include/osmo-bts/Makefile.am1
-rw-r--r--include/osmo-bts/bts.h7
-rw-r--r--include/osmo-bts/nm_bts_fsm.h40
-rw-r--r--include/osmo-bts/oml.h2
-rw-r--r--src/common/Makefile.am1
-rw-r--r--src/common/abis.c2
-rw-r--r--src/common/bts.c15
-rw-r--r--src/common/bts_ctrl_commands.c2
-rw-r--r--src/common/main.c2
-rw-r--r--src/common/nm_bts_fsm.c152
-rw-r--r--src/common/oml.c42
-rw-r--r--src/common/rsl.c2
-rw-r--r--src/common/vty.c4
-rw-r--r--src/osmo-bts-litecell15/oml.c7
-rw-r--r--src/osmo-bts-oc2g/oc2gbts_vty.c4
-rw-r--r--src/osmo-bts-oc2g/oml.c15
-rw-r--r--src/osmo-bts-octphy/l1_oml.c5
-rw-r--r--src/osmo-bts-omldummy/bts_model.c5
-rw-r--r--src/osmo-bts-sysmo/oml.c15
-rw-r--r--src/osmo-bts-trx/l1_if.c5
-rw-r--r--src/osmo-bts-virtual/bts_model.c5
21 files changed, 276 insertions, 57 deletions
diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am
index c03cf3cc..8179f1ad 100644
--- a/include/osmo-bts/Makefile.am
+++ b/include/osmo-bts/Makefile.am
@@ -28,4 +28,5 @@ noinst_HEADERS = \
dtx_dl_amr_fsm.h \
ta_control.h \
nm_bts_sm_fsm.h \
+ nm_bts_fsm.h \
$(NULL)
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 191feb92..e4f40997 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -133,7 +133,12 @@ struct gsm_bts {
struct timespec oml_conn_established_timestamp;
/* Abis network management O&M handle */
- struct gsm_abis_mo mo;
+ struct {
+ /* NM BTS FSM */
+ struct osmo_fsm_inst *fi;
+ bool opstart_success;
+ struct gsm_abis_mo mo;
+ } nm;
/* number of this BTS on given E1 link */
uint8_t bts_nr;
diff --git a/include/osmo-bts/nm_bts_fsm.h b/include/osmo-bts/nm_bts_fsm.h
new file mode 100644
index 00000000..9ee74274
--- /dev/null
+++ b/include/osmo-bts/nm_bts_fsm.h
@@ -0,0 +1,40 @@
+/* NM BTS 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>
+
+enum nm_bts_op_fsm_states {
+ NM_BTS_ST_OP_DISABLED_NOTINSTALLED,
+ NM_BTS_ST_OP_DISABLED_OFFLINE,
+ NM_BTS_ST_OP_ENABLED,
+};
+
+enum nm_bts_op_fsm_events {
+ NM_BTS_EV_SW_ACT,
+ NM_BTS_EV_OPSTART_ACK,
+ NM_BTS_EV_OPSTART_NACK,
+};
+
+extern struct osmo_fsm nm_bts_fsm;
diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 484e210b..0689bb05 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -32,7 +32,7 @@ struct gsm_abis_mo {
struct gsm_bts *bts;
};
-int oml_init(struct gsm_abis_mo *mo);
+int oml_init(void);
int down_oml(struct gsm_bts *bts, struct msgb *msg);
struct msgb *oml_msgb_alloc(void);
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 67243746..546e02a1 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -38,6 +38,7 @@ libbts_a_SOURCES = \
scheduler_mframe.c \
ta_control.c \
nm_bts_sm_fsm.c \
+ nm_bts_fsm.c \
$(NULL)
libl1sched_a_SOURCES = scheduler.c
diff --git a/src/common/abis.c b/src/common/abis.c
index 4c62e8f4..5b914c76 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -259,7 +259,7 @@ void abis_init(struct gsm_bts *bts)
{
g_bts = bts;
- oml_init(&bts->mo);
+ oml_init();
libosmo_abis_init(tall_bts_ctx);
osmo_signal_register_handler(SS_L_INPUT, &inp_s_cbfn, bts);
diff --git a/src/common/bts.c b/src/common/bts.c
index 34a6be27..38ec5534 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -53,6 +53,7 @@
#include <osmo-bts/cbch.h>
#include <osmo-bts/bts_shutdown_fsm.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#define MIN_QUAL_RACH 50 /* minimum link quality (in centiBels) for Access Bursts */
#define MIN_QUAL_NORM -5 /* minimum link quality (in centiBels) for Normal Bursts */
@@ -226,8 +227,10 @@ struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
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);
+ bts->nm.fi = osmo_fsm_inst_alloc(&nm_bts_fsm, bts, bts,
+ LOGL_INFO, NULL);
+ osmo_fsm_inst_update_id_f(bts->nm.fi, "bts%d", bts->nr);
+ gsm_mo_init(&bts->nm.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;
@@ -333,9 +336,9 @@ int bts_init(struct gsm_bts *bts)
/* Start with the site manager */
oml_mo_state_init(&bts->site_mgr.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+ oml_mo_state_init(&bts->nm.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
- /* set BTS to dependency */
- oml_mo_state_init(&bts->mo, -1, NM_AVSTATE_DEPENDENCY);
+ /* set BTS attr to dependency */
oml_mo_state_init(&bts->gprs.nse.mo, -1, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.cell.mo, -1, NM_AVSTATE_DEPENDENCY);
oml_mo_state_init(&bts->gprs.nsvc[0].mo, -1, NM_AVSTATE_DEPENDENCY);
@@ -395,9 +398,9 @@ int bts_link_estab(struct gsm_bts *bts)
LOGP(DSUM, LOGL_INFO, "Main link established, sending NM Status.\n");
- /* BTS SITE MGR becomes Offline (tx SW ACT Report), BTS is DEPENDENCY */
+ /* BTS SITE MGR and BTS become Offline (tx SW ACT Report) */
osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_SW_ACT, NULL);
- oml_tx_state_changed(&bts->mo);
+ osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_SM_EV_SW_ACT, NULL);
/* those should all be in DEPENDENCY */
oml_tx_state_changed(&bts->gprs.nse.mo);
diff --git a/src/common/bts_ctrl_commands.c b/src/common/bts_ctrl_commands.c
index faaba6a1..971a587b 100644
--- a/src/common/bts_ctrl_commands.c
+++ b/src/common/bts_ctrl_commands.c
@@ -77,7 +77,7 @@ CTRL_CMD_DEFINE_WO_NOVRF(oml_alert, "oml-alert");
static int set_oml_alert(struct ctrl_cmd *cmd, void *data)
{
/* Note: we expect signal dispatch to be synchronous */
- oml_tx_failure_event_rep(&g_bts->mo, NM_SEVER_INDETERMINATE, OSMO_EVT_EXT_ALARM, cmd->value);
+ oml_tx_failure_event_rep(&g_bts->nm.mo, NM_SEVER_INDETERMINATE, OSMO_EVT_EXT_ALARM, cmd->value);
cmd->reply = "OK";
diff --git a/src/common/main.c b/src/common/main.c
index dfdc2a74..79ae43d0 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -186,7 +186,7 @@ static void signal_handler(int signal)
case SIGINT:
case SIGTERM:
if (!quit) {
- oml_tx_failure_event_rep(&bts->mo,
+ oml_tx_failure_event_rep(&bts->nm.mo,
NM_SEVER_CRITICAL, OSMO_EVT_CRIT_PROC_STOP,
"BTS: SIGINT received -> shutdown");
bts_shutdown(bts, "SIGINT");
diff --git a/src/common/nm_bts_fsm.c b/src/common/nm_bts_fsm.c
new file mode 100644
index 00000000..1343fb38
--- /dev/null
+++ b/src/common/nm_bts_fsm.c
@@ -0,0 +1,152 @@
+/* NM BTS 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 <osmo-bts/logging.h>
+#include <osmo-bts/gsm_data.h>
+#include <osmo-bts/bts_model.h>
+#include <osmo-bts/bts.h>
+#include <osmo-bts/rsl.h>
+#include <osmo-bts/nm_bts_fsm.h>
+#include <osmo-bts/phy_link.h>
+
+#define X(s) (1 << (s))
+
+#define nm_bts_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 *bts = (struct gsm_bts *)fi->priv;
+ bts->nm.opstart_success = false;
+ oml_mo_state_chg(&bts->nm.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+}
+
+static void st_op_disabled_notinstalled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
+
+ switch (event) {
+ case NM_BTS_EV_SW_ACT:
+ oml_mo_tx_sw_act_rep(&bts->nm.mo);
+ nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_DISABLED_OFFLINE);
+ 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 *bts = (struct gsm_bts *)fi->priv;
+ bts->nm.opstart_success = false;
+ oml_mo_state_chg(&bts->nm.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_OFF_LINE);
+}
+
+static void st_op_disabled_offline(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+ struct gsm_bts *bts = (struct gsm_bts *)fi->priv;
+
+ switch (event) {
+ case NM_BTS_EV_OPSTART_ACK:
+ bts->nm.opstart_success = true;
+ oml_mo_opstart_ack(&bts->nm.mo);
+ nm_bts_fsm_state_chg(fi, NM_BTS_ST_OP_ENABLED);
+ break; /* check statechg below */
+ case NM_BTS_EV_OPSTART_NACK:
+ bts->nm.opstart_success = false;
+ oml_mo_opstart_nack(&bts->nm.mo, (int)(intptr_t)data);
+ return;
+ default:
+ OSMO_ASSERT(0);
+ }
+}
+
+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->nm.mo, NM_OPSTATE_ENABLED, NM_AVSTATE_OK);
+}
+
+static void st_op_enabled(struct osmo_fsm_inst *fi, uint32_t event, void *data)
+{
+}
+
+static struct osmo_fsm_state nm_bts_fsm_states[] = {
+ [NM_BTS_ST_OP_DISABLED_NOTINSTALLED] = {
+ .in_event_mask =
+ X(NM_BTS_EV_SW_ACT),
+ .out_state_mask =
+ X(NM_BTS_ST_OP_DISABLED_OFFLINE),
+ .name = "DISABLED_NOTINSTALLED",
+ .onenter = st_op_disabled_notinstalled_on_enter,
+ .action = st_op_disabled_notinstalled,
+ },
+ [NM_BTS_ST_OP_DISABLED_OFFLINE] = {
+ .in_event_mask =
+ X(NM_BTS_EV_OPSTART_ACK) |
+ X(NM_BTS_EV_OPSTART_NACK),
+ .out_state_mask =
+ X(NM_BTS_ST_OP_ENABLED),
+ .name = "DISABLED_OFFLINE",
+ .onenter = st_op_disabled_offline_on_enter,
+ .action = st_op_disabled_offline,
+ },
+ [NM_BTS_ST_OP_ENABLED] = {
+ .in_event_mask = 0,
+ .out_state_mask = 0,
+ .name = "ENABLED",
+ .onenter = st_op_enabled_on_enter,
+ .action = st_op_enabled,
+ },
+};
+
+const struct value_string nm_bts_fsm_event_names[] = {
+ { NM_BTS_EV_SW_ACT, "SW_ACT" },
+ { NM_BTS_EV_OPSTART_ACK, "OPSTART_ACK" },
+ { NM_BTS_EV_OPSTART_NACK, "OPSTART_NACK" },
+ { 0, NULL }
+};
+
+struct osmo_fsm nm_bts_fsm = {
+ .name = "NM_BTS_OP",
+ .states = nm_bts_fsm_states,
+ .num_states = ARRAY_SIZE(nm_bts_fsm_states),
+ .event_names = nm_bts_fsm_event_names,
+ .log_subsys = DOML,
+};
+
+static __attribute__((constructor)) void nm_bts_fsm_init(void)
+{
+ OSMO_ASSERT(osmo_fsm_register(&nm_bts_fsm) == 0);
+}
diff --git a/src/common/oml.c b/src/common/oml.c
index fd4aed85..0dd7ecb2 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -544,7 +544,7 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
rc = oml_tlv_parse(&tp, foh->data, msgb_l3len(msg) - sizeof(*foh));
if (rc < 0) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UNSUP_ATTR,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UNSUP_ATTR,
"New value for Attribute not supported");
return oml_fom_ack_nack(msg, NM_NACK_INCORR_STRUCT);
}
@@ -553,7 +553,7 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
if (TLVP_PRES_LEN(&tp, NM_ATT_BCCH_ARFCN, 2)) {
uint16_t arfcn = ntohs(tlvp_val16_unal(&tp, NM_ATT_BCCH_ARFCN));
if (arfcn >= 1024) { /* 0 .. 1023 (1024 channels total) */
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_WARN_SW_WARN,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_WARN_SW_WARN,
"Given ARFCN %u is not supported",
arfcn);
LOGPFOH(DOML, LOGL_ERROR, foh, "Given ARFCN %u is not supported.\n", arfcn);
@@ -562,26 +562,26 @@ static int oml_rx_set_bts_attr(struct gsm_bts *bts, struct msgb *msg)
}
/* 9.4.52 Starting Time */
if (TLVP_PRESENT(&tp, NM_ATT_START_TIME)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UNSUP_ATTR,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UNSUP_ATTR,
"NM_ATT_START_TIME Attribute not "
"supported");
return oml_fom_ack_nack(msg, NM_NACK_SPEC_IMPL_NOTSUPP);
}
/* merge existing BTS attributes with new attributes */
- tp_merged = osmo_tlvp_copy(bts->mo.nm_attr, bts);
+ tp_merged = osmo_tlvp_copy(bts->nm.mo.nm_attr, bts);
osmo_tlvp_merge(tp_merged, &tp);
/* Ask BTS driver to validate new merged attributes */
- rc = bts_model_check_oml(bts, foh->msg_type, bts->mo.nm_attr, tp_merged, bts);
+ rc = bts_model_check_oml(bts, foh->msg_type, bts->nm.mo.nm_attr, tp_merged, bts);
if (rc < 0) {
talloc_free(tp_merged);
return oml_fom_ack_nack(msg, -rc);
}
/* Success: replace old BTS attributes with new */
- talloc_free(bts->mo.nm_attr);
- bts->mo.nm_attr = tp_merged;
+ talloc_free(bts->nm.mo.nm_attr);
+ bts->nm.mo.nm_attr = tp_merged;
/* ... and actually still parse them */
@@ -776,7 +776,7 @@ static int oml_rx_set_radio_attr(struct gsm_bts_trx *trx, struct msgb *msg)
arfcn = ntohs(_value);
value += 2;
if (arfcn >= 1024) { /* 0 .. 1023 (1024 channels total) */
- oml_tx_failure_event_rep(&trx->bts->mo, NM_SEVER_MAJOR, OSMO_EVT_WARN_SW_WARN,
+ oml_tx_failure_event_rep(&trx->bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_WARN_SW_WARN,
"Given ARFCN %u is unsupported", arfcn);
LOGPFOH(DOML, LOGL_NOTICE, foh, "Given ARFCN %u is unsupported.\n", arfcn);
return oml_fom_ack_nack(msg, NM_NACK_FREQ_NOTAVAIL);
@@ -1052,7 +1052,7 @@ static int oml_rx_chg_adm_state(struct gsm_bts *bts, struct msgb *msg)
static inline bool report_bts_number_incorrect(struct gsm_bts *bts, const struct abis_om_fom_hdr *foh, bool is_formatted)
{
struct gsm_bts_trx *trx;
- const struct gsm_abis_mo *mo = &bts->mo;
+ const struct gsm_abis_mo *mo = &bts->nm.mo;
const char *form = is_formatted ?
"Unexpected BTS %d in formatted O&M %s (exp. 0 or 0xFF)" :
"Unexpected BTS %d in manufacturer O&M %s (exp. 0 or 0xFF)";
@@ -1076,7 +1076,7 @@ static int down_fom(struct gsm_bts *bts, struct msgb *msg)
struct abis_om_hdr *oh = msgb_l2(msg);
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
- const struct gsm_abis_mo *mo = &bts->mo;
+ const struct gsm_abis_mo *mo = &bts->nm.mo;
int ret;
if (msgb_l2len(msg) < sizeof(*foh)) {
@@ -1375,7 +1375,7 @@ static int rx_oml_ipa_rsl_connect(struct gsm_bts_trx *trx, struct msgb *msg,
static int down_mom(struct gsm_bts *bts, struct msgb *msg)
{
struct abis_om_hdr *oh = msgb_l2(msg);
- const struct gsm_abis_mo *mo = &bts->mo;
+ const struct gsm_abis_mo *mo = &bts->nm.mo;
struct abis_om_fom_hdr *foh;
struct gsm_bts_trx *trx;
uint8_t idstrlen = oh->data[0];
@@ -1383,13 +1383,13 @@ static int down_mom(struct gsm_bts *bts, struct msgb *msg)
int ret;
if (msgb_l2len(msg) < sizeof(*foh)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Manufacturer O&M message too short\n");
return -EIO;
}
if (strncmp((char *)&oh->data[1], abis_nm_ipa_magic, idstrlen)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Manufacturer OML message != ipaccess not supported\n");
return -EINVAL;
}
@@ -1443,7 +1443,7 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
int ret = 0;
if (msgb_l2len(msg) < sizeof(*oh)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"OML message too short\n");
msgb_free(msg);
return -EIO;
@@ -1452,14 +1452,14 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
/* We don't implement de-segmentation of segmented OML messages */
if (oh->placement != ABIS_OM_PLACEMENT_ONLY || oh->sequence != 0) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Unsupported segmented O&M message\n");
msgb_free(msg);
return -EIO;
}
if (msgb_l3len(msg) < oh->length) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Short OML message: %u < %u\n",
msgb_l3len(msg), oh->length);
msgb_free(msg);
@@ -1469,7 +1469,7 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
switch (oh->mdisc) {
case ABIS_OM_MDISC_FOM:
if (msgb_l2len(msg) < sizeof(*oh)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Formatted O&M message too short\n");
ret = -EIO;
break;
@@ -1478,7 +1478,7 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
break;
case ABIS_OM_MDISC_MANUF:
if (msgb_l2len(msg) < sizeof(*oh)) {
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MAJOR, OSMO_EVT_MAJ_UKWN_MSG,
"Manufacturer O&M message too short\n");
ret = -EIO;
break;
@@ -1486,7 +1486,7 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
ret = down_mom(bts, msg);
break;
default:
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MINOR, OSMO_EVT_MAJ_UKWN_MSG,
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MINOR, OSMO_EVT_MAJ_UKWN_MSG,
"unknown O&M msg_disc 0x%02x\n", oh->mdisc);
ret = -EINVAL;
}
@@ -1496,7 +1496,7 @@ int down_oml(struct gsm_bts *bts, struct msgb *msg)
return ret;
}
-int oml_init(struct gsm_abis_mo *mo)
+int oml_init()
{
DEBUGP(DOML, "Initializing OML attribute definitions\n");
tlv_def_patch(&abis_nm_att_tlvdef_ipa_local, &abis_nm_att_tlvdef_ipa);
@@ -1528,7 +1528,7 @@ gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
switch (obj_class) {
case NM_OC_BTS:
- mo = &bts->mo;
+ mo = &bts->nm.mo;
break;
case NM_OC_RADIO_CARRIER:
if (obj_inst->trx_nr >= bts->num_trx) {
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 919981dd..91e9f75c 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -485,7 +485,7 @@ static int rsl_rx_paging_cmd(struct gsm_bts_trx *trx, struct msgb *msg)
if (rc < 0) {
/* FIXME: notfiy the BSC on other errors? */
if (rc == -ENOSPC) {
- oml_tx_failure_event_rep(&trx->bts->mo, NM_SEVER_WARNING,
+ oml_tx_failure_event_rep(&trx->bts->nm.mo, NM_SEVER_WARNING,
OSMO_EVT_MIN_PAG_TAB_FULL, "BTS paging table is full");
}
}
diff --git a/src/common/vty.c b/src/common/vty.c
index b662320c..c3909793 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -872,7 +872,7 @@ static void bts_dump_vty(struct vty *vty, const struct gsm_bts *bts)
bts->oml_link ? bts->oml_link->tei : 0x00,
VTY_NEWLINE);
vty_out(vty, " NM State: ");
- net_dump_nmstate(vty, &bts->mo.nm_state);
+ net_dump_nmstate(vty, &bts->nm.mo.nm_state);
vty_out(vty, " Site Mgr NM State: ");
net_dump_nmstate(vty, &bts->site_mgr.mo.nm_state);
if (strnlen(bts->pcu_version, MAX_VERSION_LENGTH))
@@ -958,7 +958,7 @@ DEFUN(test_send_failure_event_report, test_send_failure_event_report_cmd, "test
}
bts = gsm_bts_num(net, bts_nr);
- oml_tx_failure_event_rep(&bts->mo, NM_SEVER_MINOR, OSMO_EVT_WARN_SW_WARN, "test message sent from VTY");
+ oml_tx_failure_event_rep(&bts->nm.mo, NM_SEVER_MINOR, OSMO_EVT_WARN_SW_WARN, "test message sent from VTY");
return CMD_SUCCESS;
}
diff --git a/src/osmo-bts-litecell15/oml.c b/src/osmo-bts-litecell15/oml.c
index 366e8da6..424a945d 100644
--- a/src/osmo-bts-litecell15/oml.c
+++ b/src/osmo-bts-litecell15/oml.c
@@ -43,6 +43,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "l1_if.h"
#include "lc15bts.h"
@@ -1891,13 +1892,15 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_RADIO_CARRIER:
rc = trx_init(obj);
break;
case NM_OC_CHANNEL:
rc = ts_opstart(obj);
break;
- case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
@@ -1905,7 +1908,7 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -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->nm.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);
diff --git a/src/osmo-bts-oc2g/oc2gbts_vty.c b/src/osmo-bts-oc2g/oc2gbts_vty.c
index c12d0bf7..b614e128 100644
--- a/src/osmo-bts-oc2g/oc2gbts_vty.c
+++ b/src/osmo-bts-oc2g/oc2gbts_vty.c
@@ -684,7 +684,7 @@ static int set_oc2g_oml_alert(struct ctrl_cmd *cmd, void *data)
int cause = atoi(cmd->value);
char *saveptr = NULL;
- alarm_sig_data.mo = &bts->mo;
+ alarm_sig_data.mo = &bts->nm.mo;
cause = atoi(strtok_r(cmd->value, ",", &saveptr));
alarm_sig_data.event_serverity = (cause >> 8) & 0x0F;
alarm_sig_data.add_text = strtok_r(NULL, "\n", &saveptr);
@@ -706,7 +706,7 @@ static int set_oc2g_oml_ceased(struct ctrl_cmd *cmd, void *data)
int cause = atoi(cmd->value);
char *saveptr = NULL;
- alarm_sig_data.mo = &bts->mo;
+ alarm_sig_data.mo = &bts->nm.mo;
cause = atoi(strtok_r(cmd->value, ",", &saveptr));
alarm_sig_data.add_text = strtok_r(NULL, "\n", &saveptr);
memcpy(alarm_sig_data.spare, &cause, sizeof(int));
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index 798be8f3..2cff758d 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -43,6 +43,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "l1_if.h"
#include "oc2gbts.h"
@@ -1900,25 +1901,25 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ oml_mo_state_chg(&bts->nm.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);
+ break;
case NM_OC_RADIO_CARRIER:
rc = trx_init(obj);
break;
case NM_OC_CHANNEL:
rc = ts_opstart(obj);
break;
- case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -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);
- }
break;
default:
rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP);
diff --git a/src/osmo-bts-octphy/l1_oml.c b/src/osmo-bts-octphy/l1_oml.c
index 1d34378f..8156c49a 100644
--- a/src/osmo-bts-octphy/l1_oml.c
+++ b/src/osmo-bts-octphy/l1_oml.c
@@ -39,6 +39,7 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "l1_if.h"
#include "l1_oml.h"
@@ -1770,6 +1771,9 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_RADIO_CARRIER:
rc = trx_init(obj);
break;
@@ -1777,7 +1781,6 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
ts = (struct gsm_bts_trx_ts*) obj;
rc = ts_connect_as(ts, ts->pchan, pchan_act_compl_cb, NULL);
break;
- case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
diff --git a/src/osmo-bts-omldummy/bts_model.c b/src/osmo-bts-omldummy/bts_model.c
index 7ac93918..dee671b5 100644
--- a/src/osmo-bts-omldummy/bts_model.c
+++ b/src/osmo-bts-omldummy/bts_model.c
@@ -35,6 +35,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
/* TODO: check if dummy method is sufficient, else implement */
int bts_model_lchan_deactivate(struct gsm_lchan *lchan)
@@ -133,6 +134,9 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_RADIO_CARRIER:
trx = (struct gsm_bts_trx*) obj;
/* Mark Dependency TS as Offline (ready to be Opstarted) */
@@ -147,7 +151,6 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
break;
case NM_OC_CHANNEL:
case NM_OC_BASEB_TRANSC:
- case NM_OC_BTS:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index f58a0e6b..9bbf02f7 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -40,6 +40,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "l1_if.h"
#include "femtobts.h"
@@ -1777,25 +1778,25 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ oml_mo_state_chg(&bts->nm.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);
+ break;
case NM_OC_RADIO_CARRIER:
rc = trx_init(obj);
break;
case NM_OC_CHANNEL:
rc = ts_opstart(obj);
break;
- case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC:
oml_mo_state_chg(mo, NM_OPSTATE_ENABLED, -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);
- }
break;
default:
rc = oml_mo_opstart_nack(mo, NM_NACK_OBJCLASS_NOTSUPP);
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index c19a1a6c..03835a02 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -45,6 +45,7 @@
#include <osmo-bts/scheduler.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "l1_if.h"
#include "trx_if.h"
@@ -620,12 +621,14 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo,
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_RADIO_CARRIER:
/* activate transceiver */
rc = trx_init(obj);
break;
case NM_OC_CHANNEL:
- case NM_OC_BTS:
case NM_OC_BASEB_TRANSC:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
diff --git a/src/osmo-bts-virtual/bts_model.c b/src/osmo-bts-virtual/bts_model.c
index 47f0ba29..66240e26 100644
--- a/src/osmo-bts-virtual/bts_model.c
+++ b/src/osmo-bts-virtual/bts_model.c
@@ -35,6 +35,7 @@
#include <osmo-bts/handover.h>
#include <osmo-bts/l1sap.h>
#include <osmo-bts/nm_bts_sm_fsm.h>
+#include <osmo-bts/nm_bts_fsm.h>
#include "virtual_um.h"
@@ -147,6 +148,9 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
case NM_OC_SITE_MANAGER:
rc = osmo_fsm_inst_dispatch(bts->site_mgr.fi, NM_BTS_SM_EV_OPSTART_ACK, NULL);
break;
+ case NM_OC_BTS:
+ rc = osmo_fsm_inst_dispatch(bts->nm.fi, NM_BTS_EV_OPSTART_ACK, NULL);
+ break;
case NM_OC_RADIO_CARRIER:
trx = (struct gsm_bts_trx*) obj;
/* Mark Dependency TS as Offline (ready to be Opstarted) */
@@ -161,7 +165,6 @@ int bts_model_opstart(struct gsm_bts *bts, struct gsm_abis_mo *mo, void *obj)
break;
case NM_OC_CHANNEL:
case NM_OC_BASEB_TRANSC:
- case NM_OC_BTS:
case NM_OC_GPRS_NSE:
case NM_OC_GPRS_CELL:
case NM_OC_GPRS_NSVC: