George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation OpenBMC user management test. |
| 3 | |
Sweta Potthuri | a659ad2 | 2018-01-31 12:24:51 -0600 | [diff] [blame] | 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 6 | Resource ../lib/utils.robot |
Sivas SRR | 1d3e4be | 2018-11-20 07:35:50 -0600 | [diff] [blame] | 7 | Resource ../lib/user_utils.robot |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 8 | Library SSHLibrary |
| 9 | |
| 10 | Test Teardown Test Teardown Execution |
| 11 | |
| 12 | *** Variables **** |
| 13 | |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 14 | ${test_password} 0penBmc123 |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 15 | |
| 16 | *** Test Cases *** |
| 17 | |
Sivas SRR | 1a7502d | 2018-09-19 03:31:54 -0500 | [diff] [blame] | 18 | |
| 19 | Verify At Least One User In List |
| 20 | [Documentation] Verify user list API list minimum one user. |
| 21 | [Tags] Verify_At_Least_One_User_In_List |
George Keishing | b24adb3 | 2018-10-29 13:20:08 -0500 | [diff] [blame] | 22 | [Teardown] FFDC On Test Case Fail |
Sivas SRR | 1a7502d | 2018-09-19 03:31:54 -0500 | [diff] [blame] | 23 | |
| 24 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list |
| 25 | Should Not Be Empty ${bmc_user_uris} |
| 26 | |
| 27 | |
Sivas SRR | dc10cc8 | 2018-10-30 10:53:32 -0500 | [diff] [blame] | 28 | Verify User Group And Privilege Created |
| 29 | [Documentation] Verify user group and associated privilege is created. |
| 30 | [Tags] Verify_User_Group_And_Privilege_Created |
| 31 | [Teardown] FFDC On Test Case Fail |
| 32 | |
| 33 | Create Group And Privilege ${GROUP_NAME} ${GROUP_PRIVILEGE} |
| 34 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate |
| 35 | ${bmc_user_uris}= Convert To String ${bmc_user_uris} |
| 36 | Should Contain ${bmc_user_uris} ${GROUP_NAME} |
| 37 | Should Contain ${bmc_user_uris} ${GROUP_PRIVILEGE} |
Sivas SRR | 1d3e4be | 2018-11-20 07:35:50 -0600 | [diff] [blame] | 38 | Delete Defined LDAP Group And Privilege ${GROUP_NAME} |
| 39 | |
| 40 | |
| 41 | Verify LDAP User With Privilege Admin Able To Power On |
| 42 | [Documentation] Verify LDAP user with privilege admin able to power on. |
| 43 | [Tags] Verify_LDAP_User_With_Privilege_Admin_Able_To_Power_On |
| 44 | [Teardown] FFDC On Test Case Fail |
| 45 | |
| 46 | Create Privilege priv-admin |
| 47 | Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 48 | REST Power On stack_mode=normal quiet=1 |
| 49 | Delete Defined LDAP Group And Privilege ${GROUP_NAME} |
| 50 | |
| 51 | |
| 52 | Verify LDAP User With Privilege Admin Able To Power Off |
| 53 | [Documentation] Verify LDAP user with privilege admin able to power off. |
| 54 | [Tags] Verify_LDAP_User_With_Privilege_Admin_Able_To_Power_Off |
| 55 | [Teardown] FFDC On Test Case Fail |
| 56 | |
| 57 | Create Privilege priv-admin |
| 58 | Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 59 | REST Hard Power Off stack_mode=normal quiet=1 |
| 60 | Delete Defined LDAP Group And Privilege ${GROUP_NAME} |
| 61 | |
| 62 | |
| 63 | Verify LDAP User With Privilege User Able To Read Inventory |
| 64 | [Documentation] Verify LDAP user with privilege usern able to read |
| 65 | ... inventory assettag. |
| 66 | [Tags] Verify_LDAP_User_With_Privilege_User_Able_To_Read_Inventory |
| 67 | [Teardown] FFDC On Test Case Fail |
| 68 | |
| 69 | Create Privilege priv-user |
| 70 | Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 71 | Read Attribute /xyz/openbmc_project/inventory/system AssetTag |
| 72 | Delete Defined LDAP Group And Privilege ${GROUP_NAME} |
Sivas SRR | dc10cc8 | 2018-10-30 10:53:32 -0500 | [diff] [blame] | 73 | |
| 74 | |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 75 | Verify Root Password Update |
| 76 | [Documentation] Update system "root" user password and verify. |
| 77 | [Tags] Verify_Root_Password_Update |
| 78 | |
| 79 | Delete All Sessions |
| 80 | |
| 81 | Initialize OpenBMC |
| 82 | Update Root Password ${test_password} |
| 83 | |
| 84 | # Time for user manager to sync. |
| 85 | Sleep 5 s |
| 86 | |
| 87 | Delete All Sessions |
| 88 | |
| 89 | # SSH Login to BMC with new "root" password. |
| 90 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 91 | Login ${OPENBMC_USERNAME} ${test_password} |
| 92 | |
| 93 | # REST Login to BMC with new "root" password. |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 94 | Initialize OpenBMC REST_PASSWORD=${test_password} |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 95 | |
| 96 | ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate |
| 97 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 98 | ... msg=Verify of new root password failed, RC=${resp.status_code}. |
| 99 | |
| 100 | |
| 101 | *** Keywords *** |
| 102 | |
| 103 | Test Teardown Execution |
| 104 | [Documentation] Do test teardown task. |
| 105 | |
| 106 | # REST Login to BMC with new "root" password. |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 107 | Initialize OpenBMC REST_PASSWORD=${test_password} |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 108 | Update Root Password |
| 109 | Sleep 5 s |
| 110 | Delete All Sessions |
| 111 | |
| 112 | # SSH Login to BMC with user default "root" password. |
| 113 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 114 | Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 115 | |
| 116 | # REST Login to BMC with user default "root" password. |
| 117 | Initialize OpenBMC |
| 118 | |
| 119 | FFDC On Test Case Fail |
| 120 | Close All Connections |
Sivas SRR | dc10cc8 | 2018-10-30 10:53:32 -0500 | [diff] [blame] | 121 | |
| 122 | |
| 123 | Create Group And Privilege |
| 124 | [Documentation] Create group and privilege for users. |
| 125 | [Arguments] ${user_group} ${user_privilege} |
| 126 | |
| 127 | # Description of argument(s): |
| 128 | # user_group User group string. |
| 129 | # user_privilege User privilge string like priv-admin, priv-user. |
| 130 | |
| 131 | @{ldap_parm_list}= Create List |
| 132 | ... ${user_group} ${user_privilege} |
| 133 | |
| 134 | ${data}= Create Dictionary data=@{ldap_parm_list} |
| 135 | |
| 136 | ${resp}= OpenBMC Post Request |
| 137 | ... ${BMC_USER_URI}ldap/action/Create data=${data} |
| 138 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 139 | ... msg=Updating the new root password failed, RC=${resp.status_code}. |
Sivas SRR | 1d3e4be | 2018-11-20 07:35:50 -0600 | [diff] [blame] | 140 | |
| 141 | |
| 142 | Create Privilege |
| 143 | [Documentation] Create privilege as priv-admin. |
| 144 | [Arguments] ${user_privilege} |
| 145 | |
| 146 | Create Group And Privilege ${GROUP_NAME} ${user_privilege} |
| 147 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate |
| 148 | ${bmc_user_uris}= Convert To String ${bmc_user_uris} |
| 149 | Should Contain ${bmc_user_uris} ${user_privilege} |
| 150 | ... msg=Could not create ${user_privilege} privilege. |
| 151 | |
| 152 | |
| 153 | |
| 154 | Verify Root Password Update |
| 155 | [Documentation] Update system "root" user password and verify. |
| 156 | [Tags] Verify_Root_Password_Update |
| 157 | |
| 158 | Delete All Sessions |
| 159 | |
| 160 | Initialize OpenBMC |
| 161 | Update Root Password ${test_password} |
| 162 | |
| 163 | # Time for user manager to sync. |
| 164 | Sleep 5 s |
| 165 | |
| 166 | Delete All Sessions |
| 167 | |
| 168 | # SSH Login to BMC with new "root" password. |
| 169 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 170 | Login ${OPENBMC_USERNAME} ${test_password} |
| 171 | |
| 172 | # REST Login to BMC with new "root" password. |
| 173 | Initialize OpenBMC REST_PASSWORD=${test_password} |
| 174 | |
| 175 | ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate |
| 176 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 177 | ... msg=Verify of new root password failed, RC=${resp.status_code}. |