Execute a command on SSH and it hangs

606 views
Skip to first unread message

Phillip Do

unread,
May 13, 2016, 7:26:04 PM5/13/16
to robotframework-users
I used the SSH library in Robot Framework. First, I open a connection to one of my linux VM,  I can execute any command such as ls -la or call any other script and
I get the output back. 
      ${user}    root
      ${pass}   password123

       open connection {ip}
       Login  ${user} ${pass}
       Execute command  ls -la

I ssh to one of my hardware box and this box is under Linux O.S as root user. Under the Linux shell as root, there is another shell, "CLI" (Command Line Interface) as admin user and this shell can only run a command line.
I manually log into that box, I can execute any CLI command.

Cloudshield CS4000
admin connected from 10.99.4.76 using ssh on mccpos
admin@mccpos!>

However, I use the same script above to log on this box and connection will work BUT if I run any CLI command such as "show chassis" in Robot Framework, it HANGS and does not return any output.

      ${user}    admin
      ${pass}   password123

       open connection {ip}
       Login  ${user} ${pass}
       Execute command  show ipsec staus



Read output: Last Login: time date
admin connnected from 10.99.3.29 using ssh on mccpos
ESC[??handmin@mcccpos!>
INFO: Executing command 'show ipsec status'

Jaime Gil

unread,
Apr 15, 2018, 3:41:53 PM4/15/18
to robotframework-users
Hi Philip,

Did you get further on this problem? I am also having the same problem when I run a custom script in a remote machine. The connection is successful but when running the script, it hangs for ever, with no output.

The script is the following:

#!/bin/bash

while true; do
    echo "This is stdout!"
    read -p "Do you wish to install this program?" yn
    case $yn in
        [Yy]* ) make install; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done



Regards,

Jaime

ChandraSekhar Pola

unread,
Aug 24, 2021, 2:07:16 PM8/24/21
to robotframework-users
I am seeing a similar problem of hanging while running my scripts 

Yufeng Zhu

unread,
Sep 7, 2021, 1:44:42 AM9/7/21
to robotframework-users
Hi
I think this may be cause by incorrect prompt. Once you login to your CS4000, prompt was changed.
Could pleas try:
     ${user}    admin
      ${pass}   password123

       open connection {ip}    prompt=>

       Login  ${user} ${pass}
       Execute command  show ipsec staus
If execute command still not work for you, I suggest to use interactive shell like
     ${user}    admin
      ${pass}   password123

       open connection {ip}    prompt=>

       Login  ${user} ${pass}
       Write.    show ipsec staus
       ${out}.   Read Until Prompt

You can find more information in robotframework sshlibrary

Regards

Leo Li

unread,
Sep 8, 2021, 3:31:18 PM9/8/21
to robotframework-users
Hi ,
I'm using netmiko in robotframework to login to network device and execute some scripts. 

Reply all
Reply to author
Forward
0 new messages