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