Automation

 View Only

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



scp.SCPException: error: command is not valid on the ex3400-48p

This thread has been viewed 3 times
  • 1.  scp.SCPException: error: command is not valid on the ex3400-48p

    Posted 04-14-2022 05:27

    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
    ------------------------------