Trying to get the newest 2G+3G developments thru the test suites (including the vty ones), I face a problem with this VTY definition from libosmo-sccp:
routing-key RCONTEXT DPC [si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup)] [ssn SSN]
It turns out the square braces indicating optional parameters cannot contain spaces.
To test, I created
foo [a] [b]
which works as
OsmoMSC(config-msc)# foo ? [a] a OsmoMSC(config-msc)# foo b % Unknown command. OsmoMSC(config-msc)# foo a ok OsmoMSC(config-msc)# foo a ? [b] b OsmoMSC(config-msc)# foo a b ok
So far so good, but with:
foo [a AA] [b]
I get
OsmoMSC(config-msc)# foo ? [a a OsmoMSC(config-msc)# foo a % There is no matched command. OsmoMSC(config-msc)# foo a val % Unknown command.
The way this would work is
foo [a] [AA] [b]
and means that I can issue either 'foo', 'foo a', 'foo a val' or 'foo a val b'. Not that helpful really.
With above command routing-key RCONTEXT DPC [si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup)] [ssn SSN] it seems to me it is intended as optionally providing none, si or both si and ssn?
I guess we need separate command definitions:
routing-key RCONTEXT DPC routing-key RCONTEXT DPC si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup) routing-key RCONTEXT DPC si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup) ssn SSN
Does that make sense?
Until we fix it, the vty tests will not be able to match up the vty doc parameters and the python tests will fail.
I grepped for all square brace vty definitions we have; the only ones attempting to include multiple args in square braces are in osmo_ss7_vty.c:
./libosmo-sccp/src/osmo_ss7_vty.c-265- "update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)]", ./libosmo-sccp/src/osmo_ss7_vty.c-781- "routing-key RCONTEXT DPC [si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup)] [ssn SSN]}",
They aren't usable.
(the 'update route...' is part of the _sg vty command set and thus not caught by osmo-msc or -bsc vty tests; osmo-stp has no vty tests so far, AFAICT)
These appear to be all square brace vty definitions, most enclose only a single element and are fine:
▶ grep -n '<DEFUN>(' -A1 $(find . -name "*.c") | grep '[[]' ./osmo-sgsn/src/gprs/sgsn_vty.c-534- "show mm-context tlli HEX [pdp]", ./osmo-sgsn/src/gprs/sgsn_vty.c-553- "show mm-context imsi IMSI [pdp]", ./osmo-sgsn/src/gprs/sgsn_vty.c-570- "show mm-context all [pdp]", ./osmo-sgsn/src/gprs/gb_proxy_vty.c:461:DEFUN(show_gbproxy, show_gbproxy_cmd, "show gbproxy [stats]", ./osmo-sgsn/src/gprs/gb_proxy_vty.c-552- "delete-gbproxy-peer <0-65534> (only-bvc|only-nsvc|all) [dry-run]", ./osmo-bsc/src/osmo-bsc/osmo_bsc_vty.c-63- "msc [<0-1000>]", "Configure MSC details\n" "MSC connection to configure\n") ./osmo-bsc/src/libbsc/bsc_vty.c:319:DEFUN(show_bts, show_bts_cmd, "show bts [<0-255>]", ./osmo-bsc/src/libbsc/bsc_vty.c:1629:DEFUN(cfg_bts_dtxu, cfg_bts_dtxu_cmd, "dtx uplink [force]", ./osmo-bsc/src/libbsc/bsc_vty.c-3947- "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> (activate|deactivate) (hr|fr|efr|amr) [<0-7>]", ./osmo-mgw/src/libosmo-legacy-mgcp/mgcp_vty.c-229- "show mgcp [stats]", ./libosmo-sccp/src/osmo_ss7_vty.c-110- "point-code format <1-24> [<1-23>] [<1-22>]", ./libosmo-sccp/src/osmo_ss7_vty.c-265- "update route POINT_CODE MASK linkset LS_NAME [priority PRIO] [qos-class (CLASS|default)]", ./libosmo-sccp/src/osmo_ss7_vty.c-781- "routing-key RCONTEXT DPC [si (aal2|bicc|b-isup|h248|isup|sat-isup|sccp|tup)] [ssn SSN]}", ./libosmo-sccp/examples/sccp_test_vty.c-39- "connect-req <0-16777216> [DATA]", ./libosmo-sccp/examples/sccp_test_vty.c-53- "connect-resp <0-16777216> [DATA]", ./libosmocore/src/gb/gprs_ns_vty.c:216:DEFUN(show_nse, show_nse_cmd, "show ns (nsei|nsvc) <0-65535> [stats]", ./libosmocore/src/gb/gprs_bssgp_vty.c:153:DEFUN(show_bvc, show_bvc_cmd, "show bssgp nsei <0-65535> [stats]", ./libosmocore/src/vty/command.c-2965- "no service terminal-length [<0-512>]", ./libosmocore/src/vty/logging_vty.c-520- "log gsmtap [HOSTNAME]",
~N