Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for OpenBMC IPMI user management. |
| 3 | |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 6 | Resource ../lib/bmc_network_utils.robot |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 7 | Library ../lib/ipmi_utils.py |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 8 | Test Setup Printn |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 9 | |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 10 | Suite Setup Suite Setup Execution |
Rahul Maheshwari | f646baa | 2019-02-20 12:29:35 -0600 | [diff] [blame] | 11 | Test Teardown Test Teardown Execution |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 12 | |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 13 | Force Tags IPMI_User |
| 14 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 15 | *** Variables *** |
| 16 | |
| 17 | ${invalid_username} user% |
| 18 | ${invalid_password} abc123 |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 19 | ${new_username} newuser |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 20 | ${root_userid} 1 |
| 21 | ${operator_level_priv} 0x3 |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 22 | ${user_priv} 2 |
| 23 | ${operator_priv} 3 |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 24 | ${admin_level_priv} 4 |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 25 | ${valid_password} 0penBmc1 |
| 26 | ${max_password_length} 20 |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 27 | ${ipmi_setaccess_cmd} channel setaccess |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 28 | &{password_values} 16=0penBmc10penBmc2 17=0penBmc10penBmc2B |
| 29 | ... 20=0penBmc10penBmc2Bmc3 21=0penBmc10penBmc2Bmc34 |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 30 | ... 7=0penBmc 8=0penBmc0 |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 31 | ${expected_max_ids} 15 |
| 32 | ${root_pattern} ^.*\\sroot\\s.*ADMINISTRATOR.*$ |
| 33 | ${empty_name_pattern} ^User Name\\s.*\\s:\\s$ |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 34 | |
Ashwini Chandrappa | 5cefabf | 2021-08-30 23:48:14 -0500 | [diff] [blame] | 35 | # User defined count. |
| 36 | ${USER_LOOP_COUNT} 20 |
| 37 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 38 | *** Test Cases *** |
| 39 | |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 40 | Verify IPMI User Summary |
| 41 | [Documentation] Verify IPMI maximum supported IPMI user ID and |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 42 | ... enabled user from user summary. |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 43 | [Tags] Verify_IPMI_User_Summary |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 44 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 45 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 46 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 47 | ${initial_user_count} ${maximum_ids}= Get Enabled User Count |
| 48 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 49 | ${random_userid} ${random_username}= Create Random IPMI User |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 50 | Wait And Confirm New User Entry ${random_username} |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 51 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 52 | Run IPMI Standard Command user enable ${random_userid} |
| 53 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 54 | # Verify number of currently enabled users. |
| 55 | ${current_user_count} ${maximum_ids}= Get Enabled User Count |
| 56 | ${calculated_count}= Evaluate ${initial_user_count} + 1 |
| 57 | Should Be Equal As Integers ${current_user_count} ${calculated_count} |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 58 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 59 | # Verify maximum user count IPMI local user can have. |
| 60 | Should Be Equal As Integers ${maximum_ids} ${expected_max_ids} |
Rahul Maheshwari | ffc7735 | 2019-02-25 09:05:27 -0600 | [diff] [blame] | 61 | |
| 62 | |
Tony Lee | 3d351ee | 2020-02-19 10:21:04 +0800 | [diff] [blame] | 63 | Verify IPMI User List |
| 64 | [Documentation] Verify user list via IPMI. |
| 65 | [Tags] Verify_IPMI_User_List |
| 66 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 67 | ... Delete Created User ${random_userid} |
| 68 | |
| 69 | ${random_userid} ${random_username}= Create Random IPMI User |
| 70 | Set Test Variable ${random_userid} |
| 71 | |
| 72 | Run IPMI Standard Command |
| 73 | ... user set password ${random_userid} ${valid_password} |
| 74 | Run IPMI Standard Command user enable ${random_userid} |
| 75 | # Delay added for IPMI user to get enabled. |
| 76 | Sleep 5s |
| 77 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 78 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 79 | |
| 80 | ${users_access}= Get User Access Ipmi ${CHANNEL_NUMBER} |
| 81 | Rprint Vars users_access |
| 82 | |
| 83 | ${index}= Evaluate ${random_userid} - 1 |
| 84 | # Verify the user access of created user. |
| 85 | Valid Value users_access[${index}]['id'] ['${random_userid}'] |
| 86 | Valid Value users_access[${index}]['name'] ['${random_username}'] |
| 87 | Valid Value users_access[${index}]['callin'] ['true'] |
| 88 | Valid Value users_access[${index}]['link'] ['false'] |
| 89 | Valid Value users_access[${index}]['auth'] ['true'] |
| 90 | Valid Value users_access[${index}]['ipmi'] ['ADMINISTRATOR'] |
| 91 | |
| 92 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 93 | Verify IPMI User Creation With Valid Name And ID |
| 94 | [Documentation] Create user via IPMI and verify. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 95 | [Tags] Verify_IPMI_User_Creation_With_Valid_Name_And_ID |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 96 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 97 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 98 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 99 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 100 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 101 | |
| 102 | |
| 103 | Verify IPMI User Creation With Invalid Name |
| 104 | [Documentation] Verify error while creating IPMI user with invalid |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 105 | ... name (e.g. user name with special characters). |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 106 | [Tags] Verify_IPMI_User_Creation_With_Invalid_Name |
| 107 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 108 | ${random_userid}= Find Free User Id |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 109 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 110 | ... user set name ${random_userid} ${invalid_username} |
| 111 | Should Contain ${msg} Invalid data |
| 112 | |
| 113 | |
| 114 | Verify IPMI User Creation With Invalid ID |
| 115 | [Documentation] Verify error while creating IPMI user with invalid |
| 116 | ... ID(i.e. any number greater than 15 or 0). |
| 117 | [Tags] Verify_IPMI_User_Creation_With_Invalid_ID |
| 118 | |
| 119 | @{id_list}= Create List |
| 120 | ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random |
| 121 | Append To List ${id_list} ${random_invalid_id} |
| 122 | Append To List ${id_list} 0 |
| 123 | |
Sushil Singh | be97ffc | 2019-06-04 06:34:24 -0500 | [diff] [blame] | 124 | FOR ${id} IN @{id_list} |
| 125 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 126 | ... user set name ${id} newuser |
Tony Lee | c8ed753 | 2020-01-09 16:15:16 +0800 | [diff] [blame] | 127 | Should Contain Any ${msg} User ID is limited to range Parameter out of range |
Sushil Singh | be97ffc | 2019-06-04 06:34:24 -0500 | [diff] [blame] | 128 | END |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 129 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 130 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 131 | Verify Setting IPMI User With Invalid Password |
| 132 | [Documentation] Verify error while setting IPMI user with invalid |
| 133 | ... password. |
| 134 | [Tags] Verify_Setting_IPMI_User_With_Invalid_Password |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 135 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 136 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 137 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 138 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 139 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 140 | |
| 141 | # Set invalid password for newly created user. |
| 142 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 143 | ... user set password ${random_userid} ${invalid_password} |
| 144 | |
Sushma M M | 97fccae | 2020-07-27 14:55:19 -0500 | [diff] [blame] | 145 | # Delay added for user password to get set. |
| 146 | Sleep 5s |
| 147 | |
Anusha Dathatri | a54cddc | 2019-08-07 10:01:16 -0500 | [diff] [blame] | 148 | Should Contain ${msg} Set User Password command failed |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 149 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 150 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 151 | Verify Setting IPMI Root User With New Name |
| 152 | [Documentation] Verify error while setting IPMI root user with new |
| 153 | ... name. |
| 154 | [Tags] Verify_Setting_IPMI_Root_User_With_New_Name |
| 155 | |
| 156 | # Set invalid password for newly created user. |
| 157 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 158 | ... user set name ${root_userid} abcd |
| 159 | |
| 160 | Should Contain ${msg} Set User Name command failed |
| 161 | |
| 162 | |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 163 | Verify IPMI User Password Via Test Command |
| 164 | [Documentation] Verify IPMI user password using test command. |
| 165 | [Tags] Verify_IPMI_User_Password_Via_Test_Command |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 166 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 167 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 168 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 169 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 170 | Set Test Variable ${random_userid} |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 171 | |
| 172 | # Set valid password for newly created user. |
| 173 | Run IPMI Standard Command |
| 174 | ... user set password ${random_userid} ${valid_password} |
| 175 | |
| 176 | # Verify newly set password using test command. |
| 177 | ${msg}= Run IPMI Standard Command |
| 178 | ... user test ${random_userid} ${max_password_length} ${valid_password} |
| 179 | |
| 180 | Should Contain ${msg} Success |
| 181 | |
| 182 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 183 | Verify Setting Valid Password For IPMI User |
| 184 | [Documentation] Set valid password for IPMI user and verify. |
| 185 | [Tags] Verify_Setting_Valid_Password_For_IPMI_User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 186 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 187 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 188 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 189 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 190 | Set Test Variable ${random_userid} |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 191 | |
| 192 | # Set valid password for newly created user. |
| 193 | Run IPMI Standard Command |
| 194 | ... user set password ${random_userid} ${valid_password} |
| 195 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 196 | Run IPMI Standard Command user enable ${random_userid} |
| 197 | |
Rahul Maheshwari | 7d232ab | 2019-08-29 06:44:16 -0500 | [diff] [blame] | 198 | # Delay added for IPMI user to get enable |
| 199 | Sleep 5s |
| 200 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 201 | # Set admin privilege and enable IPMI messaging for newly created user |
| 202 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 203 | |
| 204 | Verify IPMI Username And Password ${random_username} ${valid_password} |
| 205 | |
| 206 | |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 207 | Verify IPMI User Creation With Same Name |
| 208 | [Documentation] Verify error while creating two IPMI user with same name. |
| 209 | [Tags] Verify_IPMI_User_Creation_With_Same_Name |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 210 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 211 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 212 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 213 | ${random_userid} ${random_username}= Create Random IPMI User |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 214 | |
| 215 | # Set same username for another IPMI user. |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 216 | ${rand_userid_two}= Find Free User Id |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 217 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 218 | ... user set name ${rand_userid_two} ${random_username} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 219 | Should Contain ${msg} Invalid data field in request |
| 220 | |
| 221 | |
| 222 | Verify Setting IPMI User With Null Password |
| 223 | [Documentation] Verify error while setting IPMI user with null |
| 224 | ... password. |
| 225 | [Tags] Verify_Setting_IPMI_User_With_Null_Password |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 226 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 227 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 228 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 229 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 230 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 404da0d | 2019-02-18 23:24:17 -0600 | [diff] [blame] | 231 | |
| 232 | # Set null password for newly created user. |
| 233 | ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command |
| 234 | ... user set password ${random_userid} "" |
| 235 | |
| 236 | Should Contain ${msg} Invalid data field in request |
| 237 | |
| 238 | |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 239 | Verify IPMI User Deletion |
| 240 | [Documentation] Delete user via IPMI and verify. |
| 241 | [Tags] Verify_IPMI_User_Deletion |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 242 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 243 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 244 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 245 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 246 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 247 | # Delete IPMI User and verify |
| 248 | Run IPMI Standard Command user set name ${random_userid} "" |
Nagarjun B | 2649914 | 2023-02-16 15:20:14 +0530 | [diff] [blame] | 249 | ${user_info}= Get User Info ${random_userid} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 645a113 | 2019-02-18 03:29:27 -0600 | [diff] [blame] | 250 | Should Be Equal ${user_info['user_name']} ${EMPTY} |
| 251 | |
| 252 | |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 253 | Test IPMI User Privilege Level |
| 254 | [Documentation] Verify IPMI user with user privilege can only run user level commands. |
| 255 | [Tags] Test_IPMI_User_Privilege_Level |
| 256 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 257 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 258 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 259 | |
| 260 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 261 | ${user_priv} Passed Failed Failed |
| 262 | |
| 263 | |
| 264 | Test IPMI Operator Privilege Level |
| 265 | [Documentation] Verify IPMI user with operator privilege can only run user and operator levels commands. |
| 266 | ... level is set to operator. |
| 267 | [Tags] Test_IPMI_Operator_Privilege_Level |
| 268 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 269 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 270 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 271 | |
| 272 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 273 | ${operator_priv} Passed Passed Failed |
| 274 | |
| 275 | |
| 276 | Test IPMI Administrator Privilege Level |
| 277 | [Documentation] Verify IPMI user with admin privilege can run all levels command. |
| 278 | [Tags] Test_IPMI_Administrator_Privilege_Level |
| 279 | [Template] Test IPMI User Privilege |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 280 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 281 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 282 | |
| 283 | #Privilege level User Cmd Status Operator Cmd Status Admin Cmd Status |
| 284 | ${admin_level_priv} Passed Passed Passed |
| 285 | |
| 286 | |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 287 | Enable IPMI User And Verify |
| 288 | [Documentation] Enable IPMI user and verify that the user is able |
| 289 | ... to run IPMI command. |
| 290 | [Tags] Enable_IPMI_User_And_Verify |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 291 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 292 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 293 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 294 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 295 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 296 | Run IPMI Standard Command |
| 297 | ... user set password ${random_userid} ${valid_password} |
| 298 | |
| 299 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 300 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 301 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 302 | # Delay added for user privilege to get set. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 303 | Sleep 5s |
| 304 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 305 | Enable IPMI User And Verify ${random_userid} |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 306 | Wait And Confirm New Username And Password ${random_username} ${valid_password} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 307 | |
| 308 | # Verify that enabled IPMI user is able to run IPMI command. |
| 309 | Verify IPMI Username And Password ${random_username} ${valid_password} |
| 310 | |
| 311 | |
| 312 | Disable IPMI User And Verify |
| 313 | [Documentation] Disable IPMI user and verify that that the user |
| 314 | ... is unable to run IPMI command. |
| 315 | [Tags] Disable_IPMI_User_And_Verify |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 316 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 317 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 318 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 319 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 320 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 321 | Run IPMI Standard Command |
| 322 | ... user set password ${random_userid} ${valid_password} |
| 323 | |
| 324 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 325 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 326 | |
| 327 | # Disable IPMI user and verify. |
| 328 | Run IPMI Standard Command user disable ${random_userid} |
Nagarjun B | 2649914 | 2023-02-16 15:20:14 +0530 | [diff] [blame] | 329 | ${user_info}= Get User Info ${random_userid} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 330 | Should Be Equal ${user_info['enable_status']} disabled |
| 331 | |
| 332 | # Verify that disabled IPMI user is unable to run IPMI command. |
| 333 | ${msg}= Run Keyword And Expect Error * Verify IPMI Username And Password |
| 334 | ... ${random_username} ${valid_password} |
Rahul Maheshwari | c3d1e96 | 2019-03-06 23:53:21 -0600 | [diff] [blame] | 335 | Should Contain ${msg} Unable to establish IPMI |
Rahul Maheshwari | 0c71f5e | 2019-02-20 03:52:55 -0600 | [diff] [blame] | 336 | |
Rahul Maheshwari | c19f838 | 2019-02-20 08:19:22 -0600 | [diff] [blame] | 337 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 338 | Verify IPMI Root User Password Change |
| 339 | [Documentation] Change IPMI root user password and verify that |
| 340 | ... root user is able to run IPMI command. |
| 341 | [Tags] Verify_IPMI_Root_User_Password_Change |
Ruud A. Haring | a6622cb | 2023-11-16 12:04:59 -0500 | [diff] [blame] | 342 | [Setup] Skip if len( '${OPENBMC_PASSWORD}' ) < 8 |
| 343 | ... msg= Do not run this test if len( OPENBMC_PASSWORD ) < 8 |
| 344 | # Reason: if OPENBMC_PASSWORD is not at least 8 characters, |
| 345 | # it cannot be restored in the Teardown step. |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 346 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
Ruud A. Haring | a6622cb | 2023-11-16 12:04:59 -0500 | [diff] [blame] | 347 | ... Run Keyword If "${TEST STATUS}" != "SKIP" |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 348 | ... Wait Until Keyword Succeeds 15 sec 5 sec |
Ruud A. Haring | a6622cb | 2023-11-16 12:04:59 -0500 | [diff] [blame] | 349 | ... Restore Default Password For IPMI Root User |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 350 | |
| 351 | # Set new password for root user. |
| 352 | Run IPMI Standard Command |
| 353 | ... user set password ${root_userid} ${valid_password} |
| 354 | |
Sushma M M | 97fccae | 2020-07-27 14:55:19 -0500 | [diff] [blame] | 355 | # Delay added for user password to get set. |
| 356 | Sleep 5s |
| 357 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 358 | # Verify that root user is able to run IPMI command using new password. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 359 | Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password |
| 360 | ... root ${valid_password} |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 361 | |
| 362 | |
ganesanb | 5e77573 | 2023-10-31 11:13:20 +0000 | [diff] [blame] | 363 | Verify Administrator And User Privilege For Different Channels |
| 364 | [Documentation] Set administrator and user privilege for different channels and verify. |
| 365 | [Tags] Verify_Administrator_And_User_Privilege_For_Different_Channels |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 366 | [Setup] Check Active Ethernet Channels |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 367 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 368 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 369 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 370 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 371 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 372 | Run IPMI Standard Command |
| 373 | ... user set password ${random_userid} ${valid_password} |
| 374 | |
| 375 | # Set admin privilege for newly created user with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 376 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 377 | |
ganesanb | 5e77573 | 2023-10-31 11:13:20 +0000 | [diff] [blame] | 378 | # Set user privilege for newly created user with channel 2. |
| 379 | Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 380 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 381 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 382 | |
| 383 | # Verify that user is able to run administrator level IPMI command with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 384 | Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 385 | |
| 386 | # Verify that user is unable to run IPMI command with channel 2. |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 387 | Run IPMI Standard Command |
| 388 | ... sel info ${secondary_channel_number} expected_rc=${1} U=${random_username} P=${valid_password} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 389 | |
| 390 | |
| 391 | Verify Operator And User Privilege For Different Channels |
| 392 | [Documentation] Set operator and user privilege for different channels and verify. |
| 393 | [Tags] Verify_Operator_And_User_Privilege_For_Different_Channels |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 394 | [Setup] Check Active Ethernet Channels |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 395 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 396 | ... Delete Created User ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 397 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 398 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 399 | Set Test Variable ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 400 | Run IPMI Standard Command |
| 401 | ... user set password ${random_userid} ${valid_password} |
| 402 | |
| 403 | # Set operator privilege for newly created user with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 404 | Set Channel Access ${random_userid} ipmi=on privilege=${operator_priv} ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 405 | |
| 406 | # Set user privilege for newly created user with channel 2. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 407 | Set Channel Access ${random_userid} ipmi=on privilege=${user_priv} ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 408 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 409 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 410 | |
| 411 | # Verify that user is able to run operator level IPMI command with channel 1. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 412 | Verify IPMI Command ${random_username} ${valid_password} Operator ${CHANNEL_NUMBER} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 413 | |
| 414 | # Verify that user is able to run user level IPMI command with channel 2. |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 415 | Verify IPMI Command ${random_username} ${valid_password} User ${secondary_channel_number} |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 416 | |
| 417 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 418 | Verify Setting IPMI User With Max Password Length |
| 419 | [Documentation] Verify IPMI user creation with password length of 20 characters. |
| 420 | [Tags] Verify_Setting_IPMI_User_With_Max_Password_Length |
| 421 | [Template] Set User Password And Verify |
| 422 | |
| 423 | # password_length password_option expected_status |
| 424 | 20 20 ${True} |
| 425 | |
| 426 | |
| 427 | Verify Setting IPMI User With Invalid Password Length |
| 428 | [Documentation] Verify that IPMI user cannot be set with 21 character password using 16 char |
| 429 | ... or 20 char password option. |
| 430 | [Tags] Verify_Setting_IPMI_User_With_Invalid_Password_Length |
| 431 | [Template] Set User Password And Verify |
| 432 | |
| 433 | # password_length password_option expected_status |
| 434 | 21 16 ${False} |
| 435 | 21 20 ${False} |
| 436 | |
| 437 | |
| 438 | Verify Setting IPMI User With 16 Character Password |
| 439 | [Documentation] Verify that IPMI user can create a 16 character password using 16 char or 20 |
| 440 | ... char password option. |
| 441 | [Tags] Verify_Setting_IPMI_User_With_16_Character_Password |
| 442 | [Template] Set User Password And Verify |
| 443 | |
| 444 | # password_length password_option expected_status |
| 445 | 16 16 ${True} |
| 446 | 16 20 ${True} |
| 447 | |
| 448 | |
| 449 | Verify Default Selection Of 16 Character Password For IPMI User |
| 450 | [Documentation] Verify that ipmitool by default opts for the 16 character option when given a |
| 451 | ... password whose length is in between 17 and 20. |
| 452 | [Tags] Verify_Default_Selection_Of_16_Character_Password_For_IPMI_User |
| 453 | [Template] Set User Password And Verify |
| 454 | |
| 455 | # password_length password_option expected_status |
| 456 | 17 16 ${True} |
| 457 | 20 16 ${True} |
| 458 | |
| 459 | |
Anusha Dathatri | 466816f | 2020-01-30 05:12:36 -0600 | [diff] [blame] | 460 | Verify Minimum Password Length For IPMI User |
| 461 | [Documentation] Verify minimum password length of 8 characters. |
| 462 | [Tags] Verify_Minimum_Password_Length_For_IPMI_User |
| 463 | [Template] Set User Password And Verify |
| 464 | |
| 465 | # password_length password_option expected_status |
| 466 | 7 16 ${False} |
| 467 | 8 16 ${True} |
| 468 | 7 20 ${False} |
| 469 | 8 20 ${True} |
| 470 | |
| 471 | |
Ashwini Chandrappa | 5cefabf | 2021-08-30 23:48:14 -0500 | [diff] [blame] | 472 | Verify Continuous IPMI Command Execution |
| 473 | [Documentation] Verify that continuous IPMI command execution runs fine. |
| 474 | [Tags] Verify_Continuous_IPMI_Command_Execution |
| 475 | |
| 476 | FOR ${i} IN RANGE ${USER_LOOP_COUNT} |
| 477 | Run IPMI Standard Command lan print |
| 478 | Run IPMI Standard Command power status |
| 479 | Run IPMI Standard Command fru list |
| 480 | Run IPMI Standard Command sel list |
| 481 | END |
| 482 | |
| 483 | |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 484 | Modify IPMI User |
| 485 | [Documentation] Verify modified IPMI user is communicating via IPMI. |
| 486 | [Tags] Modify_IPMI_User |
| 487 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 488 | ... Delete Created User ${random_userid} |
| 489 | |
| 490 | ${random_userid} ${random_username}= Create Random IPMI User |
| 491 | Set Test Variable ${random_userid} |
| 492 | Run IPMI Standard Command |
| 493 | ... user set password ${random_userid} ${valid_password} |
| 494 | |
| 495 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 496 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 497 | |
| 498 | # Delay added for user privilege to get set. |
| 499 | Sleep 5s |
| 500 | |
| 501 | Enable IPMI User And Verify ${random_userid} |
| 502 | |
| 503 | # Verify that user is able to run administrator level IPMI command. |
| 504 | Verify IPMI Command ${random_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
| 505 | |
| 506 | # Set different username for same IPMI user. |
| 507 | Run IPMI Standard Command |
| 508 | ... user set name ${random_userid} ${new_username} |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 509 | Wait And Confirm New Username And Password ${new_username} ${valid_password} |
chithrag | c0582f7 | 2021-12-08 10:34:23 -0500 | [diff] [blame] | 510 | |
| 511 | # Verify that user is able to run administrator level IPMI command. |
| 512 | Verify IPMI Command ${new_username} ${valid_password} Administrator ${CHANNEL_NUMBER} |
| 513 | |
| 514 | |
Rahul Maheshwari | ddfc0cb | 2019-02-07 23:43:19 -0600 | [diff] [blame] | 515 | *** Keywords *** |
| 516 | |
Ruud A. Haring | a6622cb | 2023-11-16 12:04:59 -0500 | [diff] [blame] | 517 | Restore Default Password For IPMI Root User |
| 518 | [Documentation] Restore default password for IPMI root user |
| 519 | |
Rahul Maheshwari | dd63c74 | 2019-02-27 23:03:54 -0600 | [diff] [blame] | 520 | ${result}= Run External IPMI Standard Command |
| 521 | ... user set password ${root_userid} ${OPENBMC_PASSWORD} |
| 522 | ... P=${valid_password} |
| 523 | Should Contain ${result} Set User Password command successful |
| 524 | |
| 525 | # Verify that root user is able to run IPMI command using default password. |
| 526 | Verify IPMI Username And Password root ${OPENBMC_PASSWORD} |
| 527 | |
Rahul Maheshwari | ef0a735 | 2019-02-20 11:07:48 -0600 | [diff] [blame] | 528 | |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 529 | Test IPMI User Privilege |
| 530 | [Documentation] Test IPMI user privilege by executing IPMI command with different privileges. |
| 531 | [Arguments] ${privilege_level} ${user_cmd_status} ${operator_cmd_status} ${admin_cmd_status} |
| 532 | |
| 533 | # Description of argument(s): |
| 534 | # privilege_level Privilege level of IPMI user (e.g. 4, 3). |
| 535 | # user_cmd_status Expected status of IPMI command run with the "User" |
| 536 | # privilege (i.e. "Passed" or "Failed"). |
| 537 | # operator_cmd_status Expected status of IPMI command run with the "Operator" |
| 538 | # privilege (i.e. "Passed" or "Failed"). |
| 539 | # admin_cmd_status Expected status of IPMI command run with the "Administrator" |
| 540 | # privilege (i.e. "Passed" or "Failed"). |
| 541 | |
| 542 | # Create IPMI user and set valid password. |
| 543 | ${random_username}= Generate Random String 8 [LETTERS] |
| 544 | ${random_userid}= Evaluate random.randint(2, 15) modules=random |
| 545 | IPMI Create User ${random_userid} ${random_username} |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 546 | Set Test Variable ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 547 | Run IPMI Standard Command |
| 548 | ... user set password ${random_userid} ${valid_password} |
| 549 | |
| 550 | # Set privilege and enable IPMI messaging for newly created user. |
| 551 | Set Channel Access ${random_userid} ipmi=on privilege=${privilege_level} |
| 552 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 553 | # Delay added for user privilege to get set. |
Rahul Maheshwari | 62c8aea | 2019-09-27 05:23:12 -0500 | [diff] [blame] | 554 | Sleep 5s |
| 555 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 556 | Enable IPMI User And Verify ${random_userid} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 557 | |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 558 | Verify IPMI Command ${random_username} ${valid_password} User |
| 559 | ... expected_status=${user_cmd_status} |
| 560 | Verify IPMI Command ${random_username} ${valid_password} Operator |
| 561 | ... expected_status=${operator_cmd_status} |
| 562 | Verify IPMI Command ${random_username} ${valid_password} Administrator |
| 563 | ... expected_status=${admin_cmd_status} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 564 | |
| 565 | |
| 566 | Verify IPMI Command |
| 567 | [Documentation] Verify IPMI command execution with given username, |
| 568 | ... password, privilege and expected status. |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 569 | [Arguments] ${username} ${password} ${privilege} ${channel}=${1} ${expected_status}=Passed |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 570 | # Description of argument(s): |
| 571 | # username The user name (e.g. "root", "robert", etc.). |
| 572 | # password The user password (e.g. "0penBmc", "0penBmc1", etc.). |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 573 | # privilege The session privilege for IPMI command (e.g. "User", "Operator", etc.). |
Rahul Maheshwari | 8e17562 | 2019-05-20 05:30:32 -0500 | [diff] [blame] | 574 | # channel The user channel number (e.g. "1" or "2"). |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 575 | # expected_status Expected status of IPMI command run with the user |
| 576 | # of above password and privilege (i.e. "Passed" or "Failed"). |
| 577 | |
| 578 | ${expected_rc}= Set Variable If '${expected_status}' == 'Passed' ${0} ${1} |
Rahul Maheshwari | ceb282e | 2019-09-16 00:11:41 -0500 | [diff] [blame] | 579 | Wait Until Keyword Succeeds 15 sec 5 sec Run IPMI Standard Command |
| 580 | ... sel info ${channel} expected_rc=${expected_rc} U=${username} P=${password} |
Rahul Maheshwari | c05bf56 | 2019-03-01 04:02:53 -0600 | [diff] [blame] | 581 | ... L=${privilege} |
| 582 | |
| 583 | |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 584 | Set User Password And Verify |
| 585 | [Documentation] Create a user and set its password with given length and option. |
| 586 | [Arguments] ${password_length} ${password_option} ${expected_result} |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 587 | [Teardown] Run Keyword Delete Created User ${random_userid} |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 588 | # Description of argument(s): |
| 589 | # password_length Length of password to be generated and used (e.g. "16"). |
| 590 | # password_option Password length option to be given in IPMI command (e.g. "16", "20"). |
| 591 | # expected_result Expected result for setting the user's password (e.g. "True", "False"). |
| 592 | |
| 593 | Rprint Vars password_length password_option expected_result |
| 594 | ${random_userid} ${random_username}= Create Random IPMI User |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 595 | Set Test Variable ${random_userid} |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 596 | ${password}= Get From Dictionary ${password_values} ${password_length} |
| 597 | Rprint Vars random_userid password |
| 598 | |
| 599 | # Set password for newly created user. |
| 600 | ${status}= Run Keyword And Return Status Run IPMI Standard Command |
| 601 | ... user set password ${random_userid} ${password} ${password_option} |
| 602 | Rprint Vars status |
| 603 | Valid Value status [${expected_result}] |
Anusha Dathatri | 7f81071 | 2020-01-07 04:13:16 -0600 | [diff] [blame] | 604 | Return From Keyword If '${expected_result}' == '${False}' |
Anusha Dathatri | dd8e7d8 | 2019-12-03 07:45:30 -0600 | [diff] [blame] | 605 | |
| 606 | # Set admin privilege and enable IPMI messaging for newly created user. |
| 607 | Set Channel Access ${random_userid} ipmi=on privilege=${admin_level_priv} |
| 608 | |
| 609 | # Delay added for user privilege to get set. |
| 610 | Sleep 5s |
| 611 | |
| 612 | Enable IPMI User And Verify ${random_userid} |
| 613 | |
| 614 | # For password_option 16, passwords with length between 17 and 20 will be truncated. |
| 615 | # For all other cases, passwords will be retained as it is to verify. |
| 616 | ${truncated_password}= Set Variable ${password[:${password_option}]} |
| 617 | Rprint Vars truncated_password |
| 618 | ${status}= Run Keyword And Return Status Verify IPMI Username And Password ${random_username} |
| 619 | ... ${truncated_password} |
| 620 | Rprint Vars status |
| 621 | Valid Value status [${expected_result}] |
| 622 | |
| 623 | |
Rahul Maheshwari | f646baa | 2019-02-20 12:29:35 -0600 | [diff] [blame] | 624 | Test Teardown Execution |
| 625 | [Documentation] Do the test teardown execution. |
| 626 | |
| 627 | FFDC On Test Case Fail |
Tony Lee | f9379e8 | 2020-01-08 18:20:38 +0800 | [diff] [blame] | 628 | |
| 629 | |
ganesanb | 0ae3620 | 2022-02-17 12:14:37 +0000 | [diff] [blame] | 630 | Check Active Ethernet Channels |
| 631 | [Documentation] Check active ethernet channels and set suite variables. |
| 632 | |
| 633 | ${channel_number_list}= Get Active Ethernet Channel List |
| 634 | ${channel_length}= Get Length ${channel_number_list} |
| 635 | Skip If '${channel_length}' == '1' |
| 636 | ... msg= Skips this test case as only one channel was in active. |
| 637 | |
| 638 | FOR ${channel_num} IN @{channel_number_list} |
| 639 | ${secondary_channel_number}= Set Variable If ${channel_num} != ${CHANNEL_NUMBER} ${channel_num} |
| 640 | END |
| 641 | |
| 642 | Set Suite Variable ${secondary_channel_number} |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 643 | |
| 644 | |
| 645 | Suite Setup Execution |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 646 | [Documentation] Make sure the enabled user count is below maximum, |
| 647 | ... and prepares administrative user list suite variables. |
| 648 | |
| 649 | Check Enabled User Count |
George Keishing | ca9a784 | 2022-07-07 03:44:44 -0500 | [diff] [blame] | 650 | # Skip root user checking if user decides not to use root user as default. |
| 651 | Run Keyword If '${IPMI_USERNAME}' == 'root' Determine Root User Id |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 652 | |
| 653 | |
| 654 | Check Enabled User Count |
| 655 | [Documentation] Ensure that there are available user IDs. |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 656 | |
| 657 | # Check for the enabled user count |
| 658 | ${resp}= Run IPMI Standard Command user summary ${CHANNEL_NUMBER} |
| 659 | ${enabled_user_count}= |
| 660 | ... Get Lines Containing String ${resp} Enabled User Count |
| 661 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 662 | Should not contain ${enabled_user_count} ${expected_max_ids} |
Ashwini Chandrappa | 12be4b4 | 2022-03-15 23:02:07 -0500 | [diff] [blame] | 663 | ... msg=IPMI have reached maximum user count |
George Keishing | 5e9fbbf | 2022-04-29 03:48:14 -0500 | [diff] [blame] | 664 | |
| 665 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 666 | Determine Root User Id |
| 667 | [Documentation] Determines the user ID of the root user. |
| 668 | |
| 669 | ${resp}= Wait Until Keyword Succeeds 15 sec 1 sec Run IPMI Standard Command |
| 670 | ... user list |
| 671 | @{lines}= Split To Lines ${resp} |
| 672 | |
| 673 | ${root_userid}= Set Variable ${-1} |
| 674 | ${line_count}= Get Length ${lines} |
| 675 | FOR ${id_index} IN RANGE 1 ${line_count} |
| 676 | ${line}= Get From List ${lines} ${id_index} |
| 677 | ${root_found}= Get Lines Matching Regexp ${line} ${root_pattern} |
| 678 | IF '${root_found}' != '${EMPTY}' |
| 679 | ${root_userid}= Set Variable ${id_index} |
George Keishing | e9e44c4 | 2022-05-26 08:41:39 -0500 | [diff] [blame] | 680 | Exit For Loop |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 681 | END |
| 682 | END |
| 683 | Set Suite Variable ${root_userid} |
| 684 | |
| 685 | Log To Console The root user ID is ${root_userid}. |
| 686 | Run Keyword If ${root_userid} < ${1} Fail msg= Did not identify root user ID. |
| 687 | |
| 688 | |
Gene Ratzlaff | 3a3d5d5 | 2022-05-05 08:30:52 -0400 | [diff] [blame] | 689 | Wait And Confirm New Username And Password |
George Keishing | 5e9fbbf | 2022-04-29 03:48:14 -0500 | [diff] [blame] | 690 | [Documentation] Wait in loop trying to to confirm Username And Password. |
| 691 | [Arguments] ${username} ${password} |
| 692 | |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 693 | # Description of argument(s): |
| 694 | # username The user name (e.g. "root", "robert", etc.). |
| 695 | # password The user password (e.g. "0penBmc", "0penBmc1", etc.). |
| 696 | |
George Keishing | 5e9fbbf | 2022-04-29 03:48:14 -0500 | [diff] [blame] | 697 | # Give time for previous command to complete. |
| 698 | Sleep 5s |
| 699 | |
| 700 | # Looping verify that root user is able to run IPMI command using new password. |
| 701 | Wait Until Keyword Succeeds 15 sec 5 sec Verify IPMI Username And Password |
| 702 | ... ${username} ${password} |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 703 | |
| 704 | |
| 705 | Get Enabled User Count |
| 706 | [Documentation] Return as integers: current number of enabled users and |
| 707 | ... Maximum number of Ids. |
| 708 | |
| 709 | # Isolate 'Enabled User Count' value and convert to integer |
| 710 | ${resp}= Wait Until Keyword Succeeds 15 sec 1 sec Run IPMI Standard Command |
| 711 | ... user summary ${CHANNEL_NUMBER} |
| 712 | ${user_count_line}= Get Lines Containing String ${resp} Enabled User Count |
| 713 | ${count}= Fetch From Right ${user_count_line} \: |
| 714 | ${user_count}= Convert To Integer ${count} |
| 715 | |
| 716 | # Isolate 'Maximum IDs' value and convert to integer |
| 717 | ${maximum_ids}= Get Lines Containing String ${resp} Maximum IDs |
| 718 | ${max_ids}= Fetch From Right ${maximum_ids} \: |
| 719 | ${int_maximum_ids_count}= Convert To Integer ${max_ids} |
| 720 | |
| 721 | [Return] ${user_count} ${int_maximum_ids_count} |
| 722 | |
| 723 | |
| 724 | Wait And Confirm New User Entry |
| 725 | [Documentation] Wait in loop until new user appears with given username. |
| 726 | [Arguments] ${username} |
| 727 | |
| 728 | # Description of argument(s): |
| 729 | # username The user name (e.g. "root", "robert", etc.). |
| 730 | |
| 731 | Wait Until Keyword Succeeds 45 sec 1 sec Verify IPMI Username Visible |
| 732 | ... ${username} |
| 733 | |
| 734 | |
| 735 | Verify IPMI Username Visible |
| 736 | [Documentation] Confirm that username is present in user list. |
| 737 | [Arguments] ${username} |
| 738 | |
| 739 | # Description of argument(s): |
| 740 | # username The user name (e.g. "root", "robert", etc.). |
| 741 | |
| 742 | ${resp}= Run IPMI Standard Command user list |
| 743 | Should Contain ${resp} ${username} |
| 744 | |
| 745 | |
| 746 | Find Free User Id |
| 747 | [Documentation] Find a user ID that is not being used. |
| 748 | |
| 749 | Check Enabled User Count |
| 750 | FOR ${num} IN RANGE 300 |
| 751 | ${random_userid}= Evaluate random.randint(1, ${expected_max_ids}) modules=random |
Nagarjun B | 2649914 | 2023-02-16 15:20:14 +0530 | [diff] [blame] | 752 | ${access}= Run IPMI Standard Command channel getaccess ${CHANNEL_NUMBER} ${random_userid} |
Gene Ratzlaff | a631d69 | 2022-05-05 14:40:03 -0400 | [diff] [blame] | 753 | |
| 754 | ${name_line}= Get Lines Containing String ${access} User Name |
| 755 | Log To Console For ID ${random_userid}: ${name_line} |
| 756 | ${is_empty}= Run Keyword And Return Status |
| 757 | ... Should Match Regexp ${name_line} ${empty_name_pattern} |
| 758 | |
| 759 | Exit For Loop If ${is_empty} == ${True} |
| 760 | END |
George Keishing | ca9a784 | 2022-07-07 03:44:44 -0500 | [diff] [blame] | 761 | [Return] ${random_userid} |