LDAP related test cases automated
Added Test Cases:
- Verify LDAP Login Works After BMC Reboot
- Verify LDAP User with Admin Privilege Able To Do BMC Reboot
resolves openbmc/openbmc-test-automation#1788
Change-Id: I71868e32f67b93402f1666f75206ef8e4c80e7ce
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/redfish/account_service/test_ldap_configuration.robot b/redfish/account_service/test_ldap_configuration.robot
index 43d1a0f..1658a2e 100644
--- a/redfish/account_service/test_ldap_configuration.robot
+++ b/redfish/account_service/test_ldap_configuration.robot
@@ -41,6 +41,29 @@
... msg=LDAPService is not available.
+Verify LDAP Login Works After BMC Reboot
+ [Documentation] Verify LDAP login works after BMC reboot.
+ [Tags] Verify_LDAP_Login_Works_After_BMC_Reboot
+
+ Redfish OBMC Reboot (off)
+ Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
+ Redfish.Logout
+
+
+Verify LDAP User With Admin Privilege Able To Do BMC Reboot
+ [Documentation] Verify LDAP user with administrator privilege able to do BMC reboot.
+ [Tags] Verify_LDAP_User_With_Admin_Privilege_Able_To_Do_BMC_Reboot
+
+
+ Update LDAP Configuration with LDAP User Role And Group ${LDAP_TYPE}
+ ... ${GROUP_PRIVILEGE} ${GROUP_NAME}
+ Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
+ # With LDAP user and with right privilege trying to do BMC reboot.
+ Redfish OBMC Reboot (off)
+ Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
+ Redfish.Logout
+
+
*** Keywords ***
Suite Setup Execution
[Documentation] Do suite setup tasks.
@@ -72,3 +95,20 @@
${ldap_config}= Redfish.Get Properties ${REDFISH_BASE_URI}AccountService
[Return] ${ldap_config["${ldap_type}"]}
+
+
+Update LDAP Configuration with LDAP User Role And Group
+ [Documentation] Update LDAP configuration update with LDAP user Role and group.
+ [Arguments] ${ldap_type} ${group_privilege} ${group_name}
+
+ # Description of argument(s):
+ # ldap_type The LDAP type ("ActiveDirectory" or "LDAP").
+ # group_privilege The group privilege ("Administrator", "Operator", "User" or "Callback").
+ # group_name The group name of user.
+
+ ${local_role_remote_group}= Create Dictionary LocalRole=${group_privilege} RemoteGroup=${group_name}
+ ${remote_role_mapping}= Create List ${local_role_remote_group}
+ ${ldap_data}= Create Dictionary RemoteRoleMapping=${remote_role_mapping}
+ ${payload}= Create Dictionary ${ldap_type}=${ldap_data}
+ Redfish.Patch ${REDFISH_BASE_URI}AccountService body=&{payload}
+