DMTF Redfish-JsonSchema-ResponseValidator Tool
Changes:
- Test to target BMC using Redfish-JsonSchema-ResponseValidator.
- Update DMTF lib test to validate result.
Tested: On latest Master build https://openpower.xyz/job/openbmc-build/2005/
Change-Id: I6eac2ac69d3aea76a6a2e8532b24fd2b9e2eb43b
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/dmtf_tools_utils.robot b/lib/dmtf_tools_utils.robot
index 1a406d0..2bc2d3d 100644
--- a/lib/dmtf_tools_utils.robot
+++ b/lib/dmtf_tools_utils.robot
@@ -20,7 +20,6 @@
# rsv_github_url Github URL link(e.g "https://github.com/DMTF/Redfish-Service-Validator").
${rc} ${output}= Shell Cmd rm -rf ${rsv_dir_path} ; git clone ${rsv_github_url} ${rsv_dir_path}
- Log ${output}
Run DMTF Tool
@@ -33,7 +32,23 @@
${rc} ${output}= Shell Cmd ${command_string}
Log ${output}
+ [Return] ${output}
+
+
+Redfish Service Validator Result
+ [Documentation] Check tool output for errors.
+ [Arguments] ${tool_output}
# Example:
# Validation has failed: 9 problems found
- Should Not Contain ${output} Validation has failed
+ Should Not Contain ${tool_output} Validation has failed
+
+
+Redfish JsonSchema ResponseValidator Result
+ [Documentation] Check tool output for errors.
+ [Arguments] ${tool_output}
+
+ # Example:
+ # 0 errors
+ Should Contain ${tool_output} 0 errors
+
diff --git a/redfish/dmtf_tools/Redfish-JsonSchema-ResponseValidator.robot b/redfish/dmtf_tools/Redfish-JsonSchema-ResponseValidator.robot
new file mode 100644
index 0000000..d875c22
--- /dev/null
+++ b/redfish/dmtf_tools/Redfish-JsonSchema-ResponseValidator.robot
@@ -0,0 +1,57 @@
+*** Settings ***
+Documentation Test BMC using https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator
+... DMTF tool.
+
+Library OperatingSystem
+Resource ../../lib/dmtf_tools_utils.robot
+Resource ../../lib/bmc_redfish_resource.robot
+
+*** Variables ***
+
+${DEFAULT_PYTHON} python3
+${rsv_dir_path} Redfish-JsonSchema-ResponseValidator
+${rsv_github_url} https://github.com/DMTF/Redfish-JsonSchema-ResponseValidator.git
+${command_string} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}Redfish-JsonSchema-ResponseValidator.py
+... -r https://${OPENBMC_HOST} -u ${OPENBMC_USERNAME} -p ${OPENBMC_PASSWORD} -S -v
+
+*** Test Case ***
+
+Test BMC Redfish Using Redfish JsonSchema ResponseValidator
+ [Documentation] Check OpenBMC conformance with JsonSchema files at the DMTF site.
+ [Tags] Test_BMC_Redfish_Using_Redfish_JsonSchema_ResponseValidator
+
+ Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
+
+ redfish.Login
+ ${url_list}= redfish_utils.List Request /redfish/v1
+ redfish.Logout
+
+ Shell Cmd mkdir -p logs/
+
+ :FOR ${url} IN @{url_list}
+ \ ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string} -i ${url}
+ \ ${status}= Run Keyword And Return Status Redfish JsonSchema ResponseValidator Result ${output}
+ \ Run Keyword If ${status} == ${False} Set Test Variable ${test_run_status} ${status}
+ \ Save Logs For Debugging ${status} ${url}
+
+ Run Keyword If ${test_run_status} == ${False}
+ ... Fail Redfish-JsonSchema-ResponseValidator detected errors.
+
+
+*** Keywords ***
+
+Save Logs For Debugging
+ [Documentation] Save validate_errs on errors.
+ [Arguments] ${status} ${url}
+
+ # Description of arguments:
+ # status True/False.
+ # url Redfish resource path (e.g. "/redfish/v1/AccountService").
+
+ ${validate_errs}= Shell Cmd cat validate_errs
+ Log ${validate_errs}
+
+ # URL /redfish/v1/Managers/bmc strip the last ending string and save off
+ # the logs for debugging "validate_errs_AccountService" and move to logs/.
+ Run Keyword If ${status} == ${False}
+ ... Shell Cmd mv validate_errs logs/validate_errs_${url.rsplit("/")[-1]}
diff --git a/redfish/dmtf_tools/Redfish-Service-Validator.robot b/redfish/dmtf_tools/Redfish-Service-Validator.robot
index 5d8e9f6..9c7992b 100644
--- a/redfish/dmtf_tools/Redfish-Service-Validator.robot
+++ b/redfish/dmtf_tools/Redfish-Service-Validator.robot
@@ -22,4 +22,6 @@
Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
- Run DMTF Tool ${rsv_dir_path} ${command_string}
+ ${output}= Run DMTF Tool ${rsv_dir_path} ${command_string}
+
+ Redfish Service Validator Result ${output}