Added test case for testing expire password
Test cases added:
Expire And Change Root User Password And Access Via SSH
Expire Root Password And Update Bad Password Length Via Redfish
Change-Id: I57eda3775acc0e00794d58e079e15adf547324ac
Signed-off-by: Anves Kumar rayankula <anvesr77@in.ibm.com>
diff --git a/security/test_bmc_expire_password.robot b/security/test_bmc_expire_password.robot
index a92ed47..4e93495 100644
--- a/security/test_bmc_expire_password.robot
+++ b/security/test_bmc_expire_password.robot
@@ -8,16 +8,14 @@
Library SSHLibrary
Test Setup Test Setup Execution
-Test Teardown Test Teardown Execution
*** Test Cases ***
Expire Root Password And Check IPMI Access Fails
[Documentation] Expire root user password and expect an error while access via IPMI.
[Tags] Expire_Root_Password_And_Check_IPMI_Access_Fails
- [Teardown] Run Keywords FFDC On Test Case Fail AND
- ... Wait Until Keyword Succeeds 1 min 10 sec
- ... Restore Default Password For Root User
+ [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec
+ ... Restore Default Password For Root User AND FFDC On Test Case Fail
Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
@@ -27,6 +25,39 @@
${status}= Run Keyword And Return Status Run External IPMI Standard Command lan print -v
Should Be Equal ${status} ${False}
+Expire And Change Root User Password And Access Via SSH
+ [Documentation] Expire and change root user password and access via SSH.
+ [Tags] Expire_Root_User_Password_And_Access_Via_SSH
+ [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec
+ ... Restore Default Password For Root User AND FFDC On Test Case Fail
+
+ Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+
+ ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME}
+ Should Contain ${output} password expiry information changed
+
+ # Change to a valid password.
+ ${resp}= Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME}
+ ... body={'Password': '0penBmc123'} valid_status_codes=[${HTTP_OK}]
+
+ # Verify login with the new password through SSH.
+ Open Connection And Log In ${OPENBMC_USERNAME} 0penBmc123
+
+
+Expire Root Password And Update Bad Password Length Via Redfish
+ [Documentation] Expire root password and update bad password via Redfish and expect an error.
+ [Tags] Expire_Root_Password_And_Update_Bad_Password_Length_Via_Redfish
+ [Teardown] Run Keywords Wait Until Keyword Succeeds 1 min 10 sec
+ ... Restore Default Password For Root User AND FFDC On Test Case Fail
+
+ Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+ ${output} ${stderr} ${rc}= BMC Execute Command passwd --expire ${OPENBMC_USERNAME}
+ Should Contain ${output} password expiry information changed
+
+ ${status}= Run Keyword And Return Status
+ ... Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME}
+ ... body={'Password': '0penBmc0penBmc0penBmc'}
+ Should Be Equal ${status} ${False}
*** Keywords ***
@@ -40,7 +71,8 @@
[Documentation] Restore default password for root user (i.e. 0penBmc).
# Set default password for root user.
- ${result}= Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME}
- ... body={'Password': '${OPENBMC_PASSWORD}'}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${OPENBMC_USERNAME}
+ ... body={'Password': '${OPENBMC_PASSWORD}'} valid_status_codes=[${HTTP_OK}]
# Verify that root user is able to run Redfish command using default password.
Redfish.login
+