1*** Settings *** 2Documentation Test root user expire password. 3 4Resource ../lib/resource.robot 5Resource ../gui/lib/resource.robot 6Resource ../lib/bmc_redfish_resource.robot 7Resource ../lib/ipmi_client.robot 8Library ../lib/bmc_ssh_utils.py 9Library SSHLibrary 10 11Suite Setup Suite Setup Execution 12Suite Teardown Suite Teardown Execution 13 14Test Teardown Test Teardown Execution 15 16*** Test Cases *** 17 18Expire Root Password And Check IPMI Access Fails 19 [Documentation] Expire root user password and expect an error while access via IPMI. 20 [Tags] Expire_Root_Password_And_Check_IPMI_Access_Fails 21 22 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 23 24 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 25 Should Contain ${output} password expiry information changed 26 27 ${status}= Run Keyword And Return Status Run External IPMI Standard Command lan print -v 28 Should Be Equal ${status} ${False} 29 30 31Expire Root Password And Check SSH Access Fails 32 [Documentation] Expire root user password and expect an error while access via SSH. 33 [Tags] Expire_Root_Password_And_Check_SSH_Access_Fails 34 35 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 36 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 37 Should Contain ${output} password expiry information changed 38 39 ${status}= Run Keyword And Return Status 40 ... Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 41 Should Be Equal ${status} ${False} 42 43 44Expire And Change Root User Password And Access Via SSH 45 [Documentation] Expire and change root user password and access via SSH. 46 [Tags] Expire_Root_User_Password_And_Access_Via_SSH 47 [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec 48 ... Restore Default Password For Root User AND FFDC On Test Case Fail 49 50 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 51 52 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 53 Should Contain ${output} password expiry information changed 54 55 Redfish.Login 56 # Change to a valid password. 57 ${resp}= Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} 58 ... body={'Password': '0penBmc123'} valid_status_codes=[${HTTP_OK}] 59 60 # Verify login with the new password through SSH. 61 Open Connection And Log In ${OPENBMC_USERNAME} 0penBmc123 62 63 64Expire Root Password And Update Bad Password Length Via Redfish 65 [Documentation] Expire root password and update bad password via Redfish and expect an error. 66 [Tags] Expire_Root_Password_And_Update_Bad_Password_Length_Via_Redfish 67 [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec 68 ... Restore Default Password For Root User AND FFDC On Test Case Fail 69 70 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 71 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 72 Should Contain ${output} password expiry information changed 73 74 Redfish.Login 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} 79 80 81Expire 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 88 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 89 90 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 91 Should Contain ${output} password expiry information changed 92 93 94 Redfish.Login 95 Verify Root Password Expired 96 # Change to a valid password. 97 Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} 98 ... body={'Password': '0penBmc123'} 99 Redfish.Logout 100 101 # Verify login with the new password. 102 Redfish.Login ${OPENBMC_USERNAME} 0penBmc123 103 104 105Verify Error While Creating User With Expired Password 106 [Documentation] Expire root password and expect an error while creating new user. 107 [Tags] Verify_Error_While_Creating_User_With_Expired_Password 108 [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec 109 ... Restore Default Password For Root User AND FFDC On Test Case Fail 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 123Expire And Change Root Password Via GUI 124 [Documentation] Expire and change root password via GUI. 125 [Tags] Expire_And_Change_Root_Password_Via_GUI 126 [Setup] Run Keywords Launch Browser And Login OpenBMC GUI 127 [Teardown] Run Keywords Logout And Close Browser 128 ... AND Restore Default Password For Root User AND FFDC On Test Case Fail 129 130 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 131 ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME} 132 Should Contain ${output} password expiry information changed 133 134 Click Button ${xpath_button_user_action} 135 Click Element ${xpath_button_profile_settings} 136 Page Should Contain Change password 137 Sleep 2s 138 # Change valid password. 139 Input Text ${xpath_input_password} 0penBmc123 140 Input Text ${xpath_input_confirm_password} 0penBmc123 141 Click Button ${xpath_submit_button} 142 143 # Verify valid password. 144 Open Browser With URL ${obmc_gui_url} 145 Login OpenBMC GUI ${OPENBMC_USERNAME} 0penBmc123 146 Redfish.Login ${OPENBMC_USERNAME} 0penBmc123 147 148 149*** Keywords *** 150 151Suite Setup Execution 152 [Documentation] Suite setup execution. 153 154 Redfish.login 155 Redfish.Patch /redfish/v1/AccountService/ body={"AccountLockoutThreshold": 0} 156 Valid Length OPENBMC_PASSWORD min_length=8 157 Redfish.Logout 158 159Restore Default Password For Root User 160 [Documentation] Restore default password for root user (i.e. 0penBmc). 161 162 # Set default password for root user. 163 Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME} 164 ... body={'Password': '${OPENBMC_PASSWORD}'} valid_status_codes=[${HTTP_OK}] 165 # Verify that root user is able to run Redfish command using default password. 166 Redfish.Logout 167 168 169Test Teardown Execution 170 [Documentation] Do test teardown task. 171 172 Redfish.Login 173 Wait Until Keyword Succeeds 1 min 10 sec Restore Default Password For Root User 174 FFDC On Test Case Fail 175 176 177Suite Teardown Execution 178 [Documentation] Do suite teardown task. 179 180 Redfish.login 181 Redfish.Patch /redfish/v1/AccountService/ body={"AccountLockoutThreshold": 5} 182 Redfish.Logout 183 184Verify Root Password Expired 185 [Documentation] Checking whether root password expired or not. 186 187 Create Session openbmc ${AUTH_URI} 188 ${headers}= Create Dictionary Content-Type=application/json 189 @{credentials}= Create List ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} 190 ${data}= Create Dictionary data=@{credentials} 191 ${resp}= Post Request openbmc /login data=${data} headers=${headers} 192 ${json}= To JSON ${resp.content} 193 Should Contain ${json["extendedMessage"]} POST the new password 194