cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
636
Views
10
Helpful
2
Replies

Want to execute an NSO command with two parameters through python api

Shashank Srivastava
Cisco Employee
Cisco Employee

Hi,

I am working on a task in which I need to download a file and then upload the same on the device after making some changes. I can download the file easily by using scp-from python api as shown in python code snippet.

 

However, the issue is with sending multiple parameters. I want to execute following command through python api and send two parameters local-file and remote-file through python api.

devices device edgemarc1 scp-to local-file dummy remote-file /etc/conf/dummy

 

I know we can execute single parameter command through below piece of python code but I am unable to figure out how to send two parameters through python api .

scp_from_cmd = devs[devicename].scp_from.remote_file
inp = scp_from_cmd.get_input()
inp.args = ['/etc/config/fw_defs.conf']
response = scp_from_cmd.request(inp)

 

Any guidance is appreciated.

 

Thanks,

Shashank Srivastava

1 Accepted Solution

Accepted Solutions

rogaglia
Cisco Employee
Cisco Employee

Best is to use ncs_pycli that will give you tab access to all the model:

 

In [3]: input = device.scp_to.get_input()

In [4]: input.local_file="test"

In [5]: input.remote_file="test2"

In [6]: result=device.scp_to(input)

 

View solution in original post

2 Replies 2

rogaglia
Cisco Employee
Cisco Employee

Best is to use ncs_pycli that will give you tab access to all the model:

 

In [3]: input = device.scp_to.get_input()

In [4]: input.local_file="test"

In [5]: input.remote_file="test2"

In [6]: result=device.scp_to(input)

 

Thanks for this wonderful solution! Works well