blob: 56160710e02ed51f0397af951cde1a30438525df [file] [log] [blame]
George Keishing4d6c1da2016-07-15 05:51:22 -05001*** Settings ***
2Documentation This module is for SSH connection override to QEMU
3... based openbmc systems.
4
George Keishingffcf02a2016-09-13 01:55:28 -05005Library SSHLibrary timeout=30 seconds
George Keishing4d6c1da2016-07-15 05:51:22 -05006Library OperatingSystem
root442f0ef2016-08-04 20:23:05 +00007Library Collections
George Keishing4d6c1da2016-07-15 05:51:22 -05008
9*** Variables ***
10
11*** Keywords ***
12Open Connection And Log In
root442f0ef2016-08-04 20:23:05 +000013 [Documentation] Opens a connection with the given arguments, and logs in.
14 ... Defaults to logging into the BMC.
15 [Arguments] ${username}=${OPENBMC_USERNAME}
16 ... ${password}=${OPENBMC_PASSWORD} &{connection_args}
17
18 # username The username to log into the connection with.
19 # password The password to log into the connection with.
20 # connection_args A dictionary of acceptable inputs to the Open Connection
21 # keyword. This includes, but is not limited to, the
22 # following:
23 # host, alias, port, timeout, newline, prompt, term_type,
24 # width, height, path_separator, endcoding
25 # (For more information, please visit the SSHLibrary doc)
26
27 # Of the above arguments to Open Connection, this keyword
28 # will provide the following default values:
29 # host ${OPENBMC_HOST}
30
31 # If no host was provided, add ${OPENBMC_HOST} to the dictionary
32 ${has_host}= Run Keyword and Return Status
33 ... Dictionary Should Contain Key ${connection_args} host
34 Run Keyword If ${has_host} == ${FALSE}
35 ... Set To Dictionary ${connection_args} host=${OPENBMC_HOST}
36
37 Run Keyword If
38 ... '${SSH_PORT}' != '${EMPTY}' and '${HTTPS_PORT}' != '${EMPTY}'
George Keishing4d6c1da2016-07-15 05:51:22 -050039 ... User input SSH and HTTPs Ports
40
root442f0ef2016-08-04 20:23:05 +000041 # Check to see if a port to connect to was provided.
42 ${has_port}= Run Keyword and Return Status
43 ... Dictionary Should Contain Key ${connection_args} port
George Keishing4d6c1da2016-07-15 05:51:22 -050044
root442f0ef2016-08-04 20:23:05 +000045 # If the ${SSH_PORT} is set and no port was provided, add the defined port
46 # to the dictionary and open the connection. Otherwise, open the connection
47 # with the either the provided port or the default port.
48 Run Keyword If '${SSH_PORT}' != '${EMPTY}' and ${has_port} == ${FALSE}
49 ... Run Keywords
50 ... Set To Dictionary ${connection_args} port=${SSH_PORT} AND
George Keishing314cf852016-08-26 09:02:16 -050051 ... SSHLibrary.Open connection &{connection_args}
52 ... ELSE Run Keyword SSHLibrary.Open connection &{connection_args}
root442f0ef2016-08-04 20:23:05 +000053
54 Login ${username} ${password}
George Keishing4d6c1da2016-07-15 05:51:22 -050055
George Keishing4346a412016-07-19 11:26:49 -050056Open Connection for SCP
57 Import Library SCPLibrary WITH NAME scp
58 Run Keyword If '${SSH_PORT}' == '${EMPTY}' scp.Open connection ${OPENBMC_HOST}
59 ... username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD}
60 ... ELSE Run Keyword scp.Open connection ${OPENBMC_HOST} port=${SSH_PORT}
61 ... username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD}
62
63
George Keishing4d6c1da2016-07-15 05:51:22 -050064User input SSH and HTTPs Ports
65 [Documentation] Update the global SSH and HTTPs port variable for QEMU
66 ${port_num}= Convert To Integer ${SSH_PORT}
67 ${SSH_PORT}= Replace Variables ${port_num}
68
69 ${https_num}= Convert To Integer ${HTTPS_PORT}
Sridevi Ramesh89a86922016-07-22 01:00:36 -050070 Set Global Variable ${AUTH_URI} https://${OPENBMC_HOST}:${https_num}