vty: Allow using hex and octal representations in cmd numeric ranges
Some time ago, I submitted a patch to allow submitting number ranges not only as decimal, but also as hexadecimal or octal:
However, it was never merged.
Today a similar topic was raised again due to SMSCB Message IDs being printed in the vty "show messages" command as hexadecimal (and without 0x prefix) while the "show message ID" only accepted decimal numbers, which makes the user experience really confusing (I even spent some time debugging why "show message ID" was saying no message existing and I was seeing it in the list).
It was also raised that cisco console seems to also support hex numbers, see for instance "lac" in https://www.cisco.com/c/en/us/td/docs/wireless/asr_5000/21-1/CLI/books/R-Z/21-1_R-Z_CLI_Reference/21-1_R-Z_CLI_Reference_chapter_0100001.html
Supporting ranges in hexadecimal would also us to set stuff like lac as hexadecimal, and even store the config that way, because the vty would be able to read it back.
Similary, supporting octal would allow us to easily specify file permissions bitmaks in the VTY.I see 2 main options to support those:
1- Specify range parameters as decimal ranges (ex: <0-200>) but allowing passing any format of integer (dec, hex, oct) by specifying the format prefix. That's what the libosmocore patch above adds support for.
- cmd definition: "lac <0-6534324>"
- cmd write: "lac 0x30"
2- Specify accepted range formats explicitly. This means each param needs to be more detailed but also allows accepting specific formats on specific parameters. For instance, one would allow only decimal and hex in lac cmd: "lac (<0-6534324>|<0x0-0x4352>), or only accept hex: "lac <0x0-0x4352>"
I'm happy with any of the two above. Let's see what others want to say about it.