Telnet Library - Open Connection Keyword returning unexpected gaierror [Errno 11001] getaddrinfo failed

Hi there,

I’m performing a prove of concept to use the Robot Framework plus Telnet Library to validates some projects, but I’m stuck after facing a problem to connect the server. And it is the reason why I’m here.
Below are described the scenario, the current result, the expected result from my side and a brief analysis of the robot framework outputs.

ERROR DESCRIPTION:

Given a tcp/ip server is running over “localhost” and port “1123”
And, currently, this server can be connected directly using the telnet.
When I execute script below:

*** Settings ***
Documentation     Telnet Test Concept
...
...               Test Pilot for using Robot Framwork to validate Telnet server
Library           Telnet

*** Variables ***
${host}         localhost
${port}         1123

*** Test Cases ***
Connect to Server using Telnet
    Open Connection	${host} port=${port}
    Close All Connections

ACTUAL RESULT
Then Open Connection fails with the error: "gaierror: [Errno 11001] getaddrinfo failed"

EXPECTED RESULT:
The connection to the host=localhost and port=1123 should be opened like it is opened when using telnet directly.

ANALYSIS
I verified in the output.xml, that the argument port was set to “1123:23” instaed of “23” (as showed in the log below). I know that the port “23” is the default value for the argument port. But I suppose it should be replaced by the new value “1123”

KEYWORD Telnet . Open Connection ${host} port=${port}
Documentation:	
Opens a new Telnet connection to the given host and port.

Start / End / Elapsed:	20220204 13:18:02.547 / 20220204 13:18:02.564 / 00:00:00.017
13:18:02.547	INFO	Opening connection to localhost port=1123:23 with prompt: None	
13:18:02.564	FAIL	gaierror: [Errno 11001] getaddrinfo failed	
00:00:00.000KEYWORD Telnet . Close All Connections
Documentation:	
Closes all open connections and empties the connection cache.

Start / End / Elapsed:	20220204 13:18:02.565 / 20220204 13:18:02.565 / 00:00:00.000

QUESTION:

  1. Someone have idea why the value “1123:23” is set instead of the value “1123”?
  2. How I could to fix it to get the connection opened properly?

Thanks in advance,
Jefferson

Olá Jefferson,

I was thinking of some bug on Telnet library, but checked the code and looked fine. Then I went to see your code and identified the problem.

You are having problems with spaces separation either on the definition of host and port, or in the Open Connection call.

I have used RIDE and could fix the spacing and run the test case.

Here is the code, but with a different port:

*** Settings ***
Documentation     Telnet Test Concept
...
...               Test Pilot for using Robot Framwork to validate Telnet server
Library           Telnet

*** Variables ***
${host}           localhost
${port}           80

*** Test Cases ***
Connect to Server using Telnet
    Open Connection    ${host}    port=${port}
    Close All Connections

1 Like

Olá Helio. You hit in the bull’s eye! :grinning:

After your reply, I back to the framework documentation and find the following information:

Space separated format

When Robot Framework parses data, it first splits the data to lines and then lines to tokens such as keywords and arguments. When using the space separated format, the separator between tokens is two or more spaces or alternatively one or more tab characters

Thanks a lot!