Page MenuHomeVyOS Platform

Interface definitions must always have the correct 'type:' set
Open, NormalPublic

Description

We need to update the way we do and convert interface definitions to always set the correct 'type:' field because the completion scripts need to behave differently for different node types, f.e. "file" needs to do filename completion, "range" shows a range of values sorted numerically, "u32" (number) sorts numerically, "txt" sorts alphabetically, etc.

Right now the "type" isn't regarded as important and can't be set in the XML, so the build-command-templates script defaults to type "txt", which sorts wrongly for numeric values.

Also, I see no reference to "type" in the XML definitions docs: https://phabricator.vyos.net/w/development/xml/
This needs to be updated with all the allowed "type" values, and how they relates to other things (validators, shell completion,...)

When all nodes have the correct type set, the bash completion scripts can be improved with different completion help sorting logic depending on node type.

https://github.com/vyos/vyatta-cfg/blob/current/etc/bash_completion.d/vyatta-cfg#L511
This is where the bash completion script has some handling of item types, but it doesn't do much with it other than print different item text to the screen.
This could be leveraged to apply different sorts to the help item list (right now it's always alphabetic).

https://github.com/vyos/vyatta-cfg/blob/current/src/cstore/cstore.cpp#L800
This is where the help items list is built for passing to the shell scripts. This needs to be studied and understood completely as it builds the help item pairs from the command definitions. We need to know the exact syntax for the old command definitions as they are still at the core of the system.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Event Timeline

jjakob triaged this task as Low priority.Apr 8 2020, 9:04 PM
jjakob created this task.
jjakob created this object in space S1 VyOS Public.
jjakob renamed this task from Correct node types for interface definitions to Interface definitions must always have the correct 'type:' set.May 9 2020, 10:12 AM
jjakob raised the priority of this task from Low to Normal.
jjakob updated the task description. (Show Details)

I see the XML format did use to have a way to set 'type', but this was regarded as unimportant and removed. It's very important for the bash completion scripts and needs to be added back.

erkin set Issue type to Internal change (not visible to end users).Aug 30 2021, 7:18 AM
erkin removed a subscriber: Active contributors.