- Run Keyword If "${switch.mgmt_protocol}" == "ssh" Call Method ${switch} set_ssh_key ${USER_HOME}/.ssh/${SSH_KEY}
- Run Keyword If "${switch.mgmt_protocol}" == "ssh" Call Method ${switch} set_mgmt_user ${MININET_USER}
- ${connection_index}= Run Keyword If "${switch.mgmt_protocol}" == "ssh" SSHLibrary.Open Connection ${switch.mgmt_ip} prompt=${switch.mgmt_prompt} timeout=30s
- Run Keyword If "${switch.mgmt_protocol}" == "ssh" Login With Public Key ${switch.mgmt_user} ${switch.ssh_key} any
- ${connection_index}= Run Keyword If "${switch.mgmt_protocol}" == "telnet" Telnet.Open Connection ${switch.mgmt_ip} ELSE Set Variable
- ... ${connection_index}
- [Return] ${connection_index}
+ [Arguments] ${switch}
+ IF "${switch.mgmt_protocol}" == "ssh"
+ Call Method ${switch} set_ssh_key ${USER_HOME}/.ssh/${SSH_KEY}
+ END
+ IF "${switch.mgmt_protocol}" == "ssh"
+ Call Method ${switch} set_mgmt_user ${TOOLS_SYSTEM_USER}
+ END
+ IF "${switch.mgmt_protocol}" == "ssh"
+ ${connection_index}= SSHLibrary.Open Connection
+ ... ${switch.mgmt_ip}
+ ... prompt=${switch.mgmt_prompt}
+ ... timeout=30s
+ ELSE
+ ${connection_index}= Set Variable ${None}
+ END
+ IF "${switch.mgmt_protocol}" == "ssh"
+ Login With Public Key ${switch.mgmt_user} ${switch.ssh_key} any
+ END
+ IF "${switch.mgmt_protocol}" == "telnet"
+ ${connection_index}= Telnet.Open Connection ${switch.mgmt_ip}
+ ELSE
+ ${connection_index}= Set Variable ${connection_index}
+ END
+ RETURN ${connection_index}