[MERGED] osmo-bsc[master]: OML: consider RSL link state

Max gerrit-no-reply at lists.osmocom.org
Tue Oct 10 08:17:58 UTC 2017


Max has submitted this change and it was merged.

Change subject: OML: consider RSL link state
......................................................................


OML: consider RSL link state

OML link state is available via vty ("sh bts 0" command) and
ctrl ("oml-connection-state" RO variable).

When showing OML link state, take into consideration RSL link state as
well: if OML is up but RSL is missing show it as degraded.

That's implemented via BTS model-specific functions (currently Sysmo- and
Nano- BTS only)

Change-Id: I5952fc59e4d82e0aa627ad91d20f964d9559a4c4
Related: OS#2486
---
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_nm.c
M src/libbsc/bsc_ctrl_commands.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/bts_ipaccess_nanobts.c
7 files changed, 39 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: 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 6814662..429526d 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -654,6 +654,9 @@
 extern const struct value_string bts_type_names[_NUM_GSM_BTS_TYPE+1];
 extern const struct value_string bts_type_descs[_NUM_GSM_BTS_TYPE+1];
 
+char *get_oml_status(const struct gsm_bts *bts);
+char *get_model_oml_status(const struct gsm_bts *bts);
+
 /* control interface handling */
 int bsc_base_ctrl_cmds_install(void);
 
diff --git a/include/osmocom/bsc/gsm_data_shared.h b/include/osmocom/bsc/gsm_data_shared.h
index f41bac4..240be1c 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -546,6 +546,7 @@
 	bool started;
 	int (*start)(struct gsm_network *net);
 	int (*oml_rcvmsg)(struct msgb *msg);
+	char * (*oml_status)(const struct gsm_bts *bts);
 
 	void (*e1line_bind_ops)(struct e1inp_line *line);
 
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 9567cfa..f0dfe9e 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -683,6 +683,34 @@
 	return 0;
 }
 
+static inline bool all_trx_rsl_connected(const struct gsm_bts *bts)
+{
+	const struct gsm_bts_trx *trx;
+
+	llist_for_each_entry(trx, &bts->trx_list, list) {
+		if (!trx->rsl_link)
+			return false;
+	}
+
+	return true;
+}
+
+char *get_oml_status(const struct gsm_bts *bts)
+{
+	if (bts->oml_link)
+		return all_trx_rsl_connected(bts) ? "connected" : "degraded";
+
+	return "disconnected";
+}
+
+char *get_model_oml_status(const struct gsm_bts *bts)
+{
+	if (bts->model->oml_status)
+		return bts->model->oml_status(bts);
+
+	return "unknown";
+}
+
 void abis_nm_queue_send_next(struct gsm_bts *bts)
 {
 	int wait = 0;
diff --git a/src/libbsc/bsc_ctrl_commands.c b/src/libbsc/bsc_ctrl_commands.c
index 7c2bfb5..d925e67 100644
--- a/src/libbsc/bsc_ctrl_commands.c
+++ b/src/libbsc/bsc_ctrl_commands.c
@@ -231,9 +231,10 @@
 
 static int get_bts_oml_conn(struct ctrl_cmd *cmd, void *data)
 {
-	struct gsm_bts *bts = cmd->node;
+	const struct gsm_bts *bts = cmd->node;
 
-	cmd->reply = bts->oml_link ? "connected" : "disconnected";
+	cmd->reply = get_model_oml_status(bts);
+
 	return CTRL_CMD_REPLY;
 }
 
diff --git a/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c
index f3e13e2..f5f265f 100644
--- a/src/libbsc/bsc_init.c
+++ b/src/libbsc/bsc_init.c
@@ -38,6 +38,7 @@
 #include <osmocom/bsc/common_bsc.h>
 #include <osmocom/bsc/pcu_if.h>
 #include <limits.h>
+#include <stdbool.h>
 
 /* global pointer to the gsm network data structure */
 extern struct gsm_network *bsc_gsmnet;
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index f1c78c8..43cb282 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -308,9 +308,8 @@
 		paging_pending_requests_nr(bts),
 		bts->paging.available_slots, VTY_NEWLINE);
 	if (is_ipaccess_bts(bts)) {
-		vty_out(vty, "  OML Link state: ");
+		vty_out(vty, "  OML Link state: %s", get_model_oml_status(bts));
 		if (bts->oml_link) {
-			vty_out(vty, "connected");
 			if (bts->uptime) {
 				rc = clock_gettime(CLOCK_MONOTONIC, &tp);
 				if (rc == 0) { /* monotonic clock helps to ensure that conversion below is valid */
@@ -320,8 +319,7 @@
 						sec % 60, VTY_NEWLINE);
 				}
 			}
-		} else
-			vty_out(vty, "disconnected.%s", VTY_NEWLINE);
+		}
 	} else {
 		vty_out(vty, "  E1 Signalling Link:%s", VTY_NEWLINE);
 		e1isl_dump_vty(vty, bts->oml_link);
diff --git a/src/libbsc/bts_ipaccess_nanobts.c b/src/libbsc/bts_ipaccess_nanobts.c
index 87ec7b2..dbb0e4f 100644
--- a/src/libbsc/bts_ipaccess_nanobts.c
+++ b/src/libbsc/bts_ipaccess_nanobts.c
@@ -52,6 +52,7 @@
 	.name = "nanobts",
 	.start = bts_model_nanobts_start,
 	.oml_rcvmsg = &abis_nm_rcvmsg,
+	.oml_status = &get_oml_status,
 	.e1line_bind_ops = bts_model_nanobts_e1line_bind_ops, 
 	.nm_att_tlvdef = {
 		.def = {

-- 
To view, visit https://gerrit.osmocom.org/4169
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5952fc59e4d82e0aa627ad91d20f964d9559a4c4
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>


More information about the gerrit-log mailing list