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