Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 1 | *** Settings *** |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 2 | Documentation Verify openbmctool.py functionality. |
Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 3 | |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 4 | # This module tests the functionality of openbmctool.py. |
George Keishing | 7c6342b | 2018-11-02 14:27:13 -0500 | [diff] [blame] | 5 | # The following tests are performed: |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 6 | # |
| 7 | # FRU status |
| 8 | # FRU print |
| 9 | # FRU list |
| 10 | # FRU list of a single FRU |
| 11 | # sensors print |
| 12 | # sensors list |
| 13 | # sensors list of a single sensor |
| 14 | # health check |
| 15 | # service data |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 16 | # remote logging |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 17 | # |
| 18 | # It is the responsibility of the user to include openbmctool.py's |
| 19 | # directory PATH in $PATH. |
| 20 | # |
| 21 | # Test Parameters: |
| 22 | # OPENBMC_HOST The BMC host name or IP address. |
| 23 | # OPENBMC_USERNAME The username to login to the BMC. |
| 24 | # OPENBMC_PASSWORD Password for OPENBMC_USERNAME. |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 25 | # LOGGING_HOST The hostname or IP address of the remote |
| 26 | # logging server. The default value is |
| 27 | # '10.10.10.10'. |
| 28 | # LOGGING_PORT The port number for remote logging on the |
| 29 | # LOGGING_HOST. The default value is '514'. |
| 30 | |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 31 | |
| 32 | # TODO: |
| 33 | # chassis tests |
| 34 | # sel tests |
| 35 | # dump |
| 36 | # bmc (same as mc) |
| 37 | # gardclear |
| 38 | # firmware commands |
| 39 | |
| 40 | |
| 41 | Library String |
| 42 | Library OperatingSystem |
| 43 | Library ../lib/gen_print.py |
| 44 | Library ../lib/gen_robot_print.py |
| 45 | Library ../lib/openbmctool_utils.py |
| 46 | Library ../lib/gen_misc.py |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 47 | Library ../lib/gen_robot_valid.py |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 48 | Resource ../syslib/utils_os.robot |
| 49 | Resource ../lib/resource.txt |
| 50 | |
| 51 | |
| 52 | Suite Setup Suite Setup Execution |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 53 | Test Setup Rprintn |
Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 54 | |
| 55 | *** Variables *** |
| 56 | |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 57 | ${min_number_items} ${30} |
| 58 | ${min_number_sensors} ${15} |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 59 | ${LOGGING_HOST} 10.10.10.10 |
| 60 | ${LOGGING_PORT} 514 |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 61 | |
Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 62 | |
| 63 | *** Test Cases *** |
| 64 | |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 65 | Verify Openbmctool FRU Commands |
| 66 | [Documentation] Verify FRU commands work. |
| 67 | [Tags] Verify_Openbmctool_FRU_Commands |
Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 68 | |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 69 | Verify FRU Status |
| 70 | Verify FRU Print |
| 71 | Verify FRU List |
| 72 | # Verify FRU List With Single FRU |
| 73 | # Known issue - openbmctool.py FRU list with single FRU is not working yet. |
| 74 | # See https://github.com/openbmc/openbmc-tools/issues/32. |
| 75 | |
| 76 | |
| 77 | Verify Openbmctool Sensors Commands |
| 78 | [Documentation] Verify sensors commands work. |
| 79 | [Tags] Verify_Openbmctool_Sensors_Commands |
| 80 | |
| 81 | Verify Sensors Print |
| 82 | Verify Sensors List |
| 83 | # Verify Sensors List With Single Sensor |
| 84 | # Known issue - openbmctool.py sensors list with single sensor is |
| 85 | # not working yet. See https://github.com/openbmc/openbmc-tools/issues/33. |
| 86 | |
| 87 | |
| 88 | Verify Openbmctool Health Check Commands |
| 89 | [Documentation] Verify health check command works. |
| 90 | [Tags] Verify_Openbmctool_Health_Check_Commands |
| 91 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 92 | ${health_results}= Get Health Check verify=${1} |
| 93 | Rprint Vars health_results |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 94 | |
| 95 | |
| 96 | Verify Openbmctool Service Data Commands |
| 97 | [Documentation] Verify collect service data command works. |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 98 | [Tags] Verify_Openbmctool_Service_Data_Commands |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 99 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 100 | ${service_paths}= Collect Service Data verify=${1} |
| 101 | Rprint Vars service_paths |
| 102 | |
| 103 | |
| 104 | Verify Openbmctool Remote Logging Operations |
| 105 | [Documentation] Verify logging commands work. |
| 106 | [Tags] Verify_Openbmctool_Remote_Logging_Operations |
| 107 | |
| 108 | # Verify Logging View |
| 109 | ${remote_logging_view}= Get Remote Logging View verify=${True} |
| 110 | |
| 111 | # Save previous remote logging settings, if any. |
| 112 | ${remote_config}= Get Remote Logging Settings |
| 113 | |
| 114 | # Enable remote logging and verify. |
| 115 | Verify Logging Parameters ${LOGGING_HOST} ${LOGGING_PORT} |
| 116 | |
| 117 | # Disable remote logging and verify. Disable will clear any |
| 118 | # previous settings. |
| 119 | Verify Logging Disable ${LOGGING_HOST} |
| 120 | |
| 121 | # Set original parameters back, if any. |
| 122 | Run Keyword If ${remote_config} |
| 123 | ... Verify Logging Parameters |
| 124 | ... ${remote_config['Address']} ${remote_config['Port']} |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 125 | |
| 126 | |
| 127 | *** Keywords *** |
| 128 | |
| 129 | |
| 130 | Verify FRU Status |
| 131 | [Documentation] Verify that the 'fru status' command works. |
| 132 | |
| 133 | ${fru_status}= Get Fru Status |
| 134 | ${num_frus}= Get Length ${fru_status} |
| 135 | Rprint Vars num_frus |
| 136 | Check Greater Than Minimum ${num_frus} ${min_number_items} frus |
| 137 | |
| 138 | |
| 139 | Verify FRU Print |
| 140 | [Documentation] Verify that the 'fru print' command works. |
| 141 | |
| 142 | ${rc} ${num_frus}= Openbmctool Execute Command |
| 143 | ... fru print | wc -l |
| 144 | Rprint Vars num_frus |
| 145 | Check Greater Than Minimum ${num_frus} ${min_number_items} frus |
| 146 | |
| 147 | |
| 148 | Verify FRU List |
| 149 | [Documentation] Verify that the 'fru list' command works. |
| 150 | |
| 151 | # Note: The output from 'fru list' is the same as 'fru print'. |
| 152 | ${rc} ${num_frus}= Openbmctool Execute Command |
| 153 | ... fru list | wc -l |
| 154 | Rprint Vars num_frus |
| 155 | Check Greater Than Minimum ${num_frus} ${min_number_items} frus |
| 156 | |
| 157 | |
| 158 | Verify FRU List With Single FRU |
| 159 | [Documentation] Verify that 'fru list' with parameter works. |
| 160 | |
| 161 | # Get the name of one FRU, in this case the first one listed. |
| 162 | ${fru_status}= Get Fru Status |
| 163 | ${fruname}= Set Variable ${fru_status[0]['component']} |
| 164 | Rprint Vars fruname |
| 165 | Should Not Be Empty ${fruname} msg=Could not find a FRU. |
George Keishing | 7c6342b | 2018-11-02 14:27:13 -0500 | [diff] [blame] | 166 | # Get a fru list specifying just the FRU. |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 167 | ${rc} ${output}= Openbmctool Execute Command |
| 168 | ... fru list ${fruname} | wc -l |
| 169 | ${fru_detail}= Convert to Integer ${output} |
| 170 | Rprint Vars fru_detail |
| 171 | Should Be True ${fru_detail} <= ${min_number_items} |
| 172 | ... msg=Too many lines reported for fru status ${fruname} |
| 173 | Should Be True ${fru_detail} > ${4} |
| 174 | ... msg=Too few lines reported for fru status ${fruname} |
| 175 | |
| 176 | |
| 177 | Verify Sensors Print |
| 178 | [Documentation] Verify that sensors print works. |
| 179 | |
| 180 | ${sensor_status}= Get Sensors Print |
| 181 | ${num_sensors}= Get Length ${sensor_status} |
Michael Walsh | 98d56d1 | 2018-09-19 16:05:00 -0500 | [diff] [blame] | 182 | Rprint Vars num_sensors |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 183 | Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors |
| 184 | |
| 185 | |
| 186 | Verify Sensors List |
| 187 | [Documentation] Verify that sensors list works. |
| 188 | |
| 189 | # Note: The output from 'sensors list' is the same as 'sensors print'. |
| 190 | ${sensor_status}= Get Sensors List |
| 191 | ${num_sensors}= Get Length ${sensor_status} |
| 192 | Rprint Vars num_sensors |
| 193 | Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors |
| 194 | |
| 195 | |
| 196 | Verify Sensors List With Single Sensor |
| 197 | [Documentation] Verify that sensors list with parameter works. |
| 198 | |
| 199 | ${sensor}= Set Variable ambient |
| 200 | ${rc} ${num_sensors}= Openbmctool Execute Command |
| 201 | ... sensors list ${sensor} | wc -l |
| 202 | Rprint Vars sensor num_sensors |
| 203 | ${num_sensors}= Convert to Integer ${num_sensors} |
| 204 | Should Be True ${num_sensors} < ${10} |
| 205 | ... msg=Too many lines reported for list sensor ${sensor} |
| 206 | |
| 207 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 208 | Verify Logging Parameters |
| 209 | [Documentation] Verify remote_logging_config. |
| 210 | [Arguments] ${log_host} ${log_port} |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 211 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 212 | # Description of argument(s): |
| 213 | # log_host The host name or IP address of remote logging server. |
| 214 | # log_port The port number for remote logging on log_host. |
| 215 | |
| 216 | ${rc} ${result}= Openbmctool Execute Command JSON |
| 217 | ... logging remote_logging_config -a ${log_host} -p ${log_port} |
| 218 | ... print_output=${False} ignore_err=${False} |
| 219 | |
| 220 | ${remote_logging_view}= Get Remote Logging View verify=${True} |
| 221 | |
| 222 | Rvalid Value remote_logging_view['Address'] valid_values=['${log_host}'] |
| 223 | Rvalid Value remote_logging_view['Port'] valid_values=[int(${log_port})] |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 224 | |
| 225 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 226 | Verify Logging Disable |
| 227 | [Documentation] Verify remote_logging disable |
| 228 | [Arguments] ${log_host} |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 229 | |
Steven Sombar | bd049cb | 2018-10-07 20:40:39 -0500 | [diff] [blame] | 230 | # Description of argument(s): |
| 231 | # log_host The host name or IP address of remote logging server. |
| 232 | |
| 233 | ${rc} ${result}= Openbmctool Execute Command JSON |
| 234 | ... logging remote_logging disable |
| 235 | |
| 236 | ${remote_logging_view}= Get Remote Logging View verify=${True} |
| 237 | Rvalid Value remote_logging_view['Address'] valid_values=[''] |
| 238 | |
| 239 | |
| 240 | Get Remote Logging Settings |
| 241 | [Documentation] Return the remote config settings as a dictionary |
| 242 | ... if active. Otherwise, return ${False}. |
| 243 | |
| 244 | ${remote_config}= Read Properties ${BMC_LOGGING_URI}config/remote |
| 245 | Return From Keyword If |
| 246 | ... '${remote_config["Address"]}' == '' or '${remote_config["Port"]}' == '0' |
| 247 | ... ${False} |
| 248 | |
| 249 | [Return] ${remote_config} |
Steven Sombar | 15d1b9d | 2018-09-26 11:39:24 -0500 | [diff] [blame] | 250 | |
| 251 | |
| 252 | Check Greater Than Minimum |
| 253 | [Documentation] Value should be greater than minimum, otherwise fail. |
| 254 | [Arguments] ${value_to_test} ${minimum_value} ${label} |
| 255 | |
| 256 | # Description of argument(s): |
| 257 | # value_to_test Value to compare to the minimum. |
| 258 | # minimum_value The minimum acceptable value. |
| 259 | # label Name to print if failure. |
| 260 | |
| 261 | ${value_to_test}= Convert to Integer ${value_to_test} |
| 262 | Should Be True ${value_to_test} > ${minimum_value} |
| 263 | ... msg=There should be at least ${minimum_value} ${label}. |
| 264 | |
| 265 | |
| 266 | Suite Setup Execution |
| 267 | [Documentation] Verify connectivity to run openbmctool commands. |
| 268 | |
| 269 | # Verify connectivity to the BMC host. |
| 270 | ${bmc_version}= Run Keyword And Ignore Error Get BMC Version |
| 271 | Run Keyword If '${bmc_version[0]}' == 'FAIL' Fail |
| 272 | ... msg=Could not connect to BMC ${OPENBMC_HOST} to get firmware version. |
| 273 | |
| 274 | # Verify can find the openbmctool. |
| 275 | ${openbmctool_file_path}= which openbmctool.py |
| 276 | Rprintn |
| 277 | Rprint Vars openbmctool_file_path |
| 278 | |
| 279 | # Get the version number from openbmctool. |
| 280 | ${openbmctool_version}= Get Openbmctool Version |
| 281 | |
| 282 | Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1] |