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