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 |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 5 | Resource ../gui/lib/gui_resource.robot |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 6 | Resource ../lib/ipmi_client.robot |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 7 | Resource ../lib/bmc_redfish_utils.robot |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 8 | Library ../lib/bmc_ssh_utils.py |
| 9 | Library SSHLibrary |
| 10 | |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 11 | Test Setup Set Account Lockout Threshold |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 12 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 13 | Force Tags BMC_Expire_Password |
| 14 | |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 15 | *** Variables *** |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 16 | |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 17 | # If user re-tries more than 5 time incorrectly, the user gets locked for 5 minutes. |
| 18 | ${default_lockout_duration} ${300} |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 19 | ${admin_user} admin_user |
| 20 | ${default_adminuser_passwd} AdminUser1 |
| 21 | ${admin_password} AdminUser2 |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 22 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 23 | |
| 24 | *** Test Cases *** |
| 25 | |
| 26 | Expire Root Password And Check IPMI Access Fails |
| 27 | [Documentation] Expire root user password and expect an error while access via IPMI. |
| 28 | [Tags] Expire_Root_Password_And_Check_IPMI_Access_Fails |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 29 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 30 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 31 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 32 | |
| 33 | ${status}= Run Keyword And Return Status Run External IPMI Standard Command lan print -v |
| 34 | Should Be Equal ${status} ${False} |
| 35 | |
Anves Kumar rayankula | 5df05f7 | 2020-06-22 23:58:25 -0500 | [diff] [blame] | 36 | |
| 37 | Expire Root Password And Check SSH Access Fails |
| 38 | [Documentation] Expire root user password and expect an error while access via SSH. |
| 39 | [Tags] Expire_Root_Password_And_Check_SSH_Access_Fails |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 40 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | 5df05f7 | 2020-06-22 23:58:25 -0500 | [diff] [blame] | 41 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 42 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | 5df05f7 | 2020-06-22 23:58:25 -0500 | [diff] [blame] | 43 | |
| 44 | ${status}= Run Keyword And Return Status |
| 45 | ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 46 | Should Be Equal ${status} ${False} |
| 47 | |
| 48 | |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 49 | Expire And Change Root User Password And Access Via SSH |
| 50 | [Documentation] Expire and change root user password and access via SSH. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 51 | [Tags] Expire_And_Change_Root_User_Password_And_Access_Via_SSH |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 52 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
| 53 | ... Restore Default Password For Root User AND FFDC On Test Case Fail |
| 54 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 55 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 56 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 57 | Redfish.Login |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 58 | # Change to a valid password. |
| 59 | ${resp}= Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 60 | ... body={'Password': '0penBmc123'} valid_status_codes=[${HTTP_OK}] |
| 61 | |
| 62 | # Verify login with the new password through SSH. |
| 63 | Open Connection And Log In ${OPENBMC_USERNAME} 0penBmc123 |
| 64 | |
| 65 | |
| 66 | Expire Root Password And Update Bad Password Length Via Redfish |
| 67 | [Documentation] Expire root password and update bad password via Redfish and expect an error. |
| 68 | [Tags] Expire_Root_Password_And_Update_Bad_Password_Length_Via_Redfish |
| 69 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 70 | ... 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] | 71 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 72 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 73 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 74 | Redfish.Login |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 75 | ${status}= Run Keyword And Return Status |
| 76 | ... Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 77 | ... body={'Password': '0penBmc0penBmc0penBmc'} |
| 78 | Should Be Equal ${status} ${False} |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 79 | |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 80 | |
| 81 | Expire And Change Root User Password Via Redfish And Verify |
| 82 | [Documentation] Expire and change root user password via Redfish and verify. |
| 83 | [Tags] Expire_And_Change_Root_User_Password_Via_Redfish_And_Verify |
| 84 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 85 | ... Wait Until Keyword Succeeds 1 min 10 sec |
| 86 | ... Restore Default Password For Root User |
| 87 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 88 | Expire Password ${OPENBMC_USERNAME} |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 89 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 90 | Verify User Password Expired Using Redfish ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 91 | # Change to a valid password. |
| 92 | Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 93 | ... body={'Password': '0penBmc123'} |
| 94 | Redfish.Logout |
| 95 | |
| 96 | # Verify login with the new password. |
| 97 | Redfish.Login ${OPENBMC_USERNAME} 0penBmc123 |
| 98 | |
| 99 | |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 100 | Verify Error While Creating User With Expired Password |
| 101 | [Documentation] Expire root password and expect an error while creating new user. |
| 102 | [Tags] Verify_Error_While_Creating_User_With_Expired_Password |
| 103 | [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec |
| 104 | ... Restore Default Password For Root User AND FFDC On Test Case Fail |
| 105 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 106 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 107 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 108 | Verify User Password Expired Using Redfish ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
Anves Kumar rayankula | 322e3aa | 2020-06-01 00:28:48 -0500 | [diff] [blame] | 109 | Redfish.Login |
| 110 | ${payload}= Create Dictionary |
| 111 | ... UserName=admin_user Password=TestPwd123 RoleId=Administrator Enabled=${True} |
| 112 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 113 | ... valid_status_codes=[${HTTP_FORBIDDEN}] |
| 114 | |
| 115 | |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 116 | Expire And Change Root Password Via GUI |
| 117 | [Documentation] Expire and change root password via GUI. |
| 118 | [Tags] Expire_And_Change_Root_Password_Via_GUI |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 119 | [Setup] Launch Browser And Login GUI |
| 120 | [Teardown] Run Keywords Logout GUI AND Close Browser |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 121 | ... AND Restore Default Password For Root User AND FFDC On Test Case Fail |
| 122 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 123 | Expire Password ${OPENBMC_USERNAME} |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 124 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 125 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 126 | Click Element ${xpath_root_button_menu} |
| 127 | Click Element ${xpath_profile_settings} |
| 128 | Wait Until Page Contains Change password |
| 129 | |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 130 | # Change valid password. |
| 131 | Input Text ${xpath_input_password} 0penBmc123 |
| 132 | Input Text ${xpath_input_confirm_password} 0penBmc123 |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 133 | Click Button ${xpath_profile_save_button} |
| 134 | Wait Until Page Contains Successfully saved account settings. |
| 135 | Wait Until Page Does Not Contain Successfully saved account settings. timeout=20 |
| 136 | Logout GUI |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 137 | |
| 138 | # Verify valid password. |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 139 | Login GUI ${OPENBMC_USERNAME} 0penBmc123 |
Anves Kumar rayankula | 9233ce1 | 2020-06-17 00:14:41 -0500 | [diff] [blame] | 140 | Redfish.Login ${OPENBMC_USERNAME} 0penBmc123 |
| 141 | |
| 142 | |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 143 | Verify Maximum Failed Attempts And Check Root User Account Locked |
| 144 | [Documentation] Verify maximum failed attempts and locks out root user account. |
| 145 | [Tags] Verify_Maximum_Failed_Attempts_And_Check_Root_User_Account_Locked |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 146 | [Setup] Set Account Lockout Threshold account_lockout_threshold=${5} |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 147 | |
| 148 | # Make maximum failed login attempts. |
| 149 | Repeat Keyword ${5} times |
| 150 | ... Run Keyword And Expect Error InvalidCredentialsError* Redfish.Login root 0penBmc123 |
| 151 | |
| 152 | # Verify that legitimate login fails due to lockout. |
| 153 | Run Keyword And Expect Error InvalidCredentialsError* |
| 154 | ... Redfish.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 155 | |
| 156 | # Wait for lockout duration to expire and then verify that login works. |
| 157 | Sleep ${default_lockout_duration}s |
| 158 | Redfish.Login |
| 159 | Redfish.Logout |
| 160 | |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 161 | Verify New Password Persistency After BMC Reboot |
| 162 | [Documentation] Verify new password persistency after BMC reboot. |
| 163 | [Tags] Verify_New_Password_Persistency_After_BMC_Reboot |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 164 | [Teardown] Test Teardown Execution |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 165 | |
| 166 | Redfish.Login |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 167 | |
| 168 | # Make sure the user account in question does not already exist. |
| 169 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 170 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 171 | |
| 172 | # Create specified user. |
| 173 | ${payload}= Create Dictionary |
| 174 | ... UserName=admin_user Password=TestPwd123 RoleId=Administrator Enabled=${True} |
| 175 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 176 | ... valid_status_codes=[${HTTP_CREATED}] |
| 177 | Redfish.Logout |
| 178 | |
| 179 | Redfish.Login admin_user TestPwd123 |
| 180 | |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 181 | # Change to a valid password. |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 182 | Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 183 | ... body={'Password': '0penBmc123'} |
| 184 | |
| 185 | # Reboot BMC and verify persistency. |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 186 | Redfish OBMC Reboot (off) |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 187 | |
| 188 | # verify new password |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 189 | Redfish.Login admin_user 0penBmc123 |
Anves Kumar rayankula | c46a896 | 2020-08-07 10:00:44 -0500 | [diff] [blame] | 190 | |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 191 | |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 192 | Verify Expire And Change Admin User Password Via GUI |
| 193 | [Documentation] Force expire admin password and update admin password via GUI. |
| 194 | [Tags] Verify_Expire_And_Change_Admin_User_Password_Via_GUI |
| 195 | [Setup] Run Keywords Launch Browser And Login GUI AND |
| 196 | ... Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True} |
| 197 | [Teardown] Run Keywords Logout GUI AND Close Browser |
| 198 | |
| 199 | Expire Password ${admin_user} |
| 200 | |
| 201 | Logout GUI |
| 202 | |
| 203 | # Verify that admin user should not be able to login with expired password. |
| 204 | Login GUI ${admin_user} ${default_adminuser_passwd} |
| 205 | |
| 206 | # Verify error message to update the password. |
| 207 | Wait Until Page Contains The password is expired and must be changed. timeout=10 |
| 208 | |
| 209 | # Update a valid acceptable password. |
| 210 | Input Text ${xpath_input_password} ${admin_password} |
| 211 | Input Text ${xpath_input_confirm_password} ${admin_password} |
| 212 | Click Button ${xpath_confirm_password_button} |
| 213 | Wait Until Page Contains Overview timeout=20 |
| 214 | |
| 215 | # Verify valid password. |
| 216 | Redfish.Login ${admin_user} ${admin_password} |
| 217 | |
| 218 | |
Megha G N | 2f76ae4 | 2023-10-13 05:05:46 -0500 | [diff] [blame] | 219 | Expire Admin Password And Check IPMI Access Fails |
| 220 | [Documentation] Expire admin user password and expect an error while access via IPMI. |
| 221 | [Tags] Expire_Admin_Password_And_Check_IPMI_Access_Fails |
| 222 | [Setup] Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True} |
| 223 | |
| 224 | Expire Password ${admin_user} |
| 225 | |
| 226 | ${status}= Run Keyword And Return Status Run External IPMI Standard Command lan print -v |
| 227 | Should Be Equal ${status} ${False} |
| 228 | |
| 229 | |
Megha G N | 80222cf | 2023-10-17 04:01:04 -0500 | [diff] [blame] | 230 | Verify Expire Admin Password And Update Bad Password Length Via Redfish |
| 231 | [Documentation] Expire admin password and update bad password with more than 20 characters |
| 232 | ... via Redfish and expect an error. |
| 233 | [Tags] Verify_Expire_Admin_Password_And_Update_Bad_Password_Length_Via_Redfish |
| 234 | [Setup] Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True} |
| 235 | |
| 236 | Expire Password ${admin_user} |
| 237 | |
| 238 | Redfish.Login |
Megha G N | 80222cf | 2023-10-17 04:01:04 -0500 | [diff] [blame] | 239 | |
Megha G N | b196238 | 2023-10-17 05:45:39 -0500 | [diff] [blame] | 240 | Set Password Via Redfish 0penBmc0penBmc0penBmc ${False} |
Megha G N | 80222cf | 2023-10-17 04:01:04 -0500 | [diff] [blame] | 241 | |
| 242 | |
Megha G N | 014ad01 | 2023-11-07 01:13:04 -0600 | [diff] [blame] | 243 | Verify Error While Creating User With Expired Admin Password |
| 244 | [Documentation] Expire admin password and expect an error while creating new user. |
| 245 | [Tags] Verify_Error_While_Creating_User_With_Expired_Admin_Password |
| 246 | [Teardown] Restore Default Password For Admin User |
| 247 | |
| 248 | Expire Password ${admin_user} |
| 249 | |
| 250 | Verify User Password Expired Using Redfish ${admin_user} ${default_adminuser_passwd} |
| 251 | |
| 252 | # Create new user with expired admin password and expect an error. |
| 253 | ${payload}= Create Dictionary |
| 254 | ... UserName=admin_user1 Password=TestPwd123 RoleId=Administrator Enabled=${True} |
| 255 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 256 | ... valid_status_codes=[${HTTP_FORBIDDEN}] |
| 257 | |
| 258 | |
Megha G N | 521e9e0 | 2023-11-14 04:36:45 -0600 | [diff] [blame] | 259 | Verify New Admin Password Persistency After BMC Reboot |
| 260 | [Documentation] Verify new admin password persistency after BMC reboot. |
| 261 | [Tags] Verify_New_Admin_Password_Persistency_After_BMC_Reboot |
| 262 | [Setup] Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True} |
| 263 | [Teardown] Restore Default Password For Admin User |
| 264 | |
| 265 | Expire Password ${admin_user} |
| 266 | |
Megha G N | b196238 | 2023-10-17 05:45:39 -0500 | [diff] [blame] | 267 | Set Password Via Redfish ${admin_password} ${True} |
Megha G N | 521e9e0 | 2023-11-14 04:36:45 -0600 | [diff] [blame] | 268 | |
| 269 | # Reboot BMC. |
| 270 | Redfish OBMC Reboot (off) stack_mode=skip |
| 271 | |
| 272 | # Verify password is persisted after bmc reboot. |
| 273 | Redfish.Login ${admin_user} ${admin_password} |
| 274 | |
| 275 | |
Megha G N | b196238 | 2023-10-17 05:45:39 -0500 | [diff] [blame] | 276 | Expire And Change Admin User Password Via Redfish And Verify |
| 277 | [Documentation] Expire and change admin user password via Redfish and verify. |
| 278 | [Tags] Expire_And_Change_Admin_User_Password_Via_Redfish_And_Verify |
| 279 | [Setup] Redfish Create User ${admin_user} ${default_adminuser_passwd} Administrator ${True} |
| 280 | [Teardown] Restore Default Password For Admin User |
| 281 | |
| 282 | Expire Password ${admin_user} |
| 283 | |
| 284 | Verify User Password Expired Using Redfish ${admin_user} ${default_adminuser_passwd} |
| 285 | |
| 286 | # Change to a valid password. |
| 287 | Set Password Via Redfish AdminUser2 ${True} |
| 288 | Redfish.Logout |
| 289 | |
| 290 | # Verify login with the new password. |
| 291 | Redfish.Login ${admin_user} AdminUser2 |
| 292 | |
| 293 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 294 | *** Keywords *** |
| 295 | |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 296 | Set Account Lockout Threshold |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 297 | [Documentation] Set user account lockout threshold. |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 298 | [Arguments] ${account_lockout_threshold}=${0} ${account_lockout_duration}=${50} |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 299 | |
| 300 | # Description of argument(s): |
| 301 | # account_lockout_threshold Set lockout threshold value. |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 302 | # account_lockout_duration Set lockout duration value. |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 303 | |
| 304 | Redfish.login |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 305 | ${payload}= Create Dictionary AccountLockoutThreshold=${account_lockout_threshold} |
| 306 | ... AccountLockoutDuration=${account_lockout_duration} |
| 307 | Redfish.Patch /redfish/v1/AccountService/ body=&{payload} |
Anves Kumar rayankula | e6c745a | 2020-09-24 04:14:09 -0500 | [diff] [blame] | 308 | gen_robot_valid.Valid Length OPENBMC_PASSWORD min_length=8 |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 309 | Redfish.Logout |
| 310 | |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 311 | Restore Default Password For Root User |
| 312 | [Documentation] Restore default password for root user (i.e. 0penBmc). |
| 313 | |
| 314 | # Set default password for root user. |
Anves Kumar rayankula | 6792114 | 2020-05-14 04:03:24 -0500 | [diff] [blame] | 315 | Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} |
| 316 | ... body={'Password': '${OPENBMC_PASSWORD}'} valid_status_codes=[${HTTP_OK}] |
Anves Kumar rayankula | a87b1b1 | 2020-05-06 01:18:28 -0500 | [diff] [blame] | 317 | # 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] | 318 | Redfish.Logout |
| 319 | |
| 320 | |
| 321 | Test Teardown Execution |
| 322 | [Documentation] Do test teardown task. |
| 323 | |
| 324 | Redfish.Login |
| 325 | Wait Until Keyword Succeeds 1 min 10 sec Restore Default Password For Root User |
Anvesh Kumar | 9f42121 | 2020-04-27 01:42:50 -0500 | [diff] [blame] | 326 | Redfish.Logout |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 327 | Set Account Lockout Threshold account_lockout_threshold=${5} |
Anves Kumar rayankula | 68f985b | 2020-07-24 04:39:46 -0500 | [diff] [blame] | 328 | FFDC On Test Case Fail |
Megha G N | e18cdb5 | 2023-10-11 04:45:32 -0500 | [diff] [blame] | 329 | |
| 330 | |
| 331 | Expire Password |
| 332 | [Documentation] Force expire password. |
| 333 | [Arguments] ${username} |
| 334 | |
| 335 | # Description of argument(s): |
| 336 | # username User to be created and expire. |
| 337 | |
| 338 | # Expire the password. |
| 339 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 340 | |
| 341 | ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${username} |
| 342 | Should Contain Any ${output} password expiry information changed password changed |
| 343 | |
| 344 | # Example output: |
| 345 | # passwd --expire admin |
| 346 | # passwd: password changed. |
| 347 | |
| 348 | Close All Connections |
Megha G N | 014ad01 | 2023-11-07 01:13:04 -0600 | [diff] [blame] | 349 | |
| 350 | |
| 351 | Restore Default Password For Admin User |
| 352 | [Documentation] Restore default password for admin user (i.e. AdminUser1). |
| 353 | |
| 354 | # Set default password for admin user. |
| 355 | Redfish.Patch /redfish/v1/AccountService/Accounts/${admin_user} |
| 356 | ... body={'Password': '${default_adminuser_passwd}'} valid_status_codes=[${HTTP_OK}] |
| 357 | # Verify that admin user is able to run Redfish command using default password. |
| 358 | Redfish.Logout |
Megha G N | b196238 | 2023-10-17 05:45:39 -0500 | [diff] [blame] | 359 | |
| 360 | |
| 361 | Set Password Via Redfish |
| 362 | [Documentation] Set new password via redfish. |
| 363 | [Arguments] ${new_password} ${expect_result} |
| 364 | |
| 365 | # Description of argument(s): |
| 366 | # new_password New password set. |
| 367 | # expect_result Expected result (eg:true or false). |
| 368 | |
| 369 | ${status}= Run Keyword And Return Status |
| 370 | ... Redfish.Patch /redfish/v1/AccountService/Accounts/${admin_user} |
| 371 | ... body={'Password': '${new_password}'} |
| 372 | |
| 373 | Should be Equal ${status} ${expect_result} |