Page MenuHomeVyOS Platform

Reorganize the operational mode command cache format for ease of searching
Open, HighPublicFEATURE REQUEST

Description

At the moment, the op mode cache is a mix of lists and dicts, so any search algorithm needs to check what's inside — a list of a dict.

Additionally, it puts lots of fields inside a node_data subdict, even though their names are unique and don't clash with anything at the upper level.

op_reference = [
  {'show': [
    {'node_data': {'node_type': 'node', 'help_text': None, 'comp_help': None, 'command': None, 'path': ['show']}},

I believe it's beneficial to:

  • Flatten the node dict and place node properties at the top level.
  • Make all entries lists of dicts, move the node name to inside the node dict, and put children in the children field.
[
  {
    "name": "show",
    "type": "node",
    "comp_help": {},
    "command": null,
    "path": [
      "show"
    ],
    "children": [
      {
        "name": "kernel",
        "type": "node",
        "comp_help": {},
        "command": null,
        "path": [
          "show",
          "kernel"
        ],
        "children": [
          {
            "name": "modules",
            "type": "node",
            "comp_help": {},
            "command": "sudo /usr/libexec/vyos//op_mode/kernel_modules.py show",
            "path": [
              "show",
              "kernel",
              "modules"
            ],
            "children": []
          }
        ]
      }
    ]
  },

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)
Story points
3