fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/35978?usp=email )


Change subject: VTY: rename 'sctp-role' to 'transport-role', add an alias
......................................................................

VTY: rename 'sctp-role' to 'transport-role', add an alias

Now that we're adding support for M3UA-over-TCP, the transport layer
role is no longer an SCTP specific paremeter, but rather a generic one.
This is also the case for the OSMO_SS7_ASP_PROT_IPA, which employs TCP,
and for which we can also choose between the client and server role.

The 'sctp-role' now becomes an alias to 'transport-role', so that
we keep backwards compatibility with old config files.

Change-Id: Iab6c898181d79a5ed2bea767ee90e55bc3af16a5
Related: SYS#5424
---
M include/osmocom/sigtran/osmo_ss7.h
M src/osmo_ss7_vty.c
M src/sccp_user.c
M tests/vty/ss7_asp_test.vty
4 files changed, 53 insertions(+), 27 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/78/35978/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index fa7f830..1afccea 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -433,7 +433,7 @@
                bool is_server;
                enum osmo_ss7_asp_role role;
                bool role_set_by_vty;
-               bool sctp_role_set_by_vty;
+               bool trans_role_set_by_vty;

                struct osmo_ss7_asp_peer local;
                struct osmo_ss7_asp_peer remote;
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index b5c2449..8addd57 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -1029,11 +1029,11 @@
        return CMD_SUCCESS;
 }

-DEFUN_ATTR(sctp_role, asp_sctp_role_cmd,
-          "sctp-role (client|server)",
-          "Specify the SCTP role for this ASP\n"
-          "Operate as SCTP client; connect to a server\n"
-          "Operate as SCTP server; wait for client connections\n",
+DEFUN_ATTR(asp_transport_role, asp_transport_role_cmd,
+          "transport-role (client|server)",
+          "Specify the transport layer role for this ASP\n"
+          "Operate as a client; connect to a server\n"
+          "Operate as a server; wait for client connections\n",
           CMD_ATTR_NODE_EXIT)
 {
        struct osmo_ss7_asp *asp = vty->index;
@@ -1045,10 +1045,17 @@
        else
                OSMO_ASSERT(0);

-       asp->cfg.sctp_role_set_by_vty = true;
+       asp->cfg.trans_role_set_by_vty = true;
        return CMD_SUCCESS;
 }

+ALIAS_ATTR(asp_transport_role, asp_sctp_role_cmd,
+          "sctp-role (client|server)",
+          "Specify the SCTP role for this ASP\n"
+          "Operate as SCTP client; connect to a server\n"
+          "Operate as SCTP server; wait for client connections\n",
+          CMD_ATTR_HIDDEN | CMD_ATTR_NODE_EXIT);
+
 #define ASP_SCTP_PARAM_INIT_DESC \
        "Configure SCTP parameters\n" \
        "Configure INIT related parameters\n" \
@@ -1694,7 +1701,7 @@
                vty_out(vty, "  qos-class %u%s", asp->cfg.qos_class, 
VTY_NEWLINE);
        vty_out(vty, "  role %s%s", 
osmo_str_tolower(get_value_string(osmo_ss7_asp_role_names, asp->cfg.role)),
                VTY_NEWLINE);
-       vty_out(vty, "  sctp-role %s%s", asp->cfg.is_server ? "server" : 
"client", VTY_NEWLINE);
+       vty_out(vty, "  transport-role %s%s", asp->cfg.is_server ? "server" : 
"client", VTY_NEWLINE);
        if (asp->cfg.sctp_init.num_ostreams_present)
                vty_out(vty, "  sctp-param init num-ostreams %u%s", 
asp->cfg.sctp_init.num_ostreams_value, VTY_NEWLINE);
        if (asp->cfg.sctp_init.max_instreams_present)
@@ -2958,6 +2965,7 @@
        install_lib_element(L_CS7_ASP_NODE, &asp_no_local_ip_cmd);
        install_lib_element(L_CS7_ASP_NODE, &asp_qos_class_cmd);
        install_lib_element(L_CS7_ASP_NODE, &asp_role_cmd);
+       install_lib_element(L_CS7_ASP_NODE, &asp_transport_role_cmd);
        install_lib_element(L_CS7_ASP_NODE, &asp_sctp_role_cmd);
        install_lib_element(L_CS7_ASP_NODE, &asp_sctp_param_init_cmd);
        install_lib_element(L_CS7_ASP_NODE, &asp_no_sctp_param_init_cmd);
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 9520464..f79832f 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -639,7 +639,7 @@
                        if (!asp)
                                goto out_rt;
                        asp_created = true;
-                       /* Ensure that the ASP we use is set to sctp-role 
client. */
+                       /* Ensure that the ASP we use is set to operate as a 
client. */
                        asp->cfg.is_server = false;
                        /* Ensure that the ASP we use is set to role ASP. */
                        asp->cfg.role = OSMO_SS7_ASP_ROLE_ASP;
@@ -658,7 +658,7 @@
        /* Extra sanity checks if the ASP asp-clnt-* was pre-configured over 
VTY: */
        if (!asp->simple_client_allocated) {
                /* Forbid ASPs defined through VTY that are not entirely
-                * configured. "role" and "sctp-role" must be explicitly 
provided:
+                * configured. "role" and "transport-role" must be explicitly 
provided:
                 */
                if (!asp->cfg.role_set_by_vty) {
                        LOGP(DLSCCP, LOGL_ERROR,
@@ -666,9 +666,9 @@
                             name, asp->cfg.name);
                        goto out_asp;
                }
-               if (!asp->cfg.sctp_role_set_by_vty) {
+               if (!asp->cfg.trans_role_set_by_vty) {
                        LOGP(DLSCCP, LOGL_ERROR,
-                            "%s: ASP %s defined in VTY but 'sctp-role' was not 
set there, please set it.\n",
+                            "%s: ASP %s defined in VTY but 'transport-role' 
was not set there, please set it.\n",
                             name, asp->cfg.name);
                        goto out_asp;
                }
@@ -676,17 +676,17 @@
                /* If ASP was configured through VTY it may be explicitly 
configured as
                 * SCTP server. It may be a bit confusing since this function 
is to create
                 * a "SCCP simple client", but this allows users of this API 
such as
-                * osmo-hnbgw to support SCTP-role server if properly 
configured through VTY.
+                * osmo-hnbgw to support transport-role server if properly 
configured through VTY.
                */
                if (asp->cfg.is_server) {
                        struct osmo_xua_server *xs;
                        LOGP(DLSCCP, LOGL_NOTICE,
-                            "%s: Requesting an SCCP simple client on ASP %s 
configured with 'sctp-role server'\n",
+                            "%s: Requesting an SCCP simple client on ASP %s 
configured with 'transport-role server'\n",
                             name, asp->cfg.name);
                        xs = osmo_ss7_xua_server_find2(ss7, trans_proto, prot, 
asp->cfg.local.port);
                        if (!xs) {
                                LOGP(DLSCCP, LOGL_ERROR, "%s: Requesting an 
SCCP simple client on ASP %s configured "
-                                    "with 'sctp-role server' but no matching 
xUA server was configured!\n",
+                                    "with 'transport-role server' but no 
matching xUA server was configured!\n",
                                     name, asp->cfg.name);
                                goto out_asp;
                        }
diff --git a/tests/vty/ss7_asp_test.vty b/tests/vty/ss7_asp_test.vty
index b1cfb04..64baddb 100644
--- a/tests/vty/ss7_asp_test.vty
+++ b/tests/vty/ss7_asp_test.vty
@@ -256,7 +256,7 @@
   no local-ip (A.B.C.D|X:X::X:X)
   qos-class <0-255>
   role (sg|asp|ipsp)
-  sctp-role (client|server)
+  transport-role (client|server)
   sctp-param init (num-ostreams|max-instreams|max-attempts|timeout) <0-65535>
   no sctp-param init (num-ostreams|max-instreams|max-attempts|timeout)
   block
@@ -265,16 +265,16 @@

 ss7_asp_vty_test(config-cs7-asp)# ?
 ...
-  description  Save human-readable description of the object
-  remote-ip    Specify Remote IP Address of ASP
-  no           Negate a command or set its defaults
-  local-ip     Specify Local IP Address from which to contact ASP
-  qos-class    Specify QoS Class of ASP
-  role         Specify the xUA role for this ASP
-  sctp-role    Specify the SCTP role for this ASP
-  sctp-param   Configure SCTP parameters
-  block        Allows a SCTP Association with ASP, but doesn't let it become 
active
-  shutdown     Terminates SCTP association; New associations will be rejected
+  description     Save human-readable description of the object
+  remote-ip       Specify Remote IP Address of ASP
+  no              Negate a command or set its defaults
+  local-ip        Specify Local IP Address from which to contact ASP
+  qos-class       Specify QoS Class of ASP
+  role            Specify the xUA role for this ASP
+  transport-role  Specify the transport layer role for this ASP
+  sctp-param      Configure SCTP parameters
+  block           Allows a SCTP Association with ASP, but doesn't let it 
become active
+  shutdown        Terminates SCTP association; New associations will be 
rejected
 ...

 ss7_asp_vty_test(config-cs7-asp)# no ?
@@ -422,7 +422,7 @@
   remote-ip 127.0.0.200
   remote-ip 127.0.0.201
   role sg
-  sctp-role server
+  transport-role server
  as my-ass m3ua
   asp my-asp
   routing-key 0 3.2.1

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/35978?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Iab6c898181d79a5ed2bea767ee90e55bc3af16a5
Gerrit-Change-Number: 35978
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to