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
22    ${cmd_buf}  Catenate  rm -rf ${rsv_dir_path} ;
23    ...  git clone --branch ${branch_name} ${rsv_github_url} ${rsv_dir_path}
24    ${rc}  ${output}=  Shell Cmd  ${cmd_buf}
25
26
27Run DMTF Tool
28    [Documentation]  Execution of the command.
29    [Arguments]      ${rsv_dir_path}  ${command_string}  ${check_error}=0
30
31    # Description of arguments:
32    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
33    # command_string  The complete rsv command string to be run.
34    # check_error     It decides if error information is to be checked.
35
36    ${rc}  ${output}=  Shell Cmd  ${command_string}  ignore_err=${check_error}
37    Log  ${output}
38    [Return]  ${rc}  ${output}
39
40
41Redfish Service Validator Result
42    [Documentation]  Check tool output for errors.
43    [Arguments]      ${tool_output}
44
45    # Example:
46    # Validation has failed: 9 problems found
47    # Service could not be started: RetriesExhaustedError()
48    Should Not Contain Any  ${tool_output}  Validation has failed
49    ...  Service could not be started: RetriesExhaustedError()
50
51
52Redfish JsonSchema ResponseValidator Result
53    [Documentation]  Check tool output for errors.
54    [Arguments]      ${tool_output}
55
56    # Example:
57    # 0 errors
58    Should Contain  ${tool_output}  0 errors
59
60