xref: /openbmc/openbmc-test-automation/lib/dmtf_tools_utils.robot (revision 409df05d4b10b9a8c81e282da8fef0199db5bdea)
100ee05a4SGeorge Keishing*** Settings ***
200ee05a4SGeorge KeishingDocumentation   DMTF tools utility keywords.
300ee05a4SGeorge Keishing
400ee05a4SGeorge KeishingResource        resource.robot
500ee05a4SGeorge KeishingLibrary         gen_cmd.py
600ee05a4SGeorge Keishing
700ee05a4SGeorge Keishing*** Variables ***
800ee05a4SGeorge Keishing
900ee05a4SGeorge Keishing# ignore_err controls Shell Cmd behavior.
1000ee05a4SGeorge Keishing${ignore_err}     ${0}
1100ee05a4SGeorge Keishing
1200ee05a4SGeorge Keishing*** Keywords ***
1300ee05a4SGeorge Keishing
1400ee05a4SGeorge KeishingDownload DMTF Tool
1500ee05a4SGeorge Keishing    [Documentation]  Git clone tool.
16bca06d02Sganesanb    [Arguments]      ${rsv_dir_path}  ${rsv_github_url}  ${branch_name}
1700ee05a4SGeorge Keishing
1800ee05a4SGeorge Keishing    # Description of arguments:
1900ee05a4SGeorge Keishing    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
2000ee05a4SGeorge Keishing    # rsv_github_url  Github URL link(e.g "https://github.com/DMTF/Redfish-Service-Validator").
2100ee05a4SGeorge Keishing
222d0804ebSGeorge Keishing    ${cmd_buf}  Catenate  rm -rf ${rsv_dir_path} ;
23bca06d02Sganesanb    ...  git clone --branch ${branch_name} ${rsv_github_url} ${rsv_dir_path}
242d0804ebSGeorge Keishing    ${rc}  ${output}=  Shell Cmd  ${cmd_buf}
2500ee05a4SGeorge Keishing
2600ee05a4SGeorge Keishing
2700ee05a4SGeorge KeishingRun DMTF Tool
2800ee05a4SGeorge Keishing    [Documentation]  Execution of the command.
29a053fb34Smanashsarma    [Arguments]      ${rsv_dir_path}  ${command_string}  ${check_error}=0
3000ee05a4SGeorge Keishing
3100ee05a4SGeorge Keishing    # Description of arguments:
3200ee05a4SGeorge Keishing    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
3300ee05a4SGeorge Keishing    # command_string  The complete rsv command string to be run.
34a053fb34Smanashsarma    # check_error     It decides if error information is to be checked.
3500ee05a4SGeorge Keishing
36a053fb34Smanashsarma    ${rc}  ${output}=  Shell Cmd  ${command_string}  ignore_err=${check_error}
3700ee05a4SGeorge Keishing    Log  ${output}
38*409df05dSGeorge Keishing    RETURN  ${rc}  ${output}
39398d9e6eSGeorge Keishing
40398d9e6eSGeorge Keishing
41398d9e6eSGeorge KeishingRedfish Service Validator Result
42398d9e6eSGeorge Keishing    [Documentation]  Check tool output for errors.
43398d9e6eSGeorge Keishing    [Arguments]      ${tool_output}
4400ee05a4SGeorge Keishing
4500ee05a4SGeorge Keishing    # Example:
4600ee05a4SGeorge Keishing    # Validation has failed: 9 problems found
474a90394eSGeorge Keishing    # Service could not be started: RetriesExhaustedError()
484a90394eSGeorge Keishing    Should Not Contain Any  ${tool_output}  Validation has failed
494a90394eSGeorge Keishing    ...  Service could not be started: RetriesExhaustedError()
50398d9e6eSGeorge Keishing
51398d9e6eSGeorge Keishing
52398d9e6eSGeorge KeishingRedfish JsonSchema ResponseValidator Result
53398d9e6eSGeorge Keishing    [Documentation]  Check tool output for errors.
54398d9e6eSGeorge Keishing    [Arguments]      ${tool_output}
55398d9e6eSGeorge Keishing
56398d9e6eSGeorge Keishing    # Example:
57398d9e6eSGeorge Keishing    # 0 errors
58398d9e6eSGeorge Keishing    Should Contain  ${tool_output}  0 errors
59398d9e6eSGeorge Keishing
60