manashsarma | 8b5d680 | 2020-03-09 04:09:15 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Verify Redfish tool functionality. |
| 3 | |
| 4 | # The following tests are performed: |
| 5 | # |
| 6 | # sensors list |
| 7 | # health check |
| 8 | # |
| 9 | # directory PATH in $PATH. |
| 10 | # |
| 11 | # Test Parameters: |
| 12 | # OPENBMC_HOST The BMC host name or IP address. |
| 13 | # OPENBMC_USERNAME The username to login to the BMC. |
| 14 | # OPENBMC_PASSWORD Password for OPENBMC_USERNAME. |
| 15 | # |
| 16 | # We use DMTF redfishtool for writing openbmc automation test cases. |
| 17 | # DMTF redfishtool is a commandline tool that implements the client |
| 18 | # side of the Redfish RESTful API for Data Center Hardware Management. |
| 19 | |
| 20 | Library String |
| 21 | Library OperatingSystem |
| 22 | |
| 23 | Suite Setup Suite Setup Execution |
| 24 | |
| 25 | *** Variables *** |
| 26 | |
| 27 | ${root_cmd_args} redfishtool raw -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S Always |
| 28 | ${HTTTP_ERROR} Error |
| 29 | ${min_number_sensors} ${15} |
| 30 | |
| 31 | *** Test Cases *** |
| 32 | |
| 33 | Verify Redfishtool Sensor Commands |
| 34 | [Documentation] Verify redfishtool's sensor commands. |
| 35 | [Tags] Verify_Redfishtool_Sensor_Commands |
| 36 | |
| 37 | ${sensor_status}= Redfishtool Get /redfish/v1/Chassis/chassis/Sensors |
| 38 | ${json_object}= Evaluate json.loads('''${sensor_status}''') json |
| 39 | Should Be True ${json_object["Members@odata.count"]} > ${min_number_sensors} |
| 40 | ... msg=There should be at least ${min_number_sensors} sensors. |
| 41 | |
| 42 | Verify Redfishtool Health Check Commands |
| 43 | [Documentation] Verify redfishtool's health check command. |
| 44 | [Tags] Verify_Redfishtool_Health_Check_Commands |
| 45 | |
| 46 | ${chassis_data}= Redfishtool Get /redfish/v1/Chassis/chassis/ |
| 47 | ${json_object}= Evaluate json.loads('''${chassis_data}''') json |
| 48 | ${status}= Set Variable ${json_object["Status"]} |
| 49 | Should Be Equal OK ${status["Health"]} |
| 50 | ... msg=Health status should be OK. |
| 51 | |
| 52 | *** Keywords *** |
| 53 | |
| 54 | Redfishtool Get |
| 55 | [Documentation] Return the output of redfishtool for GET operation. |
| 56 | [Arguments] ${uri} ${cmd_args}=${root_cmd_args} |
| 57 | |
| 58 | # Description of argument(s): |
| 59 | # uri URI for GET operation. |
| 60 | # cmd_args redfishtool command arguments. |
| 61 | |
| 62 | ${cmd_output}= Run ${cmd_args} GET ${uri} |
| 63 | [Return] ${cmd_output} |
| 64 | |
| 65 | Suite Setup Execution |
| 66 | [Documentation] Do suite setup execution. |
| 67 | |
| 68 | ${tool_exist}= Run which redfishtool |
| 69 | Should Not Be Empty ${tool_exist} |