George Keishing | f133167 | 2018-01-18 05:19:02 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation OpenBMC user management test. |
| 3 | |
| 4 | Resource ../../lib/rest_client.robot |
| 5 | Resource ../../lib/openbmc_ffdc.robot |
| 6 | Library SSHLibrary |
| 7 | |
| 8 | Test Teardown Test Teardown Execution |
| 9 | |
| 10 | *** Variables **** |
| 11 | |
| 12 | ${test_password} abc123 |
| 13 | |
| 14 | *** Test Cases *** |
| 15 | |
| 16 | Verify Root Password Update |
| 17 | [Documentation] Update system "root" user password and verify. |
| 18 | [Tags] Verify_Root_Password_Update |
| 19 | |
| 20 | Delete All Sessions |
| 21 | |
| 22 | Initialize OpenBMC |
| 23 | Update Root Password ${test_password} |
| 24 | |
| 25 | # Time for user manager to sync. |
| 26 | Sleep 5 s |
| 27 | |
| 28 | Delete All Sessions |
| 29 | |
| 30 | # SSH Login to BMC with new "root" password. |
| 31 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 32 | Login ${OPENBMC_USERNAME} ${test_password} |
| 33 | |
| 34 | # REST Login to BMC with new "root" password. |
| 35 | Initialize OpenBMC OPENBMC_PASSWORD=${test_password} |
| 36 | |
| 37 | ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate |
| 38 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 39 | ... msg=Verify of new root password failed, RC=${resp.status_code}. |
| 40 | |
| 41 | |
| 42 | *** Keywords *** |
| 43 | |
| 44 | Test Teardown Execution |
| 45 | [Documentation] Do test teardown task. |
| 46 | |
| 47 | # REST Login to BMC with new "root" password. |
| 48 | Initialize OpenBMC OPENBMC_PASSWORD=${test_password} |
| 49 | Update Root Password |
| 50 | Sleep 5 s |
| 51 | Delete All Sessions |
| 52 | |
| 53 | # SSH Login to BMC with user default "root" password. |
| 54 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 55 | Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 56 | |
| 57 | # REST Login to BMC with user default "root" password. |
| 58 | Initialize OpenBMC |
| 59 | |
| 60 | FFDC On Test Case Fail |
| 61 | Close All Connections |
| 62 | |
| 63 | |
| 64 | Update Root Password |
| 65 | [Documentation] Update system default "root" user password. |
| 66 | [Arguments] ${user_password}=${OPENBMC_PASSWORD} |
| 67 | |
| 68 | # Description of argument(s): |
| 69 | # user_password User password string. |
| 70 | |
| 71 | @{password} = Create List ${user_password} |
| 72 | ${data} = Create Dictionary data=@{password} |
| 73 | |
| 74 | ${headers} = Create Dictionary Content-Type=application/json |
| 75 | ${resp} = Post Request openbmc ${BMC_USER_URI}root/action/SetPassword |
| 76 | ... data=${data} headers=${headers} |
| 77 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 78 | ... msg=Updating the new root password failed, RC=${resp.status_code}. |