1

I am connecting a network switch using telnet, please see my script below. This script keeps showing "EOFError: telnet connection closed" error message after running 80-90 iterations when executing the username command. I searched google and tried to find the root cause, unfortunately, no success. I would be thankful if you can guide me to address this issue:

*** Settings ***
Library    Telnet    

*** keyword ***
Telnet Connection
    Telnet.Open Connection    ${IP}    prompt=$
    Telnet.Set Prompt     (>|#|> |# |:|Password:| |)    prompt_is_regexp=true

    Telnet.Execute Command    username
    Telnet.Execute Command    password

    Telnet.Execute Command    show something
    sleep    2s
    Telnet.read 

    Telnet.Execute Command    exit
    sleep    2s
    Telnet.read 

*** Test Cases ***
Telnet Connection    
    :FOR    ${I}    IN RANGE    0    10000
    \     Telnet Connection
Passionate
  • 139
  • 1
  • 4
  • 13

1 Answers1

0

Use Login keyword to connect: https://robotframework.org/robotframework/latest/libraries/Telnet.html#Login

Check also: https://robotframework.org/robotframework/latest/libraries/Telnet.html#Connections

You can also get return value from Execute Command and log it on the screen with Log To Console keyword.

  • Thanks for the reply. I used login and got the same error message. KEYWORD ${out} = Telnet . Login username, password Documentation: Logs in to the Telnet server with the given user information. Start / End / Elapsed: 20200109 11:09:41.167 / 20200109 11:09:42.172 / 00:00:01.005 11:09:42.171 FAIL EOFError: telnet connection closed – Passionate Jan 09 '20 at 16:10