I need to move a file (RSI info) off an EX3400 switch. I am trying to use the basic script suggested in Transfer Files Using Junos PyEZ and copied below:
from jnpr.junos import Device
from jnpr.junos.utils.scp import SCP
dev = Device('router1.example.com')
with SCP(dev) as scp:
scp.put('local-file', remote_path='path')
scp.get('remote-file', local_path='path')
My code is virtually identical, as seen in screenshot below. Never mind the 'timeout' setting or the 'exit' - I was just trying this out real quick as part of another existing script.
So the 'put' part work just fine - copied my test file to the switch. But then I get the error below. The line 148 referenced there is the one with the .get() method.
Is this for real – is the .get() method for some reason not written for EX3400 (also EX4600 and EX9208?)? The Junos PyEZ developer guide makes no such qualifications.
I am a Python newbie, and I tried to think through this. When SCP is imported from jnpr.junos.utils.scp, it looks like (https://junos-pyez.readthedocs.io/en/2.6.3/_modules/jnpr/junos/utils/scp.html) SCPClient Class is imported from scp site package, where .put() and .get() methods are also defined. Again, nothing is mentioned about how the .get() method would work for some devices but not others.
I see in this scp site package code that the error I get some from the following line. The actual text about this being invalid for ex3400 is not explicitly included in the scp site package. So, where does it come from?
Finally, if I am not missing anything, and this really is not meant for EX3400, can anyone suggest alternative available methods?
Many thanks!
Lydia
------------------------------
LYDIA N
------------------------------