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