Is there a way to use telnet in an ssh connection in Robot Framework?

There is a node where I am ssh and I run the script remotely using the Robot Framework (SSHLibrary.Start command or run command). This remote script starts a telnet connection to another node, which is hidden from the outside. This telnet call seems to be a blocking event for the robot. I use RIDE to run the test and it just stops working. I can send stop signals inefficiently. Is it possible to run telnet in ssh?

+4
source share
2 answers

Everything is possible.

Describe your scenario as: Robot Framework runs on machine A. The test connects A to machine B through ssh and B to machine C through telnet.

From your question it is not clear at what stage the test is stuck . Does the test really establish a telnet connection? Does the telnet process really start with B?

Here you should consider two related issues.

First, the Robot Framework runs the test in a single thread. This means that the test does not progress until the keyword returns. If you want the telnet session to be open during the test, you must use the SSHLibrary.start command and not run the command.

The second point is to manage the software connection of the telnet session. The telnet client must support some kind of batch execution (for example, not ask for a password or reset input). Make sure you can issue C commands from the test. You should be able to redirect commands to C using write keywords. You can check the health of the telnet client by specifying a command file from its standard input. Sort of

cat commands_for_c.txt | telnet ...to..c... 
+3
source

We definitely did not use the method with telnet, but with a different ssh session or other shells, which we cannot access otherwise ...

Open an ssh connection with the first device. Use SSHLibrary keywords such as Set Prompt, Write and Read or Read Until in this connection. Ask to manually open a telnet connection to the next machine. Writing and reading words can be used a little like expectation and caviar ...

+2
source

All Articles