Sivas SRR | 7d7bae3 | 2019-05-29 00:31:14 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Redfish LDAP user configuration. |
| 3 | |
| 4 | Resource ../../lib/resource.robot |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
| 8 | Suite Setup Suite Setup Execution |
| 9 | Test Setup Test Setup Execution |
| 10 | Test Teardown Test Teardown Execution |
| 11 | |
Sivas SRR | 9358b5c | 2019-06-06 04:57:03 -0500 | [diff] [blame] | 12 | Force Tags LDAP_Test |
| 13 | |
Sivas SRR | 7d7bae3 | 2019-05-29 00:31:14 -0500 | [diff] [blame] | 14 | ** Test Cases ** |
| 15 | |
| 16 | Verify LDAP Configuration Exist |
| 17 | [Documentation] Verify LDAP configuration is available. |
| 18 | [Tags] Verify_LDAP_Configuration_Exist |
| 19 | |
| 20 | ${resp}= Redfish.Get Attribute ${REDFISH_BASE_URI}AccountService |
| 21 | ... ${LDAP_TYPE} default=${EMPTY} |
| 22 | Should Not Be Empty ${resp} msg=LDAP configuration is not defined. |
| 23 | |
| 24 | |
| 25 | Verify LDAP User Login |
| 26 | [Documentation] Verify LDAP user able to login into BMC. |
| 27 | [Tags] Verify_LDAP_User_Login |
| 28 | |
| 29 | ${resp}= Run Keyword And Return Status Redfish.Login ${LDAP_USER} |
| 30 | ... ${LDAP_USER_PASSWORD} |
| 31 | Should Be Equal ${resp} ${True} msg=LDAP user is not able to login. |
| 32 | redfish.Logout |
| 33 | |
| 34 | |
| 35 | Verify LDAP Service Available |
| 36 | [Documentation] Verify LDAP service is available. |
| 37 | [Tags] Verify_LDAP_Service_Available |
| 38 | |
| 39 | @{ldap_configuration}= Get LDAP Configuration ${LDAP_TYPE} |
| 40 | Should Contain ${ldap_configuration} LDAPService |
| 41 | ... msg=LDAPService is not available. |
| 42 | |
| 43 | |
Sivas SRR | 108f9d3 | 2019-06-03 10:05:34 -0500 | [diff] [blame] | 44 | Verify LDAP Login Works After BMC Reboot |
| 45 | [Documentation] Verify LDAP login works after BMC reboot. |
| 46 | [Tags] Verify_LDAP_Login_Works_After_BMC_Reboot |
| 47 | |
| 48 | Redfish OBMC Reboot (off) |
| 49 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 50 | Redfish.Logout |
| 51 | |
| 52 | |
| 53 | Verify LDAP User With Admin Privilege Able To Do BMC Reboot |
| 54 | [Documentation] Verify LDAP user with administrator privilege able to do BMC reboot. |
| 55 | [Tags] Verify_LDAP_User_With_Admin_Privilege_Able_To_Do_BMC_Reboot |
| 56 | |
| 57 | |
| 58 | Update LDAP Configuration with LDAP User Role And Group ${LDAP_TYPE} |
| 59 | ... ${GROUP_PRIVILEGE} ${GROUP_NAME} |
| 60 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 61 | # With LDAP user and with right privilege trying to do BMC reboot. |
| 62 | Redfish OBMC Reboot (off) |
| 63 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 64 | Redfish.Logout |
| 65 | |
| 66 | |
Sivas SRR | 7d7bae3 | 2019-05-29 00:31:14 -0500 | [diff] [blame] | 67 | *** Keywords *** |
| 68 | Suite Setup Execution |
| 69 | [Documentation] Do suite setup tasks. |
| 70 | |
| 71 | Should Not Be Empty ${LDAP_TYPE} |
| 72 | redfish.Login |
| 73 | Get LDAP Configuration ${LDAP_TYPE} |
| 74 | redfish.Logout |
| 75 | |
| 76 | |
| 77 | Test Setup Execution |
| 78 | [Documentation] Do test case setup tasks. |
| 79 | |
| 80 | redfish.Login |
| 81 | |
| 82 | |
| 83 | Test Teardown Execution |
| 84 | [Documentation] Do the post test teardown. |
| 85 | FFDC On Test Case Fail |
| 86 | redfish.Logout |
| 87 | |
| 88 | |
| 89 | Get LDAP Configuration |
| 90 | [Documentation] Retrieve LDAP Configuration. |
| 91 | [Arguments] ${ldap_type} |
| 92 | |
| 93 | # Description of argument(s): |
| 94 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
| 95 | |
| 96 | ${ldap_config}= Redfish.Get Properties ${REDFISH_BASE_URI}AccountService |
| 97 | [Return] ${ldap_config["${ldap_type}"]} |
Sivas SRR | 108f9d3 | 2019-06-03 10:05:34 -0500 | [diff] [blame] | 98 | |
| 99 | |
| 100 | Update LDAP Configuration with LDAP User Role And Group |
| 101 | [Documentation] Update LDAP configuration update with LDAP user Role and group. |
| 102 | [Arguments] ${ldap_type} ${group_privilege} ${group_name} |
| 103 | |
| 104 | # Description of argument(s): |
| 105 | # ldap_type The LDAP type ("ActiveDirectory" or "LDAP"). |
| 106 | # group_privilege The group privilege ("Administrator", "Operator", "User" or "Callback"). |
| 107 | # group_name The group name of user. |
| 108 | |
| 109 | ${local_role_remote_group}= Create Dictionary LocalRole=${group_privilege} RemoteGroup=${group_name} |
| 110 | ${remote_role_mapping}= Create List ${local_role_remote_group} |
| 111 | ${ldap_data}= Create Dictionary RemoteRoleMapping=${remote_role_mapping} |
| 112 | ${payload}= Create Dictionary ${ldap_type}=${ldap_data} |
| 113 | Redfish.Patch ${REDFISH_BASE_URI}AccountService body=&{payload} |
| 114 | |