blob: 3a85d0981dbcf6fb482a99d732094dab561dc1dc [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
Sridevi Rameshcf0c8b02025-09-17 06:22:35 -05009Test Tags Redfish_JsonSchema_ResponseValidator
10
George Keishing398d9e62019-02-28 05:41:33 -060011*** Variables ***
12
13${DEFAULT_PYTHON} python3
14${rsv_dir_path} Redfish-JsonSchema-ResponseValidator
15${rsv_github_url} https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator.git
16${command_string} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}Redfish-JsonSchema-ResponseValidator.py
17... -r https://${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S -v
18
ganesanbbca06d02023-04-15 10:52:51 +000019${branch_name} main
20
George Keishing409df052024-01-17 22:36:14 +053021*** Test Cases ***
George Keishing398d9e62019-02-28 05:41:33 -060022
23Test BMC Redfish Using Redfish JsonSchema ResponseValidator
24 [Documentation] Check OpenBMC conformance with JsonSchema files at the DMTF site.
25 [Tags] Test_BMC_Redfish_Using_Redfish_JsonSchema_ResponseValidator
26
ganesanbbca06d02023-04-15 10:52:51 +000027 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name}
George Keishing398d9e62019-02-28 05:41:33 -060028
George Keishing97c93942019-03-04 12:45:07 -060029 Redfish.Login
George Keishing398d9e62019-02-28 05:41:33 -060030 ${url_list}= redfish_utils.List Request /redfish/v1
George Keishing97c93942019-03-04 12:45:07 -060031 Redfish.Logout
George Keishing398d9e62019-02-28 05:41:33 -060032
33 Shell Cmd mkdir -p logs/
34
George Keishing7a85ba32019-03-15 07:06:09 -050035 Set Test Variable ${test_run_status} ${True}
36
Sushma M Md27fc312020-06-19 08:26:50 -050037 FOR ${url} IN @{url_list}
George Keishing899ae012022-03-25 10:16:41 -050038 ${rc} ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string} -i ${url}
Sushma M Md27fc312020-06-19 08:26:50 -050039 ${status}= Run Keyword And Return Status Redfish JsonSchema ResponseValidator Result ${output}
George Keishingc5dbbdd2025-05-07 13:55:17 +053040 IF ${status} == ${False} Set Test Variable ${test_run_status} ${status}
Sushma M Md27fc312020-06-19 08:26:50 -050041 Save Logs For Debugging ${status} ${url}
42 END
George Keishing398d9e62019-02-28 05:41:33 -060043
George Keishingc5dbbdd2025-05-07 13:55:17 +053044 IF ${test_run_status} == ${False}
45 Fail Redfish-JsonSchema-ResponseValidator detected errors.
46 END
George Keishing398d9e62019-02-28 05:41:33 -060047
48
49*** Keywords ***
50
51Save Logs For Debugging
52 [Documentation] Save validate_errs on errors.
53 [Arguments] ${status} ${url}
54
55 # Description of arguments:
56 # status True/False.
57 # url Redfish resource path (e.g. "/redfish/v1/AccountService").
58
59 ${validate_errs}= Shell Cmd cat validate_errs
60 Log ${validate_errs}
61
ganesanb4d430282023-04-27 14:33:23 +000062 # URL /redfish/v1/Managers/${MANAGER_ID} strip the last ending string and save off
George Keishing398d9e62019-02-28 05:41:33 -060063 # the logs for debugging "validate_errs_AccountService" and move to logs/.
George Keishingc5dbbdd2025-05-07 13:55:17 +053064 IF ${status} == ${False}
65 Shell Cmd mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}
66 END