Run redfish service validator using different roles
Changes:
- Added test to run validator using operator and readonly role.
Change-Id: I3263abec69440177d9a46b7b4d1b07b12ba5593f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/redfish/dmtf_tools/Redfish_Service_Validator.robot b/redfish/dmtf_tools/Redfish_Service_Validator.robot
index 9c7992b..6f2eeb9 100644
--- a/redfish/dmtf_tools/Redfish_Service_Validator.robot
+++ b/redfish/dmtf_tools/Redfish_Service_Validator.robot
@@ -3,7 +3,10 @@
... DMTF tool.
Library OperatingSystem
+Library ../../lib/gen_robot_print.py
Resource ../../lib/dmtf_tools_utils.robot
+Resource ../../lib/bmc_redfish_resource.robot
+Resource ../../lib/bmc_redfish_utils.robot
*** Variables ***
@@ -25,3 +28,58 @@
${output}= Run DMTF Tool ${rsv_dir_path} ${command_string}
Redfish Service Validator Result ${output}
+
+
+Run Redfish Service Validator With Additional Roles
+ [Documentation] Check Redfish conformance using the Redfish Service Validator.
+ ... Run the validator as additional non-admin user roles.
+ [Tags] Run_Redfish_Service_Validator_With_Additional_Roles
+ [Template] Create User And Run Service Validator
+
+ #username password role enabled
+ operator_user ${OPENBMC_PASSWORD} Operator ${True}
+ readonly_user ${OPENBMC_PASSWORD} ReadOnly ${True}
+
+
+*** Keywords ***
+
+Create User And Run Service Validator
+ [Documentation] Create user and run validator.
+ [Arguments] ${username} ${password} ${role} ${enabled}
+ [Teardown] Delete User Created ${username}
+
+ # Description of argument(s):
+ # username The username to be created.
+ # password The password to be assigned.
+ # role The role of the user to be created
+ # (e.g. "Administrator", "Operator", etc.).
+ # enabled Indicates whether the username being created
+ # should be enabled (${True}, ${False}).
+
+ Redfish.Login
+ Redfish Create User ${username} ${password} ${role} ${enabled}
+ Redfish.Logout
+
+ Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
+
+ ${cmd}= Catenate ${DEFAULT_PYTHON} ${rsv_dir_path}${/}RedfishServiceValidator.py
+ ... --ip ${OPENBMC_HOST} --nochkcert --authtype=Session -u ${username}
+ ... -p ${password} --logdir ${EXECDIR}${/}logs_${username}${/} --debug_logging
+
+ Rprint Vars cmd
+
+ ${output}= Run DMTF Tool ${rsv_dir_path} ${cmd}
+
+ Redfish Service Validator Result ${output}
+
+
+Delete User Created
+ [Documentation] Delete user.
+ [Arguments] ${username}
+
+ # Description of argument(s):
+ # username The username to be deleted.
+
+ Redfish.Login
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
+ Redfish.Logout