Page MenuHomeVyOS Platform

Inconsistent leveling output from json printout
Closed, WontfixPublicBUG

Description

When displaying all interfaces as json the output from the json printout is referenced to showing all children of the interface dub-mode

[edit]
vyos@vyos# show int | json
{
    "ethernet": {
        "eth0": {
            "address": "10.10.10.10/24"
        }
    },
    "loopback": {
        "lo": {}
    }
}

When displaying a tag node eg. all ethernet interfaces this is different and the output is referenced to the ethernet-block itself (same reference level as in "show int" ) and not the the children inside it

[edit]
vyos@vyos# show int eth | json
{
    "ethernet": {
        "eth0": {
            "address": "10.10.10.10/24"
        }
    }
}

When displaying a single tag in the tag node this again is back to showing all children, this is the same as done in "show int"

[edit]
vyos@vyos# show int eth eth0 | json
{
    "address": "10.10.10.10/24"
}

Is this api inconsistency a symptom of the old cli interpreting done from the show command, or is it this a bug in the json interpreter?

Details

Difficulty level
Unknown (require assessment)
Version
vyos-1.2-rolling-201910310217
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

To fix this inconsistancy the output of show int ethernet | json should be:

{
       "eth0": {
            "address": "10.10.10.10/24"
        }
}
syncer changed the task status from Open to Needs testing.Nov 16 2019, 10:51 PM
syncer assigned this task to dmbaturin.
syncer triaged this task as Low priority.
syncer edited projects, added VyOS 1.3 Equuleus; removed VyOS 1.2 Crux.
dmbaturin renamed this task from Inconsistant leveling output from json printout to Inconsistent leveling output from json printout.May 29 2021, 7:20 AM

This is, sadly, a WONTFIX for now: it's indeed coming from the old backend. I'm also not sure what a right design would be. That command simply parses the output of a show command and converts it to JSON.

The show interfaces ethernet command returns the same format as just show interfaces just with all non-ethernet interfaces filtered out.

# show interfaces ethernet 
 ethernet eth1 {
     duplex auto
     ...
 }

One possible benefit of it is that scripts designed to work with outputs of show interfaces are plug-compatible with outputs of show interfaces <type> commands.

erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 6:23 PM