Change in osmo-bsc[master]: CBSP VTY: re-add legacy cbc config for backwards compat

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Sep 3 13:33:42 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/19967 )

Change subject: CBSP VTY: re-add legacy cbc config for backwards compat
......................................................................

CBSP VTY: re-add legacy cbc config for backwards compat

In commit [1], I replaced the way the CBSP link is configured in the VTY. But
that configuration was already part of a release, hence I should only have
deprecated the old commands. Re-add the legacy config as deprecated.

Try to make the legacy commands take a similar effect as they previously would
be intended for, i.e. switching to server/client/disabled modes, and take
effect immediately when commands are read from telnet.

[1] 641f7f08450f2d0c4b8e8a9f6a36b0a6b2788816
    Icaa2775cc20a99227dabe38a775ff808b374cf98
    "CBSP: rewrite the CBSP link setup and 'cbc' VTY section"

Related: OS#4702
Change-Id: If6b742f28191b3f19ff1d87a217037a305133f4b
---
M src/osmo-bsc/cbsp_link.c
M tests/cbc.vty
2 files changed, 157 insertions(+), 0 deletions(-)

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



diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c
index f4cdbb7..4926799 100644
--- a/src/osmo-bsc/cbsp_link.c
+++ b/src/osmo-bsc/cbsp_link.c
@@ -543,6 +543,91 @@
 	return CMD_SUCCESS;
 }
 
+/* --- Deprecated 'cbc' commands for backwards compat --- */
+
+DEFUN_DEPRECATED(cfg_cbc_remote_ip, cfg_cbc_remote_ip_cmd,
+	"remote-ip A.B.C.D",
+	"IP Address of the Cell Broadcast Centre\n"
+	"IP Address of the Cell Broadcast Centre\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/ mode%s",
+		VTY_NEWLINE);
+	osmo_sockaddr_str_from_str(&cbc->client.remote_addr, argv[0], cbc->client.remote_addr.port);
+	cbc->mode = BSC_CBC_LINK_MODE_CLIENT;
+	if (vty->type != VTY_FILE)
+		bsc_cbc_link_restart();
+	return CMD_SUCCESS;
+}
+DEFUN_DEPRECATED(cfg_cbc_no_remote_ip, cfg_cbc_no_remote_ip_cmd,
+	"no remote-ip",
+	NO_STR "Remove IP address of CBC; disables outbound CBSP connections\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/mode%s",
+		VTY_NEWLINE);
+	if (cbc->mode == BSC_CBC_LINK_MODE_CLIENT) {
+		cbc->mode = BSC_CBC_LINK_MODE_DISABLED;
+		if (vty->type != VTY_FILE)
+			bsc_cbc_link_restart();
+	}
+	return CMD_SUCCESS;
+}
+
+DEFUN_DEPRECATED(cfg_cbc_remote_port, cfg_cbc_remote_port_cmd,
+	"remote-port <1-65535>",
+	"TCP Port number of the Cell Broadcast Centre (Default: 48049)\n"
+	"TCP Port number of the Cell Broadcast Centre (Default: 48049)\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/remote-port config is deprecated, instead use cbc/client/remote-port%s",
+		VTY_NEWLINE);
+	cbc->client.remote_addr.port = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
+DEFUN_DEPRECATED(cfg_cbc_listen_port, cfg_cbc_listen_port_cmd,
+	"listen-port <1-65535>",
+	"Local TCP port at which BSC listens for incoming CBSP connections from CBC\n"
+	"Local TCP port at which BSC listens for incoming CBSP connections from CBC\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode%s",
+		VTY_NEWLINE);
+	cbc->mode = BSC_CBC_LINK_MODE_SERVER;
+	cbc->server.local_addr.port = atoi(argv[0]);
+	if (vty->type != VTY_FILE)
+		bsc_cbc_link_restart();
+	return CMD_SUCCESS;
+}
+
+DEFUN_DEPRECATED(cfg_cbc_no_listen_port, cfg_cbc_no_listen_port_cmd,
+	"no listen-port",
+	NO_STR "Remove CBSP Listen Port; disables inbound CBSP connections\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode%s",
+		VTY_NEWLINE);
+	if (cbc->mode == BSC_CBC_LINK_MODE_SERVER) {
+		cbc->mode = BSC_CBC_LINK_MODE_DISABLED;
+		if (vty->type != VTY_FILE)
+			bsc_cbc_link_restart();
+	}
+	return CMD_SUCCESS;
+}
+
+DEFUN_DEPRECATED(cfg_cbc_listen_ip, cfg_cbc_listen_ip_cmd,
+	"listen-ip A.B.C.D",
+	"Local IP Address where BSC listens for incoming CBC connections (Default: 127.0.0.1)\n"
+	"Local IP Address where BSC listens for incoming CBC connections\n")
+{
+	struct bsc_cbc_link *cbc = vty_cbc_data(vty);
+	vty_out(vty, "%% cbc/listen-ip config is deprecated, instead use cbc/server/local-ip%s",
+		VTY_NEWLINE);
+	osmo_sockaddr_str_from_str(&cbc->server.local_addr, argv[0], cbc->server.local_addr.port);
+	return CMD_SUCCESS;
+}
+
 void cbc_vty_init(void)
 {
 	install_element_ve(&show_cbc_cmd);
@@ -564,4 +649,12 @@
 	install_element(CBC_CLIENT_NODE, &cfg_cbc_client_local_port_cmd);
 	install_element(CBC_CLIENT_NODE, &cfg_cbc_client_no_local_ip_cmd);
 	install_element(CBC_CLIENT_NODE, &cfg_cbc_client_no_local_port_cmd);
+
+	/* Deprecated, for backwards compat */
+	install_element(CBC_NODE, &cfg_cbc_remote_ip_cmd);
+	install_element(CBC_NODE, &cfg_cbc_no_remote_ip_cmd);
+	install_element(CBC_NODE, &cfg_cbc_remote_port_cmd);
+	install_element(CBC_NODE, &cfg_cbc_listen_port_cmd);
+	install_element(CBC_NODE, &cfg_cbc_no_listen_port_cmd);
+	install_element(CBC_NODE, &cfg_cbc_listen_ip_cmd);
 }
diff --git a/tests/cbc.vty b/tests/cbc.vty
index 7a4031f..a15de59 100644
--- a/tests/cbc.vty
+++ b/tests/cbc.vty
@@ -209,3 +209,67 @@
 OsmoBSC(config-cbc)# mode disabled
 OsmoBSC(config-cbc)# do show cbc
 CBSP link is disabled
+
+
+OsmoBSC(config-cbc)# # TEST DEPRECATED COMMANDS
+
+OsmoBSC(config-cbc)# remote-ip 1.2.3.4
+% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/ mode
+OsmoBSC(config-cbc)# remote-port 1234
+% cbc/remote-port config is deprecated, instead use cbc/client/remote-port
+OsmoBSC(config-cbc)# do show cbc
+OsmoBSC is configured as CBSP Client to remote CBC at 1.2.3.4:1234
+CBSP Client Connection: Disconnected
+OsmoBSC(config-cbc)# show running-config
+...
+cbc
+ mode client
+...
+ client
+  remote-ip 1.2.3.4
+  remote-port 1234
+...
+
+OsmoBSC(config-cbc)# no remote-ip
+% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/mode
+OsmoBSC(config-cbc)# do show cbc
+CBSP link is disabled
+OsmoBSC(config-cbc)# show running-config
+...
+cbc
+ mode disabled
+...
+ client
+  remote-ip 1.2.3.4
+  remote-port 1234
+...
+
+OsmoBSC(config-cbc)# listen-ip 127.0.0.2
+% cbc/listen-ip config is deprecated, instead use cbc/server/local-ip
+OsmoBSC(config-cbc)# do show cbc
+CBSP link is disabled
+OsmoBSC(config-cbc)# listen-port 48049
+% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode
+OsmoBSC(config-cbc)# do show cbc
+OsmoBSC is configured as CBSP Server on 127.0.0.2:48049
+CBSP Server Connection: Disconnected
+OsmoBSC(config-cbc)# show running-config
+...
+cbc
+ mode server
+ server
+  local-ip 127.0.0.2
+ client
+  remote-ip 1.2.3.4
+  remote-port 1234
+...
+
+OsmoBSC(config-cbc)# no listen-port
+% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode
+OsmoBSC(config-cbc)# do show cbc
+CBSP link is disabled
+OsmoBSC(config-cbc)# show running-config
+...
+cbc
+ mode disabled
+...

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If6b742f28191b3f19ff1d87a217037a305133f4b
Gerrit-Change-Number: 19967
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200903/a85498f0/attachment.htm>


More information about the gerrit-log mailing list