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