You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is for a ticket regarding the the conversation we've had on Slack.
Attached you will see the ncclient_call.py that I had modified with your assistance to make this work for us. ncclient_call.py.zip
I've made modifications to the following lines:
169
178
184
190
195
199
202
210
220
When using r.tostring.decode() instead of etree.tostring(r._root, pretty_print=True) I was able to perform all transactions and was thrown an error regarding persist=pid as seen in the below exception:
error:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/nornir_salt/plugins/tasks/ncclient_call.py", line 189, in _call_transaction
r = manager.commit(
File "/usr/local/lib/python3.9/site-packages/ncclient/manager.py", line 246, in execute
return cls(self.session,
TypeError: request() got an unexpected keyword argument 'persist'
|
After removing the persist=pid part of the code i was able to successfully do a full transaction.
However the following flow did not work as expected;
Lock target configuration datastore
If client and server supports it - Discard previous changes if any
Edit configuration
If client and server supports it - validate configuration if validate argument is True
If client and server supports it - do commit confirmed if confirmed argument is True
If client and server supports it - do commit operation
Unlock target configuration datastore
If client and server supports it - discard all changes if any of steps 3, 4, 5 or 6 fail
Return results list of dictionaries keyed by step name
steps 5 & 6 did not work.
The command I executed is as follows;
salt 'nrp02' nr.nc transaction config="salt://templates/my_rpc_config.xml" target="candidate" confirmed=True confirmed_delay=120 commit_final_delay=10 comment="Commit via NCCLIENT with rollback" FO='[{"hostname": "192.168.2.2"}]'
On the juniper device i saw this mesage;
0 2022-07-22 00:59:21 EDT by admin via netconf commit confirmed, rollback in 1mins
The final commit never happens.
When I use this command; salt 'nrp02' nr.nc transaction config="salt://templates/my_rpc_config.xml" target="candidate" comment="Commit via NCCLIENT with rollback" FO='[{"hostname": "192.168.2.2"}]'
The juniper see's this
0 2022-07-22 01:07:42 EDT by admin via netconf commit confirmed, rollback in 10mins
1 2022-07-22 01:07:34 EDT by admin via netconf commit confirmed, rollback in 1mins
It looks like it's doing a double commit confirmed on the box.
Lastly a few points;
Using the ncclient, the transactions function doesn't seem to call the ncclient third-party/junos/rpc.py for it's work (i could be wrong)
I should be able to pass in the following attributes based on their documentation; format="text" action="set" comment="Test Comment"
Looks like it doesn't work as expected, comments don't pass through either.
I am more than happy to continue testing in a collaborative effort as well and will report any additional findings.
The text was updated successfully, but these errors were encountered:
Hi, updated ncclient_call to support specifying edit configuration operation name and passing custom arguments to edit configuration call. Also, updated transaction function to better handle return results and properly handle proprietary commit confirmed RPC for juniper. Commit changes - d05e667
This is for a ticket regarding the the conversation we've had on Slack.
Attached you will see the
ncclient_call.py
that I had modified with your assistance to make this work for us.ncclient_call.py.zip
I've made modifications to the following lines:
When using
r.tostring.decode()
instead ofetree.tostring(r._root, pretty_print=True)
I was able to perform all transactions and was thrown an error regardingpersist=pid
as seen in the below exception:After removing the
persist=pid
part of the code i was able to successfully do a full transaction.However the following flow did not work as expected;
steps 5 & 6 did not work.
The command I executed is as follows;
salt 'nrp02' nr.nc transaction config="salt://templates/my_rpc_config.xml" target="candidate" confirmed=True confirmed_delay=120 commit_final_delay=10 comment="Commit via NCCLIENT with rollback" FO='[{"hostname": "192.168.2.2"}]'
On the juniper device i saw this mesage;
The final commit never happens.
When I use this command;
salt 'nrp02' nr.nc transaction config="salt://templates/my_rpc_config.xml" target="candidate" comment="Commit via NCCLIENT with rollback" FO='[{"hostname": "192.168.2.2"}]'
The juniper see's this
It looks like it's doing a double commit confirmed on the box.
Lastly a few points;
Using the ncclient, the transactions function doesn't seem to call the ncclient third-party/junos/rpc.py for it's work (i could be wrong)
I should be able to pass in the following attributes based on their documentation;
format="text" action="set" comment="Test Comment"
Looks like it doesn't work as expected, comments don't pass through either.
I am more than happy to continue testing in a collaborative effort as well and will report any additional findings.
The text was updated successfully, but these errors were encountered: