Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create generalized function for ssh-client #957

Merged
merged 4 commits into from Sep 27, 2019

Conversation

rsmekala
Copy link
Contributor

Cherry-picked code from #896. Cannot merge it due to merge conflicts

  • Added generalized script for ssh_client open utility
  • start_shell and scp modified to use the generalized utility.

Test logs

Script

from jnpr.junos.device import Device
from jnpr.junos.utils.start_shell import StartShell
from jnpr.junos.utils.scp import SCP


with Device(host='xx.xx.xx.xx', user='xxxxx', password='xxxxx') as dev:
    with StartShell(dev) as shell:
        result = shell.run("ls /var/tmp/NSSULogs.pdf")
        print(result[1])

    with SCP(dev) as scp:
        scp.put(files='bin/NSSULogs.pdf', remote_path='/var/tmp')

    with StartShell(dev) as shell:
        result = shell.run("ls /var/tmp/NSSULogs.pdf")
        print(result[1])

Output

ls /var/tmp/NSSULogs.pdf
ls: /var/tmp/NSSULogs.pdf: No such file or directory
% 
ls /var/tmp/NSSULogs.pdf
/var/tmp/NSSULogs.pdf
% 

Process finished with exit code 0

@jnpr-community-netdev
Copy link

Can one of the admins verify this patch?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.885% when pulling ff36677 on rsmekala:ssh_open_utility into 96b8c2d on Juniper:master.

Copy link
Contributor

@vnitinv vnitinv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@vnitinv vnitinv merged commit 290decc into Juniper:master Sep 27, 2019
@rsmekala rsmekala deleted the ssh_open_utility branch December 10, 2019 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants