George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 1 | *** Settings *** |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 2 | Documentation Keywords for system test. |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 3 | |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 4 | Library ../lib/gen_robot_keyword.py |
Steven Sombar | 07be374 | 2018-01-11 13:02:40 -0600 | [diff] [blame] | 5 | Resource ../lib/boot_utils.robot |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 6 | Resource ../extended/obmc_boot_test_resource.robot |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 7 | Resource ../lib/utils.robot |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 8 | Resource ../lib/state_manager.robot |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 9 | Resource ../lib/rest_client.robot |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 10 | Resource resource.txt |
George Keishing | 4ef2908 | 2017-05-13 05:01:23 -0500 | [diff] [blame] | 11 | Library OperatingSystem |
| 12 | Library DateTime |
| 13 | |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 14 | *** Variables *** |
| 15 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 16 | ${htx_log_dir_path} ${EXECDIR}${/}logs${/} |
George Keishing | 4ef2908 | 2017-05-13 05:01:23 -0500 | [diff] [blame] | 17 | |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 18 | # Error strings to check from dmesg. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 19 | ${ERROR_REGEX} error|GPU|NVRM|nvidia |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 20 | |
| 21 | # GPU specific error message from dmesg. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 22 | ${ERROR_DBE_MSG} (DBE) has been detected on GPU |
| 23 | |
| 24 | # Inventory - List of I/O devices to collect for Inventory |
| 25 | @{I/O} communication disk display generic input multimedia |
| 26 | ... network printer tape |
| 27 | |
| 28 | # Inventory Paths of the JSON and YAML files |
Steven Sombar | a2f166c | 2017-08-02 14:22:45 -0500 | [diff] [blame] | 29 | ${json_tmp_file_path} ${EXECDIR}/inventory_temp_file.json |
| 30 | ${yaml_file_path} ${EXECDIR}/inventory_temp_file.yaml |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 31 | |
| 32 | |
George Keishing | 4ef2908 | 2017-05-13 05:01:23 -0500 | [diff] [blame] | 33 | |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 34 | *** Keywords *** |
| 35 | |
| 36 | Execute Command On OS |
| 37 | [Documentation] Execute given command on OS and return output. |
| 38 | [Arguments] ${command} |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 39 | # Description of argument(s): |
| 40 | # command Shell command to be executed on OS. |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 41 | ${stdout} ${stderr}= Execute Command ${command} return_stderr=True |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 42 | Should Be Empty ${stderr} msg=Failed running ${command}. stderr=${stderr} |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 43 | [Return] ${stdout} |
| 44 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 45 | |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 46 | Login To OS |
| 47 | [Documentation] Login to OS Host. |
| 48 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 49 | ... ${os_password}=${OS_PASSWORD} |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 50 | ... ${alias_name}=os_connection |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 51 | # Description of argument(s): |
| 52 | # os_host IP address of the OS Host. |
| 53 | # os_username OS Host Login user name. |
| 54 | # os_password OS Host Login passwrd. |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 55 | # alias_name Default OS SSH session connection alias name. |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 56 | |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 57 | Ping Host ${os_host} |
George Keishing | 664a016 | 2017-06-05 12:24:24 -0500 | [diff] [blame] | 58 | SSHLibrary.Open Connection ${os_host} alias=${alias_name} |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 59 | Login ${os_username} ${os_password} |
| 60 | |
| 61 | |
George Keishing | 88366b3 | 2017-05-12 13:50:48 -0500 | [diff] [blame] | 62 | Tool Exist |
| 63 | [Documentation] Check whether given tool is installed on OS. |
| 64 | [Arguments] ${tool_name} |
| 65 | # Description of argument(s): |
| 66 | # tool_name Tool name whose existence is to be checked. |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 67 | Login To OS |
George Keishing | 88366b3 | 2017-05-12 13:50:48 -0500 | [diff] [blame] | 68 | ${output}= Execute Command On OS which ${tool_name} |
| 69 | Should Contain ${output} ${tool_name} |
| 70 | ... msg=Please install ${tool_name} tool. |
George Keishing | 91c852f | 2017-05-03 02:48:21 -0500 | [diff] [blame] | 71 | |
| 72 | |
| 73 | Boot To OS |
| 74 | [Documentation] Boot host OS. |
| 75 | Run Key OBMC Boot Test \ REST Power On |
| 76 | |
| 77 | |
| 78 | Power Off Host |
| 79 | [Documentation] Power off host. |
| 80 | Run Key OBMC Boot Test \ REST Power Off |
George Keishing | 0fff68a | 2017-04-27 22:25:49 -0500 | [diff] [blame] | 81 | |
George Keishing | 6fec3ab | 2017-05-05 10:45:08 -0500 | [diff] [blame] | 82 | |
| 83 | File Exist On OS |
| 84 | [Documentation] Check if the given file path exist on OS. |
| 85 | [Arguments] ${file_path} |
| 86 | # Description of argument(s): |
| 87 | # file_path Absolute file path. |
| 88 | |
| 89 | Login To OS |
| 90 | ${out}= Execute Command On OS ls ${file_path} |
| 91 | Log To Console \n File Exist: ${out} |
| 92 | |
George Keishing | 8740a0c | 2017-05-13 07:19:16 -0500 | [diff] [blame] | 93 | |
| 94 | Is HTX Running |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 95 | [Documentation] Return "True" if the HTX is running, "False" |
| 96 | ... otherwise. |
| 97 | |
| 98 | # Example usage: |
| 99 | # ${status}= Is HTX Running |
| 100 | # Run Keyword If '${status}' == 'True' Shutdown HTX Exerciser |
| 101 | |
George Keishing | 8740a0c | 2017-05-13 07:19:16 -0500 | [diff] [blame] | 102 | |
| 103 | ${status}= Execute Command On OS htxcmdline -status |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 104 | |
| 105 | ${match_count_idle}= Count Values In List ${status} |
| 106 | ... Daemon state is <IDLE> |
| 107 | ${match_count_not_running}= Count Values In List ${status} |
| 108 | ... No MDT is currently running |
| 109 | ${running}= Evaluate |
| 110 | ... not (${match_count_idle} or ${match_count_not_running}) |
| 111 | [Return] ${running} |
George Keishing | 4ef2908 | 2017-05-13 05:01:23 -0500 | [diff] [blame] | 112 | |
| 113 | |
| 114 | Write Log Data To File |
| 115 | [Documentation] Write log data to the logs directory. |
| 116 | [Arguments] ${data}= ${log_file_path}= |
| 117 | # Description of argument(s): |
| 118 | # data String buffer. |
| 119 | # log_file_path The log file path. |
| 120 | |
| 121 | Create File ${log_file_path} ${data} |
| 122 | |
| 123 | |
| 124 | Collect HTX Log Files |
| 125 | [Documentation] Collect status and error log files. |
| 126 | # Collects the following files: |
| 127 | # HTX error log file /tmp/htxerr |
| 128 | # HTX status log file /tmp/htxstats |
| 129 | |
| 130 | # Create logs directory and get current datetime. |
| 131 | Create Directory ${htx_log_dir_path} |
| 132 | ${cur_datetime}= Get Current Date result_format=%Y%m%d%H%M%S%f |
| 133 | |
| 134 | File Exist On OS /tmp/htxerr |
| 135 | ${htx_err}= Execute Command On BMC cat /tmp/htxerr |
| 136 | Write Log Data To File |
| 137 | ... ${htx_err} ${htx_log_dir_path}/${OS_HOST}${cur_datetime}.htxerr |
| 138 | |
| 139 | File Exist On OS /tmp/htxstats |
| 140 | ${htx_stats}= Execute Command On BMC cat /tmp/htxstats |
| 141 | Write Log Data To File |
| 142 | ... ${htx_stats} ${htx_log_dir_path}/${OS_HOST}_${cur_datetime}.htxstats |
| 143 | |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 144 | |
| 145 | REST Upload File To BMC |
| 146 | [Documentation] Upload a file via REST to BMC. |
| 147 | |
| 148 | # Generate 32 MB file size |
| 149 | Run dd if=/dev/zero of=dummyfile bs=1 count=0 seek=32MB |
| 150 | OperatingSystem.File Should Exist dummyfile |
| 151 | |
| 152 | # Get the content of the file and upload to BMC |
| 153 | ${image_data}= OperatingSystem.Get Binary File dummyfile |
| 154 | |
| 155 | # Get REST session to BMC |
| 156 | Initialize OpenBMC |
| 157 | |
| 158 | # Create the REST payload headers and data |
| 159 | ${data}= Create Dictionary data ${image_data} |
| 160 | ${headers}= Create Dictionary Content-Type=application/octet-stream |
| 161 | ... Accept=application/octet-stream |
| 162 | Set To Dictionary ${data} headers ${headers} |
| 163 | |
| 164 | ${resp}= Post Request openbmc /upload/image &{data} |
| 165 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 166 | ... msg=Openbmc /upload/image failed. |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 167 | |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 168 | # Take SSH connection to BMC and switch to BMC connection to perform |
| 169 | # the task. |
| 170 | &{bmc_connection_args}= Create Dictionary alias=bmc_connection |
| 171 | Open Connection And Log In &{bmc_connection_args} |
| 172 | |
| 173 | # Currently OS SSH session is active, switch to BMC connection. |
| 174 | Switch Connection bmc_connection |
George Keishing | cff7aa0 | 2017-05-16 08:05:10 -0500 | [diff] [blame] | 175 | |
| 176 | # Switch back to OS SSH connection. |
| 177 | Switch Connection os_connection |
| 178 | |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 179 | |
Steven Sombar | 1dc6fa7 | 2018-01-12 10:58:20 -0600 | [diff] [blame] | 180 | Get CPU Min Frequency Limit |
| 181 | [Documentation] Get CPU minimum assignable frequency. |
| 182 | |
| 183 | # lscpu | grep min returns |
| 184 | # CPU min MHz: 1983.0000 |
| 185 | |
| 186 | ${cmd}= Catenate lscpu | grep min | tr -dc '0-9.\n' |
| 187 | ${cpu_freq} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 188 | [Return] ${cpu_freq} |
| 189 | |
| 190 | |
| 191 | Get CPU Min Frequency |
| 192 | [Documentation] Get CPU assigned minimum frequency. |
| 193 | |
| 194 | # ppc64_cpu --frequency -t 10 returns |
| 195 | # min: 3.295 GHz (cpu 143) |
| 196 | # max: 3.295 GHz (cpu 0) |
| 197 | # avg: 3.295 GHz |
| 198 | |
| 199 | ${cmd}= Catenate ppc64_cpu --frequency -t 10 | grep min |
| 200 | ... | cut -f 2 | cut -d ' ' -f 1 | tr -dc '0-9\n' |
| 201 | ${cpu_freq} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 202 | [Return] ${cpu_freq} |
| 203 | |
| 204 | |
| 205 | Get CPU Max Frequency Limit |
| 206 | [Documentation] Get CPU maximum assignable frequency. |
| 207 | |
| 208 | # lscpu | grep max returns |
| 209 | # CPU max MHz: 3300.0000 |
| 210 | |
| 211 | ${cmd}= Catenate lscpu | grep max | tr -dc '0-9.\n' |
| 212 | ${cpu_freq} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 213 | [Return] ${cpu_freq} |
| 214 | |
| 215 | |
| 216 | Get CPU Max Frequency |
| 217 | [Documentation] Get CPU assigned maximum frequency. |
| 218 | |
| 219 | # ppc64_cpu --frequency -t 10 returns |
| 220 | # min: 3.295 GHz (cpu 143) |
| 221 | # max: 3.295 GHz (cpu 0) |
| 222 | # avg: 3.295 GHz |
| 223 | |
| 224 | ${cmd}= Catenate ppc64_cpu --frequency -t 10 | grep max |
| 225 | ... | cut -f 2 | cut -d ' ' -f 1 | tr -dc '0-9\n' |
| 226 | ${cpu_freq} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 227 | [Return] ${cpu_freq} |
| 228 | |
| 229 | |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 230 | Check For Errors On OS Dmesg Log |
| 231 | [Documentation] Check if dmesg has nvidia errors logged. |
| 232 | |
| 233 | ${dmesg_log}= Execute Command On OS dmesg | egrep '${ERROR_REGEX}' |
| 234 | # To enable multiple string check. |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 235 | Should Not Contain ${dmesg_log} ${ERROR_DBE_MSG} |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 236 | ... msg=OS dmesg shows ${ERROR_DBE_MSG}. |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 237 | |
| 238 | |
| 239 | Collect NVIDIA Log File |
| 240 | [Documentation] Collect ndivia-smi command output. |
George Keishing | 664a016 | 2017-06-05 12:24:24 -0500 | [diff] [blame] | 241 | [Arguments] ${suffix} |
| 242 | # Description of argument(s): |
| 243 | # suffix String name to append. |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 244 | |
| 245 | # Collects the output of ndivia-smi cmd output. |
Steven Sombar | e27cca9 | 2018-02-28 10:56:38 -0600 | [diff] [blame] | 246 | # +--------------------------------------------------------------------+ |
| 247 | # | NVIDIA-SMI 361.89 Driver Version: 361.89 | |
| 248 | # |-------------------------------+----------------------+-------------+ |
| 249 | # | GPU Name Persistence-M| Bus-Id Disp.A | GPU ECC | |
| 250 | # | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | Utiliz err | |
| 251 | # |===============================+======================+=============| |
| 252 | # | 0 Tesla P100-SXM2... On | 0002:01:00.0 Off | 0 | |
| 253 | # | N/A 25C P0 35W / 300W | 931MiB / 16280MiB | 0% Default | |
| 254 | # +-------------------------------+----------------------+-------------+ |
| 255 | # | 1 Tesla P100-SXM2... On | 0003:01:00.0 Off | 0 | |
| 256 | # | N/A 26C P0 40W / 300W | 1477MiB / 16280MiB | 0% Default | |
| 257 | # +-------------------------------+----------------------+-------------+ |
| 258 | # | 2 Tesla P100-SXM2... On | 0006:01:00.0 Off | 0 | |
| 259 | # | N/A 25C P0 35W / 300W | 931MiB / 16280MiB | 0% Default | |
| 260 | # +-------------------------------+----------------------+-------------+ |
| 261 | # | 3 Tesla P100-SXM2... On | 0007:01:00.0 Off | 0 | |
| 262 | # | N/A 44C P0 290W / 300W | 965MiB / 16280MiB | 0% Default | |
| 263 | # +-------------------------------+----------------------+-------------+ |
| 264 | # +--------------------------------------------------------------------+ |
| 265 | # | Processes: GPU Memory | |
| 266 | # | GPU PID Type Process name Usage | |
| 267 | # |====================================================================| |
| 268 | # | 0 28459 C hxenvidia 929MiB | |
| 269 | # | 1 28460 C hxenvidia 1475MiB | |
| 270 | # | 2 28461 C hxenvidia 929MiB | |
| 271 | # | 3 28462 C hxenvidia 963MiB | |
| 272 | # +--------------------------------------------------------------------+ |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 273 | |
| 274 | # Create logs directory and get current datetime. |
| 275 | Create Directory ${htx_log_dir_path} |
| 276 | ${cur_datetime}= Get Current Date result_format=%Y%m%d%H%M%S%f |
| 277 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 278 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command nvidia-smi |
George Keishing | 4bbf520 | 2017-05-18 06:55:53 -0500 | [diff] [blame] | 279 | Write Log Data To File |
George Keishing | 664a016 | 2017-06-05 12:24:24 -0500 | [diff] [blame] | 280 | ... ${nvidia_out} |
| 281 | ... ${htx_log_dir_path}/${OS_HOST}_${cur_datetime}.nvidia_${suffix} |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 282 | |
| 283 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 284 | Get GPU Power Limit |
| 285 | [Documentation] Get NVIDIA GPU maximum permitted power draw. |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 286 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 287 | # nvidia-smi --query-gpu=power.limit --format=csv returns |
| 288 | # power.limit [W] |
| 289 | # 300.00 W |
| 290 | # 300.00 W |
| 291 | # 300.00 W |
| 292 | # 300.00 W |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 293 | |
Steven Sombar | 0278b13 | 2018-01-09 14:41:32 -0600 | [diff] [blame] | 294 | ${cmd}= Catenate nvidia-smi --query-gpu=power.limit |
| 295 | ... --format=csv | cut -f 1 -d ' ' | sort -n -u | tail -n 1 |
| 296 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 297 | # Allow for sensor overshoot. That is, max power reported for |
| 298 | # a GPU could be a few watts above the limit. |
| 299 | ${power_max}= Evaluate ${nvidia_out}+${7.00} |
| 300 | [Return] ${power_max} |
| 301 | |
| 302 | |
| 303 | Get GPU Power |
| 304 | [Documentation] Get the GPU power dissipation. |
| 305 | |
| 306 | # nvidia-smi --query-gpu=power.draw --format=csv returns |
| 307 | # power.draw [W] |
| 308 | # 34.12 W |
| 309 | # 34.40 W |
| 310 | # 36.55 W |
| 311 | # 36.05 W |
| 312 | |
| 313 | ${cmd}= Catenate nvidia-smi --query-gpu=power.draw |
| 314 | ... --format=csv | cut -f 1 -d ' ' | sort -n -u | tail -n 1 |
| 315 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 316 | [Return] ${nvidia_out} |
| 317 | |
| 318 | |
| 319 | Get GPU Temperature Limit |
| 320 | [Documentation] Get NVIDIA GPU maximum permitted temperature. |
| 321 | |
| 322 | # nvidia-smi -q -d TEMPERATURE | grep "GPU Max" returns |
| 323 | # GPU Max Operating Temp : 83 C |
| 324 | # GPU Max Operating Temp : 83 C |
| 325 | # GPU Max Operating Temp : 83 C |
| 326 | # GPU Max Operating Temp : 83 C |
| 327 | |
| 328 | ${cmd}= Catenate nvidia-smi -q -d TEMPERATURE | grep "GPU Max" |
| 329 | ... | cut -f 2 -d ":" | tr -dc '0-9\n' | sort -n -u | tail -n 1 |
| 330 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 331 | [Return] ${nvidia_out} |
| 332 | |
| 333 | |
| 334 | Get GPU Temperature |
| 335 | [Documentation] Get the GPU temperature. |
| 336 | |
| 337 | # nvidia-smi --query-gpu=temperature.gpu --format=csv returns |
| 338 | # 38 |
| 339 | # 41 |
| 340 | # 38 |
| 341 | # 40 |
| 342 | |
| 343 | ${cmd}= Catenate nvidia-smi --query-gpu=temperature.gpu |
| 344 | ... --format=csv | sort -n -u | tail -n 1 |
| 345 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 346 | [Return] ${nvidia_out} |
| 347 | |
| 348 | |
| 349 | Get GPU Clock Limit |
| 350 | [Documentation] Get NVIDIA GPU maximum permitted graphics clock. |
| 351 | |
| 352 | # nvidia-smi --query-gpu=clocks.max.gr --format=csv returns |
| 353 | # 1530 MHz |
| 354 | # 1530 MHz |
| 355 | # 1530 MHz |
| 356 | # 1530 MHz |
| 357 | |
| 358 | ${cmd}= Catenate nvidia-smi --query-gpu=clocks.max.gr |
| 359 | ... --format=csv | cut -f 1 -d ' ' | sort -n -u | tail -n 1 |
| 360 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 361 | [Return] ${nvidia_out} |
| 362 | |
| 363 | |
| 364 | Get GPU Clock |
| 365 | [Documentation] Get the highest assigned value of the GPU graphics clock. |
| 366 | |
| 367 | # nvidia-smi --query-gpu=clocks.gr --format=csv returns |
| 368 | # 1230 MHz |
| 369 | # 1230 MHz |
| 370 | # 135 MHz |
| 371 | # 150 MHz |
| 372 | |
| 373 | ${cmd}= Catenate nvidia-smi --query-gpu=clocks.gr |
| 374 | ... --format=csv | cut -f 1 -d ' ' | sort -n -u | tail -n 1 |
| 375 | ${nvidia_out} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 376 | [Return] ${nvidia_out} |
| 377 | |
| 378 | |
| 379 | Count GPUs From BMC |
| 380 | [Documentation] Determine number of GPUs from the BMC. Hostboot |
| 381 | ... needs to have been run previously because the BMC gets GPU data |
| 382 | ... from Hostboot. |
| 383 | |
| 384 | # Example of gv* endpoint data: |
| 385 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card0": { |
| 386 | # "Functional": 1, |
| 387 | # "Present": 1, |
| 388 | # "PrettyName": "" |
| 389 | # }, |
| 390 | |
| 391 | ${num_bmc_gpus}= Set Variable ${0} |
| 392 | |
| 393 | ${gpu_list}= Get Endpoint Paths |
| 394 | ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv* |
| 395 | |
| 396 | :FOR ${gpu_uri} IN @{gpu_list} |
| 397 | \ ${present}= Read Attribute ${gpu_uri} Present |
| 398 | \ ${state}= Read Attribute ${gpu_uri} Functional |
| 399 | \ Rpvars gpu_uri present state |
| 400 | \ ${num_bmc_gpus}= Run Keyword If ${present} and ${state} |
| 401 | ... Evaluate ${num_bmc_gpus}+${1} |
| 402 | [Return] ${num_bmc_gpus} |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 403 | |
| 404 | |
| 405 | Create Default MDT Profile |
| 406 | [Documentation] Create default mdt.bu profile and run. |
| 407 | |
| 408 | Rprint Timen Create HTX mdt profile. |
| 409 | |
| 410 | ${profile}= Execute Command On OS htxcmdline -createmdt |
| 411 | Rprintn ${profile} |
| 412 | Should Contain ${profile} mdts are created successfully |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 413 | ... msg=Create MDT profile failed. response=${profile} |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 414 | |
| 415 | |
| 416 | Run MDT Profile |
| 417 | [Documentation] Load user pre-defined MDT profile. |
| 418 | |
| 419 | Rprint Timen Start HTX mdt profile execution. |
| 420 | ${htx_run}= Execute Command On OS |
| 421 | ... htxcmdline -run -mdt ${HTX_MDT_PROFILE} |
| 422 | Rprintn ${htx_run} |
| 423 | Should Contain ${htx_run} Activated |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 424 | ... msg=htxcmdline run mdt did not return "Activated" status. |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 425 | |
| 426 | |
| 427 | Check HTX Run Status |
| 428 | [Documentation] Get HTX exerciser status and check for error. |
Joy Onyerikwu | a807417 | 2018-04-20 07:08:19 -0500 | [diff] [blame] | 429 | [Arguments] ${sleep_time}=${EMPTY} |
| 430 | |
| 431 | # Description of argument(s): |
| 432 | # sleep_time The amount of time to sleep after checking status. |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 433 | |
| 434 | Rprint Timen Check HTX mdt Status and error. |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 435 | ${htx_status}= Execute Command On OS |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 436 | ... htxcmdline -status -mdt ${HTX_MDT_PROFILE} |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 437 | Rprintn ${htx_status} |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 438 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 439 | ${htx_errlog}= Execute Command On OS htxcmdline -geterrlog |
| 440 | Rprintn ${htx_errlog} |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 441 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 442 | Should Contain ${htx_errlog} file </tmp/htxerr> is empty |
| 443 | ... msg=HTX geterrorlog was not empty. |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 444 | |
Joy Onyerikwu | a807417 | 2018-04-20 07:08:19 -0500 | [diff] [blame] | 445 | Return From Keyword If ${sleep_time} == ${EMPTY} |
| 446 | |
| 447 | Run Key U Sleep \ ${sleep-time} |
| 448 | |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 449 | |
| 450 | Shutdown HTX Exerciser |
| 451 | [Documentation] Shut down HTX exerciser run. |
| 452 | |
| 453 | Rprint Timen Shutdown HTX Run |
| 454 | ${shutdown}= Execute Command On OS |
| 455 | ... htxcmdline -shutdown -mdt ${HTX_MDT_PROFILE} |
| 456 | Rprintn ${shutdown} |
Steven Sombar | e27cca9 | 2018-02-28 10:56:38 -0600 | [diff] [blame] | 457 | |
| 458 | ${match_count_no_mdt}= Count Values In List ${shutdown} |
| 459 | ... No MDT is currently running |
| 460 | ${match_count_success}= Count Values In List ${shutdown} |
| 461 | ... shutdown successfully |
| 462 | Run Keyword If ${match_count_no_mdt} == 0 and ${match_count_success} == 0 |
| 463 | ... Fail msg=Shutdown command returned unexpected message. |
| 464 | |
George Keishing | bbfec9e | 2017-05-17 10:47:21 -0500 | [diff] [blame] | 465 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 466 | Create JSON Inventory File |
| 467 | [Documentation] Create a JSON inventory file, and make a YAML copy. |
| 468 | [Arguments] ${json_file_path} |
| 469 | # Description of argument: |
| 470 | # json_file_path Where the inventory file is wrtten to. |
| 471 | |
| 472 | Login To OS |
| 473 | Compile Inventory JSON |
| 474 | Run json2yaml ${json_tmp_file_path} ${yaml_file_path} |
| 475 | # Format to JSON pretty print to file. |
| 476 | Run python -m json.tool ${json_tmp_file_path} > ${json_file_path} |
| 477 | OperatingSystem.File Should Exist ${json_file_path} |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 478 | ... msg=File ${json_file_path} does not exist. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 479 | |
| 480 | |
| 481 | Compile Inventory JSON |
| 482 | [Documentation] Compile the Inventory into a JSON file. |
| 483 | Create File ${json_tmp_file_path} |
| 484 | Write New JSON List ${json_tmp_file_path} Inventory |
| 485 | Retrieve HW Info And Write processor ${json_tmp_file_path} |
| 486 | Retrieve HW Info And Write memory ${json_tmp_file_path} |
| 487 | Retrieve HW Info And Write List ${I/O} ${json_tmp_file_path} I/O last |
| 488 | Close New JSON List ${json_tmp_file_path} |
| 489 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 490 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 491 | Write New JSON List |
| 492 | [Documentation] Start a new JSON list element in file. |
| 493 | [Arguments] ${json_tmp_file_path} ${json_field_name} |
| 494 | # Description of argument(s): |
| 495 | # json_tmp_file_path Name of file to write to. |
| 496 | # json_field_name Name to give json list element. |
| 497 | Append to File ${json_tmp_file_path} { "${json_field_name}" : [ |
| 498 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 499 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 500 | Close New JSON List |
| 501 | [Documentation] Close JSON list element in file. |
| 502 | [Arguments] ${json_tmp_file_path} |
| 503 | # Description of argument(s): |
| 504 | # json_tmp_file_path Path of file to write to. |
| 505 | Append to File ${json_tmp_file_path} ]} |
| 506 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 507 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 508 | Retrieve HW Info And Write |
| 509 | [Documentation] Retrieve and write info, add a comma if not last item. |
| 510 | [Arguments] ${class} ${json_tmp_file_path} ${last}=false |
| 511 | # Description of argument(s): |
| 512 | # class Device class to retrieve with lshw. |
| 513 | # json_tmp_file_path Path of file to write to. |
| 514 | # last Is this the last element in the parent JSON? |
| 515 | Write New JSON List ${json_tmp_file_path} ${class} |
| 516 | ${output} = Retrieve Hardware Info ${class} |
| 517 | ${output} = Clean Up String ${output} |
| 518 | Run Keyword if ${output.__class__ is not type(None)} |
| 519 | ... Append To File ${json_tmp_file_path} ${output} |
| 520 | Close New JSON List ${json_tmp_file_path} |
| 521 | Run Keyword if '${last}' == 'false' |
| 522 | ... Append to File ${json_tmp_file_path} , |
| 523 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 524 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 525 | Retrieve HW Info And Write List |
| 526 | [Documentation] Does a Retrieve/Write with a list of classes and |
| 527 | ... encapsulates them into one large JSON element. |
| 528 | [Arguments] ${list} ${json_tmp_file_path} ${json_field_name} |
| 529 | ... ${last}=false |
| 530 | # Description of argument(s): |
| 531 | # list The list of devices classes to retrieve with lshw. |
| 532 | # json_tmp_file_path Path of file to write to. |
| 533 | # json_field_name Name of the JSON element to encapsulate this list. |
| 534 | # last Is this the last element in the parent JSON? |
| 535 | Write New JSON List ${json_tmp_file_path} ${json_field_name} |
| 536 | : FOR ${class} IN @{list} |
| 537 | \ ${tail} Get From List ${list} -1 |
| 538 | \ Run Keyword if '${tail}' == '${class}' |
| 539 | \ ... Retrieve HW Info And Write ${class} ${json_tmp_file_path} true |
| 540 | \ ... ELSE Retrieve HW Info And Write ${class} ${json_tmp_file_path} |
| 541 | Close New JSON List ${json_tmp_file_path} |
| 542 | Run Keyword if '${last}' == 'false' |
| 543 | ... Append to File ${json_tmp_file_path} , |
| 544 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 545 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 546 | Retrieve Hardware Info |
| 547 | [Documentation] Retrieves the lshw output of the device class as JSON. |
| 548 | [Arguments] ${class} |
| 549 | # Description of argument(s): |
| 550 | # class Device class to retrieve with lshw. |
| 551 | ${output} = Execute Command On OS lshw -c ${class} -json |
| 552 | ${output} = Verify JSON string ${output} |
| 553 | [Return] ${output} |
| 554 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 555 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 556 | Verify JSON String |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 557 | [Documentation] Ensure the JSON string content is separated by commas. |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 558 | [Arguments] ${unver_string} |
| 559 | # Description of argument(s): |
| 560 | # unver_string JSON String we will be checking for lshw comma errors. |
| 561 | ${unver_string} = Convert to String ${unver_string} |
| 562 | ${ver_string} = Replace String Using Regexp ${unver_string} }\\s*{ },{ |
| 563 | [Return] ${ver_string} |
| 564 | |
Steven Sombar | 3ecb689 | 2018-03-23 11:41:08 -0500 | [diff] [blame] | 565 | |
Steven Sombar | 130a04f | 2017-07-16 10:02:37 -0500 | [diff] [blame] | 566 | Clean Up String |
| 567 | [Documentation] Remove extra whitespace and trailing commas. |
| 568 | [Arguments] ${dirty_string} |
| 569 | # Description of argument(s): |
| 570 | # dirty_string String that will be space stripped and have comma removed. |
| 571 | ${clean_string} = Strip String ${dirty_string} |
| 572 | ${last_char} = Get Substring ${clean_string} -1 |
| 573 | ${trimmed_string} = Get Substring ${clean_string} 0 -1 |
| 574 | ${clean_string} = Set Variable If '${last_char}' == ',' |
| 575 | ... ${trimmed_string} ${clean_string} |
| 576 | [Return] ${clean_string} |
Joy Onyerikwu | 4cb8c0a | 2018-04-11 18:05:13 -0500 | [diff] [blame] | 577 | |
| 578 | |
| 579 | Get OS Network Interface Names |
| 580 | [Documentation] Return a list of interface names on the OS. |
| 581 | |
| 582 | ${stdout} ${stderr} ${rc}= OS Execute Command ls /sys/class/net |
| 583 | @{interface_names}= Split String ${stdout} |
| 584 | [Return] @{interface_names} |