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

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

Change subject: Introduce NM BTS Site Manager FSM
..

Introduce NM BTS Site Manager FSM

Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/gsm_data.h
A 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_sm_fsm.c
A 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.c
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
21 files changed, 518 insertions(+), 19 deletions(-)

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



diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 05d71bb..1f066b6 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -38,6 +38,7 @@
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 7f36904..a9d57a3 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -361,6 +361,11 @@
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 @@
/* 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 @@
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 050cd7a..06348be 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -393,6 +393,8 @@
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 000..a76c198
--- /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 
+ * 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 
+#include 
+
+/* 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 c7d7fe1..abda67e 100644
--- a/include/osmocom/bsc/signal.h
+++ b/include/osmocom/bsc/signal.h
@@ -72,6 +72,7 @@
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 

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

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

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 09 Oct 2020 19:19:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-10-09 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20400 )

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5:

(2 comments)

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c
File src/osmo-bsc/abis_nm.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c@832
PS5, Line 832:  DEB
> Ack
I'll fix that in a follow-up patch.


https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/nm_bts_sm_fsm.c
File src/osmo-bsc/nm_bts_sm_fsm.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/nm_bts_sm_fsm.c@264
PS5, Line 264: NM_BTS_SM_OP
> As I already complained when reviewing the related changes, SM may confuse 
> people as it usually stan […]
I don't see much issue here with the naming since Short Messages have nothing 
to do with this part of the code, so it shouldn't create much confusion, 
specially given that the struct name is following typical data structure 
gsm_bts_* prefix. So unless there's really an issue I'm ticking to it.



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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 09 Oct 2020 18:11:36 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: Vadim Yanitskiy 
Gerrit-MessageType: comment


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

2020-10-09 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20400 )

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5: -Code-Review


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 09 Oct 2020 18:07:50 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


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

2020-10-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20400 )

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5:

(1 comment)

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/nm_bts_sm_fsm.c
File src/osmo-bsc/nm_bts_sm_fsm.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/nm_bts_sm_fsm.c@264
PS5, Line 264: NM_BTS_SM_OP
As I already complained when reviewing the related changes, SM may confuse 
people as it usually stands for Short Message.



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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 09 Oct 2020 15:13:09 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

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

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c
File src/osmo-bsc/abis_nm.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c@832
PS5, Line 832:  DEB
> shouldnt a NACK be ERROR or at least NOTICE ins tead of DEBUG?
Ack



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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 08 Oct 2020 21:35:06 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


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

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

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 5: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c
File src/osmo-bsc/abis_nm.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/5/src/osmo-bsc/abis_nm.c@832
PS5, Line 832:  DEB
shouldnt a NACK be ERROR or at least NOTICE ins tead of DEBUG?



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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 08 Oct 2020 19:49:15 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: Introduce NM BTS Site Manager 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/+/20400

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

Change subject: Introduce NM BTS Site Manager FSM
..

Introduce NM BTS Site Manager FSM

Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/bts.h
M include/osmocom/bsc/gsm_data.h
A 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_sm_fsm.c
A 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.c
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
21 files changed, 518 insertions(+), 19 deletions(-)


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


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

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

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 4:

> This current implementation is not aiming to be the last ultimate 
> implementation for these objects, but I think it's a pretty good one to start 
> with and improve iteratively from.

I think realistically speaking nobody will revisit this for quite some time 
after the patches are merged.  I still think the fsm_instance should go insid 
the gsm_abis_mo, and the input even enum should be shared.  All other 
improvements can be done subsequently, bu those two should happen now, IMHO


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Tue, 06 Oct 2020 11:51:21 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

2020-10-05 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20400 )

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 3:

I didn't know about abis_om2000.c before, I had a look now. I also thought 
about having a shared FSM for different objects, but in the end I decided to go 
to one different FSM per NM object since in the long term I think it makes 
sense to control them differently because different actions need to be taken 
(and different specific workarounds need to be applied on different objects 
depending on which type of peer are we talking too). I think this difference 
will become more evident as we start adding more fine control and features to 
each object.

This current implementation is not aiming to be the last ultimate 
implementation for these objects, but I think it's a pretty good one to start 
with and improve iteratively from. I'm open to changing stuff but I think it 
makes sense to have it merged without major changes and then start doing 
improvements on top of that, since I have spent already quite a lot of time on 
it and I also need to move on to other stuff which also requires my attention, 
and this implementation already solves some of the issues I spotted and/or 
provides means to fix them quickly, which means we avoid having currently 
broken setups (like sysmobts or previously some osmo-bts-trx ones).


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Mon, 05 Oct 2020 09:04:32 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

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

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 3:

(2 comments)

Did you check the way how MOs and FSMs work in abis_om2000.c? I really like 
about that code that the MO is turned into a 'first class citizen', and that 
'struct om2k_mo' encapsulates all the MO parameters (like its address) and the 
FSM instance in one.  Also, there's one shared enumeration of externalevents 
going into those MO.  So all in all, there's more encapsulation which makes the 
"user" of those FSMs more generic.  Receiving an OML message basically consists 
only of resolving the MO by its addres, and sending the event related to that 
OML message to the MO, all in a generic function (abis_om2k_rcvmsg in that 
case).

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/3/include/osmocom/bsc/bts.h
File include/osmocom/bsc/bts.h:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/3/include/osmocom/bsc/bts.h@429
PS3, Line 429: struct osmo_fsm_inst *fi;
 :  bool opstart_sent;
see my comment about making those part of the gsm_abis_mo


https://gerrit.osmocom.org/c/osmo-bsc/+/20400/3/include/osmocom/bsc/nm_bts_sm_fsm.h
File include/osmocom/bsc/nm_bts_sm_fsm.h:

https://gerrit.osmocom.org/c/osmo-bsc/+/20400/3/include/osmocom/bsc/nm_bts_sm_fsm.h@36
PS3, Line 36: NM_BTS_SM_EV_SW_ACT_REP,
:   NM_BTS_SM_EV_STATE_CHG_REP,
:   NM_BTS_SM_EV_OPSTART_ACK,
:   NM_BTS_SM_EV_OPSTART_NACK,
also, those four first events could be common events



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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: laforge 
Gerrit-Comment-Date: Sat, 03 Oct 2020 07:34:19 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

2020-10-02 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/20400 )

Change subject: Introduce NM BTS Site Manager FSM
..


Patch Set 1:

Better merged all the commits introducing BTS at the same time.
They were tested with a nanoBTS, with osmo-bts master and with osmo-bts with 
OML FSMs implemented (yet to be pushed to gerrit).
I also checked that ttcn3-bsc-test is working fine with these patches applied.


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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
Gerrit-Change-Number: 20400
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: pespin 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Fri, 02 Oct 2020 16:30:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


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

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


Change subject: Introduce NM BTS Site Manager FSM
..

Introduce NM BTS Site Manager FSM

Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/bts.h
A include/osmocom/bsc/nm_bts_sm_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_sm_fsm.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/acc/Makefile.am
M tests/acc/acc_test.c
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
19 files changed, 465 insertions(+), 11 deletions(-)



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

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 1ee96ed..b25c95a 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -35,6 +35,7 @@
misdn.h \
neighbor_ident.h \
network_listen.h \
+   nm_bts_sm_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 7f36904..063a531 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -426,6 +426,8 @@
struct gsm_bts_trx *c0;

struct {
+   struct osmo_fsm_inst *fi;
+   bool opstart_sent;
struct gsm_abis_mo mo;
} site_mgr;

diff --git a/include/osmocom/bsc/nm_bts_sm_fsm.h 
b/include/osmocom/bsc/nm_bts_sm_fsm.h
new file mode 100644
index 000..caa46d0
--- /dev/null
+++ b/include/osmocom/bsc/nm_bts_sm_fsm.h
@@ -0,0 +1,43 @@
+/* NM BTS Site Manager 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_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,
+};
+
+enum nm_bts_sm_op_fsm_events {
+   NM_BTS_SM_EV_SW_ACT_REP,
+   NM_BTS_SM_EV_STATE_CHG_REP,
+   NM_BTS_SM_EV_OPSTART_ACK,
+   NM_BTS_SM_EV_OPSTART_NACK,
+   NM_BTS_SM_EV_OML_DOWN,
+};
+
+extern struct osmo_fsm nm_bts_sm_fsm;
diff --git a/include/osmocom/bsc/signal.h b/include/osmocom/bsc/signal.h
index c7d7fe1..abda67e 100644
--- a/include/osmocom/bsc/signal.h
+++ b/include/osmocom/bsc/signal.h
@@ -72,6 +72,7 @@
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 717a6a1..08d6dd1 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -54,6 +54,7 @@
$(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_bts_sm_fsm.o \
$(OSMO_LIBS) \
$(NULL)

@@ -68,5 +69,6 @@
$(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_bts_sm_fsm.o \
$(OSMO_LIBS) \
$(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index c19d01b..48e38a0 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -72,6 +72,7 @@
neighbor_ident.c \
neigh