pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38361?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: SYS#7112 (cherry picked from commit 5361f273e1cad25505e490d89d4b12d990cba557) Change-Id: I91aa6031ca64841e63eb034fd2be2b3b2818fb53 --- 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/61/38361/1
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c index 9d58fb6..97c06fe 100644 --- a/src/osmo_ss7_vty.c +++ b/src/osmo_ss7_vty.c @@ -325,7 +325,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" @@ -364,6 +364,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 69a0ab7..c5e82f7 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