napalm-sros icon indicating copy to clipboard operation
napalm-sros copied to clipboard

Port diffs show a port number instead port name

Open jk2lx opened this issue 3 years ago • 3 comments

When showing the diff for a port admin-state change on an SR-7s, the diff does shows port numbers which cannot be correlated to any port:

[
    "change",
    [
        "configure",
        "port",
        0,
        "admin-state"
    ],
    [
        "enable",
        "disable"
    ]
]

Instead the diff should show the actual port name:

[
    "change",
    [
        "configure",
        "port",
        "1/1/c1",
        "admin-state"
    ],
    [
        "enable",
        "disable"
    ]
]

diff.json.txt

jk2lx avatar Feb 14 '22 14:02 jk2lx

Thanks for catching this issue @jan-linx. We'll investigate why the output isn't correct.

JonLundstrom avatar Feb 22 '22 13:02 JonLundstrom

Haven't seen your reply before, but if that helps the reason why the diff is like that is because that's exactly how dictdiffer package works. It takes ports as a list of elements so showing 0 for difference in first port element.

omron93 avatar Mar 18 '22 10:03 omron93

@jk2lx would your usage of the API be affected if we were to change the output of compare_config to simply be:

A:admin@c# /configure port 1/1/1 admin-state disable 

*(gl)[/]

A:admin@c# compare 

    configure {

        port 1/1/1 {

-           admin-state enable

+           admin-state disable

        }

        port 1/1/c7 {

+           admin-state enable

        }

    }

i.e. the output of the CLI 'compare' command, with '+' and '-' to denote additions/changes?

jbemmel avatar May 10 '22 17:05 jbemmel