Is it possible to connect to a remote server from another remote server using Robot framework

1,086 views
Skip to first unread message

Mathews Jose

unread,
Nov 22, 2016, 1:45:23 AM11/22/16
to robotframework-users

I am currently using SSHLibrary for connecting to a remote server using robot framework for my testing purpose . But I need to establish connection to a 2nd server (for running some commands and obtain some results),to which direct connection from my laptop is not possible . Only way to connect to this 2nd server is , login to the server 1 then ssh .


So is there any way I can achieve this using robot framework . Any other libraries or keywords available ?

I tried searching but could not succeed . Any help is very much appreciated as I am stuck in this for long time now .

Ibraheem Saleh

unread,
Nov 22, 2016, 12:19:35 PM11/22/16
to mathew...@gmail.com, robotframework-users
I've never actually done or needed this to chain systems together but I imagine you can use the Remote library and robotremoteserver to setup a remote library on the 2nd server. You would then setup a proxy-like wrapper library on the 1st server which sets up its own remote library that directly calls the 2nd servers remote library functions. Then, from your laptop, you import the 1st server's hosted remote library and voila, you're sending commands and receiving output from the 2nd server from your laptop.



--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Mathews Jose

unread,
Nov 22, 2016, 12:32:21 PM11/22/16
to robotframework-users, mathew...@gmail.com
Hi,

Thanks for the suggestion .But I am little confused with the terms mentioned as I am new to this about setting proxy and all  :( .

If you can guide me to ,some sample test snippets for this scenario it would be really helpfull. I will also try to see if I can understand the implementation suggested in the above . 

Thanks again...


On Tuesday, November 22, 2016 at 10:49:35 PM UTC+5:30, Ibraheem Saleh wrote:
I've never actually done or needed this to chain systems together but I imagine you can use the Remote library and robotremoteserver to setup a remote library on the 2nd server. You would then setup a proxy-like wrapper library on the 1st server which sets up its own remote library that directly calls the 2nd servers remote library functions. Then, from your laptop, you import the 1st server's hosted remote library and voila, you're sending commands and receiving output from the 2nd server from your laptop.


On Mon, Nov 21, 2016 at 9:56 PM, Mathews Jose <mathew...@gmail.com> wrote:

I am currently using SSHLibrary for connecting to a remote server using robot framework for my testing purpose . But I need to establish connection to a 2nd server (for running some commands and obtain some results),to which direct connection from my laptop is not possible . Only way to connect to this 2nd server is , login to the server 1 then ssh .


So is there any way I can achieve this using robot framework . Any other libraries or keywords available ?

I tried searching but could not succeed . Any help is very much appreciated as I am stuck in this for long time now .

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

David

unread,
Nov 22, 2016, 7:13:00 PM11/22/16
to robotframework-users
I'm not familiar with details of SSHLibrary, but do you need a persistent connection from server 1 to server 2 to execute commands or you can execute just a sequence of commands or a script on server 2 that does what you want when executed from server 1 via SSH?

If not need persistent connection, and one time connections (even if a series of them) to execute commands will do, this shouldn't be hard to do. I'm not sure if SSHLibrary offers persistent connections or not (need to look at the docs).

But you don't necessarily need to set up proxying or remote servers on both server 1 and server 2, until you really need such a thing. I would try something like this first:

SSH to server 1 from RF test via SSHLibrary, using SSHLibrary keyword(s) to execute commands on server 1 to "SSH" to server 2 (using native SSH agent, not SSHLibrary on server 1 with RF). And instead of establishing a normal shell with SSH for server 1 to server 2 connection, you execute the SSH command/use case where you simply execute some commands via SSH then exit. e.g. something like this for SSH command on server 1 (to server 2):

echo "Replace echo here with actual command(s) you want to run" | ssh server2 bash

execute the above type of command with SSHLibrary from RF to server 1 (which does that command to server2 over ssh).

that's the simplest setup without proxying and remote servers, and it's a way you would 1st test stuff out.

Mathews Jose

unread,
Nov 23, 2016, 2:09:39 AM11/23/16
to robotframework-users
Hi David,

Thank you very much for this suggestion . I will definitely try this one out as it looks achievable and a relatively easy way  for me in my setup .
Reply all
Reply to author
Forward
0 new messages