Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON compare_config format #23

Open
omron93 opened this issue Dec 9, 2022 · 0 comments
Open

JSON compare_config format #23

omron93 opened this issue Dec 9, 2022 · 0 comments

Comments

@omron93
Copy link

omron93 commented Dec 9, 2022

Based on napalm documentation the compare_config() should be returning a string - https://napalm.readthedocs.io/en/latest/base.html#napalm.base.base.NetworkDriver.compare_config
image
Current compare_config implementation for JSON returns list of dictionaries. Also that's missing any formatting so it's not easy for human to review.
Also the current format/data type is not consistent with the return values from compare_config() for on-box set-style diff - which is nicely formatted human readable string.

The simplest fix might be to return pprint.pprint(<diff>) from the JSON diff. With exception of "no diff' for which I think napalm should be returning empty string.
Best fix I guess might be some form of unified-diff style output - lines with '+' prefix for added parts, '-' line prefix for removed parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant