OML: expand status reporting checks
* check GPRS state: if GPRS is enabled for the BTS but NSE, CELL or both
NSVC are locked than report it as degraded
* check TRX usability: use already available function to check that TRX
is actually usable when reporting OML status via CTRL
* fix tests linking: libbsc is using gsm48_create_mm_serv_rej() which is
defined in libcommon-cs but neither libbsc itself nor tests using it
are actually linked against libcommon-cs
Related: OS#2486
Change-Id: I9dce1d3b0cabe149a90cfca58a3fe55f8d6a72bc
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 2c84ba7..33af213 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -46,6 +46,7 @@
#include <osmocom/bsc/misdn.h>
#include <osmocom/bsc/signal.h>
#include <osmocom/abis/e1_input.h>
+#include <osmocom/bsc/chan_alloc.h>
#define OM_ALLOC_SIZE 1024
#define OM_HEADROOM_SIZE 128
@@ -691,9 +692,25 @@
if (bts->mo.nm_state.administrative == NM_STATE_LOCKED)
return false;
+ if (bts->gprs.mode != BTS_GPRS_NONE) {
+ if (bts->gprs.cell.mo.nm_state.administrative == NM_STATE_LOCKED)
+ return false;
+
+ if (bts->gprs.nse.mo.nm_state.administrative == NM_STATE_LOCKED)
+ return false;
+
+ if (bts->gprs.nsvc[0].mo.nm_state.administrative == NM_STATE_LOCKED &&
+ bts->gprs.nsvc[1].mo.nm_state.administrative == NM_STATE_LOCKED)
+ return false;
+ }
+
llist_for_each_entry(trx, &bts->trx_list, list) {
if (!trx->rsl_link)
return false;
+
+ if (!trx_is_usable(trx))
+ return false;
+
if (trx->mo.nm_state.administrative == NM_STATE_LOCKED)
return false;
}