Page MenuHomeVyOS Platform

`show configuration json` (op mode) and `show | json` (conf mode) represent multi-value nodes differently
On hold, LowPublicBUG

Description

It seems that show configuration json in operational mode and show | json in configuration mode do not represent multi-value configuration nodes in the same way. For example, given the config:

interfaces {
    ethernet eth0 {
        address dhcp
        address dhcpv6
    }
    ethernet eth1 {
        address dhcp
    }
}

show configuration json (op mode) returns:

{
    "interfaces": {
        "ethernet": {
            "eth0": {
                "address": [
                    "dhcp",
                    "dhcpv6"
                ]
            },
            "eth1": {
                "address": [
                    "dhcp"
                ]
            }
        }
    }
}

while show | json (config mode) returns:

{
    "interfaces": {
        "ethernet": {
            "eth0": {
                "address": [
                    "dhcp",
                    "dhcpv6"
                ]
            },
            "eth1": {
                "address": "dhcp"
            }
        }
    }
}

The config mode is representing single values as just a string instead of a 1-element array. It seems to me that operational mode's output is more consistent (always an array).

Is this difference in behavior expected? Is it possible to fix without breaking compatibility?

References:

Details

Version
1.4-rolling-202202080317
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

dmbaturin edited projects, added VyOS 1.5 Circinus; removed VyOS 1.4 Sagitta.
dmbaturin subscribed.
dmbaturin edited projects, added VyOS Rolling; removed Restricted Project.Oct 14 2024, 11:00 AM
dmbaturin edited a custom field.
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Behavior change.
dmbaturin changed Issue type from Unspecified (please specify) to behavior-change.

Reassigned to @natali-rs1985 ; please ask if any questions.

natali-rs1985 changed the task status from Open to On hold.Nov 18 2024, 2:14 PM

Tried to apply multi_to_list function to ConfigTree().to_json() but it works only for the full config or if pass the path.
The problem is described in the comment on closing the pull request: link. For now there is no way to pass the argument before the filter (json) to the function after the filter

dmbaturin changed Issue type from behavior-change to Bug (incorrect behavior).Nov 27 2024, 6:48 PM