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

Diff action not showing add related changes #124

Open
XioNoX opened this issue Jun 8, 2023 · 0 comments
Open

Diff action not showing add related changes #124

XioNoX opened this issue Jun 8, 2023 · 0 comments

Comments

@XioNoX
Copy link
Contributor

XioNoX commented Jun 8, 2023

Trying to make my way through the diff feature after #122 and #123.

I noticed 2 issues when adding configuration options to a gNMI peer.

For example, sending this replace message (which works fine):
[('openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan', {'openconfig-vlan:switched-vlan': {'config': {'interface-mode': 'TRUNK', 'access-vlan': 1038, 'trunk-vlans': [1031]}}})]

I added some debug print messages under elif entry_tuple[0] == "add": (in https://github.com/akarneliuk/pygnmi/blob/master/pygnmi/tools.py#L128)

entry tuple: ('add', [], [('openconfig-vlan:switched-vlan', {'config': {'access-vlan': 1038, 'interface-mode': 'TRUNK', 'trunk-vlans': [1031]}})])

But the diff only shows:

+ /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/access-vlan 1038
+ /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/interface-mode TRUNK

While it should also show the change related to 'trunk-vlans': [1031]

The same issue happen with the "delete" action. For example sending:
['openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan']
Only returns:

- /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/access-vlan 1038
- /openconfig-interfaces:interfaces/interface[name=Ethernet1]/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config/interface-mode TRUNK

While it's also present in diff_list (at the beginning of def diff_openconfig())
[('change', ['notification', 0, 'timestamp'], (1686224822858689646, 1686224823572389369)), ('remove', ['notification', 0, 'update', 0, 'val'], [('openconfig-vlan:switched-vlan', {'config': {'access-vlan': 1038, 'interface-mode': 'TRUNK', 'trunk-vlans': [1031]}})])]


Next, sending this update message:
[('openconfig-interfaces:interfaces/interface[name=Ethernet1]', {'openconfig-interfaces:interface': [{'config': {'enabled': True, 'description': 'sretest1003', 'mtu': 9192}, 'name': 'Ethernet1'}]})]

have this entry tuple:
entry tuple: ('add', ['openconfig-interfaces:interface', 0, 'config'], [('description', 'sretest1003'), ('enabled', True), ('mtu', 9192)])
Which doesn't work out with _dict_to_xpath as elem_list[-1] is a string (Eg. sretest1003) and not the expected dict.

And doesn't return any diff.

Let me know if I can be of any help.

Thanks,

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