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

Need mechanism to update/replace based on xpath #81

Open
mahen-g opened this issue Jul 28, 2020 · 1 comment
Open

Need mechanism to update/replace based on xpath #81

mahen-g opened this issue Jul 28, 2020 · 1 comment
Labels
enhancement New feature or request refactor

Comments

@mahen-g
Copy link

mahen-g commented Jul 28, 2020

Current way of doing the update/replace operation requires user to provide the payload in the json format. While this seems ok for update operation, for replace operation user would have to provide the entire payload, though that is not being replaced.

For example, if user needs to replace an ip address on an interface on NX-OS, and if if the box had 48 interfaces, the user would have to create the payload which would include all the interfaces on the device with their corresponding info, even though the intent is to replace ip address for only interface.

Providing a mechanism to replace based on xpath would help resolve this.
something of the below format
--xpath_update /interfaces/interface[name=eth1/47]/@ip.json

On NX-OS, if we do not provide the entire payload, we would hit the below error. I believe, it could be the same for other platforms too.

File "/ws/mgangaia-sjc/pyats-latest/lib/python3.6/site-packages/cisco_gnmi/nx.py", line 194, in set_json
return self.set(prefix=prefix, updates=updates, replaces=replaces)
File "/ws/mgangaia-sjc/pyats-latest/lib/python3.6/site-packages/cisco_gnmi/client.py", line 223, in set
response = self.service.Set(request, metadata=self.default_call_metadata)
File "/ws/mgangaia-sjc/pyats-latest/lib/python3.6/site-packages/grpc/_channel.py", line 549, in call
return _end_unary_response_blocking(state, call, False, None)
File "/ws/mgangaia-sjc/pyats-latest/lib/python3.6/site-packages/grpc/_channel.py", line 466, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.INTERNAL
details = "descr:internal processing error [error:operation-failed msg:Cannot delete object of class:l1PhysIf path:/config/interfaces][error:operation-failed msg:Cannot delete object of class:l1PhysIf Commit Failed path:/config/interfaces]"
debug_error_string = "{"created":"@1595898351.637576743","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1039,"grpc_message":"descr:internal processing error [error:operation-failed msg:Cannot delete object of class:l1PhysIf path:/config/interfaces][error:operation-failed msg:Cannot delete object of class:l1PhysIf Commit Failed path:/config/interfaces]","grpc_status":13}"

Thanks,
Mahendra

@remingtonc remingtonc added enhancement New feature or request refactor labels Jul 28, 2020
@remingtonc
Copy link
Contributor

Related to #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

No branches or pull requests

2 participants