xref: /openbmc/openbmc-test-automation/lib/dmtf_tools_utils.robot (revision 94041a34a992d9b5f6418a43e1cd5273a6d9f9b2)
1*** Settings ***
2Documentation   DMTF tools utility keywords.
3
4Resource        resource.robot
5Library         gen_cmd.py
6
7*** Variables ***
8
9# ignore_err controls Shell Cmd behavior.
10${ignore_err}     ${0}
11
12*** Keywords ***
13
14Download DMTF Tool
15    [Documentation]  Git clone tool.
16    [Arguments]      ${rsv_dir_path}  ${rsv_github_url}  ${branch_name}
17
18    # Description of arguments:
19    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
20    # rsv_github_url  Github URL link(e.g "https://github.com/DMTF/Redfish-Service-Validator").
21    # branch_name     Name of the branch.
22
23    ${cmd_buf}  Catenate  rm -rf ${rsv_dir_path} ;
24    ...  git clone --branch ${branch_name} ${rsv_github_url} ${rsv_dir_path}
25    ${rc}  ${output}=  Shell Cmd  ${cmd_buf}
26
27
28Run DMTF Tool
29    [Documentation]  Execution of the command.
30    [Arguments]      ${rsv_dir_path}  ${command_string}  ${check_error}=0
31
32    # Description of arguments:
33    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
34    # command_string  The complete rsv command string to be run.
35    # check_error     It decides if error information is to be checked.
36
37    ${rc}  ${output}=  Shell Cmd  ${command_string}  ignore_err=${check_error}
38    Log  ${output}
39    RETURN  ${rc}  ${output}
40
41
42Redfish Service Validator Result
43    [Documentation]  Check tool output for errors.
44    [Arguments]      ${tool_output}
45
46    # Description of arguments:
47    # tool_output    DMTF tool output.
48
49    # Example:
50    # Validation has failed: 9 problems found
51    # Service could not be started: RetriesExhaustedError()
52    Should Not Contain Any  ${tool_output}  Validation has failed
53    ...  Service could not be started: RetriesExhaustedError()
54
55
56Redfish JsonSchema ResponseValidator Result
57    [Documentation]  Check tool output for errors.
58    [Arguments]      ${tool_output}
59
60    # Description of arguments:
61    # tool_output    DMTF tool output.
62
63    # Example:
64    # 0 errors
65    Should Contain  ${tool_output}  0 errors
66
67