Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 1 | *** Settings *** |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 2 | Documentation Test suite for verifying Redfish admin, readonly operation user accounts. |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 3 | |
| 4 | Resource ../../lib/resource.robot |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 7 | Resource ../../lib/bmc_redfish_utils.robot |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 8 | |
manashsarma | 654cbc1 | 2021-09-23 02:28:12 -0500 | [diff] [blame] | 9 | Library SSHLibrary |
| 10 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 11 | Test Setup Redfish.Login |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 12 | Test Teardown Test Teardown Execution |
| 13 | |
Sridevi Ramesh | cf0c8b0 | 2025-09-17 06:22:35 -0500 | [diff] [blame] | 14 | Test Tags User_Account |
| 15 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 16 | *** Variables *** |
| 17 | |
| 18 | ${account_lockout_duration} ${30} |
| 19 | ${account_lockout_threshold} ${3} |
George Keishing | f8e1819 | 2023-07-05 14:26:27 +0530 | [diff] [blame] | 20 | ${ssh_status} ${True} |
| 21 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 22 | *** Test Cases *** |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 23 | |
| 24 | Verify AccountService Available |
Sivas SRR | fa6831c | 2019-02-22 00:12:00 -0600 | [diff] [blame] | 25 | [Documentation] Verify Redfish account service is available. |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 26 | [Tags] Verify_AccountService_Available |
| 27 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 28 | ${resp} = Redfish_utils.Get Attribute /redfish/v1/AccountService ServiceEnabled |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 29 | Should Be Equal As Strings ${resp} ${True} |
| 30 | |
Rahul Maheshwari | d0aa72b | 2022-08-23 06:44:07 -0500 | [diff] [blame] | 31 | |
| 32 | Verify Redfish Admin User Persistence After Reboot |
| 33 | [Documentation] Verify Redfish admin user persistence after reboot. |
| 34 | [Tags] Verify_Redfish_Admin_User_Persistence_After_Reboot |
| 35 | [Setup] Run Keywords Redfish.Login AND |
| 36 | ... Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 37 | [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 38 | ... AND Test Teardown Execution |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 39 | |
| 40 | # Reboot BMC. |
| 41 | Redfish OBMC Reboot (off) stack_mode=normal |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 42 | |
| 43 | # Verify users after reboot. |
| 44 | Redfish Verify User admin_user TestPwd123 Administrator ${True} |
Rahul Maheshwari | d0aa72b | 2022-08-23 06:44:07 -0500 | [diff] [blame] | 45 | |
| 46 | |
| 47 | Verify Redfish Operator User Persistence After Reboot |
| 48 | [Documentation] Verify Redfish operator user persistence after reboot. |
| 49 | [Tags] Verify_Redfish_Operator_User_Persistence_After_Reboot |
| 50 | [Setup] Run Keywords Redfish.Login AND |
| 51 | ... Redfish Create User operator_user TestPwd123 Operator ${True} |
| 52 | [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 53 | ... AND Test Teardown Execution |
| 54 | |
| 55 | # Reboot BMC. |
| 56 | Redfish OBMC Reboot (off) stack_mode=normal |
| 57 | |
| 58 | # Verify users after reboot. |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 59 | Redfish Verify User operator_user TestPwd123 Operator ${True} |
Rahul Maheshwari | d0aa72b | 2022-08-23 06:44:07 -0500 | [diff] [blame] | 60 | |
| 61 | |
| 62 | Verify Redfish Readonly User Persistence After Reboot |
| 63 | [Documentation] Verify Redfish readonly user persistence after reboot. |
| 64 | [Tags] Verify_Redfish_Readonly_User_Persistence_After_Reboot |
| 65 | [Setup] Run Keywords Redfish.Login AND |
| 66 | ... Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
| 67 | [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
| 68 | ... AND Test Teardown Execution |
| 69 | |
| 70 | # Reboot BMC. |
| 71 | Redfish OBMC Reboot (off) stack_mode=normal |
| 72 | |
| 73 | # Verify users after reboot. |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 74 | Redfish Verify User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | a83fb47 | 2019-08-29 02:26:21 -0500 | [diff] [blame] | 75 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 76 | Redfish Create and Verify Admin User |
| 77 | [Documentation] Create a Redfish user with administrator role and verify. |
George Keishing | f517690 | 2022-05-12 04:23:59 -0500 | [diff] [blame] | 78 | [Tags] Redfish_Create_and_Verify_Admin_User |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 79 | [Template] Redfish Create And Verify User |
| 80 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 81 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 82 | admin_user TestPwd123 Administrator ${True} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 83 | |
| 84 | |
| 85 | Redfish Create and Verify Operator User |
| 86 | [Documentation] Create a Redfish user with operator role and verify. |
| 87 | [Tags] Redfish_Create_and_Verify_Operator_User |
| 88 | [Template] Redfish Create And Verify User |
| 89 | |
| 90 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 91 | operator_user TestPwd123 Operator ${True} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 92 | |
| 93 | |
| 94 | Redfish Create and Verify Readonly User |
| 95 | [Documentation] Create a Redfish user with readonly role and verify. |
| 96 | [Tags] Redfish_Create_and_Verify_Readonly_User |
| 97 | [Template] Redfish Create And Verify User |
| 98 | |
| 99 | #username password role_id enabled |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 100 | readonly_user TestPwd123 ReadOnly ${True} |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 101 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 102 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 103 | Verify Redfish Admin User Login With Wrong Password |
| 104 | [Documentation] Verify Redfish create admin user with valid password and make sure |
| 105 | ... admin user failed to login with wrong password. |
| 106 | [Tags] Verify_Redfish_Admin_User_Login_With_Wrong_Password |
| 107 | [Template] Verify Redfish User Login With Wrong Password |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 108 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 109 | #username password role_id enabled wrong_password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 110 | admin_user TestPwd123 Administrator ${True} alskjhfwurh |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 111 | |
| 112 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 113 | Verify Redfish Operator User Login With Wrong Password |
| 114 | [Documentation] Verify Redfish create operator user with valid password and make sure |
| 115 | ... operator user failed to login with wrong password. |
| 116 | [Tags] Verify_Redfish_Operator_User_Login_With_Wrong_Password |
| 117 | [Template] Verify Redfish User Login With Wrong Password |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 118 | |
| 119 | #username password role_id enabled wrong_password |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 120 | operator_user TestPwd123 Operator ${True} 12j8a8uakjhdaosiruf024 |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 121 | |
| 122 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 123 | Verify Redfish Readonly User Login With Wrong Password |
| 124 | [Documentation] Verify Redfish create readonly user with valid password and make sure |
| 125 | ... readonly user failed to login with wrong password. |
| 126 | [Tags] Verify_Redfish_Readonly_User_Login_With_Wrong_Password |
| 127 | [Template] Verify Redfish User Login With Wrong Password |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 128 | |
| 129 | #username password role_id enabled wrong_password |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 130 | readonly_user TestPwd123 ReadOnly ${True} 12 |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 131 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 132 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 133 | Verify Login with Deleted Redfish Admin User |
| 134 | [Documentation] Verify login with deleted Redfish admin user. |
| 135 | [Tags] Verify_Login_with_Deleted_Redfish_Admin_User |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 136 | [Template] Verify Login with Deleted Redfish User |
| 137 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 138 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 139 | admin_user TestPwd123 Administrator ${True} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 140 | |
| 141 | |
| 142 | Verify Login with Deleted Redfish Operator User |
| 143 | [Documentation] Verify login with deleted Redfish operator user. |
| 144 | [Tags] Verify_Login_with_Deleted_Redfish_Operator_User |
| 145 | [Template] Verify Login with Deleted Redfish User |
| 146 | |
| 147 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 148 | operator_user TestPwd123 Operator ${True} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 149 | |
| 150 | |
| 151 | Verify Login with Deleted Redfish Readonly User |
| 152 | [Documentation] Verify login with deleted Redfish readonly user. |
| 153 | [Tags] Verify_Login_with_Deleted_Redfish_Readonly_User |
| 154 | [Template] Verify Login with Deleted Redfish User |
| 155 | |
| 156 | #username password role_id enabled |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 157 | readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 158 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 159 | |
| 160 | Verify Admin User Creation Without Enabling It |
| 161 | [Documentation] Verify admin user creation without enabling it. |
| 162 | [Tags] Verify_Admin_User_Creation_Without_Enabling_It |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 163 | [Template] Verify Create User Without Enabling |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 164 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 165 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 166 | admin_user TestPwd123 Administrator ${False} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 167 | |
| 168 | |
| 169 | Verify Operator User Creation Without Enabling It |
| 170 | [Documentation] Verify operator user creation without enabling it. |
| 171 | [Tags] Verify_Operator_User_Creation_Without_Enabling_It |
| 172 | [Template] Verify Create User Without Enabling |
| 173 | |
| 174 | #username password role_id enabled |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 175 | operator_user TestPwd123 Operator ${False} |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 176 | |
| 177 | |
| 178 | Verify Readonly User Creation Without Enabling It |
| 179 | [Documentation] Verify readonly user creation without enabling it. |
| 180 | [Tags] Verify_Readonly_User_Creation_Without_Enabling_It |
| 181 | [Template] Verify Create User Without Enabling |
| 182 | |
| 183 | #username password role_id enabled |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 184 | readonly_user TestPwd123 ReadOnly ${False} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 185 | |
Rahul Maheshwari | cbc4c0b | 2022-04-25 05:29:25 -0500 | [diff] [blame] | 186 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 187 | Verify User Creation With Invalid Role Id |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 188 | [Documentation] Verify user creation with invalid role ID. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 189 | [Tags] Verify_User_Creation_With_Invalid_Role_Id |
| 190 | |
| 191 | # Make sure the user account in question does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 192 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 193 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 194 | |
| 195 | # Create specified user. |
| 196 | ${payload}= Create Dictionary |
| 197 | ... UserName=test_user Password=TestPwd123 RoleId=wrongroleid Enabled=${True} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 198 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 199 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 200 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 201 | Verify Error Upon Creating Same Users With Different Privileges |
| 202 | [Documentation] Verify error upon creating same users with different privileges. |
| 203 | [Tags] Verify_Error_Upon_Creating_Same_Users_With_Different_Privileges |
| 204 | |
| 205 | Redfish Create User test_user TestPwd123 Administrator ${True} |
| 206 | |
| 207 | # Create specified user. |
| 208 | ${payload}= Create Dictionary |
Nandish-Matti | 232a6f0 | 2023-04-07 05:54:32 -0500 | [diff] [blame] | 209 | ... UserName=test_user Password=TestPwd123 RoleId=ReadOnly Enabled=${True} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 210 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 211 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 212 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 213 | Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 214 | |
Rahul Maheshwari | 124ebef | 2022-08-23 12:06:59 -0500 | [diff] [blame] | 215 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 216 | Verify Modifying User Attributes |
| 217 | [Documentation] Verify modifying user attributes. |
| 218 | [Tags] Verify_Modifying_User_Attributes |
Rahul Maheshwari | 124ebef | 2022-08-23 12:06:59 -0500 | [diff] [blame] | 219 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 220 | # Create Redfish users. |
| 221 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 222 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 223 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 224 | # Make sure the new user account does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 225 | Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 226 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 227 | |
| 228 | # Update admin_user username using Redfish. |
| 229 | ${payload}= Create Dictionary UserName=newadmin_user |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 230 | Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body=&{payload} |
George Keishing | 3f2902e | 2025-03-14 08:19:02 +0530 | [diff] [blame] | 231 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 232 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 233 | # Update readonly_user role using Redfish. |
Rahul Maheshwari | 124ebef | 2022-08-23 12:06:59 -0500 | [diff] [blame] | 234 | ${payload}= Create Dictionary RoleId=Administrator |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 235 | Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body=&{payload} |
George Keishing | 3f2902e | 2025-03-14 08:19:02 +0530 | [diff] [blame] | 236 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 237 | |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 238 | # Verify users after updating |
| 239 | Redfish Verify User newadmin_user TestPwd123 Administrator ${True} |
Rahul Maheshwari | 124ebef | 2022-08-23 12:06:59 -0500 | [diff] [blame] | 240 | Redfish Verify User readonly_user TestPwd123 Administrator ${True} |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 241 | |
| 242 | # Delete created users. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 243 | Redfish.Delete /redfish/v1/AccountService/Accounts/newadmin_user |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 244 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 245 | |
Rahul Maheshwari | 124ebef | 2022-08-23 12:06:59 -0500 | [diff] [blame] | 246 | |
| 247 | Verify Modifying Operator User Attributes |
| 248 | [Documentation] Verify modifying operator user attributes. |
| 249 | [Tags] Verify_Modifying_Operator_User_Attributes |
| 250 | [Setup] Run Keywords Redfish.Login AND |
| 251 | ... Redfish Create User operator_user TestPwd123 Operator ${True} |
| 252 | [Teardown] Run Keywords Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
| 253 | ... AND Test Teardown Execution |
| 254 | |
| 255 | # Update operator_user password using Redfish. |
| 256 | ${payload}= Create Dictionary Password=NewTestPwd123 |
| 257 | Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body=&{payload} |
| 258 | |
| 259 | # Verify users after updating |
| 260 | Redfish Verify User operator_user NewTestPwd123 Operator ${True} |
| 261 | |
| 262 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 263 | Verify User Account Locked |
| 264 | [Documentation] Verify user account locked upon trying with invalid password. |
| 265 | [Tags] Verify_User_Account_Locked |
| 266 | |
| 267 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 268 | |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 269 | ${payload}= Create Dictionary AccountLockoutThreshold=${account_lockout_threshold} |
| 270 | ... AccountLockoutDuration=${account_lockout_duration} |
| 271 | Redfish.Patch ${REDFISH_ACCOUNTS_SERVICE_URI} body=${payload} |
George Keishing | 1f8db9c | 2025-04-01 21:37:44 +0530 | [diff] [blame] | 272 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 273 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 274 | Redfish.Logout |
| 275 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 276 | # Make ${account_lockout_threshold} failed login attempts. |
| 277 | Repeat Keyword ${account_lockout_threshold} times |
Vidya-Kalasappanavar | 4831f59 | 2025-04-21 04:17:21 -0500 | [diff] [blame] | 278 | ... Run Keyword And Expect Error *InvalidCredentialsError* Redfish.Login admin_user abcd1234 |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 279 | |
| 280 | # Verify that legitimate login fails due to lockout. |
Vidya-Kalasappanavar | 4831f59 | 2025-04-21 04:17:21 -0500 | [diff] [blame] | 281 | Run Keyword And Expect Error *InvalidCredentialsError* |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 282 | ... Redfish.Login admin_user TestPwd123 |
| 283 | |
Vidya-Kalasappanavar | 344c21d | 2025-07-01 12:21:05 -0500 | [diff] [blame] | 284 | # Wait for lockout duration to expire and adding 5 sec delay to the account lock timeout |
| 285 | # ... then verify that login works. |
| 286 | ${total_wait_duartion}= Evaluate ${account_lockout_duration} + 5 |
| 287 | Sleep ${total_wait_duartion}s |
| 288 | |
Sandhya Somashekar | 37122b6 | 2019-06-18 06:02:02 -0500 | [diff] [blame] | 289 | Redfish.Login admin_user TestPwd123 |
| 290 | |
| 291 | Redfish.Logout |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 292 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 293 | Redfish.Login |
| 294 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 295 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 296 | |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 297 | |
| 298 | Verify User Account Unlock |
| 299 | [Documentation] Verify manually unlocking the account before lockout time |
| 300 | [Tags] Verify_User_Account_Unlock |
George Keishing | a36926b | 2023-05-17 21:54:34 +0530 | [diff] [blame] | 301 | [Teardown] Run Keywords Redfish.Logout |
| 302 | ... AND Redfish.Login |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 303 | ... AND Redfish.Delete /redfish/v1/AccountService/Accounts/test_user |
| 304 | ... AND SSHLibrary.Close All Connections |
| 305 | |
| 306 | Redfish Create User test_user TestPwd123 Administrator ${True} |
| 307 | |
| 308 | ${payload}= Create Dictionary |
| 309 | ... AccountLockoutThreshold=${account_lockout_threshold} |
| 310 | ... AccountLockoutDuration=${account_lockout_duration} |
| 311 | Redfish.Patch ${REDFISH_ACCOUNTS_SERVICE_URI} body=${payload} |
| 312 | |
| 313 | Redfish.Logout |
| 314 | |
| 315 | # Make ${account_lockout_threshold} failed login attempts. |
| 316 | Repeat Keyword ${account_lockout_threshold} times |
| 317 | ... Run Keyword And Expect Error InvalidCredentialsError* |
| 318 | ... Redfish.Login test_user abc123 |
| 319 | |
| 320 | # Ensure SSH Login with locked account gets failed |
| 321 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 322 | Run Keyword And Expect Error Authentication failed* |
| 323 | ... SSHLibrary.Login test_user TestPwd123 |
| 324 | |
| 325 | # Verify that legitimate login fails due to lockout. |
| 326 | Run Keyword And Expect Error InvalidCredentialsError* |
| 327 | ... Redfish.Login test_user TestPwd123 |
| 328 | |
| 329 | ${payload}= Create Dictionary Locked=${FALSE} |
| 330 | |
| 331 | # Manually unlock the account before lockout threshold expires |
| 332 | Redfish.Login |
| 333 | Redfish.Patch ${REDFISH_ACCOUNTS_URI}test_user body=${payload} |
| 334 | Redfish.Logout |
| 335 | |
| 336 | # Try redfish login with the recently unlocked account |
| 337 | Redfish.Login test_user TestPwd123 |
| 338 | |
| 339 | # Try SSH login with the unlocked account |
| 340 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 341 | SSHLibrary.Login test_user TestPwd123 |
| 342 | |
| 343 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 344 | Verify Admin User Privilege |
| 345 | [Documentation] Verify admin user privilege. |
| 346 | [Tags] Verify_Admin_User_Privilege |
| 347 | |
| 348 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 349 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 350 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 351 | Redfish.Logout |
| 352 | |
Rahul Maheshwari | 3bc0864 | 2022-08-23 12:49:48 -0500 | [diff] [blame] | 353 | Redfish.Login admin_user TestPwd123 |
| 354 | |
| 355 | # Change password of 'readonly' user with admin user. |
| 356 | Redfish.Patch /redfish/v1/AccountService/Accounts/readonly_user body={'Password': 'NewTestPwd123'} |
| 357 | |
| 358 | # Verify modified user. |
| 359 | Redfish Verify User readonly_user NewTestPwd123 ReadOnly ${True} |
| 360 | |
| 361 | # Note: Delete user would work here because a root login is |
| 362 | # performed as part of "Redfish Verify User" keyword's teardown. |
| 363 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 364 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
| 365 | |
| 366 | |
| 367 | Verify Operator User Role Change Using Admin Privilege User |
| 368 | [Documentation] Verify operator user role change using admin privilege user |
| 369 | [Tags] Verify_Operator_User_Role_Change_Using_Admin_Privilege_User |
| 370 | |
| 371 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 372 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 373 | |
| 374 | Redfish.Logout |
| 375 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 376 | # Change role ID of operator user with admin user. |
| 377 | # Login with admin user. |
| 378 | Redfish.Login admin_user TestPwd123 |
| 379 | |
| 380 | # Modify Role ID of Operator user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 381 | Redfish.Patch /redfish/v1/AccountService/Accounts/operator_user body={'RoleId': 'Administrator'} |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 382 | |
| 383 | # Verify modified user. |
| 384 | Redfish Verify User operator_user TestPwd123 Administrator ${True} |
| 385 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 386 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 387 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
Rahul Maheshwari | 3bc0864 | 2022-08-23 12:49:48 -0500 | [diff] [blame] | 388 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 389 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 390 | Verify Operator User Privilege |
| 391 | [Documentation] Verify operator user privilege. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 392 | [Tags] Verify_Operator_User_Privilege |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 393 | |
| 394 | Redfish Create User admin_user TestPwd123 Administrator ${True} |
| 395 | Redfish Create User operator_user TestPwd123 Operator ${True} |
| 396 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 397 | Redfish.Logout |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 398 | # Login with operator user. |
| 399 | Redfish.Login operator_user TestPwd123 |
| 400 | |
George Keishing | 093c1bd | 2020-02-10 09:47:34 -0600 | [diff] [blame] | 401 | # Verify BMC reset. |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 402 | Run Keyword And Expect Error ValueError* Redfish BMC Reset Operation |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 403 | |
| 404 | # Attempt to change password of admin user with operator user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 405 | Redfish.Patch /redfish/v1/AccountService/Accounts/admin_user body={'Password': 'NewTestPwd123'} |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 406 | ... valid_status_codes=[${HTTP_FORBIDDEN}] |
| 407 | |
| 408 | Redfish.Logout |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 409 | |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 410 | Redfish.Login |
| 411 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 412 | Redfish.Delete /redfish/v1/AccountService/Accounts/admin_user |
| 413 | Redfish.Delete /redfish/v1/AccountService/Accounts/operator_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 414 | |
| 415 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 416 | Verify ReadOnly User Privilege |
| 417 | [Documentation] Verify ReadOnly user privilege. |
| 418 | [Tags] Verify_ReadOnly_User_Privilege |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 419 | |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 420 | Redfish Create User readonly_user TestPwd123 ReadOnly ${True} |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 421 | Redfish.Logout |
| 422 | |
| 423 | # Login with read_only user. |
| 424 | Redfish.Login readonly_user TestPwd123 |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 425 | |
| 426 | # Read system level data. |
| 427 | ${system_model}= Redfish_Utils.Get Attribute |
| 428 | ... ${SYSTEM_BASE_URI} Model |
| 429 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 430 | Redfish.Logout |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 431 | Redfish.Login |
Anusha Dathatri | 4062b44 | 2020-02-03 04:39:15 -0600 | [diff] [blame] | 432 | Redfish.Delete ${REDFISH_ACCOUNTS_URI}readonly_user |
Sandhya Somashekar | 7a23747 | 2019-07-15 02:06:39 -0500 | [diff] [blame] | 433 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 434 | |
Sridevi Ramesh | 34acff5 | 2025-08-07 03:34:22 -0500 | [diff] [blame] | 435 | Verify Minimum Password Length For Redfish Admin And Readonly User |
| 436 | [Documentation] Verify minimum password length for new and existing admin or |
| 437 | ... readonly user. |
| 438 | [Template] Verify Minimum Password Length For Redfish User |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 439 | |
Sridevi Ramesh | 34acff5 | 2025-08-07 03:34:22 -0500 | [diff] [blame] | 440 | #username role_id |
| 441 | admin_user Administrator |
| 442 | readonly_user ReadOnly |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 443 | |
| 444 | |
Tony Lee | 94335f4 | 2021-02-04 15:16:39 +0800 | [diff] [blame] | 445 | Verify Standard User Roles Defined By Redfish |
| 446 | [Documentation] Verify standard user roles defined by Redfish. |
| 447 | [Tags] Verify_Standard_User_Roles_Defined_By_Redfish |
| 448 | |
| 449 | ${member_list}= Redfish_Utils.Get Member List |
| 450 | ... /redfish/v1/AccountService/Roles |
| 451 | |
| 452 | @{roles}= Create List |
| 453 | ... /redfish/v1/AccountService/Roles/Administrator |
| 454 | ... /redfish/v1/AccountService/Roles/Operator |
| 455 | ... /redfish/v1/AccountService/Roles/ReadOnly |
| 456 | |
| 457 | List Should Contain Sub List ${member_list} ${roles} |
| 458 | |
| 459 | # The standard roles are: |
| 460 | |
| 461 | # | Role name | Assigned privileges | |
| 462 | # | Administrator | Login, ConfigureManager, ConfigureUsers, ConfigureComponents, ConfigureSelf | |
| 463 | # | Operator | Login, ConfigureComponents, ConfigureSelf | |
| 464 | # | ReadOnly | Login, ConfigureSelf | |
| 465 | |
| 466 | @{admin}= Create List Login ConfigureManager ConfigureUsers ConfigureComponents ConfigureSelf |
| 467 | @{operator}= Create List Login ConfigureComponents ConfigureSelf |
| 468 | @{readOnly}= Create List Login ConfigureSelf |
| 469 | |
| 470 | ${roles_dict}= create dictionary admin_privileges=${admin} operator_privileges=${operator} |
| 471 | ... readOnly_privileges=${readOnly} |
| 472 | |
| 473 | ${resp}= redfish.Get /redfish/v1/AccountService/Roles/Administrator |
| 474 | List Should Contain Sub List ${resp.dict['AssignedPrivileges']} ${roles_dict['admin_privileges']} |
| 475 | |
| 476 | ${resp}= redfish.Get /redfish/v1/AccountService/Roles/Operator |
| 477 | List Should Contain Sub List ${resp.dict['AssignedPrivileges']} ${roles_dict['operator_privileges']} |
| 478 | |
| 479 | ${resp}= redfish.Get /redfish/v1/AccountService/Roles/ReadOnly |
| 480 | List Should Contain Sub List ${resp.dict['AssignedPrivileges']} ${roles_dict['readOnly_privileges']} |
| 481 | |
| 482 | |
manashsarma | 4910aa2 | 2021-07-26 09:12:36 -0500 | [diff] [blame] | 483 | Verify Error While Deleting Root User |
| 484 | [Documentation] Verify error while deleting root user. |
| 485 | [Tags] Verify_Error_While_Deleting_Root_User |
| 486 | |
| 487 | Redfish.Delete /redfish/v1/AccountService/Accounts/root valid_status_codes=[${HTTP_FORBIDDEN}] |
| 488 | |
| 489 | |
manashsarma | 654cbc1 | 2021-09-23 02:28:12 -0500 | [diff] [blame] | 490 | Verify SSH Login Access With Admin User |
George Keishing | f8e1819 | 2023-07-05 14:26:27 +0530 | [diff] [blame] | 491 | [Documentation] Verify that admin user have SSH login access. |
| 492 | ... By default, admin should have access but there could be |
| 493 | ... case where admin user shell access is restricted by design |
| 494 | ... in the community sphere.. |
manashsarma | 654cbc1 | 2021-09-23 02:28:12 -0500 | [diff] [blame] | 495 | [Tags] Verify_SSH_Login_Access_With_Admin_User |
| 496 | |
| 497 | # Create an admin User. |
| 498 | Redfish Create User new_admin TestPwd1 Administrator ${True} |
| 499 | |
| 500 | # Attempt SSH login with admin user. |
| 501 | SSHLibrary.Open Connection ${OPENBMC_HOST} |
| 502 | ${status}= Run Keyword And Return Status SSHLibrary.Login new_admin TestPwd1 |
George Keishing | f8e1819 | 2023-07-05 14:26:27 +0530 | [diff] [blame] | 503 | |
| 504 | # By default ssh_status is True, user can change the status via CLI |
| 505 | # -v ssh_status:False |
| 506 | Should Be Equal As Strings "${status}" "${ssh_status}" |
manashsarma | 654cbc1 | 2021-09-23 02:28:12 -0500 | [diff] [blame] | 507 | |
George Keishing | e8015b3 | 2022-09-19 09:38:47 -0500 | [diff] [blame] | 508 | Redfish.Login |
| 509 | Redfish.Delete /redfish/v1/AccountService/Accounts/new_admin |
| 510 | |
manashsarma | 654cbc1 | 2021-09-23 02:28:12 -0500 | [diff] [blame] | 511 | |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 512 | Verify Configure BasicAuth Enable And Disable |
| 513 | [Documentation] Verify configure basicauth enable and disable |
| 514 | [Tags] Verify_Configure_BasicAuth_Enable_And_Disable |
| 515 | [Template] Template For Configure Auth Methods |
| 516 | |
| 517 | # auth_method |
| 518 | BasicAuth |
| 519 | XToken |
| 520 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 521 | |
| 522 | Redfish Create and Verify Admin User With Invalid Password Format |
| 523 | [Documentation] Create a admin user with invalid password format and verify. |
| 524 | [Template] Create User With Unsupported Password Format And Verify |
| 525 | [Tags] Redfish_Create_and_Verify_Admin_User_With_Invalid_Password_Format |
| 526 | |
| 527 | #username role_id password |
| 528 | admin_user Administrator snellens |
| 529 | admin_user Administrator 10000001 |
| 530 | admin_user Administrator 12345678 |
| 531 | admin_user Administrator abcdefgh |
| 532 | admin_user Administrator abf12345 |
| 533 | admin_user Administrator helloworld |
| 534 | admin_user Administrator HELLOWORLD |
| 535 | admin_user Administrator &$%**!*@ |
| 536 | admin_user Administrator Dictation |
| 537 | |
| 538 | |
| 539 | Redfish Create and Verify Readonly User With Invalid Password Format |
| 540 | [Documentation] Create a readonly user with invalid password format and verify. |
| 541 | [Template] Create User With Unsupported Password Format And Verify |
| 542 | [Tags] Redfish_Create_and_Verify_Readonly_User_With_Invalid_Password_Format |
| 543 | |
| 544 | #username role_id password |
| 545 | readonly_user ReadOnly snellens |
| 546 | readonly_user ReadOnly 10000001 |
| 547 | readonly_user ReadOnly 12345678 |
| 548 | readonly_user ReadOnly abcdefgh |
| 549 | readonly_user ReadOnly abf12345 |
| 550 | readonly_user ReadOnly helloworld |
| 551 | readonly_user ReadOnly HELLOWORLD |
| 552 | readonly_user ReadOnly &$%**!*@ |
| 553 | readonly_user ReadOnly Dictation |
| 554 | |
| 555 | |
Sridevi Ramesh | 1a2d045 | 2025-08-05 12:16:51 -0500 | [diff] [blame] | 556 | Verify Admin And Readonly User Password Is Not Same As Username |
| 557 | [Documentation] Verify that admin and readonly user creation is failed if |
| 558 | ... password is same as username. |
| 559 | [Template] Create User With Unsupported Password Format And Verify |
| 560 | [Tags] Verify_Admin_And_Readonly_User_Password_Is_Not_Same_As_Username |
| 561 | |
| 562 | #username role_id password |
| 563 | AdminUser1 Administrator AdminUser1 |
| 564 | ReadOnlyUser1 ReadOnly ReadOnlyUser1 |
| 565 | |
| 566 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 567 | *** Keywords *** |
| 568 | |
Sivas SRR | 6aa101f | 2019-02-19 22:31:55 -0600 | [diff] [blame] | 569 | Test Teardown Execution |
| 570 | [Documentation] Do the post test teardown. |
| 571 | |
Anusha Dathatri | db76970 | 2020-02-12 01:02:30 -0600 | [diff] [blame] | 572 | Run Keyword And Ignore Error Redfish.Logout |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 573 | FFDC On Test Case Fail |
| 574 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 575 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 576 | Redfish Create User |
| 577 | [Documentation] Redfish create user. |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 578 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${login_check}=${True} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 579 | |
| 580 | # Description of argument(s): |
| 581 | # username The username to be created. |
| 582 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 583 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 584 | # (e.g. "Administrator", "Operator", etc.). |
| 585 | # enabled Indicates whether the username being created |
| 586 | # should be enabled (${True}, ${False}). |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 587 | # login_check Checks user login for created user. |
| 588 | # (e.g. ${True}, ${False}). |
Sandhya Somashekar | 8c5b249 | 2019-05-16 05:19:03 -0500 | [diff] [blame] | 589 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 590 | # Make sure the user account in question does not already exist. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 591 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 592 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 593 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 594 | # Create specified user. |
| 595 | ${payload}= Create Dictionary |
| 596 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${enabled} |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 597 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 598 | ... valid_status_codes=[${HTTP_CREATED}] |
| 599 | |
Rahul Maheshwari | 9928b1d | 2021-07-19 04:59:55 -0500 | [diff] [blame] | 600 | # Resetting faillock count as a workaround for issue |
Anusha Dathatri | f7268b5 | 2020-02-19 01:03:49 -0600 | [diff] [blame] | 601 | # openbmc/phosphor-user-manager#4 |
Rahul Maheshwari | 638a598 | 2024-04-19 07:35:15 -0500 | [diff] [blame] | 602 | ${cmd}= Catenate /usr/sbin/faillock --user ${username} --reset |
Alagiridhilipank | b9c9377 | 2024-04-02 10:04:27 +0000 | [diff] [blame] | 603 | |
Anusha Dathatri | f7268b5 | 2020-02-19 01:03:49 -0600 | [diff] [blame] | 604 | Bmc Execute Command ${cmd} |
| 605 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 606 | # Verify login with created user. |
George Keishing | 79fc7f0 | 2025-05-02 00:37:49 +0530 | [diff] [blame] | 607 | IF '${login_check}' == '${True}' |
| 608 | ${status}= Run Keyword And Return Status |
| 609 | ... Verify Redfish User Login ${username} ${password} |
| 610 | ELSE |
| 611 | ${status}= Set Variable ${False} |
| 612 | END |
| 613 | |
| 614 | IF '${login_check}' == '${True}' Should Be Equal ${status} ${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 615 | |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 616 | # Validate Role ID of created user. |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 617 | ${role_config}= Redfish_Utils.Get Attribute |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 618 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 619 | Should Be Equal ${role_id} ${role_config} |
| 620 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 621 | |
| 622 | Redfish Verify User |
| 623 | [Documentation] Redfish user verification. |
| 624 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 625 | |
| 626 | # Description of argument(s): |
| 627 | # username The username to be created. |
| 628 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 629 | # role_id The role ID of the user to be created |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 630 | # (e.g. "Administrator", "Operator", etc.). |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 631 | # enabled Indicates whether the username being created |
| 632 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 633 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 634 | ${status}= Verify Redfish User Login ${username} ${password} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 635 | # Doing a check of the returned status. |
| 636 | Should Be Equal ${status} ${enabled} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 637 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 638 | # Validate Role Id of user. |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 639 | ${role_config}= Redfish_Utils.Get Attribute |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 640 | ... /redfish/v1/AccountService/Accounts/${username} RoleId |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 641 | Should Be Equal ${role_id} ${role_config} |
| 642 | |
| 643 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 644 | Verify Redfish User Login |
| 645 | [Documentation] Verify Redfish login with given user id. |
| 646 | [Teardown] Run Keywords Run Keyword And Ignore Error Redfish.Logout AND Redfish.Login |
| 647 | [Arguments] ${username} ${password} |
| 648 | |
| 649 | # Description of argument(s): |
| 650 | # username Login username. |
| 651 | # password Login password. |
| 652 | |
| 653 | # Logout from current Redfish session. |
George Keishing | 1cf2a42 | 2021-02-02 22:59:29 -0600 | [diff] [blame] | 654 | # We don't really care if the current session is flushed out since we are going to login |
| 655 | # with new credential in next. |
| 656 | Run Keyword And Ignore Error Redfish.Logout |
| 657 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 658 | ${status}= Run Keyword And Return Status Redfish.Login ${username} ${password} |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 659 | RETURN ${status} |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 660 | |
| 661 | |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 662 | Redfish Create And Verify User |
| 663 | [Documentation] Redfish create and verify user. |
| 664 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 665 | |
| 666 | # Description of argument(s): |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 667 | # username The username to be created. |
| 668 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 669 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 670 | # (e.g. "Administrator", "Operator", etc.). |
| 671 | # enabled Indicates whether the username being created |
| 672 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 673 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 674 | # Example: |
| 675 | #{ |
| 676 | #"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount", |
| 677 | #"@odata.id": "/redfish/v1/AccountService/Accounts/test1", |
| 678 | #"@odata.type": "#ManagerAccount.v1_0_3.ManagerAccount", |
| 679 | #"Description": "User Account", |
| 680 | #"Enabled": true, |
| 681 | #"Id": "test1", |
| 682 | #"Links": { |
| 683 | # "Role": { |
| 684 | # "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" |
| 685 | # } |
| 686 | #}, |
| 687 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 688 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 689 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 690 | Redfish Verify User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 00f59cc | 2019-03-05 03:39:47 -0600 | [diff] [blame] | 691 | |
| 692 | # Delete Specified User |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 693 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 694 | |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 695 | Verify Redfish User Login With Wrong Password |
| 696 | [Documentation] Verify Redfish User failed to login with wrong password. |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 697 | [Arguments] ${username} ${password} ${role_id} ${enabled} ${wrong_password} |
| 698 | |
| 699 | # Description of argument(s): |
| 700 | # username The username to be created. |
| 701 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 702 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 703 | # (e.g. "Administrator", "Operator", etc.). |
| 704 | # enabled Indicates whether the username being created |
| 705 | # should be enabled (${True}, ${False}). |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 706 | # wrong_password Any invalid password. |
| 707 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 708 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 709 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 710 | Redfish.Logout |
| 711 | |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 712 | # Attempt to login with created user with invalid password. |
| 713 | Run Keyword And Expect Error InvalidCredentialsError* |
| 714 | ... Redfish.Login ${username} ${wrong_password} |
| 715 | |
| 716 | Redfish.Login |
| 717 | |
| 718 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 719 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
Sandhya Somashekar | 33aa48c | 2019-03-13 05:54:49 -0500 | [diff] [blame] | 720 | |
| 721 | |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 722 | Verify Login with Deleted Redfish User |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 723 | [Documentation] Verify Login with Deleted Redfish User. |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 724 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 725 | |
| 726 | # Description of argument(s): |
| 727 | # username The username to be created. |
| 728 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 729 | # role_id The role ID of the user to be created |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 730 | # (e.g. "Administrator", "Operator", etc.). |
| 731 | # enabled Indicates whether the username being created |
| 732 | # should be enabled (${True}, ${False}). |
| 733 | |
Sandhya Somashekar | aa280aa | 2019-04-01 04:15:06 -0500 | [diff] [blame] | 734 | Redfish Create User ${username} ${password} ${role_id} ${enabled} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 735 | |
| 736 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 737 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 738 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 739 | Redfish.Logout |
| 740 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 741 | # Attempt to login with deleted user account. |
| 742 | Run Keyword And Expect Error InvalidCredentialsError* |
| 743 | ... Redfish.Login ${username} ${password} |
| 744 | |
| 745 | Redfish.Login |
| 746 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 747 | |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 748 | Verify Create User Without Enabling |
| 749 | [Documentation] Verify Create User Without Enabling. |
| 750 | [Arguments] ${username} ${password} ${role_id} ${enabled} |
| 751 | |
| 752 | # Description of argument(s): |
| 753 | # username The username to be created. |
| 754 | # password The password to be assigned. |
Sandhya Somashekar | d7d46c0 | 2019-06-26 05:10:25 -0500 | [diff] [blame] | 755 | # role_id The role ID of the user to be created |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 756 | # (e.g. "Administrator", "Operator", etc.). |
| 757 | # enabled Indicates whether the username being created |
| 758 | # should be enabled (${True}, ${False}). |
| 759 | |
Anusha Dathatri | e0dddcf | 2020-06-18 05:23:16 -0500 | [diff] [blame] | 760 | Redfish Create User ${username} ${password} ${role_id} ${enabled} ${False} |
Sandhya Somashekar | e92b1e6 | 2019-04-25 05:27:45 -0500 | [diff] [blame] | 761 | |
| 762 | Redfish.Logout |
| 763 | |
| 764 | # Login with created user. |
| 765 | Run Keyword And Expect Error InvalidCredentialsError* |
| 766 | ... Redfish.Login ${username} ${password} |
| 767 | |
| 768 | Redfish.Login |
Sandhya Somashekar | af402ca | 2019-03-18 05:59:19 -0500 | [diff] [blame] | 769 | |
| 770 | # Delete newly created user. |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 771 | Redfish.Delete /redfish/v1/AccountService/Accounts/${username} |
George Keishing | 07fb41f | 2020-06-16 08:09:19 -0500 | [diff] [blame] | 772 | |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 773 | Template For Configure Auth Methods |
| 774 | [Documentation] Template to configure auth methods. |
| 775 | [Arguments] ${auth_method} |
| 776 | [Teardown] Configure AuthMethods ${auth_method}=${initial_value} |
| 777 | |
| 778 | # Description of Argument(s): |
| 779 | # authmethods The authmethod setting which needs to be |
| 780 | # set in account service URI. |
| 781 | # valid values BasicAuth, XToken. |
| 782 | |
| 783 | Get AuthMethods Default Values ${auth_method} |
| 784 | |
| 785 | # Patch basicauth to TRUE |
| 786 | Configure AuthMethods ${auth_method}=${TRUE} |
| 787 | |
George Keishing | 79fc7f0 | 2025-05-02 00:37:49 +0530 | [diff] [blame] | 788 | IF "${auth_method}" == "XToken" |
| 789 | Check XToken Works Fine ${HTTP_OK} |
| 790 | ELSE |
| 791 | Check BasicAuth Works Fine ${HTTP_OK} |
| 792 | END |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 793 | |
| 794 | # Patch basicauth to FALSE |
| 795 | Configure AuthMethods ${auth_method}=${FALSE} |
| 796 | |
George Keishing | 79fc7f0 | 2025-05-02 00:37:49 +0530 | [diff] [blame] | 797 | IF "${auth_method}" == "BasicAuth" |
| 798 | Check BasicAuth Works Fine ${HTTP_UNAUTHORIZED} |
| 799 | ELSE |
| 800 | Check XToken Works Fine ${HTTP_UNAUTHORIZED} |
| 801 | END |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 802 | |
| 803 | Configure AuthMethods |
| 804 | [Documentation] Enable/disable authmethod types. |
| 805 | [Arguments] &{authmethods} |
| 806 | |
| 807 | # Description of argument(s): |
| 808 | # authmethods The authmethod setting which needs to be |
| 809 | # set in account service URI. |
| 810 | # Usage Example Configure AuthMethods XToken=${TRUE} BasicAuth=${TRUE} |
| 811 | # This will set the value of "XToken" and "BasicAuth" |
| 812 | # property in accountservice uri to TRUE. |
| 813 | |
| 814 | ${openbmc}= Create Dictionary AuthMethods=${authmethods} |
| 815 | ${oem}= Create Dictionary OpenBMC=${openbmc} |
| 816 | ${payload}= Create Dictionary Oem=${oem} |
| 817 | |
| 818 | # Setting authmethod properties using Redfish session based auth |
| 819 | ${status}= Run Keyword And Return Status |
| 820 | ... Redfish.Patch ${REDFISH_BASE_URI}AccountService |
| 821 | ... body=${payload} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] |
| 822 | |
George Keishing | c63bfe6 | 2023-11-15 19:09:59 +0530 | [diff] [blame] | 823 | # Setting authmethod properties using basic auth in case the former fails |
aravinth0510 | 746884b | 2022-09-29 16:04:07 +0000 | [diff] [blame] | 824 | IF ${status}==${FALSE} |
| 825 | # Payload dictionary pre-process to match json formatting |
| 826 | ${payload}= Convert To String ${payload} |
| 827 | ${payload}= Replace String ${payload} ' " |
| 828 | ${payload}= Replace String ${payload} False false |
| 829 | ${payload}= Replace String ${payload} True true |
| 830 | |
| 831 | # Curl Command Framing for PATCH authmethod |
| 832 | ${cmd}= Catenate curl -k -i -u ${OPENBMC_USERNAME}:${OPENBMC_PASSWORD} |
| 833 | ... -X PATCH '${AUTH_URI}${REDFISH_ACCOUNTS_SERVICE_URI}' |
| 834 | ... -H 'content-type:application/json' -H 'If-Match:*' |
| 835 | ... -d '${payload}' |
| 836 | ${rc} ${out}= Run And Return Rc And Output ${cmd} |
| 837 | |
| 838 | # Check the response of curl command is 200 or 204 |
| 839 | ${check_no_content}= |
| 840 | ... Run Keyword and Return Status Should Contain ${out} 204 |
| 841 | ${check_ok}= |
| 842 | ... Run Keyword and Return Status Should Contain ${out} 200 |
| 843 | Pass Execution If ${check_no_content}==${TRUE} |
| 844 | ... OR ${check_ok}==${TRUE} |
| 845 | END |
| 846 | |
| 847 | |
| 848 | Get AuthMethods Default Values |
| 849 | [Documentation] Get enabled/disabled status of all authmethods |
| 850 | ... from Redfish account service URI |
| 851 | [Arguments] ${authmethod} |
| 852 | |
| 853 | # Description of argument(s): |
| 854 | # authmethod The authmethod property whose value needs to be |
| 855 | # retrieved from account service URI. |
| 856 | # Usage Example Get AuthMethods Default Values BasicAuth |
| 857 | # returns >> ${TRUE} |
| 858 | # Example: |
| 859 | # { |
| 860 | # "@odata.id": "/redfish/v1/AccountService", |
| 861 | # (...) |
| 862 | # "Oem": { |
| 863 | # "OpenBMC": { |
| 864 | # "AuthMethods": { |
| 865 | # "BasicAuth": true, |
| 866 | # "Cookie": true, |
| 867 | # "SessionToken": true, |
| 868 | # "TLS": true, |
| 869 | # "XToken": true |
| 870 | # } |
| 871 | # } |
| 872 | # } |
| 873 | # } |
| 874 | |
| 875 | ${resp}= Redfish.Get Attribute ${REDFISH_ACCOUNTS_SERVICE_URI} Oem |
| 876 | ${authmethods}= Set Variable ${resp['OpenBMC']['AuthMethods']} |
| 877 | ${initial_value}= Get From Dictionary ${authmethods} ${authmethod} |
| 878 | Set Test Variable ${initial_value} |
| 879 | |
| 880 | Check XToken Works Fine |
| 881 | [Documentation] Verify Xtoken works fine. |
| 882 | [Arguments] ${status_code} |
| 883 | |
| 884 | # Description of Argument(s): |
| 885 | # status_code : 200, 401. |
| 886 | |
| 887 | # Verify xtoken auth works for xtoken |
| 888 | Redfish.Get ${REDFISH_ACCOUNTS_SERVICE_URI} |
| 889 | ... valid_status_codes=[${status_code}] |
| 890 | |
| 891 | Check BasicAuth Works Fine |
| 892 | [Documentation] Verify Basic Auth works fine. |
| 893 | [Arguments] ${status_code} |
| 894 | |
| 895 | # Description of Argument(s): |
| 896 | # status_code : 200, 401. |
| 897 | |
| 898 | # Verify basic auth works based on basic auth. |
| 899 | ${cmd}= Catenate curl -k -i -u ${OPENBMC_USERNAME}:${OPENBMC_PASSWORD} |
| 900 | ... ${AUTH_URI}/redfish/v1/AccountService |
| 901 | ${rc} ${out}= Run And Return Rc And Output ${cmd} |
| 902 | |
| 903 | # Check the response of curl command is 200/401 |
| 904 | Should Contain ${out} ${status_code} |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 905 | |
| 906 | |
| 907 | Create User With Unsupported Password Format And Verify |
| 908 | [Documentation] Create admin or readonly user with unsupported password format |
| 909 | ... and verify. |
| 910 | [Arguments] ${username} ${role_id} ${password} |
| 911 | |
| 912 | # Description of argument(s): |
| 913 | # username The username to be created. |
| 914 | # role_id The role ID of the user to be created |
| 915 | # (e.g. "Administrator", "ReadOnly"). |
| 916 | # password The password to be assigned. |
| 917 | # Unsupported password format are sequential characters, |
| 918 | # sequential digits, palindrome digits, palindrome characters, |
| 919 | # only uppercase letters, only lowercase letters, only digits, |
Sridevi Ramesh | 1a2d045 | 2025-08-05 12:16:51 -0500 | [diff] [blame] | 920 | # only characters, not a dictionary word, username and password |
| 921 | # should not be same. |
Sridevi Ramesh | 4fc23cf | 2025-08-04 02:08:05 -0500 | [diff] [blame] | 922 | |
| 923 | # Make sure the user account in question does not already exist. |
| 924 | Redfish.Delete /redfish/v1/AccountService/Accounts/${userName} |
| 925 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 926 | |
| 927 | # Create specified user with invalid password format. |
| 928 | ${payload}= Create Dictionary |
| 929 | ... UserName=${username} Password=${password} RoleId=${role_id} Enabled=${True} |
| 930 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 931 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
Sridevi Ramesh | 34acff5 | 2025-08-07 03:34:22 -0500 | [diff] [blame] | 932 | |
| 933 | |
| 934 | Verify Minimum Password Length For Redfish User |
| 935 | [Documentation] Verify minimum password length for new and existing admin or |
| 936 | ... readonly user. |
| 937 | [Arguments] ${user_name} ${role_id} |
| 938 | |
| 939 | # Description of argument(s): |
| 940 | # user_name The username to be created. |
| 941 | # role_id The role ID of the user to be created. |
| 942 | |
| 943 | # Make sure the user account in question does not already exist. |
| 944 | Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name} |
| 945 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 946 | |
| 947 | # Try to create a user with invalid length password. |
| 948 | ${payload}= Create Dictionary |
| 949 | ... UserName=${user_name} Password=UserPwd RoleId=${role_id} Enabled=${True} |
| 950 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 951 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 952 | |
| 953 | # Create specified user with valid length password. |
| 954 | Set To Dictionary ${payload} Password UserPwd1 |
| 955 | Redfish.Post /redfish/v1/AccountService/Accounts/ body=&{payload} |
| 956 | ... valid_status_codes=[${HTTP_CREATED}] |
| 957 | |
| 958 | # Try to change to an invalid password. |
| 959 | Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd'} |
| 960 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 961 | |
| 962 | # Change to a valid password. |
| 963 | Redfish.Patch /redfish/v1/AccountService/Accounts/${user_name} body={'Password': 'UserPwd1'} |
| 964 | |
| 965 | # Verify login. |
| 966 | Redfish.Logout |
| 967 | Redfish.Login ${user_name} UserPwd1 |
| 968 | Redfish.Logout |
| 969 | Redfish.Login |
| 970 | Redfish.Delete /redfish/v1/AccountService/Accounts/${user_name} |