11-27-2020 07:04 AM - edited 11-27-2020 07:04 AM
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
Solved! Go to Solution.
11-27-2020 08:39 AM
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)
11-27-2020 08:39 AM
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)
11-27-2020 10:13 AM
Thanks for this wonderful solution! Works well
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