Hi, it would be very useful for a code I'm writing in Python, to be able to get "commit dry-run outfomat xml" like output in python.
The code is like
with ncs.maapi.single_write_trans('admin', 'python') as t:
several maagic writes to CDB
At this point, before applying the transaction, I would lke to get CLI o XML output similar to "commit dry-run..." on the NSO CLI..
I tried t.apply with COMMIT_NCS_DRY_RUN_XML flag, but didn't get any result..
Anybody knows if that is possible?
You can find apply_params() pydocs here: nso-220.127.116.11/doc/api/python/ncs.maapi.html
CommitParams class here: nso-18.104.22.168/src/ncs/pyapi/pysrc/maapi.py
Using CommitParams() along with apply_params() you can do dry-run like this:
I don't recognize the this exact error, but usually it is not prudent to apply a transaction 'inside' of a transaction - tends to get into a transaction lock deadlock situation.
See this thread previous thread on a similar:
Presumably, you are attempting to save off the dry-run config that is getting written to the network. I've seen this done through a 2-step action, does a transaction for the dry-run followed by a transaction for the actual service instance commit. Also seen it done via a custom cli command that issues subsequent commit-dry-run and commit commands. I'm sure a reactive fastmap service could be crafted to do the dry-run/commit sequence as well.