Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test root user expire password. |
| 3 | |
| 4 | Resource ../lib/resource.robot |
| 5 | Resource ../lib/bmc_redfish_resource.robot |
| 6 | Resource ../lib/ipmi_client.robot |
| 7 | Library ../lib/bmc_ssh_utils.py |
| 8 | Library SSHLibrary |
| 9 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
| 11 | Suite Teardown Suite Teardown Execution |
| 12 | |
| 13 | Test Teardown Test Teardown Execution |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Expire Root Password And Check IPMI Access Fails |
| 18 | [Documentation] Expire root user password and expect an error while access via IPMI. |
| 19 | [Tags] Expire_Root_Password_And_Check_IPMI_Access_Fails |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 20 | |
| 21 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 22 | |
| 23 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 24 | Should Contain ${output} password expiry information changed |
| 25 | |
| 26 | ${status}= Run Keyword And Return Status Run External IPMI Standard Command lan print -v |
| 27 | Should Be Equal ${status} ${False} |
| 28 | |
Anves Kumar rayankula | 5df05f7 | 2020-06-22 23:58:25 -0500 | [diff] [blame] | 29 | |
| 30 | Expire Root Password And Check SSH Access Fails |
| 31 | [Documentation] Expire root user password and expect an error while access via SSH. |
| 32 | [Tags] Expire_Root_Password_And_Check_SSH_Access_Fails |
| 33 | |
| 34 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 35 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 36 | Should Contain ${output} password expiry information changed |
| 37 | |
| 38 | ${status}= Run Keyword And Return Status |
| 39 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 40 | Should Be Equal ${status} ${False} |
| 41 | |
| 42 | |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 43 | Expire And Change Root User Password And Access Via SSH |
| 44 | [Documentation] Expire and change root user password and access via SSH. |
| 45 | [Tags] Expire_Root_User_Password_And_Access_Via_SSH |
| 46 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
| 47 | ... Restore Default Password For Root User AND FFDC On Test Case Fail |
| 48 | |
| 49 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 50 | |
| 51 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 52 | Should Contain ${output} password expiry information changed |
| 53 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 54 | Redfish.Login |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 55 | # Change to a valid password. |
| 56 | ${resp}= Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 57 | ... body={'Password': '0penBmc123'} valid_status_codes=[${HTTP_OK}] |
| 58 | |
| 59 | # Verify login with the new password through SSH. |
| 60 | Open Connection And Log In ${OPENBMC_USERNAME} 0penBmc123 |
| 61 | |
| 62 | |
| 63 | Expire Root Password And Update Bad Password Length Via Redfish |
| 64 | [Documentation] Expire root password and update bad password via Redfish and expect an error. |
| 65 | [Tags] Expire_Root_Password_And_Update_Bad_Password_Length_Via_Redfish |
| 66 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 67 | ... Restore Default Password For Root User AND FFDC On Test Case Fail |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 68 | |
| 69 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 70 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 71 | Should Contain ${output} password expiry information changed |
| 72 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 73 | Redfish.Login |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 74 | ${status}= Run Keyword And Return Status |
| 75 | ... Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 76 | ... body={'Password': '0penBmc0penBmc0penBmc'} |
| 77 | Should Be Equal ${status} ${False} |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 78 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 79 | |
| 80 | Expire And Change Root User Password Via Redfish And Verify |
| 81 | [Documentation] Expire and change root user password via Redfish and verify. |
| 82 | [Tags] Expire_And_Change_Root_User_Password_Via_Redfish_And_Verify |
| 83 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 84 | ... Wait Until Keyword Succeeds 1 min 10 sec |
| 85 | ... Restore Default Password For Root User |
| 86 | |
| 87 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 88 | |
| 89 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 90 | Should Contain ${output} password expiry information changed |
| 91 | |
| 92 | |
| 93 | Redfish.Login |
| 94 | Verify Root Password Expired |
| 95 | # Change to a valid password. |
| 96 | Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 97 | ... body={'Password': '0penBmc123'} |
| 98 | Redfish.Logout |
| 99 | |
| 100 | # Verify login with the new password. |
| 101 | Redfish.Login ${OPENBMC_USERNAME} 0penBmc123 |
| 102 | |
| 103 | |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 104 | Verify Error While Creating User With Expired Password |
| 105 | [Documentation] Expire root password and expect an error while creating new user. |
| 106 | [Tags] Verify_Error_While_Creating_User_With_Expired_Password |
| 107 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
| 108 | ... Restore Default Password For Root User AND FFDC On Test Case Fail |
| 109 | |
| 110 | |
| 111 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 112 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} |
| 113 | Should Contain ${output} password expiry information changed |
| 114 | |
| 115 | Verify Root Password Expired |
| 116 | Redfish.Login |
| 117 | ${payload}= Create Dictionary |
| 118 | ... UserName=admin_user Password=TestPwd123 RoleId=Administrator Enabled=${True} |
| 119 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 120 | ... valid_status_codes=[${HTTP_FORBIDDEN}] |
| 121 | |
| 122 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 123 | *** Keywords *** |
| 124 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 125 | Suite Setup Execution |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 126 | [Documentation] Suite setup execution. |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 127 | |
| 128 | Redfish.login |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 129 | Redfish.Patch /redfish/v1/AccountService/ body={"AccountLockoutThreshold": 0} |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 130 | Valid Length OPENBMC_PASSWORD min_length=8 |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 131 | Redfish.Logout |
| 132 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 133 | Restore Default Password For Root User |
| 134 | [Documentation] Restore default password for root user (i.e. 0penBmc). |
| 135 | |
| 136 | # Set default password for root user. |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 137 | Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 138 | ... body={'Password': '${OPENBMC_PASSWORD}'} valid_status_codes=[${HTTP_OK}] |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 139 | # Verify that root user is able to run Redfish command using default password. |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 140 | Redfish.Logout |
| 141 | |
| 142 | |
| 143 | Test Teardown Execution |
| 144 | [Documentation] Do test teardown task. |
| 145 | |
| 146 | Redfish.Login |
| 147 | Wait Until Keyword Succeeds 1 min 10 sec Restore Default Password For Root User |
| 148 | FFDC On Test Case Fail |
| 149 | |
| 150 | |
| 151 | Suite Teardown Execution |
| 152 | [Documentation] Do suite teardown task. |
| 153 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 154 | Redfish.login |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 155 | Redfish.Patch /redfish/v1/AccountService/ body={"AccountLockoutThreshold": 5} |
| 156 | Redfish.Logout |
| 157 | |
| 158 | Verify Root Password Expired |
| 159 | [Documentation] Checking whether root password expired or not. |
| 160 | |
| 161 | Create Session openbmc ${AUTH_URI} |
| 162 | ${headers}= Create Dictionary Content-Type=application/json |
| 163 | @{credentials}= Create List ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 164 | ${data}= Create Dictionary data=@{credentials} |
| 165 | ${resp}= Post Request openbmc /login data=${data} headers=${headers} |
| 166 | ${json}= To JSON ${resp.content} |
| 167 | Should Contain ${json["extendedMessage"]} POST the new password |