Change in osmo-bts[master]: allow to configure multiple oml remote-ip addresses

dexter gerrit-no-reply at lists.osmocom.org
Wed Jun 2 15:53:29 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/24513 )


Change subject: allow to configure multiple oml remote-ip addresses
......................................................................

allow to configure multiple oml remote-ip addresses

At the moment we can only configure a single BSC in the BTS
configuration. This also means that if this single BSC fails for some
reason the BTS has no alternate BSC to connect to. Lets extend the
remote-ip parameter so that it can be used multiple times so that an
operater can configure any number of BSCs that are tried one after
another during BTS startup.

Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Related: SYS#4971
---
M include/osmo-bts/bts.h
M src/common/abis.c
M src/common/bts.c
M src/common/main.c
M src/common/vty.c
5 files changed, 62 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/13/24513/1

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 978a548..70683ca 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -131,6 +131,12 @@
 	struct gsm_abis_mo mo;
 };
 
+/* Struct that holds one OML-Address (Address of the BSC) */
+struct bsc_oml_host {
+	struct llist_head list;
+	char *addr;
+};
+
 /* One BTS */
 struct gsm_bts {
 	/* list header in net->bts_list */
@@ -291,7 +297,7 @@
 	} etws;
 
 	struct paging_state *paging_state;
-	char *bsc_oml_host;
+	struct llist_head bsc_oml_hosts;
 	struct llist_head oml_queue;
 	unsigned int rtp_jitter_buf_ms;
 	bool rtp_jitter_adaptive;
diff --git a/src/common/abis.c b/src/common/abis.c
index 17a244c..e6a6f61 100644
--- a/src/common/abis.c
+++ b/src/common/abis.c
@@ -249,6 +249,7 @@
 		.ipa = {
 			.role	= E1INP_LINE_R_BTS,
 			.dev	= &bts_dev_info,
+			.timeout_msec = -1, /* infinite (until OS detects error) */
 		},
 	},
 	.sign_link_up	= sign_link_up,
diff --git a/src/common/bts.c b/src/common/bts.c
index bf29113..640c0cc 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -398,6 +398,7 @@
 	bts->smscb_queue_hyst = 2;
 
 	INIT_LLIST_HEAD(&bts->oml_queue);
+	INIT_LLIST_HEAD(&bts->bsc_oml_hosts);
 
 	/* register DTX DL FSM */
 	rc = osmo_fsm_register(&dtx_dl_amr_fsm);
diff --git a/src/common/main.c b/src/common/main.c
index 0b7d3fb..bfa7874 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -271,6 +271,7 @@
 
 int bts_main(int argc, char **argv)
 {
+	struct bsc_oml_host *bsc_oml_host;
 	struct gsm_bts_trx *trx;
 	struct e1inp_line *line;
 	int rc;
@@ -397,14 +398,25 @@
 	signal(SIGUSR2, &signal_handler);
 	osmo_init_ignore_signals();
 
-	if (!g_bts->bsc_oml_host) {
-		fprintf(stderr, "Cannot start BTS without knowing BSC OML IP\n");
+	if (llist_count(&g_bts->bsc_oml_hosts) == 0) {
+		LOGP(DABIS, LOGL_FATAL, "Cannot start BTS without knowing BSC OML IP\n");
 		exit(1);
 	}
 
-	line = abis_open(g_bts, g_bts->bsc_oml_host, "osmo-bts");
+	llist_for_each_entry(bsc_oml_host, &g_bts->bsc_oml_hosts, list) {
+		line = abis_open(g_bts, bsc_oml_host->addr, "osmo-bts");
+		if (!line) {
+			LOGP(DABIS, LOGL_NOTICE, "unable to connect to BSC (%s)\n",
+			     bsc_oml_host->addr);
+		} else {
+			LOGP(DABIS, LOGL_NOTICE, "connection to BSC (%s) successful\n",
+			     bsc_oml_host->addr);
+			break;
+		}
+	}
+
 	if (!line) {
-		fprintf(stderr, "unable to connect to BSC\n");
+		LOGP(DABIS, LOGL_FATAL, "BSC connection failed!\n");
 		exit(2);
 	}
 
diff --git a/src/common/vty.c b/src/common/vty.c
index d4e2902..961252b 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -282,6 +282,7 @@
 	const struct gsm_bts_trx *trx;
 	const char *sapi_buf;
 	int i;
+	struct bsc_oml_host *bsc_oml_host;
 
 	vty_out(vty, "bts %u%s", bts->nr, VTY_NEWLINE);
 	if (bts->description)
@@ -291,7 +292,8 @@
 		vty_out(vty, " auto-band%s", VTY_NEWLINE);
 	vty_out(vty, " ipa unit-id %u %u%s",
 		bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
-	vty_out(vty, " oml remote-ip %s%s", bts->bsc_oml_host, VTY_NEWLINE);
+	llist_for_each_entry(bsc_oml_host, &bts->bsc_oml_hosts, list)
+		vty_out(vty, " oml remote-ip %s%s", bsc_oml_host->addr, VTY_NEWLINE);
 	vty_out(vty, " rtp jitter-buffer %u", bts->rtp_jitter_buf_ms);
 	if (bts->rtp_jitter_adaptive)
 		vty_out(vty, " adaptive");
@@ -507,11 +509,41 @@
       "OML Parameters\n" "OML IP Address\n" "OML IP Address\n")
 {
 	struct gsm_bts *bts = vty->index;
+	struct bsc_oml_host *bsc_oml_host;
 
-	if (bts->bsc_oml_host)
-		talloc_free(bts->bsc_oml_host);
+	/* Silently stop when the address is already in the list */
+	llist_for_each_entry(bsc_oml_host, &bts->bsc_oml_hosts, list) {
+		if (strcmp(argv[0], bsc_oml_host->addr) == 0)
+			return CMD_SUCCESS;
+	}
 
-	bts->bsc_oml_host = talloc_strdup(bts, argv[0]);
+	bsc_oml_host = talloc_zero(bts, struct bsc_oml_host);
+	OSMO_ASSERT(bsc_oml_host);
+	bsc_oml_host->addr = talloc_strdup(bsc_oml_host, argv[0]);
+	OSMO_ASSERT(bsc_oml_host->addr);
+	llist_add_tail(&bsc_oml_host->list, &bts->bsc_oml_hosts);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_oml_ip,
+      cfg_bts_no_oml_ip_cmd,
+      "no oml remote-ip A.B.C.D",
+      NO_STR "OML Parameters\n" "OML IP Address\n" "OML IP Address\n")
+{
+	struct gsm_bts *bts = vty->index;
+	struct bsc_oml_host *bsc_oml_host;
+	struct bsc_oml_host *bsc_oml_host_del = NULL;
+
+	llist_for_each_entry(bsc_oml_host, &bts->bsc_oml_hosts, list) {
+		if (strcmp(argv[0], bsc_oml_host->addr) == 0)
+			bsc_oml_host_del = bsc_oml_host;
+	}
+
+	if (bsc_oml_host_del) {
+		llist_del(&bsc_oml_host_del->list);
+		talloc_free(bsc_oml_host_del);
+	}
 
 	return CMD_SUCCESS;
 }
@@ -2325,6 +2357,7 @@
 	install_element(CONFIG_NODE, &cfg_vty_telnet_port_cmd);
 	install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
 	install_element(BTS_NODE, &cfg_bts_oml_ip_cmd);
+	install_element(BTS_NODE, &cfg_bts_no_oml_ip_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_bind_ip_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_jitbuf_cmd);
 	install_element(BTS_NODE, &cfg_bts_rtp_port_range_cmd);

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I205f68a3a7f35fee4c38a7cfba2b014237df2727
Gerrit-Change-Number: 24513
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210602/e3086c97/attachment.htm>


More information about the gerrit-log mailing list