akarneliuk / pygnmi

The pure Python implementation of the gNMI client.
https://training.karneliuk.com
BSD 3-Clause "New" or "Revised" License
126 stars 44 forks source link

Add option to hide prefix in the diff output #125

Open XioNoX opened 1 year ago

XioNoX commented 1 year ago

For example in this diff output, it might be cleaner and easier to understand by the operator if the prefixes were stripped.

- /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-interfaces:interface[name=Ethernet1]/config/description sretest1003
+ /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-interfaces:interface[name=Ethernet1]/config/description DISABLED
- /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-interfaces:interface[name=Ethernet1]/config/enabled True
+ /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-interfaces:interface[name=Ethernet1]/config/enabled False
- /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/access-vlan 1038

To something like:

- /interfaces/interface[name=Ethernet1]/interface[name=Ethernet1]/config/description sretest1003
+ /interfaces/interface[name=Ethernet1]/interface[name=Ethernet1]/config/description DISABLED
- /interfaces/interface[name=Ethernet1]/interface[name=Ethernet1]/config/enabled True
+ /interfaces/interface[name=Ethernet1]/interface[name=Ethernet1]/config/enabled False
- /interfaces/interface[name=Ethernet1]/ethernet/switched-vlan/config/access-vlan 1038
akarneliuk commented 1 year ago

I'd say, that is matter of choice. I think, maintaining the origin is important, so that you precisely know where comes the branch from. Having said that, I saw some vendors drop that entirely. PR is welcome.