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