Minimum length test for IPMI and Redfish User
Signed-off-by: Anusha Dathatri <adathatr@in.ibm.com>
Change-Id: Ia068f3c6060bccc78b4dbbe30fc00733f837d88b
diff --git a/ipmi/test_ipmi_user.robot b/ipmi/test_ipmi_user.robot
index a684286..6420166 100644
--- a/ipmi/test_ipmi_user.robot
+++ b/ipmi/test_ipmi_user.robot
@@ -23,6 +23,7 @@
${ipmi_setaccess_cmd} channel setaccess
&{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B
... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34
+ ... 7=0penBmc 8=0penBmc0
*** Test Cases ***
@@ -413,6 +414,18 @@
20 16 ${True}
+Verify Minimum Password Length For IPMI User
+ [Documentation] Verify minimum password length of 8 characters.
+ [Tags] Verify_Minimum_Password_Length_For_IPMI_User
+ [Template] Set User Password And Verify
+
+ # password_length password_option expected_status
+ 7 16 ${False}
+ 8 16 ${True}
+ 7 20 ${False}
+ 8 20 ${True}
+
+
*** Keywords ***
Create Random IPMI User
diff --git a/redfish/account_service/test_user_account.robot b/redfish/account_service/test_user_account.robot
index 37c518f..a4a1de7 100644
--- a/redfish/account_service/test_user_account.robot
+++ b/redfish/account_service/test_user_account.robot
@@ -43,10 +43,10 @@
Redfish Verify User callback_user TestPwd123 Callback ${True}
# Delete created users.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/callback_user
Redfish Create and Verify Users
[Documentation] Create Redfish users with various roles.
@@ -98,13 +98,13 @@
[Tags] Verify_User_Creation_With_Invalid_Role_Id
# Make sure the user account in question does not already exist.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
# Create specified user.
${payload}= Create Dictionary
... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True}
- Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
+ Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload}
... valid_status_codes=[${HTTP_BAD_REQUEST}]
Verify Error Upon Creating Same Users With Different Privileges
@@ -116,10 +116,10 @@
# Create specified user.
${payload}= Create Dictionary
... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True}
- Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
+ Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload}
... valid_status_codes=[${HTTP_BAD_REQUEST}]
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}test_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/test_user
Verify Modifying User Attributes
[Documentation] Verify modifying user attributes.
@@ -134,24 +134,24 @@
Redfish.Login
# Make sure the new user account does not already exist.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user
... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
# Update admin_user username using Redfish.
${payload}= Create Dictionary UserName=newadmin_user
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body=&{payload}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body=&{payload}
# Update operator_user password using Redfish.
${payload}= Create Dictionary Password=NewTestPwd123
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body=&{payload}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body=&{payload}
# Update readonly_user role using Redfish.
${payload}= Create Dictionary RoleId=Operator
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}readonly_user body=&{payload}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body=&{payload}
# Update callback_user to disable using Redfish.
${payload}= Create Dictionary Enabled=${False}
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}callback_user body=&{payload}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/callback_user body=&{payload}
# Verify users after updating
Redfish Verify User newadmin_user TestPwd123 Administrator ${True}
@@ -160,10 +160,10 @@
Redfish Verify User callback_user TestPwd123 Callback ${False}
# Delete created users.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}newadmin_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}callback_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/callback_user
Verify User Account Locked
[Documentation] Verify user account locked upon trying with invalid password.
@@ -195,7 +195,7 @@
Redfish.Login
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user
Verify Admin User Privilege
[Documentation] Verify admin user privilege.
@@ -210,22 +210,22 @@
Redfish.Login admin_user TestPwd123
# Modify Role ID of Operator user.
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}operator_user body={'RoleId': 'Administrator'}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body={'RoleId': 'Administrator'}
# Verify modified user.
Redfish Verify User operator_user TestPwd123 Administrator ${True}
# Change password of 'user' user with admin user.
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}readonly_user body={'Password': 'NewTestPwd123'}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body={'Password': 'NewTestPwd123'}
# Verify modified user.
Redfish Verify User readonly_user NewTestPwd123 ReadOnly ${True}
Redfish.Login
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user
Verify Operator User Privilege
[Documentation] Verify operator user privilege.
@@ -241,13 +241,13 @@
Redfish OBMC Reboot (off) stack_mode=normal
# Attempt to change password of admin user with operator user.
- Redfish.Patch ${REDFISH_ACCOUNTS_URI}admin_user body={'Password': 'NewTestPwd123'}
+ Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body={'Password': 'NewTestPwd123'}
... valid_status_codes=[${HTTP_UNAUTHORIZED}]
Redfish.Login
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}admin_user
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}operator_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user
+ Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user
Verify ReadOnly User Privilege
@@ -265,6 +265,42 @@
Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user
+Verify Minimum Password Length For Redfish User
+ [Documentation] Verify minimum password length for new and existing user.
+ [Tags] Verify_Minimum_Password_Length_For_Redfish_User
+
+ ${user_name}= Set Variable testUser
+
+ # Make sure the user account in question does not already exist.
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name}
+ ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
+
+ # Try to create a user with invalid length password.
+ ${payload}= Create Dictionary
+ ... UserName=${user_name} Password=UserPwd RoleId=Administrator Enabled=${True}
+ Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload}
+ ... valid_status_codes=[${HTTP_BAD_REQUEST}]
+
+ # Create specified user with valid length password.
+ Set To Dictionary ${payload} Password UserPwd1
+ Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload}
+ ... valid_status_codes=[${HTTP_CREATED}]
+
+ # Try to change to an invalid password.
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd'}
+ ... valid_status_codes=[${HTTP_BAD_REQUEST}]
+
+ # Change to a valid password.
+ Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd1'}
+
+ # Verify login.
+ Redfish.Logout
+ Redfish.Login ${user_name} UserPwd1
+ Redfish.Logout
+ Redfish.Login
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name}
+
+
*** Keywords ***
Test Setup Execution
@@ -294,13 +330,13 @@
Redfish.Login
# Make sure the user account in question does not already exist.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName}
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${userName}
... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
# Create specified user.
${payload}= Create Dictionary
... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled}
- Redfish.Post ${REDFISH_ACCOUNTS_URI} body=&{payload}
+ Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload}
... valid_status_codes=[${HTTP_CREATED}]
Redfish.Logout
@@ -320,7 +356,7 @@
# Validate Role ID of created user.
${role_config}= Redfish_Utils.Get Attribute
- ... ${REDFISH_ACCOUNTS_URI}${username} RoleId
+ ... /redfish/v1/AccountService/Accounts/${username} RoleId
Should Be Equal ${role_id} ${role_config}
@@ -347,7 +383,7 @@
# Validate Role Id of user.
${role_config}= Redfish_Utils.Get Attribute
- ... ${REDFISH_ACCOUNTS_URI}${username} RoleId
+ ... /redfish/v1/AccountService/Accounts/${username} RoleId
Should Be Equal ${role_id} ${role_config}
@@ -382,7 +418,7 @@
Redfish Verify User ${username} ${password} ${role_id} ${enabled}
# Delete Specified User
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
Verify Redfish User with Wrong Password
[Documentation] Verify Redfish User with Wrong Password.
@@ -406,7 +442,7 @@
Redfish.Login
# Delete newly created user.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${username}
Verify Login with Deleted Redfish User
@@ -430,7 +466,7 @@
Redfish.Login
# Delete newly created user.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}${userName}
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${userName}
# Attempt to login with deleted user account.
Run Keyword And Expect Error InvalidCredentialsError*
@@ -463,4 +499,4 @@
Redfish.Login
# Delete newly created user.
- Redfish.Delete ${REDFISH_ACCOUNTS_URI}${username}
+ Redfish.Delete /redfish/v1/AccountService/Accounts/${username}