Added IPMI-Redfish local user test cases
Changes:
- Update User Password Via Redfish And Verify Using IPMI
- Update User Privilege Via Redfish And Verify Using IPMI
Tested:
- Ran the above test cases from sandbox successfully.
Signed-off-by: srichn28 <srichn28@in.ibm.com>
Change-Id: I85da775cd88d51af06f7534b71c4a574bdbe135e
Signed-off-by: srichn28 <srichn28@in.ibm.com>
diff --git a/openpower/localuser/test_ipmi_redfish_user.robot b/openpower/localuser/test_ipmi_redfish_user.robot
index b44930c..23eb579 100644
--- a/openpower/localuser/test_ipmi_redfish_user.robot
+++ b/openpower/localuser/test_ipmi_redfish_user.robot
@@ -91,6 +91,74 @@
... Verify IPMI Username And Password ${random_username} ${valid_password2}
+Update User Password Via Redfish And Verify Using IPMI
+ [Documentation] Update user password via Redfish and verify using IPMI.
+ [Tags] Update_User_Password_Via_Redfish_And_Verify_Using_IPMI
+
+ # Create user using Redfish.
+ ${random_username}= Generate Random String 8 [LETTERS]
+ Set Test Variable ${random_username}
+
+ ${payload}= Create Dictionary
+ ... UserName=${random_username} Password=${valid_password}
+ ... RoleId=Administrator Enabled=${True}
+ Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload}
+ ... valid_status_codes=[${HTTP_CREATED}]
+
+ Enable IPMI Access To User Using Redfish ${random_username}
+
+ # Update user password using Redfish.
+ ${payload}= Create Dictionary Password=${valid_password2}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${random_username} body=&{payload}
+
+ # Verify that IPMI command works with new password and fails with older password.
+ Verify IPMI Username And Password ${random_username} ${valid_password2}
+
+ Run Keyword And Expect Error *Error: Unable to establish IPMI*
+ ... Verify IPMI Username And Password ${random_username} ${valid_password}
+
+
+Update User Privilege Via Redfish And Verify Using IPMI
+ [Documentation] Update user privilege via Redfish and verify using IPMI.
+ [Tags] Update_User_Privilege_Via_Redfish_And_Verify_Using_IPMI
+
+ # Create user using Redfish with admin privilege.
+ ${random_username}= Generate Random String 8 [LETTERS]
+ Set Test Variable ${random_username}
+
+ ${payload}= Create Dictionary
+ ... UserName=${random_username} Password=${valid_password}
+ ... RoleId=Administrator Enabled=${True}
+ Redfish.Post /redfish/v1/AccountService/Accounts body=&{payload}
+ ... valid_status_codes=[${HTTP_CREATED}]
+
+ Enable IPMI Access To User Using Redfish ${random_username}
+
+ # Update user password using Redfish.
+ ${payload}= Create Dictionary Password=${valid_password2}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${random_username} body=&{payload}
+
+ # Update user privilege to readonly using Redfish.
+ ${payload}= Create Dictionary RoleId=ReadOnly
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${random_username} body=&{payload}
+
+ # Verify new user privilege level via IPMI.
+ ${resp}= Run IPMI Standard Command user list
+
+ # Example of response data:
+ # ID Name Callin Link Auth IPMI Msg Channel Priv Limit
+ # 1 ipmi_admin false true true ADMINISTRATOR
+ # 2 OAvCxjMv false true true USER
+ # 3 true false false NO ACCESS
+ # ..
+ # ..
+ # 15 true false false NO ACCESS
+
+ ${user_info}=
+ ... Get Lines Containing String ${resp} ${random_username}
+ Should Contain ${user_info} USER
+
+
*** Keywords ***
Create IPMI Random User With Password And Privilege