Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation OpenBMC LDAP user management test. |
| 3 | |
| 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
Sivas SRR | 396cf14 | 2018-12-04 07:06:27 -0600 | [diff] [blame] | 6 | Resource ../lib/user_utils.robot |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 7 | Library ../lib/bmc_ssh_utils.py |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Test Teardown FFDC On Test Case Fail |
| 11 | |
| 12 | *** Variables **** |
| 13 | |
| 14 | *** Test Cases *** |
| 15 | |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 16 | Verify LDAP API Available |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 17 | [Documentation] Verify LDAP client service is running and API available. |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 18 | [Tags] Verify_LDAP_API_Available |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 19 | |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 20 | ${resp}= Read Properties ${BMC_LDAP_URI} |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 21 | Should Be Empty ${resp} |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 22 | |
| 23 | |
Sivas SRR | 396cf14 | 2018-12-04 07:06:27 -0600 | [diff] [blame] | 24 | Verify User Group And Privilege Created |
| 25 | [Documentation] Verify user group and associated privilege is created. |
| 26 | [Tags] Verify_User_Group_And_Privilege_Created |
| 27 | [Teardown] FFDC On Test Case Fail |
| 28 | |
| 29 | Create Group And Privilege ${GROUP_NAME} ${GROUP_PRIVILEGE} |
| 30 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate |
| 31 | ${bmc_user_uris}= Convert To String ${bmc_user_uris} |
| 32 | Should Contain ${bmc_user_uris} ${GROUP_NAME} |
| 33 | Should Contain ${bmc_user_uris} ${GROUP_PRIVILEGE} |
| 34 | |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 35 | Verify LDAP Config Is Created |
| 36 | [Documentation] Verify LDAP config is created in BMC. |
| 37 | [Tags] Verify_LDAP_Config_Is_Created |
| 38 | |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 39 | Configure LDAP Server On BMC |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 40 | Check LDAP Config File Generated |
| 41 | |
| 42 | |
| 43 | Verify LDAP Config Is Deleted |
| 44 | [Documentation] Verify LDAP config is deleted in BMC. |
| 45 | [Tags] Verify_LDAP_Config_Is_Deleted |
| 46 | |
| 47 | Delete LDAP Config |
| 48 | Check LDAP Config File Deleted |
| 49 | |
| 50 | |
| 51 | Verify LDAP User Able To Login Using REST |
| 52 | [Documentation] Verify LDAP user able to login using REST. |
| 53 | [Tags] Verify_LDAP_User_Able_To_Login_Using_REST |
| 54 | |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 55 | Configure LDAP Server On BMC |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 56 | Check LDAP Config File Generated |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 57 | Sleep 60s |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 58 | |
| 59 | # REST Login to BMC with LDAP user and password. |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 60 | Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 61 | |
| 62 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list |
| 63 | Should Not Be Empty ${bmc_user_uris} |
| 64 | |
| 65 | |
| 66 | Verify LDAP User Able to Logout Using REST |
| 67 | [Documentation] Verify LDAP user able to logout using REST. |
| 68 | [Tags] Verify_LDAP_User_Able_To_Logout_Using_REST |
| 69 | |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 70 | Configure LDAP Server On BMC |
| 71 | Sleep 60s |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 72 | Check LDAP Config File Generated |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 73 | Sleep 60s |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 74 | |
| 75 | # REST Login to BMC with LDAP user and password. |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 76 | Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD} |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 77 | |
| 78 | # REST Logout from BMC. |
| 79 | Log Out OpenBMC |
| 80 | |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 81 | |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 82 | Verify LDAP Server URI Is Set |
| 83 | [Documentation] Verify LDAP Server URI is set using REST. |
| 84 | [Tags] Verify_LDAP_Server_URI_Is_Set |
| 85 | |
| 86 | # Example: LDAP URI should be either ldap://<LDAP IP / Hostname> or |
| 87 | # ldaps://<LDAP IP / Hostname> |
| 88 | Should Contain ${LDAP_SERVER_URI} ldap |
| 89 | ${ldap_server}= Create Dictionary data=${LDAP_SERVER_URI} |
| 90 | Write Attribute ${BMC_LDAP_URI}/config LDAPServerURI data=${ldap_server} |
| 91 | ... verify=${True} expected_value=${LDAP_SERVER_URI} |
| 92 | |
| 93 | |
| 94 | Verify LDAP Server BIND DN Is Set |
| 95 | [Documentation] Verify LDAP BIND DN is set using REST. |
| 96 | [Tags] Verify_LDAP_Server_BIND_DN_Is_Set |
| 97 | |
| 98 | ${ldap_server_binddn}= Create Dictionary data=${LDAP_BIND_DN} |
| 99 | Write Attribute ${BMC_LDAP_URI}/config LDAPBindDN data=${ldap_server_binddn} |
| 100 | ... verify=${True} expected_value=${LDAP_BIND_DN} |
| 101 | |
| 102 | |
| 103 | Verify LDAP Server BASE DN Is Set |
| 104 | [Documentation] Verify LDAP BASE DN is set using REST. |
| 105 | [Tags] Verify_LDAP_Server_BASE_DN_Is_Set |
| 106 | |
| 107 | ${ldap_server_basedn}= Create Dictionary data=${LDAP_BASE_DN} |
| 108 | Write Attribute ${BMC_LDAP_URI}/config LDAPBaseDN data=${ldap_server_basedn} |
| 109 | ... verify=${True} expected_value=${LDAP_BASE_DN} |
| 110 | |
| 111 | |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 112 | Verify LDAP Server Type Is Set As Active Directory |
| 113 | [Documentation] Verify LDAP server type is set as "Active Directory" |
| 114 | ... using REST. |
| 115 | [Tags] Verify_LDAP_Server_Type_Is_Set_As_Active_Directory |
| 116 | [Template] Modify LDAP Server Type |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 117 | |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 118 | # Server type as ActiveDirectory |
| 119 | xyz.openbmc_project.User.Ldap.Config.Type.ActiveDirectory |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 120 | |
| 121 | |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 122 | Verify LDAP Server Type Is Set As Open LDAP |
| 123 | [Documentation] Verify LDAP server type is set as "OpenLDAP" |
| 124 | ... using REST. |
| 125 | [Tags] Verify_LDAP_Server_Type_Is_Set_As_Open_LDAP |
| 126 | [Template] Modify LDAP Server Type |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 127 | |
Sivas SRR | 7353f5b | 2018-11-21 02:43:18 -0600 | [diff] [blame] | 128 | # Server type as OpenLdap |
| 129 | xyz.openbmc_project.User.Ldap.Config.Type.OpenLdap |
| 130 | |
| 131 | |
| 132 | Verify LDAP Search Scope Is Set As One |
| 133 | [Documentation] Verify LDAP search scope is set as "one" using REST. |
| 134 | [Tags] Verify_LDAP_Search_Scope_Is_Set_As_One |
| 135 | [Template] Modify LDAP Search Scope |
| 136 | |
| 137 | # Search Scope as one |
| 138 | xyz.openbmc_project.User.Ldap.Config.SearchScope.one |
| 139 | |
| 140 | |
| 141 | Verify LDAP Search Scope Is Set As Base |
| 142 | [Documentation] Verify LDAP search scope is set as "base" using REST. |
| 143 | [Tags] Verify_LDAP_Search_Scope_Is_Set_As_Base |
| 144 | [Template] Modify LDAP Search Scope |
| 145 | |
| 146 | # Search Scope as base |
| 147 | xyz.openbmc_project.User.Ldap.Config.SearchScope.base |
| 148 | |
| 149 | Verify LDAP Search Scope Is Set As Sub |
| 150 | [Documentation] Verify LDAP search scope is set as "sub" using REST. |
| 151 | [Tags] Verify_LDAP_Search_Scope_Is_Set_As_Sub |
| 152 | [Template] Modify LDAP Search Scope |
| 153 | |
| 154 | # Search Scope as sub |
| 155 | xyz.openbmc_project.User.Ldap.Config.SearchScope.sub |
Sivas SRR | 39909e3 | 2018-11-09 18:58:36 -0600 | [diff] [blame] | 156 | |
| 157 | |
| 158 | Verify LDAP Binddn Password Is Set |
| 159 | [Documentation] Verify LDAP Binddn password is set using REST. |
| 160 | [Tags] Verify_LDAP_Binddn_Password_Is_Set |
| 161 | |
| 162 | ${ldap_binddn_passwd}= Create Dictionary data=${LDAP_BIND_DN_PASSWORD} |
| 163 | Write Attribute ${BMC_LDAP_URI}/config LDAPBINDDNpassword data=${ldap_binddn_passwd} |
| 164 | ... verify=${True} expected_value=${LDAP_BIND_DN_PASSWORD} |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 165 | |
| 166 | |
Sivas SRR | 396cf14 | 2018-12-04 07:06:27 -0600 | [diff] [blame] | 167 | Delete LDAP Group |
| 168 | [Documentation] Delete LDAP group which is configured. |
| 169 | [Tags] Delete_LDAP_Group |
Sivas SRR | 3ef3bea | 2018-10-03 09:59:32 -0500 | [diff] [blame] | 170 | |
Sivas SRR | 396cf14 | 2018-12-04 07:06:27 -0600 | [diff] [blame] | 171 | Delete Defined LDAP Group And Privilege ${GROUP_NAME} |