pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38350?usp=email )


Change subject: src/osmo_ss7_vty.c: Improve error formatting in 'update route' 
cmd
......................................................................

src/osmo_ss7_vty.c: Improve error formatting in 'update route' cmd

Change-Id: I4fd5b30093425f1831348282d3563467c889e27f
---
M src/osmo_ss7_vty.c
M tests/vty/osmo_stp_test.vty
2 files changed, 10 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/50/38350/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index fb224d1..80b899c 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -364,18 +364,18 @@
        unsigned int argind;

        if (dpc < 0) {
-               vty_out(vty, "Invalid point code (%s)%s", argv[0], VTY_NEWLINE);
+               vty_out(vty, "%% Invalid point code (%s)%s", argv[0], 
VTY_NEWLINE);
                return CMD_WARNING;
        }

        if (mask < 0) {
-               vty_out(vty, "Invalid point code (%s)%s", argv[1], VTY_NEWLINE);
+               vty_out(vty, "%% Invalid point code (%s)%s", argv[1], 
VTY_NEWLINE);
                return CMD_WARNING;
        }

        rt = osmo_ss7_route_create(rtable, dpc, mask, ls_name);
        if (!rt) {
-               vty_out(vty, "cannot create route %s/%s to %s%s",
+               vty_out(vty, "%% Cannot create route %s/%s to %s%s",
                        argv[0], argv[1], argv[2], VTY_NEWLINE);
                return CMD_WARNING;
        }
@@ -394,7 +394,12 @@
                        return CMD_WARNING;
                break; /* Parse values below */
        default:
+               {
+               char *cmd = argv_concat(argv, argc, 0);
+               vty_out(vty, "%% Invalid arg count %d ('%s') in '%s'%s", argc, 
cmd, self->string, VTY_NEWLINE);
+               talloc_free(cmd);
                return CMD_WARNING;
+               }
        }

        argind = 3;
diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty
index 8aac9c1..40eb41e 100644
--- a/tests/vty/osmo_stp_test.vty
+++ b/tests/vty/osmo_stp_test.vty
@@ -621,3 +621,5 @@
 ...
  route-table system
 ... !update route 3.2.1 7.255.7 linkset my-ass priority 5 qos-class 1
+OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority
+% Invalid arg count 4 ('3.2.1 7.255.7 my-ass priority') in 'update route 
POINT_CODE MASK linkset LS_NAME [priority] [PRIO] [qos-class] [(CLASS|default)]'

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

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I4fd5b30093425f1831348282d3563467c889e27f
Gerrit-Change-Number: 38350
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to