xref: /openbmc/openbmc-test-automation/redfish/dmtf_tools/Redfish_Service_Validator.robot (revision 94041a34a992d9b5f6418a43e1cd5273a6d9f9b2)
1*** Settings ***
2Documentation      Test BMC using https://github.com/DMTF/Redfish-Service-Validator.
3...                DMTF tool.
4
5Library            OperatingSystem
6Library            ../../lib/gen_robot_print.py
7Resource           ../../lib/dmtf_tools_utils.robot
8Resource           ../../lib/bmc_redfish_resource.robot
9Resource           ../../lib/bmc_redfish_utils.robot
10
11Test Tags          Redfish_Service_Validator
12
13*** Variables ***
14
15${DEFAULT_PYTHON}  python3
16${rsv_dir_path}    Redfish-Service-Validator
17${rsv_github_url}  https://github.com/DMTF/Redfish-Service-Validator.git
18${cmd_str_master}  ${DEFAULT_PYTHON} ${rsv_dir_path}${/}RedfishServiceValidator.py
19...                --ip https://${OPENBMC_HOST}:${HTTPS_PORT} --authtype=Session -u ${OPENBMC_USERNAME}
20...                -p ${OPENBMC_PASSWORD} --logdir ${EXECDIR}${/}logs${/} --debugging
21${branch_name}    main
22
23*** Test Cases ***
24
25Test BMC Redfish Using Redfish Service Validator
26    [Documentation]  Check conformance with a Redfish service interface.
27    [Tags]  Test_BMC_Redfish_Using_Redfish_Service_Validator
28
29    Download DMTF Tool  ${rsv_dir_path}  ${rsv_github_url}  ${branch_name}
30
31    ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${cmd_str_master}  check_error=1
32
33    Redfish Service Validator Result  ${output}
34    IF  ${rc} != 0  Fail  Redfish-Service-Validator Failed.
35
36
37Run Redfish Service Validator With Additional Roles
38    [Documentation]  Check Redfish conformance using the Redfish Service Validator.
39    ...  Run the validator as additional non-admin user roles.
40    [Tags]  Run_Redfish_Service_Validator_With_Additional_Roles
41    [Template]  Create User And Run Service Validator
42
43    #username      password       role        enabled
44    operator_user  0penBmc123     Operator    ${True}
45    readonly_user  0penBmc123     ReadOnly    ${True}
46
47*** Keywords ***
48
49Create User And Run Service Validator
50    [Documentation]  Create user and run validator.
51    [Arguments]   ${username}  ${password}  ${role}  ${enabled}
52    [Teardown]  Delete User Created  ${username}
53
54    # Description of argument(s):
55    # username            The username to be created.
56    # password            The password to be assigned.
57    # role                The role of the user to be created
58    #                     (e.g. "Administrator", "Operator", etc.).
59    # enabled             Indicates whether the username being created
60    #                     should be enabled (${True}, ${False}).
61
62    Redfish.Login
63    Redfish Create User  ${username}  ${password}  ${role}  ${enabled}
64    Redfish.Logout
65
66    Download DMTF Tool  ${rsv_dir_path}  ${rsv_github_url}  ${branch_name}
67
68    ${cmd}=  Catenate  ${DEFAULT_PYTHON} ${rsv_dir_path}${/}RedfishServiceValidator.py
69    ...  --ip https://${OPENBMC_HOST}:${HTTPS_PORT} --authtype=Session -u ${username}
70    ...  -p ${password} --logdir ${EXECDIR}${/}logs_${username}${/} --debugging
71
72    Rprint Vars  cmd
73
74    ${rc}  ${output}=  Run DMTF Tool  ${rsv_dir_path}  ${cmd}  check_error=1
75
76    Redfish Service Validator Result  ${output}
77    IF  ${rc} != 0  Fail
78
79
80Delete User Created
81    [Documentation]  Delete user.
82    [Arguments]   ${username}
83
84    # Description of argument(s):
85    # username            The username to be deleted.
86
87    Redfish.Login
88    Redfish.Delete  /redfish/v1/AccountService/Accounts/${username}
89    Redfish.Logout
90