manashsarma | 9864c94 | 2020-05-26 06:58:59 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | |
| 4 | Documentation Verify Redfish tool general functionality. |
| 5 | |
| 6 | Library OperatingSystem |
| 7 | Library String |
| 8 | Library Collections |
| 9 | |
| 10 | Resource ../../lib/resource.robot |
| 11 | Resource ../../lib/bmc_redfish_resource.robot |
| 12 | Resource ../../lib/openbmc_ffdc.robot |
| 13 | |
| 14 | |
| 15 | Suite Setup Suite Setup Execution |
| 16 | |
| 17 | |
| 18 | *** Variables *** |
| 19 | |
| 20 | |
| 21 | ${root_cmd_args} = SEPARATOR= |
| 22 | ... redfishtool raw -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S Always |
| 23 | ${min_number_sensors} ${15} |
| 24 | |
| 25 | |
| 26 | *** Test Cases *** |
| 27 | |
| 28 | Verify Redfishtool Sensor Commands |
| 29 | [Documentation] Verify redfishtool's sensor commands. |
| 30 | [Tags] Verify_Redfishtool_Sensor_Commands |
| 31 | |
| 32 | ${sensor_status}= Redfishtool Get /redfish/v1/Chassis/chassis/Sensors |
| 33 | ${json_object}= Evaluate json.loads('''${sensor_status}''') json |
| 34 | Should Be True ${json_object["Members@odata.count"]} > ${min_number_sensors} |
| 35 | ... msg=There should be at least ${min_number_sensors} sensors. |
| 36 | |
| 37 | |
| 38 | Verify Redfishtool Health Check Commands |
| 39 | [Documentation] Verify redfishtool's health check command. |
| 40 | [Tags] Verify_Redfishtool_Health_Check_Commands |
| 41 | |
| 42 | ${chassis_data}= Redfishtool Get /redfish/v1/Chassis/chassis/ |
| 43 | ${json_object}= Evaluate json.loads('''${chassis_data}''') json |
| 44 | ${status}= Set Variable ${json_object["Status"]} |
| 45 | Should Be Equal OK ${status["Health"]} |
| 46 | ... msg=Health status should be OK. |
| 47 | |
| 48 | |
| 49 | *** Keywords *** |
| 50 | |
| 51 | |
| 52 | Is HTTP error Expected |
| 53 | [Documentation] Check if the HTTP error is expected. |
| 54 | [Arguments] ${cmd_output} ${error_expected} |
| 55 | |
| 56 | # Description of argument(s): |
| 57 | # cmd_output Output of an HTTP operation. |
| 58 | # error_expected Expected error. |
| 59 | |
| 60 | @{words} = Split String ${error_expected} , |
| 61 | @{errorString}= Split String ${cmd_output} ${SPACE} |
| 62 | Should Contain Any ${errorString} @{words} |
| 63 | |
| 64 | |
| 65 | Redfishtool Get |
| 66 | [Documentation] Execute redfishtool for GET operation. |
| 67 | [Arguments] ${uri} ${cmd_args}=${root_cmd_args} ${expected_error}="" |
| 68 | |
| 69 | # Description of argument(s): |
| 70 | # uri URI for GET operation (e.g. /redfish/v1/AccountService/Accounts/). |
| 71 | # cmd_args Commandline arguments. |
| 72 | # expected_error Expected error optionally provided in testcase (e.g. 401 / |
| 73 | # authentication error, etc. ). |
| 74 | |
| 75 | ${rc} ${cmd_output}= Run and Return RC and Output ${cmd_args} GET ${uri} |
| 76 | Run Keyword If ${rc} != 0 Is HTTP error Expected ${cmd_output} ${expected_error} |
| 77 | |
| 78 | [Return] ${cmd_output} |
| 79 | |
| 80 | |
| 81 | Suite Setup Execution |
| 82 | [Documentation] Do suite setup execution. |
| 83 | |
| 84 | ${tool_exist}= Run which redfishtool |
| 85 | Should Not Be Empty ${tool_exist} |