11-30-2018 10:50 AM
For the service that I am writing, I have some python code that I would like to run on a commit, but not a dry-run. I know that in the pre/post modification it gives me the parameter 'op', which will tell me if it is a CREATE/UPDATE/DELETE happening to the service, but it does not inform me if it is a dry-run. Is this possible?
Solved! Go to Solution.
11-30-2018 01:13 PM
11-30-2018 01:13 PM
02-11-2022 08:03 AM - edited 02-11-2022 08:04 AM
Hello,
In NSO 5.5 and later , you can check if it's a dry-run in your python service .
trans= ncs.maagic.get_trans(root) params = trans.get_params() params.is_dry_run()
The function get_params is returning a CommitParams object . Here Link to the the class . You can access to other commit parameter as well (no-deploy , no-networking , Get dry-run outformat type ) .
def get_commit_queue_error_option(self)
Get commit queue item behaviour on error.
def get_commit_queue_sync_timeout(self)
Get commit queue synchronous mode of operation timeout.
def get_commit_queue_tag(self)
Get commit-queue tag.
def get_dry_run_outformat(self)
Get dry-run outformat
def get_trace_id(self)
Get trace id.
def get_wait_devices(self)
Get the devices that the transaction should wait for a device lock for before entering the transactions critical section.
def is_commit_queue_async(self)
Get commit queue asynchronous mode of operation.
def is_commit_queue_atomic(self)
Check if the commit queue item should be atomic.
def is_commit_queue_block_others(self)
Check if the the commit queue item should block other commit queue items for this device.
def is_commit_queue_bypass(self)
Check if the commit is transactional even if commit queue is configured by default.
def is_commit_queue_lock(self)
Check if the commit queue item should be locked.
def is_commit_queue_non_atomic(self)
Check if the commit queue item should be non-atomic.
def is_commit_queue_sync(self)
Get commit queue synchronous mode of operation.
def is_dry_run(self)
Is dry-run enabled
def is_dry_run_reverse(self)
Is dry-run reverse enabled.
def is_no_deploy(self)
Should service create method be invoked or not.
def is_no_lsa(self)
Get no-lsa commit parameter.
def is_no_networking(self)
Check if the the configuration should only be written to CDB and not actually pushed to the device.
def is_no_out_of_sync_check(self)
Do not check device sync state before pushing the configuration change.
def is_no_overwrite(self)
Should a check be done that the parts of the device configuration to be modified are are up-to-date in CDB before pushing the configuration change to the device.
def is_no_revision_drop(self)
Get no-revision-drop commit parameter.
def is_reconcile_discard_non_service_config(self)
Get reconcile commit parameter with discard-non-service-config behaviour.
def is_reconcile_keep_non_service_config(self)
Get reconcile commit parameter with keep-non-service-config behaviour.
def is_use_lsa(self)
Get use-lsa commit parameter.
Concerning the function get_params , here a link to get_params documentation
05-05-2022 02:49 AM
Thanks Nabsch, it is very helpful!
Just tested it against 5.4.4.1 too.
Regards,
Dragan
05-05-2022 03:36 AM
You can also check This post for Python or This post for Java
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide