blob: 209228e7c6a3f25f93eb973faa21d87d416f2495 [file] [log] [blame]
George Keishing398d9e62019-02-28 05:41:33 -06001*** Settings ***
2Documentation Test BMC using https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator
3... DMTF tool.
4
5Library OperatingSystem
6Resource ../../lib/dmtf_tools_utils.robot
7Resource ../../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
17*** Test Case ***
18
19Test BMC Redfish Using Redfish JsonSchema ResponseValidator
20 [Documentation] Check OpenBMC conformance with JsonSchema files at the DMTF site.
21 [Tags] Test_BMC_Redfish_Using_Redfish_JsonSchema_ResponseValidator
22
23 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
24
George Keishing97c93942019-03-04 12:45:07 -060025 Redfish.Login
George Keishing398d9e62019-02-28 05:41:33 -060026 ${url_list}= redfish_utils.List Request /redfish/v1
George Keishing97c93942019-03-04 12:45:07 -060027 Redfish.Logout
George Keishing398d9e62019-02-28 05:41:33 -060028
29 Shell Cmd mkdir -p logs/
30
George Keishing7a85ba32019-03-15 07:06:09 -050031 Set Test Variable ${test_run_status} ${True}
32
Sushma M Md27fc312020-06-19 08:26:50 -050033 FOR ${url} IN @{url_list}
34 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string} -i ${url}
35 ${status}= Run Keyword And Return Status Redfish JsonSchema ResponseValidator Result ${output}
36 Run Keyword If ${status} == ${False} Set Test Variable ${test_run_status} ${status}
37 Save Logs For Debugging ${status} ${url}
38 END
George Keishing398d9e62019-02-28 05:41:33 -060039
40 Run Keyword If ${test_run_status} == ${False}
41 ... Fail Redfish-JsonSchema-ResponseValidator detected errors.
42
43
44*** Keywords ***
45
46Save Logs For Debugging
47 [Documentation] Save validate_errs on errors.
48 [Arguments] ${status} ${url}
49
50 # Description of arguments:
51 # status True/False.
52 # url Redfish resource path (e.g. "/redfish/v1/AccountService").
53
54 ${validate_errs}= Shell Cmd cat validate_errs
55 Log ${validate_errs}
56
57 # URL /redfish/v1/Managers/bmc strip the last ending string and save off
58 # the logs for debugging "validate_errs_AccountService" and move to logs/.
59 Run Keyword If ${status} == ${False}
60 ... Shell Cmd mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}