Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test Redfish user account. |
| 3 | |
| 4 | Resource ../../lib/resource.robot |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
| 8 | Test Setup Test Setup Execution |
| 9 | Test Teardown Test Teardown Execution |
| 10 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 11 | *** Variables *** |
| 12 | |
| 13 | ${account_lockout_duration} ${30} |
| 14 | ${account_lockout_threshold} ${3} |
| 15 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 16 | ** Test Cases ** |
| 17 | |
| 18 | Verify AccountService Available |
Sivas SRR | fa6831c | 2019-02-22 00:12:00 -0600 | [diff] [blame] | 19 | [Documentation] Verify Redfish account service is available. |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 20 | [Tags] Verify_AccountService_Available |
| 21 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 22 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 23 | Should Be Equal As Strings ${resp} ${True} |
| 24 | |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 25 | Verify Redfish User Persistence After Reboot |
| 26 | [Documentation] Verify Redfish user persistence after reboot. |
| 27 | [Tags] Verify_Redfish_User_Persistence_After_Reboot |
| 28 | |
| 29 | # Create Redfish users. |
| 30 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 31 | Redfish Create User operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 32 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 33 | |
| 34 | # Reboot BMC. |
| 35 | Redfish OBMC Reboot (off) stack_mode=normal |
| 36 | Redfish.Login |
| 37 | |
| 38 | # Verify users after reboot. |
| 39 | Redfish Verify User admin_user TestPwd123 Administrator ${True} |
| 40 | Redfish Verify User operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 41 | Redfish Verify User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 42 | |
| 43 | # Delete created users. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 44 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 45 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 46 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 47 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 48 | Redfish Create and Verify Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 49 | [Documentation] Create Redfish users with various roles. |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 50 | [Tags] Redfish_Create_and_Verify_Users |
| 51 | [Template] Redfish Create And Verify User |
| 52 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 53 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 54 | admin_user TestPwd123 Administrator ${True} |
| 55 | operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 56 | readonly_user TestPwd123 ReadOnly ${True} |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 57 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 58 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 59 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 60 | [Tags] Verify_Redfish_User_with_Wrong_Password |
| 61 | [Template] Verify Redfish User with Wrong Password |
| 62 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 63 | #username password role_id enabled wrong_password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 64 | admin_user TestPwd123 Administrator ${True} alskjhfwurh |
| 65 | operator_user TestPwd123 Operator ${True} 12j8a8uakjhdaosiruf024 |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 66 | readonly_user TestPwd123 ReadOnly ${True} 12 |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 67 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 68 | Verify Login with Deleted Redfish Users |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 69 | [Documentation] Verify login with deleted Redfish Users. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 70 | [Tags] Verify_Login_with_Deleted_Redfish_Users |
| 71 | [Template] Verify Login with Deleted Redfish User |
| 72 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 73 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 74 | admin_user TestPwd123 Administrator ${True} |
| 75 | operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 76 | readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 77 | |
George Keishing | e0c5ec3 | 2019-06-13 09:45:29 -0500 | [diff] [blame] | 78 | Verify User Creation Without Enabling It |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 79 | [Documentation] Verify User Creation Without Enabling it. |
George Keishing | e0c5ec3 | 2019-06-13 09:45:29 -0500 | [diff] [blame] | 80 | [Tags] Verify_User_Creation_Without_Enabling_It |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 81 | [Template] Verify Create User Without Enabling |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 82 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 83 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 84 | admin_user TestPwd123 Administrator ${False} |
| 85 | operator_user TestPwd123 Operator ${False} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 86 | readonly_user TestPwd123 ReadOnly ${False} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 87 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 88 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 89 | Verify User Creation With Invalid Role Id |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 90 | [Documentation] Verify user creation with invalid role ID. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 91 | [Tags] Verify_User_Creation_With_Invalid_Role_Id |
| 92 | |
| 93 | # Make sure the user account in question does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 94 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 95 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 96 | |
| 97 | # Create specified user. |
| 98 | ${payload}= Create Dictionary |
| 99 | ... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 100 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 101 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 102 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 103 | Verify Error Upon Creating Same Users With Different Privileges |
| 104 | [Documentation] Verify error upon creating same users with different privileges. |
| 105 | [Tags] Verify_Error_Upon_Creating_Same_Users_With_Different_Privileges |
| 106 | |
| 107 | Redfish Create User test_user TestPwd123 Administrator ${True} |
| 108 | |
| 109 | # Create specified user. |
| 110 | ${payload}= Create Dictionary |
| 111 | ... UserName=test_user Password=TestPwd123 RoleId=Operator Enabled=${True} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 112 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 113 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 114 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 115 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 116 | |
| 117 | Verify Modifying User Attributes |
| 118 | [Documentation] Verify modifying user attributes. |
| 119 | [Tags] Verify_Modifying_User_Attributes |
| 120 | |
| 121 | # Create Redfish users. |
| 122 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 123 | Redfish Create User operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 124 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 125 | |
| 126 | Redfish.Login |
| 127 | |
| 128 | # Make sure the new user account does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 129 | Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 130 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 131 | |
| 132 | # Update admin_user username using Redfish. |
| 133 | ${payload}= Create Dictionary UserName=newadmin_user |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 134 | Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body=&{payload} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 135 | |
| 136 | # Update operator_user password using Redfish. |
| 137 | ${payload}= Create Dictionary Password=NewTestPwd123 |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 138 | Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body=&{payload} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 139 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 140 | # Update readonly_user role using Redfish. |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 141 | ${payload}= Create Dictionary RoleId=Operator |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 142 | Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body=&{payload} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 143 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 144 | # Verify users after updating |
| 145 | Redfish Verify User newadmin_user TestPwd123 Administrator ${True} |
| 146 | Redfish Verify User operator_user NewTestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 147 | Redfish Verify User readonly_user TestPwd123 Operator ${True} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 148 | |
| 149 | # Delete created users. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 150 | Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user |
| 151 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 152 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 153 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 154 | Verify User Account Locked |
| 155 | [Documentation] Verify user account locked upon trying with invalid password. |
| 156 | [Tags] Verify_User_Account_Locked |
| 157 | |
| 158 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 159 | |
Sandhya Somashekar | 4737c8f | 2019-07-11 00:00:58 -0500 | [diff] [blame] | 160 | Redfish.Logout |
| 161 | |
| 162 | Redfish.Login |
| 163 | |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 164 | ${payload}= Create Dictionary AccountLockoutThreshold=${account_lockout_threshold} |
| 165 | ... AccountLockoutDuration=${account_lockout_duration} |
| 166 | Redfish.Patch ${REDFISH_ACCOUNTS_SERVICE_URI} body=${payload} |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 167 | |
| 168 | # Make ${account_lockout_threshold} failed login attempts. |
| 169 | Repeat Keyword ${account_lockout_threshold} times |
| 170 | ... Run Keyword And Expect Error InvalidCredentialsError* Redfish.Login admin_user abc123 |
| 171 | |
| 172 | # Verify that legitimate login fails due to lockout. |
| 173 | Run Keyword And Expect Error InvalidCredentialsError* |
| 174 | ... Redfish.Login admin_user TestPwd123 |
| 175 | |
| 176 | # Wait for lockout duration to expire and then verify that login works. |
| 177 | Sleep ${account_lockout_duration}s |
| 178 | Redfish.Login admin_user TestPwd123 |
| 179 | |
| 180 | Redfish.Logout |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 181 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 182 | Redfish.Login |
| 183 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 184 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 185 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 186 | Verify Admin User Privilege |
| 187 | [Documentation] Verify admin user privilege. |
| 188 | [Tags] Verify_Admin_User_Privilege |
| 189 | |
| 190 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 191 | Redfish Create User operator_user TestPwd123 Operator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 192 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 193 | |
| 194 | # Change role ID of operator user with admin user. |
| 195 | # Login with admin user. |
| 196 | Redfish.Login admin_user TestPwd123 |
| 197 | |
| 198 | # Modify Role ID of Operator user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 199 | Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body={'RoleId': 'Administrator'} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 200 | |
| 201 | # Verify modified user. |
| 202 | Redfish Verify User operator_user TestPwd123 Administrator ${True} |
| 203 | |
| 204 | # Change password of 'user' user with admin user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 205 | Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body={'Password': 'NewTestPwd123'} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 206 | |
| 207 | # Verify modified user. |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 208 | Redfish Verify User readonly_user NewTestPwd123 ReadOnly ${True} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 209 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 210 | Redfish.Login |
| 211 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 212 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 213 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 214 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 215 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 216 | Verify Operator User Privilege |
| 217 | [Documentation] Verify operator user privilege. |
| 218 | [Tags] Verify_operator_User_Privilege |
| 219 | |
| 220 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 221 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 222 | |
| 223 | # Login with operator user. |
| 224 | Redfish.Login operator_user TestPwd123 |
| 225 | |
| 226 | # Verify power on system. |
| 227 | Redfish OBMC Reboot (off) stack_mode=normal |
| 228 | |
| 229 | # Attempt to change password of admin user with operator user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 230 | Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body={'Password': 'NewTestPwd123'} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 231 | ... valid_status_codes=[${HTTP_UNAUTHORIZED}] |
| 232 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 233 | Redfish.Login |
| 234 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 235 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 236 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 237 | |
| 238 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 239 | Verify ReadOnly User Privilege |
| 240 | [Documentation] Verify ReadOnly user privilege. |
| 241 | [Tags] Verify_ReadOnly_User_Privilege |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 242 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 243 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 244 | |
| 245 | # Read system level data. |
| 246 | ${system_model}= Redfish_Utils.Get Attribute |
| 247 | ... ${SYSTEM_BASE_URI} Model |
| 248 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 249 | Redfish.Login |
| 250 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 251 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 252 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 253 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 254 | Verify Minimum Password Length For Redfish User |
| 255 | [Documentation] Verify minimum password length for new and existing user. |
| 256 | [Tags] Verify_Minimum_Password_Length_For_Redfish_User |
| 257 | |
| 258 | ${user_name}= Set Variable testUser |
| 259 | |
| 260 | # Make sure the user account in question does not already exist. |
| 261 | Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name} |
| 262 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 263 | |
| 264 | # Try to create a user with invalid length password. |
| 265 | ${payload}= Create Dictionary |
| 266 | ... UserName=${user_name} Password=UserPwd RoleId=Administrator Enabled=${True} |
| 267 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 268 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 269 | |
| 270 | # Create specified user with valid length password. |
| 271 | Set To Dictionary ${payload} Password UserPwd1 |
| 272 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 273 | ... valid_status_codes=[${HTTP_CREATED}] |
| 274 | |
| 275 | # Try to change to an invalid password. |
| 276 | Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd'} |
| 277 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 278 | |
| 279 | # Change to a valid password. |
| 280 | Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd1'} |
| 281 | |
| 282 | # Verify login. |
| 283 | Redfish.Logout |
| 284 | Redfish.Login ${user_name} UserPwd1 |
| 285 | Redfish.Logout |
| 286 | Redfish.Login |
| 287 | Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name} |
| 288 | |
| 289 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 290 | *** Keywords *** |
| 291 | |
| 292 | Test Setup Execution |
| 293 | [Documentation] Do test case setup tasks. |
| 294 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 295 | Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 296 | |
| 297 | |
| 298 | Test Teardown Execution |
| 299 | [Documentation] Do the post test teardown. |
| 300 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 301 | FFDC On Test Case Fail |
Anusha Dathatri | db76970 | 2020-02-12 01:02:30 -0600 | [diff] [blame] | 302 | Run Keyword And Ignore Error Redfish.Logout |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 303 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 304 | Redfish Create User |
| 305 | [Documentation] Redfish create user. |
| 306 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 307 | |
| 308 | # Description of argument(s): |
| 309 | # username The username to be created. |
| 310 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 311 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 312 | # (e.g. "Administrator", "Operator", etc.). |
| 313 | # enabled Indicates whether the username being created |
| 314 | # should be enabled (${True}, ${False}). |
| 315 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 316 | Redfish.Login |
| 317 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 318 | # Make sure the user account in question does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 319 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 320 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 321 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 322 | # Create specified user. |
| 323 | ${payload}= Create Dictionary |
| 324 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 325 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 326 | ... valid_status_codes=[${HTTP_CREATED}] |
| 327 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 328 | Redfish.Logout |
| 329 | |
| 330 | # Login with created user. |
George Keishing | 4916b46 | 2019-08-08 23:24:48 -0500 | [diff] [blame] | 331 | Run Keyword If ${enabled} == ${False} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 332 | ... Run Keyword And Expect Error InvalidCredentialsError* |
| 333 | ... Redfish.Login ${username} ${password} |
| 334 | ... ELSE |
| 335 | ... Redfish.Login ${username} ${password} |
| 336 | |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 337 | Run Keyword If ${enabled} == ${False} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 338 | ... Redfish.Login |
| 339 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 340 | # Validate Role ID of created user. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 341 | ${role_config}= Redfish_Utils.Get Attribute |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 342 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 343 | Should Be Equal ${role_id} ${role_config} |
| 344 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 345 | |
| 346 | Redfish Verify User |
| 347 | [Documentation] Redfish user verification. |
| 348 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 349 | |
| 350 | # Description of argument(s): |
| 351 | # username The username to be created. |
| 352 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 353 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 354 | # (e.g. "Administrator", "Operator", etc.). |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 355 | # enabled Indicates whether the username being created |
| 356 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 357 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 358 | # Trying to do a login with created user. |
| 359 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 360 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 361 | # Doing a check of the returned status. |
| 362 | Should Be Equal ${status} ${enabled} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 363 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 364 | # We do not need to login with created user (user could be in disabled status). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 365 | Redfish.Login |
| 366 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 367 | # Validate Role Id of user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 368 | ${role_config}= Redfish_Utils.Get Attribute |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 369 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 370 | Should Be Equal ${role_id} ${role_config} |
| 371 | |
| 372 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 373 | Redfish Create And Verify User |
| 374 | [Documentation] Redfish create and verify user. |
| 375 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 376 | |
| 377 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 378 | # username The username to be created. |
| 379 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 380 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 381 | # (e.g. "Administrator", "Operator", etc.). |
| 382 | # enabled Indicates whether the username being created |
| 383 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 384 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 385 | # Example: |
| 386 | #{ |
| 387 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 388 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 389 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 390 | #"Description": "User Account", |
| 391 | #"Enabled": true, |
| 392 | #"Id": "test1", |
| 393 | #"Links": { |
| 394 | # "Role": { |
| 395 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 396 | # } |
| 397 | #}, |
| 398 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 399 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 400 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 401 | Redfish Verify User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 402 | |
| 403 | # Delete Specified User |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 404 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 405 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 406 | Verify Redfish User with Wrong Password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 407 | [Documentation] Verify Redfish User with Wrong Password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 408 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 409 | |
| 410 | # Description of argument(s): |
| 411 | # username The username to be created. |
| 412 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 413 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 414 | # (e.g. "Administrator", "Operator", etc.). |
| 415 | # enabled Indicates whether the username being created |
| 416 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 417 | # wrong_password Any invalid password. |
| 418 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 419 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 420 | |
| 421 | # Attempt to login with created user with invalid password. |
| 422 | Run Keyword And Expect Error InvalidCredentialsError* |
| 423 | ... Redfish.Login ${username} ${wrong_password} |
| 424 | |
| 425 | Redfish.Login |
| 426 | |
| 427 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 428 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 429 | |
| 430 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 431 | Verify Login with Deleted Redfish User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 432 | [Documentation] Verify Login with Deleted Redfish User. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 433 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 434 | |
| 435 | # Description of argument(s): |
| 436 | # username The username to be created. |
| 437 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 438 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 439 | # (e.g. "Administrator", "Operator", etc.). |
| 440 | # enabled Indicates whether the username being created |
| 441 | # should be enabled (${True}, ${False}). |
| 442 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 443 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 444 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
| 445 | |
| 446 | # Doing a check of the rerurned status |
| 447 | Should Be Equal ${status} ${True} |
| 448 | |
| 449 | Redfish.Login |
| 450 | |
| 451 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 452 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 453 | |
| 454 | # Attempt to login with deleted user account. |
| 455 | Run Keyword And Expect Error InvalidCredentialsError* |
| 456 | ... Redfish.Login ${username} ${password} |
| 457 | |
| 458 | Redfish.Login |
| 459 | |
| 460 | Verify Create User Without Enabling |
| 461 | [Documentation] Verify Create User Without Enabling. |
| 462 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 463 | |
| 464 | # Description of argument(s): |
| 465 | # username The username to be created. |
| 466 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 467 | # role_id The role ID of the user to be created |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 468 | # (e.g. "Administrator", "Operator", etc.). |
| 469 | # enabled Indicates whether the username being created |
| 470 | # should be enabled (${True}, ${False}). |
| 471 | |
| 472 | Redfish.Login |
| 473 | |
| 474 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
| 475 | |
| 476 | Redfish.Logout |
| 477 | |
| 478 | # Login with created user. |
| 479 | Run Keyword And Expect Error InvalidCredentialsError* |
| 480 | ... Redfish.Login ${username} ${password} |
| 481 | |
| 482 | Redfish.Login |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 483 | |
| 484 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 485 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |