pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38348?usp=email )
Change subject: Fix 'update route' vty command ......................................................................
Fix 'update route' vty command
Optional param marks in VTY command descriptions are only supported per token, spanning a list of params is not supported and fails matching.
Related: OS#6586 Change-Id: I28d3b587ae5d6ca7f494221e2bfc39357a45736d --- M src/osmo_ss7_vty.c M tests/vty/osmo_stp_test.vty 2 files changed, 37 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/48/38348/1
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index f1b0a1c..fb224d1 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -341,7 +341,7 @@ }
DEFUN_ATTR(cs7_rt_upd, cs7_rt_upd_cmd, - "update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)]", + "update route POINT_CODE MASK linkset LS_NAME [priority] [PRIO] [qos-class] [(CLASS|default)]", "Update the Route\n" "Update the Route\n" "Destination Point Code\n" @@ -380,6 +380,23 @@ return CMD_WARNING; }
+ switch (argc) { + case 3: + return CMD_SUCCESS; + case 5: + if (strcmp(argv[3], "priority") != 0 && + strcmp(argv[3], "qos-class") != 0) + return CMD_WARNING; + break; /* Parse values below */ + case 7: + if (strcmp(argv[3], "priority") != 0 && + strcmp(argv[5], "qos-class") != 0) + return CMD_WARNING; + break; /* Parse values below */ + default: + return CMD_WARNING; + } + argind = 3; if (argc > argind && !strcmp(argv[argind], "priority")) { argind++; diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty index c952bbe..95f5d02 100644 --- a/tests/vty/osmo_stp_test.vty +++ b/tests/vty/osmo_stp_test.vty @@ -568,7 +568,24 @@ OsmoSTP(config-cs7)# route-table system OsmoSTP(config-cs7-rt)# list ... - update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)] + update route POINT_CODE MASK linkset LS_NAME [priority] [PRIO] [qos-class] [(CLASS|default)] remove route POINT_CODE MASK OsmoSTP(config-cs7-rt)# update route 3.2.1 7.255.7 linkset my-ass priority 5 -% Unknown command. +OsmoSTP(config-cs7-rt)# show running-config +... +cs7 instance 0 +... + route-table system + update route 3.2.1 7.255.7 linkset my-ass priority 5 +... +cs7 instance 1 +... + route-table system +... !update route 3.2.1 7.255.7 linkset my-ass priority 5 +OsmoSTP(config-cs7-rt)# remove route 3.2.1 7.255.7 +OsmoSTP(config-cs7-rt)# show running-config +... +cs7 instance 0 +... + route-table system +... !update route 3.2.1 7.255.7 linkset my-ass priority 5