cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1914
Views
1
Helpful
4
Replies

how to re-deploy with commit params from python

erdemk
Level 1
Level 1

Hi all,

Could you help me on the following .. in short, how can i do re-deploy with commit params from python ..

i can commit a service with commit params from cli and python with success. for example :

from cli :

dd-rfs d1

commit commit-queue bypass

and from python :

with ncs.maapi.single_write_trans('admin', 'python', groups=['ncsadmin']) as t:
    root = ncs.maagic.get_root(t)
    root.dd_rfs__dd_rfs.create('d1')
    cp = ncs.maapi.CommitParams()
    cp.commit_queue_bypass()
    cp.no_networking()
    rr = t.apply_params(True, cp)
 
on the other hand, for re-deploy, i can re-deploy the service with commit params successfully from cli :
dd-rfs d1 re-deploy commit-queue { bypass }
but trying to do the same from python doesn't work :
with ncs.maapi.single_write_trans('admin', 'python', groups=['ncsadmin']) as t:
    root = ncs.maagic.get_root(t)
    root.dd_rfs__dd_rfs['d1'].re_deploy()
    cp = ncs.maapi.CommitParams()
    cp.commit_queue_bypass()
    rr = t.apply_params(True, cp)
 
how can i do re-deploy from python ?
 
Thanks and regards.
1 Accepted Solution

Accepted Solutions

huayyang
Cisco Employee
Cisco Employee

having the same name "dry-run", it's an action input parameter to action re-deploy, not a commit parameter, so you need to do something like this:

service_instance = ncs.maagic.get_node(t, PATH_TO_YOUR_SERVICE_INSTANCE)

action = service_instance.re_deploy

action_p = action.dry_run.create()

action(action_p)

 

View solution in original post

4 Replies 4

huayyang
Cisco Employee
Cisco Employee

having the same name "dry-run", it's an action input parameter to action re-deploy, not a commit parameter, so you need to do something like this:

service_instance = ncs.maagic.get_node(t, PATH_TO_YOUR_SERVICE_INSTANCE)

action = service_instance.re_deploy

action_p = action.dry_run.create()

action(action_p)

 

this is a working copy of bypassing a commit-queue.

instance = ncs.maagic.get_node(t, PATH_TO_YOUR_SERVICE_INSTANCE)]
inputs = instance.re_deploy.get_input()
inputs.commit_queue.create().bypass.create()
inputs.no_networking.create()
instance.re_deploy(inputs)

johnnyb
Level 1
Level 1

how do you change commit_queue parameters?

Like set async, and atomic = false?

Then re_deploy

take a look at our updated document: https://cisco-tailf.gitbook.io/nso-docs/guides/development/core-concepts/api-overview/python-api-overview#maagic-api

that together with the model of the action(service re-deploy action is defined in tailf-ncs-services.yang while the ncs-commit-queue grouping in tailf-ncs-devices.yang ) should give you the answer

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?