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 |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 7 | Library SSHLibrary |
| 8 | |
| 9 | Test Teardown Test Teardown Execution |
| 10 | |
| 11 | *** Variables **** |
| 12 | |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 13 | ${test_password} 0penBmc123 |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 14 | |
| 15 | *** Test Cases *** |
| 16 | |
Sivas SRR | 1a7502d | 2018-09-19 03:31:54 -0500 | [diff] [blame] | 17 | |
| 18 | Verify At Least One User In List |
| 19 | [Documentation] Verify user list API list minimum one user. |
| 20 | [Tags] Verify_At_Least_One_User_In_List |
George Keishing | b24adb3 | 2018-10-29 13:20:08 -0500 | [diff] [blame] | 21 | [Teardown] FFDC On Test Case Fail |
Sivas SRR | 1a7502d | 2018-09-19 03:31:54 -0500 | [diff] [blame] | 22 | |
| 23 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list |
| 24 | Should Not Be Empty ${bmc_user_uris} |
| 25 | |
| 26 | |
Sivas SRR | dc10cc8 | 2018-10-30 10:53:32 -0500 | [diff] [blame] | 27 | Verify User Group And Privilege Created |
| 28 | [Documentation] Verify user group and associated privilege is created. |
| 29 | [Tags] Verify_User_Group_And_Privilege_Created |
| 30 | [Teardown] FFDC On Test Case Fail |
| 31 | |
| 32 | Create Group And Privilege ${GROUP_NAME} ${GROUP_PRIVILEGE} |
| 33 | ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate |
| 34 | ${bmc_user_uris}= Convert To String ${bmc_user_uris} |
| 35 | Should Contain ${bmc_user_uris} ${GROUP_NAME} |
| 36 | Should Contain ${bmc_user_uris} ${GROUP_PRIVILEGE} |
| 37 | |
| 38 | |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 39 | Verify Root Password Update |
| 40 | [Documentation] Update system "root" user password and verify. |
| 41 | [Tags] Verify_Root_Password_Update |
| 42 | |
| 43 | Delete All Sessions |
| 44 | |
| 45 | Initialize OpenBMC |
| 46 | Update Root Password ${test_password} |
| 47 | |
| 48 | # Time for user manager to sync. |
| 49 | Sleep 5 s |
| 50 | |
| 51 | Delete All Sessions |
| 52 | |
| 53 | # SSH Login to BMC with new "root" password. |
| 54 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 55 | Login ${OPENBMC_USERNAME} ${test_password} |
| 56 | |
| 57 | # REST Login to BMC with new "root" password. |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 58 | Initialize OpenBMC REST_PASSWORD=${test_password} |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 59 | |
| 60 | ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate |
| 61 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 62 | ... msg=Verify of new root password failed, RC=${resp.status_code}. |
| 63 | |
| 64 | |
| 65 | *** Keywords *** |
| 66 | |
| 67 | Test Teardown Execution |
| 68 | [Documentation] Do test teardown task. |
| 69 | |
| 70 | # REST Login to BMC with new "root" password. |
George Keishing | cf3df71 | 2018-10-29 09:12:58 -0500 | [diff] [blame] | 71 | Initialize OpenBMC REST_PASSWORD=${test_password} |
George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 72 | Update Root Password |
| 73 | Sleep 5 s |
| 74 | Delete All Sessions |
| 75 | |
| 76 | # SSH Login to BMC with user default "root" password. |
| 77 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 78 | Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 79 | |
| 80 | # REST Login to BMC with user default "root" password. |
| 81 | Initialize OpenBMC |
| 82 | |
| 83 | FFDC On Test Case Fail |
| 84 | Close All Connections |
Sivas SRR | dc10cc8 | 2018-10-30 10:53:32 -0500 | [diff] [blame] | 85 | |
| 86 | |
| 87 | Create Group And Privilege |
| 88 | [Documentation] Create group and privilege for users. |
| 89 | [Arguments] ${user_group} ${user_privilege} |
| 90 | |
| 91 | # Description of argument(s): |
| 92 | # user_group User group string. |
| 93 | # user_privilege User privilge string like priv-admin, priv-user. |
| 94 | |
| 95 | @{ldap_parm_list}= Create List |
| 96 | ... ${user_group} ${user_privilege} |
| 97 | |
| 98 | ${data}= Create Dictionary data=@{ldap_parm_list} |
| 99 | |
| 100 | ${resp}= OpenBMC Post Request |
| 101 | ... ${BMC_USER_URI}ldap/action/Create data=${data} |
| 102 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 103 | ... msg=Updating the new root password failed, RC=${resp.status_code}. |