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