Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 2 | Documentation This module is for IPMI client for copying ipmitool to |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 3 | ... openbmc box and execute ipmitool IPMI standard |
| 4 | ... command. IPMI raw command will use dbus-send command |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 5 | Resource ../lib/resource.txt |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 6 | Resource ../lib/connection_client.robot |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 7 | Resource ../lib/utils.robot |
| 8 | Resource ../lib/state_manager.robot |
| 9 | |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 10 | Library String |
Michael Walsh | 19621ba | 2018-12-03 17:16:02 -0600 | [diff] [blame] | 11 | Library ipmi_client.py |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
George Keishing | d7f11f7 | 2017-01-04 10:58:19 -0600 | [diff] [blame] | 14 | ${dbusHostIpmicmd1}= dbus-send --system ${OPENBMC_BASE_URI}HostIpmi/1 |
| 15 | ${dbusHostIpmiCmdReceivedMsg}= ${OPENBMC_BASE_DBUS}.HostIpmi.ReceivedMessage |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 16 | ${netfnByte}= ${EMPTY} |
George Keishing | d7f11f7 | 2017-01-04 10:58:19 -0600 | [diff] [blame] | 17 | ${cmdByte}= ${EMPTY} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 18 | ${arrayByte}= array:byte: |
Michael Walsh | 19621ba | 2018-12-03 17:16:02 -0600 | [diff] [blame] | 19 | ${IPMI_EXT_CMD} ${EMPTY} |
Michael Walsh | a791389 | 2017-04-20 16:29:01 -0500 | [diff] [blame] | 20 | ${IPMI_USER_OPTIONS} ${EMPTY} |
George Keishing | 39967eb | 2018-04-30 11:36:23 -0500 | [diff] [blame] | 21 | ${IPMI_INBAND_CMD}= ipmitool -C ${IPMI_CIPHER_LEVEL} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 22 | ${HOST}= -H |
| 23 | ${RAW}= raw |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | |
| 25 | *** Keywords *** |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 26 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | Run IPMI Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 28 | [Documentation] Run the given IPMI command. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 29 | [Arguments] ${args} |
| 30 | ${resp}= Run Keyword If '${IPMI_COMMAND}' == 'External' |
George Keishing | b4d4a4a | 2018-08-27 13:35:39 -0500 | [diff] [blame] | 31 | ... Run External IPMI Raw Command ${args} |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 32 | ... ELSE IF '${IPMI_COMMAND}' == 'Inband' |
George Keishing | b4d4a4a | 2018-08-27 13:35:39 -0500 | [diff] [blame] | 33 | ... Run Inband IPMI Raw Command ${args} |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 34 | ... ELSE IF '${IPMI_COMMAND}' == 'Dbus' |
| 35 | ... Run Dbus IPMI RAW Command ${args} |
| 36 | ... ELSE Fail msg=Invalid IPMI Command type provided : ${IPMI_COMMAND} |
| 37 | [Return] ${resp} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 38 | |
| 39 | Run IPMI Standard Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 40 | [Documentation] Run the standard IPMI command. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 41 | [Arguments] ${args} |
| 42 | ${resp}= Run Keyword If '${IPMI_COMMAND}' == 'External' |
| 43 | ... Run External IPMI Standard Command ${args} |
| 44 | ... ELSE IF '${IPMI_COMMAND}' == 'Inband' |
| 45 | ... Run Inband IPMI Standard Command ${args} |
| 46 | ... ELSE IF '${IPMI_COMMAND}' == 'Dbus' |
| 47 | ... Run Dbus IPMI Standard Command ${args} |
| 48 | ... ELSE Fail msg=Invalid IPMI Command type provided : ${IPMI_COMMAND} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 49 | |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 50 | [Return] ${resp} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 51 | |
| 52 | Run Dbus IPMI RAW Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 53 | [Documentation] Run the raw IPMI command through dbus. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 54 | [Arguments] ${args} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 55 | ${valueinBytes}= Byte Conversion ${args} |
| 56 | ${cmd}= Catenate ${dbushostipmicmd1} ${dbusHostIpmiCmdReceivedMsg} |
| 57 | ${cmd}= Catenate ${cmd} ${valueinBytes} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 58 | ${output} ${stderr}= Execute Command ${cmd} return_stderr=True |
| 59 | Should Be Empty ${stderr} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | set test variable ${OUTPUT} "${output}" |
| 61 | |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 62 | Run Dbus IPMI Standard Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 63 | [Documentation] Run the standard IPMI command through dbus. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 64 | [Arguments] ${args} |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 65 | Copy ipmitool |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 66 | ${stdout} ${stderr} ${output}= Execute Command |
| 67 | ... /tmp/ipmitool -I dbus ${args} return_stdout=True |
| 68 | ... return_stderr= True return_rc=True |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 69 | Should Be Equal ${output} ${0} msg=${stderr} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 70 | [Return] ${stdout} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 71 | |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 72 | Run Inband IPMI Raw Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 73 | [Documentation] Run the raw IPMI command in-band. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 74 | [Arguments] ${args} ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 75 | ... ${os_password}=${OS_PASSWORD} |
| 76 | |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 77 | # Description of arguments: |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 78 | # ${args} parameters to IPMI command. |
| 79 | # ${os_host} IP address of the OS Host. |
| 80 | # ${os_username} OS Host Login user name. |
| 81 | # ${os_password} OS Host Login passwrd. |
| 82 | |
| 83 | Login To OS Host ${os_host} ${os_username} ${os_password} |
| 84 | Check If IPMI Tool Exist |
| 85 | |
| 86 | ${inband_raw_cmd}= Catenate ${IPMI_INBAND_CMD} ${RAW} ${args} |
| 87 | ${stdout} ${stderr}= Execute Command ${inband_raw_cmd} return_stderr=True |
| 88 | Should Be Empty ${stderr} msg=${stdout} |
| 89 | [Return] ${stdout} |
| 90 | |
| 91 | Run Inband IPMI Standard Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 92 | [Documentation] Run the standard IPMI command in-band. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 93 | [Arguments] ${args} ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 94 | ... ${os_password}=${OS_PASSWORD} |
| 95 | |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 96 | # Description of arguments: |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 97 | # ${args} parameters to IPMI command. |
| 98 | # ${os_host} IP address of the OS Host. |
| 99 | # ${os_username} OS Host Login user name. |
| 100 | # ${os_password} OS Host Login passwrd. |
| 101 | |
| 102 | Login To OS Host ${os_host} ${os_username} ${os_password} |
| 103 | Check If IPMI Tool Exist |
| 104 | |
| 105 | ${inband_std_cmd}= Catenate ${IPMI_INBAND_CMD} ${args} |
| 106 | ${stdout} ${stderr}= Execute Command ${inband_std_cmd} return_stderr=True |
| 107 | Should Be Empty ${stderr} msg=${stdout} |
| 108 | [Return] ${stdout} |
| 109 | |
George Keishing | b4d4a4a | 2018-08-27 13:35:39 -0500 | [diff] [blame] | 110 | Run External IPMI Raw Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 111 | [Documentation] Run the raw IPMI command externally. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 112 | [Arguments] ${args} |
Michael Walsh | 19621ba | 2018-12-03 17:16:02 -0600 | [diff] [blame] | 113 | |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 114 | ${ipmi_raw_cmd}= Catenate SEPARATOR= |
Michael Walsh | a791389 | 2017-04-20 16:29:01 -0500 | [diff] [blame] | 115 | ... ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 116 | ... ${HOST}${SPACE}${OPENBMC_HOST}${SPACE}${RAW}${SPACE}${args} |
| 117 | ${rc} ${output}= Run and Return RC and Output ${ipmi_raw_cmd} |
| 118 | Should Be Equal ${rc} ${0} msg=${output} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 119 | [Return] ${output} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 120 | |
| 121 | Run External IPMI Standard Command |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 122 | [Documentation] Run the standard IPMI command in-band. |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 123 | [Arguments] ${args} ${fail_on_err}=${1} |
| 124 | |
| 125 | # Description of argument(s): |
| 126 | # args IPMI command to be executed. |
| 127 | # fail_on_err Fail if keyword the IPMI command fails |
Michael Walsh | a791389 | 2017-04-20 16:29:01 -0500 | [diff] [blame] | 128 | |
| 129 | ${ipmi_cmd}= Catenate SEPARATOR= |
| 130 | ... ${IPMI_EXT_CMD} ${IPMI_USER_OPTIONS} -P${SPACE}${IPMI_PASSWORD} |
| 131 | ... ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}${args} |
Rahul Maheshwari | 04a2204 | 2017-05-02 01:54:31 -0500 | [diff] [blame] | 132 | ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd} |
George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 133 | Return From Keyword If ${fail_on_err} == ${0} ${output} |
Michael Walsh | a791389 | 2017-04-20 16:29:01 -0500 | [diff] [blame] | 134 | Should Be Equal ${rc} ${0} msg=${output} |
| 135 | [Return] ${output} |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 136 | |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 137 | Check If IPMI Tool Exist |
| 138 | [Documentation] Check if IPMI Tool installed or not. |
| 139 | ${output}= Execute Command which ipmitool |
| 140 | Should Not Be Empty ${output} msg=ipmitool not installed. |
Rahul Maheshwari | 7a212a0 | 2016-09-05 21:17:30 -0500 | [diff] [blame] | 141 | |
Rahul Maheshwari | 04a2204 | 2017-05-02 01:54:31 -0500 | [diff] [blame] | 142 | |
| 143 | Activate SOL Via IPMI |
| 144 | [Documentation] Start SOL using IPMI and route output to a file. |
| 145 | [Arguments] ${file_path}=/tmp/sol_${OPENBMC_HOST} |
| 146 | # Description of argument(s): |
| 147 | # file_path The file path on the local machine (vs OBMC) to collect SOL |
| 148 | # output. By default SOL output is collected at |
| 149 | # /tmp/sol_<BMC_IP> else user input location. |
| 150 | |
| 151 | ${ipmi_cmd}= Catenate SEPARATOR= |
Rahul Maheshwari | c847088 | 2017-08-30 05:41:16 -0500 | [diff] [blame] | 152 | ... ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE}${HOST} |
| 153 | ... ${SPACE}${OPENBMC_HOST}${SPACE}sol activate usesolkeepalive |
Rahul Maheshwari | 04a2204 | 2017-05-02 01:54:31 -0500 | [diff] [blame] | 154 | |
George Keishing | 2102f6b | 2017-06-06 08:30:10 -0500 | [diff] [blame] | 155 | Start Process ${ipmi_cmd} shell=True stdout=${file_path} |
Rahul Maheshwari | 4f36084 | 2017-06-06 15:05:01 -0500 | [diff] [blame] | 156 | ... alias=sol_proc |
Rahul Maheshwari | 04a2204 | 2017-05-02 01:54:31 -0500 | [diff] [blame] | 157 | |
| 158 | |
| 159 | Deactivate SOL Via IPMI |
| 160 | [Documentation] Stop SOL using IPMI and return SOL output. |
| 161 | [Arguments] ${file_path}=/tmp/sol_${OPENBMC_HOST} |
| 162 | # Description of argument(s): |
| 163 | # file_path The file path on the local machine to copy SOL output |
| 164 | # collected by above "Activate SOL Via IPMI" keyword. |
| 165 | # By default it copies log from /tmp/sol_<BMC_IP>. |
| 166 | |
| 167 | ${ipmi_cmd}= Catenate SEPARATOR= |
| 168 | ... ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE} |
| 169 | ... ${HOST}${SPACE}${OPENBMC_HOST}${SPACE}sol deactivate |
| 170 | |
| 171 | ${rc} ${output}= Run and Return RC and Output ${ipmi_cmd} |
Rahul Maheshwari | 4f36084 | 2017-06-06 15:05:01 -0500 | [diff] [blame] | 172 | Run Keyword If ${rc} > 0 Run Keywords |
Rahul Maheshwari | 7f48a2c | 2017-06-16 04:00:26 -0500 | [diff] [blame] | 173 | ... Run Keyword And Ignore Error Terminate Process sol_proc |
| 174 | ... AND Return From Keyword ${output} |
Rahul Maheshwari | 04a2204 | 2017-05-02 01:54:31 -0500 | [diff] [blame] | 175 | |
| 176 | ${rc} ${output}= Run and Return RC and Output cat ${file_path} |
| 177 | Should Be Equal ${rc} ${0} msg=${output} |
| 178 | |
| 179 | # Logging SOL output for debug purpose. |
| 180 | Log ${output} |
| 181 | |
| 182 | [Return] ${output} |
| 183 | |
| 184 | |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 185 | Byte Conversion |
| 186 | [Documentation] Byte Conversion method receives IPMI RAW commands as |
| 187 | ... argument in string format. |
| 188 | ... Sample argument is as follows |
| 189 | ... "0x04 0x30 9 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 |
| 190 | ... 0x00" |
| 191 | ... IPMI RAW command format is as follows |
| 192 | ... <netfn Byte> <cmd Byte> <Data Bytes..> |
| 193 | ... This method converts IPMI command format into |
| 194 | ... dbus command format as follows |
| 195 | ... <byte:seq-id> <byte:netfn> <byte:lun> <byte:cmd> |
| 196 | ... <array:byte:data> |
| 197 | ... Sample dbus Host IPMI Received Message argument |
| 198 | ... byte:0x00 byte:0x04 byte:0x00 byte:0x30 |
| 199 | ... array:byte:9,0x01,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00 |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 200 | [Arguments] ${args} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 201 | ${argLength}= Get Length ${args} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 202 | Set Global Variable ${arrayByte} array:byte: |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 203 | @{listargs}= Split String ${args} |
| 204 | ${index}= Set Variable ${0} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 205 | :FOR ${word} in @{listargs} |
| 206 | \ Run Keyword if ${index} == 0 Set NetFn Byte ${word} |
| 207 | \ Run Keyword if ${index} == 1 Set Cmd Byte ${word} |
| 208 | \ Run Keyword if ${index} > 1 Set Array Byte ${word} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 209 | \ ${index}= Set Variable ${index + 1} |
| 210 | ${length}= Get Length ${arrayByte} |
| 211 | ${length}= Evaluate ${length} - 1 |
| 212 | ${arrayByteLocal}= Get Substring ${arrayByte} 0 ${length} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 213 | Set Global Variable ${arrayByte} ${arrayByteLocal} |
Gunnar Mills | 59204d2 | 2016-12-06 11:05:19 -0600 | [diff] [blame] | 214 | ${valueinBytesWithArray}= Catenate byte:0x00 ${netfnByte} byte:0x00 |
| 215 | ${valueinBytesWithArray}= Catenate ${valueinBytesWithArray} ${cmdByte} |
| 216 | ${valueinBytesWithArray}= Catenate ${valueinBytesWithArray} ${arrayByte} |
| 217 | ${valueinBytesWithoutArray}= Catenate byte:0x00 ${netfnByte} byte:0x00 |
| 218 | ${valueinBytesWithoutArray}= Catenate ${valueinBytesWithoutArray} ${cmdByte} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 219 | # To Check scenario for smaller IPMI raw commands with only 2 arguments |
| 220 | # instead of usual 12 arguments. |
| 221 | # Sample small IPMI raw command: Run IPMI command 0x06 0x36 |
| 222 | # If IPMI raw argument length is only 9 then return value in bytes without |
| 223 | # array population. |
| 224 | # Equivalent dbus-send argument for smaller IPMI raw command: |
| 225 | # byte:0x00 byte:0x06 byte:0x00 byte:0x36 |
| 226 | Run Keyword if ${argLength} == 9 Return from Keyword ${valueinBytesWithoutArray} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 227 | [Return] ${valueinBytesWithArray} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 228 | |
| 229 | |
| 230 | Set NetFn Byte |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 231 | [Documentation] Set the network function byte. |
| 232 | [Arguments] ${word} |
| 233 | ${netfnByteLocal}= Catenate byte:${word} |
| 234 | Set Global Variable ${netfnByte} ${netfnByteLocal} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 235 | |
| 236 | Set Cmd Byte |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 237 | [Documentation] Set the command byte. |
| 238 | [Arguments] ${word} |
| 239 | ${cmdByteLocal}= Catenate byte:${word} |
| 240 | Set Global Variable ${cmdByte} ${cmdByteLocal} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 241 | |
| 242 | Set Array Byte |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 243 | [Documentation] Set the array byte. |
| 244 | [Arguments] ${word} |
| 245 | ${arrayByteLocal}= Catenate SEPARATOR= ${arrayByte} ${word} |
| 246 | ${arrayByteLocal}= Catenate SEPARATOR= ${arrayByteLocal} , |
| 247 | Set Global Variable ${arrayByte} ${arrayByteLocal} |
Sivas SRR | a2dab3c | 2016-07-25 05:08:18 -0500 | [diff] [blame] | 248 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 249 | Copy ipmitool |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 250 | [Documentation] Copy the ipmitool to the BMC. |
| 251 | ${ipmitool_error}= Catenate The ipmitool program could not be found in the tools directory. |
| 252 | ... It is not part of the automation code by default. You must manually copy or link the correct openbmc |
| 253 | ... version of the tool in to the tools directory in order to run this test suite. |
| 254 | |
| 255 | OperatingSystem.File Should Exist tools/ipmitool msg=${ipmitool_error} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 256 | |
| 257 | Import Library SCPLibrary WITH NAME scp |
| 258 | scp.Open connection ${OPENBMC_HOST} username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD} |
| 259 | scp.Put File tools/ipmitool /tmp |
| 260 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 261 | Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 262 | Execute Command chmod +x /tmp/ipmitool |
Sridevi Ramesh | 0c34f69 | 2017-04-25 02:40:32 -0500 | [diff] [blame] | 263 | |
| 264 | Initiate Host Boot Via External IPMI |
| 265 | [Documentation] Initiate host power on using external IPMI. |
Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 266 | [Arguments] ${wait}=${1} |
| 267 | # Description of argument(s): |
| 268 | # wait Indicates that this keyword should wait for host running state. |
| 269 | |
Sridevi Ramesh | 0c34f69 | 2017-04-25 02:40:32 -0500 | [diff] [blame] | 270 | ${output}= Run External IPMI Standard Command chassis power on |
| 271 | Should Not Contain ${output} Error |
Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 272 | |
| 273 | Run Keyword If '${wait}' == '${0}' Return From Keyword |
| 274 | Wait Until Keyword Succeeds 10 min 10 sec Is Host Running |
Sridevi Ramesh | 0c34f69 | 2017-04-25 02:40:32 -0500 | [diff] [blame] | 275 | |
| 276 | Initiate Host PowerOff Via External IPMI |
| 277 | [Documentation] Initiate host power off using external IPMI. |
Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 278 | [Arguments] ${wait}=${1} |
| 279 | # Description of argument(s): |
| 280 | # wait Indicates that this keyword should wait for host off state. |
| 281 | |
Sridevi Ramesh | 0c34f69 | 2017-04-25 02:40:32 -0500 | [diff] [blame] | 282 | ${output}= Run External IPMI Standard Command chassis power off |
| 283 | Should Not Contain ${output} Error |
Rahul Maheshwari | 982fee4 | 2017-05-03 00:33:15 -0500 | [diff] [blame] | 284 | |
| 285 | Run Keyword If '${wait}' == '${0}' Return From Keyword |
| 286 | Wait Until Keyword Succeeds 3 min 10 sec Is Host Off |
| 287 | |
| 288 | Get Host State Via External IPMI |
| 289 | [Documentation] Returns host state using external IPMI. |
| 290 | |
| 291 | ${output}= Run External IPMI Standard Command chassis power status |
| 292 | Should Not Contain ${output} Error |
| 293 | ${output}= Fetch From Right ${output} ${SPACE} |
| 294 | |
| 295 | [Return] ${output} |
George Keishing | b4d4a4a | 2018-08-27 13:35:39 -0500 | [diff] [blame] | 296 | |
| 297 | |
| 298 | Set BMC Network From Host |
| 299 | [Documentation] Set BMC network from host. |
| 300 | [Arguments] ${nw_info} |
| 301 | |
| 302 | # Description of argument(s): |
| 303 | # nw_info A dictionary containing the network information to apply. |
| 304 | |
| 305 | Run Inband IPMI Standard Command |
| 306 | ... lan set 1 ipaddr ${nw_info['IP Address']} |
| 307 | |
| 308 | Run Inband IPMI Standard Command |
| 309 | ... lan set 1 netmask ${nw_info['Subnet Mask']} |
| 310 | |
| 311 | Run Inband IPMI Standard Command |
| 312 | ... lan set 1 defgw ipaddr ${nw_info['Default Gateway IP']} |