George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC using https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator |
| 3 | ... DMTF tool. |
| 4 | |
| 5 | Library OperatingSystem |
| 6 | Resource ../../lib/dmtf_tools_utils.robot |
| 7 | Resource ../../lib/bmc_redfish_resource.robot |
| 8 | |
| 9 | *** Variables *** |
| 10 | |
| 11 | ${DEFAULT_PYTHON} python3 |
| 12 | ${rsv_dir_path} Redfish-JsonSchema-ResponseValidator |
| 13 | ${rsv_github_url} https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator.git |
| 14 | ${command_string} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}Redfish-JsonSchema-ResponseValidator.py |
| 15 | ... -r https://${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S -v |
| 16 | |
ganesanb | bca06d0 | 2023-04-15 10:52:51 +0000 | [diff] [blame] | 17 | ${branch_name} main |
| 18 | |
George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 19 | *** Test Case *** |
| 20 | |
| 21 | Test BMC Redfish Using Redfish JsonSchema ResponseValidator |
| 22 | [Documentation] Check OpenBMC conformance with JsonSchema files at the DMTF site. |
| 23 | [Tags] Test_BMC_Redfish_Using_Redfish_JsonSchema_ResponseValidator |
| 24 | |
ganesanb | bca06d0 | 2023-04-15 10:52:51 +0000 | [diff] [blame] | 25 | Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name} |
George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 26 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 27 | Redfish.Login |
George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 28 | ${url_list}= redfish_utils.List Request /redfish/v1 |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 29 | Redfish.Logout |
George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 30 | |
| 31 | Shell Cmd mkdir -p logs/ |
| 32 | |
George Keishing | 7a85ba3 | 2019-03-15 07:06:09 -0500 | [diff] [blame] | 33 | Set Test Variable ${test_run_status} ${True} |
| 34 | |
Sushma M M | d27fc31 | 2020-06-19 08:26:50 -0500 | [diff] [blame] | 35 | FOR ${url} IN @{url_list} |
George Keishing | 899ae01 | 2022-03-25 10:16:41 -0500 | [diff] [blame] | 36 | ${rc} ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string} -i ${url} |
Sushma M M | d27fc31 | 2020-06-19 08:26:50 -0500 | [diff] [blame] | 37 | ${status}= Run Keyword And Return Status Redfish JsonSchema ResponseValidator Result ${output} |
| 38 | Run Keyword If ${status} == ${False} Set Test Variable ${test_run_status} ${status} |
| 39 | Save Logs For Debugging ${status} ${url} |
| 40 | END |
George Keishing | 398d9e6 | 2019-02-28 05:41:33 -0600 | [diff] [blame] | 41 | |
| 42 | Run Keyword If ${test_run_status} == ${False} |
| 43 | ... Fail Redfish-JsonSchema-ResponseValidator detected errors. |
| 44 | |
| 45 | |
| 46 | *** Keywords *** |
| 47 | |
| 48 | Save Logs For Debugging |
| 49 | [Documentation] Save validate_errs on errors. |
| 50 | [Arguments] ${status} ${url} |
| 51 | |
| 52 | # Description of arguments: |
| 53 | # status True/False. |
| 54 | # url Redfish resource path (e.g. "/redfish/v1/AccountService"). |
| 55 | |
| 56 | ${validate_errs}= Shell Cmd cat validate_errs |
| 57 | Log ${validate_errs} |
| 58 | |
| 59 | # URL /redfish/v1/Managers/bmc strip the last ending string and save off |
| 60 | # the logs for debugging "validate_errs_AccountService" and move to logs/. |
| 61 | Run Keyword If ${status} == ${False} |
| 62 | ... Shell Cmd mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]} |