Change in osmo-bsc[master]: Introduce NM BTS FSM

2020-10-14 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20401 )

Change subject: Introduce NM BTS FSM
..

Introduce NM BTS FSM

Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
---
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/nm_common_fsm.h
M include/osmocom/bsc/signal.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
A src/osmo-bsc/nm_bts_fsm.c
M src/osmo-bsc/nm_common_fsm.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/acc/Makefile.am
M tests/acc/acc_test.ok
M tests/bsc/Makefile.am
M tests/gsm0408/Makefile.am
M tests/handover/Makefile.am
M tests/nanobts_omlattr/Makefile.am
18 files changed, 489 insertions(+), 12 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 06348be..428fe87 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -395,6 +395,9 @@
struct gsm_bts *bts;
struct osmo_fsm_inst *fi;
bool opstart_sent;
+   bool adm_unlock_sent;
+   bool set_attr_sent;
+   bool set_attr_ack_received;
 };

 /* Ericsson OM2000 Managed Object */
diff --git a/include/osmocom/bsc/nm_common_fsm.h 
b/include/osmocom/bsc/nm_common_fsm.h
index a76c198..719d591 100644
--- a/include/osmocom/bsc/nm_common_fsm.h
+++ b/include/osmocom/bsc/nm_common_fsm.h
@@ -30,6 +30,7 @@
 enum nm_fsm_events {
NM_EV_SW_ACT_REP,
NM_EV_STATE_CHG_REP,
+   NM_EV_SET_ATTR_ACK,
NM_EV_OPSTART_ACK,
NM_EV_OPSTART_NACK,
NM_EV_OML_DOWN,
@@ -44,3 +45,12 @@
NM_BTS_SM_ST_OP_ENABLED,
 };
 extern struct osmo_fsm nm_bts_sm_fsm;
+
+/* BTS */
+enum nm_bts_op_fsm_states {
+   NM_BTS_ST_OP_DISABLED_NOTINSTALLED,
+   NM_BTS_ST_OP_DISABLED_DEPENDENCY,
+   NM_BTS_ST_OP_DISABLED_OFFLINE,
+   NM_BTS_ST_OP_ENABLED,
+};
+extern struct osmo_fsm nm_bts_fsm;
diff --git a/include/osmocom/bsc/signal.h b/include/osmocom/bsc/signal.h
index abda67e..4922ac8 100644
--- a/include/osmocom/bsc/signal.h
+++ b/include/osmocom/bsc/signal.h
@@ -75,6 +75,7 @@
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 */
+   S_NM_SET_BTS_ATTR_ACK,  /* Received Set BTS Attributes Ack, arg is 
struct msgb *oml_msg */
 };

 /* SS_LCHAN signals */
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 0e06caa..e49a778 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -56,6 +56,7 @@
$(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/nm_bts_fsm.o \
$(OSMO_LIBS) \
$(NULL)

@@ -68,9 +69,11 @@
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
+   $(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.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 \
+   $(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
$(OSMO_LIBS) \
$(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index ffa39a0..4584b2c 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -78,6 +78,7 @@
net_init.c \
nm_common_fsm.c \
nm_bts_sm_fsm.c \
+   nm_bts_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 511c4b3..54dfccb 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -842,6 +842,14 @@
return 0;
 }

+static int abis_nm_rx_set_bts_attr_ack(struct msgb *mb)
+{
+   struct abis_om_fom_hdr *foh = msgb_l3(mb);
+   DEBUGPFOH(DNM, foh, "Set BTS Attributes ACK\n");
+   osmo_signal_dispatch(SS_NM, S_NM_SET_BTS_ATTR_ACK, mb);
+   return 0;
+}
+
 bool all_trx_rsl_connected_unlocked(const struct gsm_bts *bts)
 {
const struct gsm_bts_trx *trx;
@@ -978,7 +986,7 @@
osmo_signal_dispatch(SS_NM, S_NM_IPACC_RESTART_NACK, NULL);
break;
case NM_MT_SET_BTS_ATTR_ACK:
-   DEBUGPFOH(DNM, foh, "Set BTS Attribute ACK\n");
+   abis_nm_rx_set_bts_attr_ack(mb);
break;
case NM_MT_GET_ATTR_RESP:
ret = abis_nm_rx_get_attr_resp(mb, gsm_bts_trx_num(bts, 
(foh)->obj_inst.trx_nr));
diff --git 

Change in osmo-bsc[master]: Introduce NM BTS FSM

2020-10-14 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20401 )

Change subject: Introduce NM BTS FSM
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
Gerrit-Change-Number: 20401
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Thu, 15 Oct 2020 05:55:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: Introduce NM BTS FSM

2020-10-08 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20401 )

Change subject: Introduce NM BTS FSM
..


Patch Set 5: Code-Review+1


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
Gerrit-Change-Number: 20401
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Thu, 08 Oct 2020 19:52:03 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: Introduce NM BTS FSM

2020-10-08 Thread pespin
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-bsc/+/20401

to look at the new patch set (#5).

Change subject: Introduce NM BTS FSM
..

Introduce NM BTS FSM

Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
---
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/nm_common_fsm.h
M include/osmocom/bsc/signal.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
A src/osmo-bsc/nm_bts_fsm.c
M src/osmo-bsc/nm_common_fsm.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/acc/Makefile.am
M tests/acc/acc_test.ok
M tests/bsc/Makefile.am
M tests/gsm0408/Makefile.am
M tests/handover/Makefile.am
M tests/nanobts_omlattr/Makefile.am
18 files changed, 489 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/01/20401/5
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/20401
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
Gerrit-Change-Number: 20401
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-bsc[master]: Introduce NM BTS FSM

2020-10-02 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20401 )


Change subject: Introduce NM BTS FSM
..

Introduce NM BTS FSM

Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/bts.h
A include/osmocom/bsc/nm_bts_fsm.h
M include/osmocom/bsc/signal.h
M src/ipaccess/Makefile.am
M src/osmo-bsc/Makefile.am
M src/osmo-bsc/abis_nm.c
M src/osmo-bsc/abis_om2000.c
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/bts.c
M src/osmo-bsc/bts_ipaccess_nanobts.c
M src/osmo-bsc/bts_nokia_site.c
M src/osmo-bsc/gsm_data.c
A src/osmo-bsc/nm_bts_fsm.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/acc/Makefile.am
M tests/acc/acc_test.ok
M tests/bsc/Makefile.am
M tests/gsm0408/Makefile.am
M tests/handover/Makefile.am
M tests/nanobts_omlattr/Makefile.am
22 files changed, 548 insertions(+), 21 deletions(-)



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

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index b25c95a..59ac91a 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -36,6 +36,7 @@
neighbor_ident.h \
network_listen.h \
nm_bts_sm_fsm.h \
+   nm_bts_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 063a531..564e2b8 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -410,7 +410,14 @@
/* Abis network management O handle */
struct abis_nm_h *nmh;

-   struct gsm_abis_mo mo;
+   struct {
+   struct osmo_fsm_inst *fi;
+   bool opstart_sent;
+   bool adm_unlock_sent;
+   bool set_bts_attr_sent;
+   bool set_bts_attr_ack_received;
+   struct gsm_abis_mo mo;
+   } nm;

/* number of this BTS on given E1 link */
uint8_t bts_nr;
diff --git a/include/osmocom/bsc/nm_bts_fsm.h b/include/osmocom/bsc/nm_bts_fsm.h
new file mode 100644
index 000..3b99762
--- /dev/null
+++ b/include/osmocom/bsc/nm_bts_fsm.h
@@ -0,0 +1,44 @@
+/* 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 
+ * Author: Pau Espin Pedrol 
+ *
+ * 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 .
+ *
+ */
+
+#pragma once
+
+#include 
+
+enum nm_bts_op_fsm_states {
+   NM_BTS_ST_OP_DISABLED_NOTINSTALLED,
+   NM_BTS_ST_OP_DISABLED_DEPENDENCY,
+   NM_BTS_ST_OP_DISABLED_OFFLINE,
+   NM_BTS_ST_OP_ENABLED,
+};
+
+enum nm_bts_op_fsm_events {
+   NM_BTS_EV_SW_ACT_REP,
+   NM_BTS_EV_STATE_CHG_REP,
+   NM_BTS_EV_SET_ATTR_ACK,
+   NM_BTS_EV_OPSTART_ACK,
+   NM_BTS_EV_OPSTART_NACK,
+   NM_BTS_EV_OML_DOWN,
+};
+
+extern struct osmo_fsm nm_bts_fsm;
diff --git a/include/osmocom/bsc/signal.h b/include/osmocom/bsc/signal.h
index abda67e..4922ac8 100644
--- a/include/osmocom/bsc/signal.h
+++ b/include/osmocom/bsc/signal.h
@@ -75,6 +75,7 @@
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 */
+   S_NM_SET_BTS_ATTR_ACK,  /* Received Set BTS Attributes Ack, arg is 
struct msgb *oml_msg */
 };

 /* SS_LCHAN signals */
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 08d6dd1..55d7408 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -55,6 +55,7 @@
$(top_builddir)/src/osmo-bsc/gsm_data.o \
$(top_builddir)/src/osmo-bsc/net_init.o \
$(top_builddir)/src/osmo-bsc/nm_bts_sm_fsm.o \
+   $(top_builddir)/src/osmo-bsc/nm_bts_fsm.o \
$(OSMO_LIBS) \
$(NULL)

@@ -67,8 +68,10 @@
$(top_builddir)/src/osmo-bsc/abis_nm.o \
$(top_builddir)/src/osmo-bsc/acc.o \
$(top_builddir)/src/osmo-bsc/bts.o \
+   $(top_builddir)/src/osmo-bsc/bts_ipaccess_nanobts_omlattr.o \
$(top_builddir)/src/osmo-bsc/bts_trx.o \