<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19967">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CBSP VTY: re-add legacy cbc config for backwards compat<br><br>In commit [1], I replaced the way the CBSP link is configured in the VTY. But<br>that configuration was already part of a release, hence I should only have<br>deprecated the old commands. Re-add the legacy config as deprecated.<br><br>Try to make the legacy commands take a similar effect as they previously would<br>be intended for, i.e. switching to server/client/disabled modes, and take<br>effect immediately when commands are read from telnet.<br><br>[1] 641f7f08450f2d0c4b8e8a9f6a36b0a6b2788816<br>    Icaa2775cc20a99227dabe38a775ff808b374cf98<br>    "CBSP: rewrite the CBSP link setup and 'cbc' VTY section"<br><br>Related: OS#4702<br>Change-Id: If6b742f28191b3f19ff1d87a217037a305133f4b<br>---<br>M src/osmo-bsc/cbsp_link.c<br>M tests/cbc.vty<br>2 files changed, 157 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/cbsp_link.c b/src/osmo-bsc/cbsp_link.c</span><br><span>index f4cdbb7..4926799 100644</span><br><span>--- a/src/osmo-bsc/cbsp_link.c</span><br><span>+++ b/src/osmo-bsc/cbsp_link.c</span><br><span>@@ -543,6 +543,91 @@</span><br><span>         return CMD_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* --- Deprecated 'cbc' commands for backwards compat --- */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_remote_ip, cfg_cbc_remote_ip_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "remote-ip A.B.C.D",</span><br><span style="color: hsl(120, 100%, 40%);">+        "IP Address of the Cell Broadcast Centre\n"</span><br><span style="color: hsl(120, 100%, 40%);">+ "IP Address of the Cell Broadcast Centre\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/ mode%s",</span><br><span style="color: hsl(120, 100%, 40%);">+             VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ osmo_sockaddr_str_from_str(&cbc->client.remote_addr, argv[0], cbc->client.remote_addr.port);</span><br><span style="color: hsl(120, 100%, 40%);">+        cbc->mode = BSC_CBC_LINK_MODE_CLIENT;</span><br><span style="color: hsl(120, 100%, 40%);">+      if (vty->type != VTY_FILE)</span><br><span style="color: hsl(120, 100%, 40%);">+         bsc_cbc_link_restart();</span><br><span style="color: hsl(120, 100%, 40%);">+       return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_no_remote_ip, cfg_cbc_no_remote_ip_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "no remote-ip",</span><br><span style="color: hsl(120, 100%, 40%);">+     NO_STR "Remove IP address of CBC; disables outbound CBSP connections\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/mode%s",</span><br><span style="color: hsl(120, 100%, 40%);">+              VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (cbc->mode == BSC_CBC_LINK_MODE_CLIENT) {</span><br><span style="color: hsl(120, 100%, 40%);">+               cbc->mode = BSC_CBC_LINK_MODE_DISABLED;</span><br><span style="color: hsl(120, 100%, 40%);">+            if (vty->type != VTY_FILE)</span><br><span style="color: hsl(120, 100%, 40%);">+                 bsc_cbc_link_restart();</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+     return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_remote_port, cfg_cbc_remote_port_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "remote-port <1-65535>",</span><br><span style="color: hsl(120, 100%, 40%);">+      "TCP Port number of the Cell Broadcast Centre (Default: 48049)\n"</span><br><span style="color: hsl(120, 100%, 40%);">+   "TCP Port number of the Cell Broadcast Centre (Default: 48049)\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/remote-port config is deprecated, instead use cbc/client/remote-port%s",</span><br><span style="color: hsl(120, 100%, 40%);">+               VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ cbc->client.remote_addr.port = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+      return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_listen_port, cfg_cbc_listen_port_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+      "listen-port <1-65535>",</span><br><span style="color: hsl(120, 100%, 40%);">+      "Local TCP port at which BSC listens for incoming CBSP connections from CBC\n"</span><br><span style="color: hsl(120, 100%, 40%);">+      "Local TCP port at which BSC listens for incoming CBSP connections from CBC\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode%s",</span><br><span style="color: hsl(120, 100%, 40%);">+           VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ cbc->mode = BSC_CBC_LINK_MODE_SERVER;</span><br><span style="color: hsl(120, 100%, 40%);">+      cbc->server.local_addr.port = atoi(argv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+       if (vty->type != VTY_FILE)</span><br><span style="color: hsl(120, 100%, 40%);">+         bsc_cbc_link_restart();</span><br><span style="color: hsl(120, 100%, 40%);">+       return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_no_listen_port, cfg_cbc_no_listen_port_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+        "no listen-port",</span><br><span style="color: hsl(120, 100%, 40%);">+   NO_STR "Remove CBSP Listen Port; disables inbound CBSP connections\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode%s",</span><br><span style="color: hsl(120, 100%, 40%);">+           VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (cbc->mode == BSC_CBC_LINK_MODE_SERVER) {</span><br><span style="color: hsl(120, 100%, 40%);">+               cbc->mode = BSC_CBC_LINK_MODE_DISABLED;</span><br><span style="color: hsl(120, 100%, 40%);">+            if (vty->type != VTY_FILE)</span><br><span style="color: hsl(120, 100%, 40%);">+                 bsc_cbc_link_restart();</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+     return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN_DEPRECATED(cfg_cbc_listen_ip, cfg_cbc_listen_ip_cmd,</span><br><span style="color: hsl(120, 100%, 40%);">+  "listen-ip A.B.C.D",</span><br><span style="color: hsl(120, 100%, 40%);">+        "Local IP Address where BSC listens for incoming CBC connections (Default: 127.0.0.1)\n"</span><br><span style="color: hsl(120, 100%, 40%);">+    "Local IP Address where BSC listens for incoming CBC connections\n")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     struct bsc_cbc_link *cbc = vty_cbc_data(vty);</span><br><span style="color: hsl(120, 100%, 40%);">+ vty_out(vty, "%% cbc/listen-ip config is deprecated, instead use cbc/server/local-ip%s",</span><br><span style="color: hsl(120, 100%, 40%);">+            VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+ osmo_sockaddr_str_from_str(&cbc->server.local_addr, argv[0], cbc->server.local_addr.port);</span><br><span style="color: hsl(120, 100%, 40%);">+  return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void cbc_vty_init(void)</span><br><span> {</span><br><span>     install_element_ve(&show_cbc_cmd);</span><br><span>@@ -564,4 +649,12 @@</span><br><span>        install_element(CBC_CLIENT_NODE, &cfg_cbc_client_local_port_cmd);</span><br><span>        install_element(CBC_CLIENT_NODE, &cfg_cbc_client_no_local_ip_cmd);</span><br><span>       install_element(CBC_CLIENT_NODE, &cfg_cbc_client_no_local_port_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Deprecated, for backwards compat */</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(CBC_NODE, &cfg_cbc_remote_ip_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element(CBC_NODE, &cfg_cbc_no_remote_ip_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+     install_element(CBC_NODE, &cfg_cbc_remote_port_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+      install_element(CBC_NODE, &cfg_cbc_listen_port_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+      install_element(CBC_NODE, &cfg_cbc_no_listen_port_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+   install_element(CBC_NODE, &cfg_cbc_listen_ip_cmd);</span><br><span> }</span><br><span>diff --git a/tests/cbc.vty b/tests/cbc.vty</span><br><span>index 7a4031f..a15de59 100644</span><br><span>--- a/tests/cbc.vty</span><br><span>+++ b/tests/cbc.vty</span><br><span>@@ -209,3 +209,67 @@</span><br><span> OsmoBSC(config-cbc)# mode disabled</span><br><span> OsmoBSC(config-cbc)# do show cbc</span><br><span> CBSP link is disabled</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# # TEST DEPRECATED COMMANDS</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# remote-ip 1.2.3.4</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/ mode</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# remote-port 1234</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/remote-port config is deprecated, instead use cbc/client/remote-port</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# do show cbc</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC is configured as CBSP Client to remote CBC at 1.2.3.4:1234</span><br><span style="color: hsl(120, 100%, 40%);">+CBSP Client Connection: Disconnected</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# show running-config</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+cbc</span><br><span style="color: hsl(120, 100%, 40%);">+ mode client</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+ client</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-ip 1.2.3.4</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-port 1234</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# no remote-ip</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/remote-ip config is deprecated, instead use cbc/client/remote-ip and cbc/mode</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# do show cbc</span><br><span style="color: hsl(120, 100%, 40%);">+CBSP link is disabled</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# show running-config</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+cbc</span><br><span style="color: hsl(120, 100%, 40%);">+ mode disabled</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+ client</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-ip 1.2.3.4</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-port 1234</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# listen-ip 127.0.0.2</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/listen-ip config is deprecated, instead use cbc/server/local-ip</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# do show cbc</span><br><span style="color: hsl(120, 100%, 40%);">+CBSP link is disabled</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# listen-port 48049</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# do show cbc</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC is configured as CBSP Server on 127.0.0.2:48049</span><br><span style="color: hsl(120, 100%, 40%);">+CBSP Server Connection: Disconnected</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# show running-config</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+cbc</span><br><span style="color: hsl(120, 100%, 40%);">+ mode server</span><br><span style="color: hsl(120, 100%, 40%);">+ server</span><br><span style="color: hsl(120, 100%, 40%);">+  local-ip 127.0.0.2</span><br><span style="color: hsl(120, 100%, 40%);">+ client</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-ip 1.2.3.4</span><br><span style="color: hsl(120, 100%, 40%);">+  remote-port 1234</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# no listen-port</span><br><span style="color: hsl(120, 100%, 40%);">+% cbc/listen-port config is deprecated, instead use cbc/server/local-port and cbc/mode</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# do show cbc</span><br><span style="color: hsl(120, 100%, 40%);">+CBSP link is disabled</span><br><span style="color: hsl(120, 100%, 40%);">+OsmoBSC(config-cbc)# show running-config</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span style="color: hsl(120, 100%, 40%);">+cbc</span><br><span style="color: hsl(120, 100%, 40%);">+ mode disabled</span><br><span style="color: hsl(120, 100%, 40%);">+...</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/19967">change 19967</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/19967"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If6b742f28191b3f19ff1d87a217037a305133f4b </div>
<div style="display:none"> Gerrit-Change-Number: 19967 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>