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