blob: d875c226d4f4a2153e6a01cd8bba2b7e6c009052 [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
25 redfish.Login
26 ${url_list}= redfish_utils.List Request /redfish/v1
27 redfish.Logout
28
29 Shell Cmd mkdir -p logs/
30
31 :FOR ${url} IN @{url_list}
32 \ ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string} -i ${url}
33 \ ${status}= Run Keyword And Return Status Redfish JsonSchema ResponseValidator Result ${output}
34 \ Run Keyword If ${status} == ${False} Set Test Variable ${test_run_status} ${status}
35 \ Save Logs For Debugging ${status} ${url}
36
37 Run Keyword If ${test_run_status} == ${False}
38 ... Fail Redfish-JsonSchema-ResponseValidator detected errors.
39
40
41*** Keywords ***
42
43Save Logs For Debugging
44 [Documentation] Save validate_errs on errors.
45 [Arguments] ${status} ${url}
46
47 # Description of arguments:
48 # status True/False.
49 # url Redfish resource path (e.g. "/redfish/v1/AccountService").
50
51 ${validate_errs}= Shell Cmd cat validate_errs
52 Log ${validate_errs}
53
54 # URL /redfish/v1/Managers/bmc strip the last ending string and save off
55 # the logs for debugging "validate_errs_AccountService" and move to logs/.
56 Run Keyword If ${status} == ${False}
57 ... Shell Cmd mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}