cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
574
Views
1
Helpful
2
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

2 Replies 2

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)