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${stable_branch}  master
12
13*** Keywords ***
14
15Download DMTF Tool
16    [Documentation]  Git clone tool.
17    [Arguments]      ${rsv_dir_path}  ${rsv_github_url}
18
19    # Description of arguments:
20    # rsv_dir_path    Directory path for rsv tool (e.g. "Redfish-Service-Validator").
21    # rsv_github_url  Github URL link(e.g "https://github.com/DMTF/Redfish-Service-Validator").
22
23    ${cmd_buf}  Catenate  rm -rf ${rsv_dir_path} ;
24    ...  git clone --branch ${stable_branch} ${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    # Example:
47    # Validation has failed: 9 problems found
48    # Service could not be started: RetriesExhaustedError()
49    Should Not Contain Any  ${tool_output}  Validation has failed
50    ...  Service could not be started: RetriesExhaustedError()
51
52
53Redfish JsonSchema ResponseValidator Result
54    [Documentation]  Check tool output for errors.
55    [Arguments]      ${tool_output}
56
57    # Example:
58    # 0 errors
59    Should Contain  ${tool_output}  0 errors
60
61