| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 1 | *** Settings *** | 
 | 2 | Documentation       This suite tests IPMI Payload in OpenBMC. | 
 | 3 |  | 
 | 4 | Resource            ../lib/ipmi_client.robot | 
 | 5 | Resource            ../lib/openbmc_ffdc.robot | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 6 | Resource            ../lib/bmc_network_utils.robot | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 7 | Variables           ../data/ipmi_raw_cmd_table.py | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 8 | Library             ../lib/ipmi_utils.py | 
 | 9 |  | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 10 | Suite Setup         IPMI Payload Setup Execution | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 11 | Test Teardown       FFDC On Test Case Fail | 
 | 12 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 13 | Test Tags          IPMI_Payload | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 14 |  | 
 | 15 | *** Variables *** | 
| George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 16 |  | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 17 | ${user_priv}                     2 | 
 | 18 | ${operator_priv}                 3 | 
 | 19 | ${admin_level_priv}              4 | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 20 | ${new_user_passwd}               0penBmc1 | 
 | 21 | ${standard_payload_type_resp}    03 00 | 
 | 22 | ${session_setup_payload_resp}    3f 00 | 
 | 23 | &{standard_payload_types}        ipmi_message=0  sol=1 | 
 | 24 | &{session_setup_payload_types}  RMCP+open_session_request=0x10 | 
 | 25 |                            ...  RMCP+open_session_response=0x11 | 
 | 26 |                            ...  RAKP_msg_1=0x12 | 
 | 27 |                            ...  RAKP_msg_2=0x13 | 
 | 28 |                            ...  RAKP_msg_3=0x14 | 
 | 29 |                            ...  RAKP_msg_4=0x15 | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 30 |  | 
 | 31 |  | 
 | 32 | *** Test Cases *** | 
 | 33 |  | 
 | 34 | Test Get Payload Activation Status | 
 | 35 |     [Documentation]  Test get payload activation status. | 
 | 36 |     [Tags]  Test_Get_Payload_Activation_Status | 
 | 37 |  | 
 | 38 |     # SOL is the payload currently supported for payload status. | 
 | 39 |     # Currently supports only one SOL session. | 
 | 40 |     # Response Data | 
 | 41 |     # 01   instance 1 is activated. | 
 | 42 |     # 00   instance 1 is deactivated. | 
 | 43 |     ${payload_status}=  Get Payload Activation Status | 
 | 44 |     Should Contain Any  ${payload_status}  01  00 | 
 | 45 |  | 
 | 46 |  | 
 | 47 | Test Activate Payload | 
 | 48 |     [Documentation]  Test activate payload via IPMI raw command. | 
 | 49 |     [Tags]  Test_Activate_Payload | 
 | 50 |  | 
 | 51 |     ${payload_status}=  Get Payload Activation Status | 
| George Keishing | 3a15f82 | 2025-06-17 22:17:48 +0530 | [diff] [blame] | 52 |     IF  '${payload_status}' == '01'  Deactivate Payload | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 53 |  | 
 | 54 |     Activate Payload | 
 | 55 |  | 
 | 56 |     ${payload_status}=  Get Payload Activation Status | 
 | 57 |     Should Contain  ${payload_status}  01 | 
 | 58 |  | 
 | 59 |  | 
 | 60 | Test Deactivate Payload | 
 | 61 |     [Documentation]  Test deactivate payload via IPMI raw command. | 
 | 62 |     [Tags]  Test_Deactivate_Payload | 
 | 63 |  | 
 | 64 |     ${payload_status}=  Get Payload Activation Status | 
| George Keishing | 3a15f82 | 2025-06-17 22:17:48 +0530 | [diff] [blame] | 65 |     IF  '${payload_status}' == '00'  Activate Payload | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 66 |  | 
 | 67 |     Deactivate Payload | 
 | 68 |  | 
 | 69 |     ${payload_status}=  Get Payload Activation Status | 
 | 70 |     Should Contain  ${payload_status}  00 | 
 | 71 |  | 
 | 72 |  | 
 | 73 | Test Get Payload Instance Info | 
 | 74 |     [Documentation]  Test Get Payload Instance via IPMI raw command. | 
 | 75 |     [Tags]  Test_Get_Payload_Instance_Info | 
 | 76 |  | 
 | 77 |     ${payload_status}=  Get Payload Activation Status | 
| George Keishing | 0628c4f | 2025-06-24 23:58:47 +0530 | [diff] [blame] | 78 |     IF  '${payload_status}' == '01'  Deactivate Payload | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 79 |  | 
 | 80 |     # First four bytes should be 00 if given instance is not activated. | 
 | 81 |     ${resp}=  Run IPMI Command | 
 | 82 |     ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][0]} | 
 | 83 |     Should Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][1]} | 
 | 84 |     Activate Payload | 
 | 85 |  | 
 | 86 |     # First four bytes should be session ID when payload is activated. | 
 | 87 |     ${resp}=  Run IPMI Command | 
 | 88 |     ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][0]} | 
 | 89 |     Should Not Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][1]} | 
 | 90 |  | 
 | 91 |  | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 92 | Verify Set User Access Payload For Standard Payload SOL | 
 | 93 |     [Documentation]  Disable standard payload for SOL and verify IPMI sol activate command does not work. | 
 | 94 |     [Tags]  Verify_Set_User_Access_Payload_For_Standard_Payload_SOL | 
 | 95 |     [Teardown]  Run Keywords  Set User Access Payload For Given User  ${user_id_in_hex} | 
 | 96 |     ...  AND  Delete Created User  ${userid} | 
 | 97 |     ...  AND  FFDC On Test Case Fail | 
 | 98 |  | 
 | 99 |     ${userid}  ${username}=  Create And Verify IPMI User | 
 | 100 |     ${user_id_in_hex}=  Convert To Hex  ${userid} | 
 | 101 |     ${userid_in_hex_format}=  Convert To Hex  ${userid}  prefix=0x  length=2 | 
 | 102 |  | 
 | 103 |     # Get default user access payload values. | 
 | 104 |     ${default_user_access_payload}=  Get User Access Payload For Given Channel  ${userid_in_hex_format} | 
 | 105 |  | 
 | 106 |     # Disable Standard payload 1 via set user access payload command. | 
 | 107 |     Set User Access Payload For Given User  ${user_id_in_hex}  Disable | 
 | 108 |  | 
 | 109 |     Verify Standard Payload  ${userid_in_hex_format}  ${username}  Disabled | 
 | 110 |  | 
 | 111 |  | 
 | 112 | Verify Set User Access Payload For Operator Privileged User | 
 | 113 |     [Documentation]  Try to set user access payload using operator privileged user and expect error. | 
 | 114 |     [Tags]  Verify_Set_User_Access_Payload_For_Operator_Privileged_User | 
 | 115 |     [Teardown]  Run Keywords  Delete Created User  ${userid}  AND  FFDC On Test Case Fail | 
 | 116 |  | 
 | 117 |     ${userid}  ${username}=  Create And Verify IPMI User  ${operator_priv}  Operator | 
 | 118 |  | 
 | 119 |     ${payload_raw_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Set_User_Access_Payload'][0]} | 
 | 120 |     ...  ${CHANNEL_NUMBER} 0x${user_id} 0x02 0x00 0x00 0x00 | 
 | 121 |  | 
 | 122 |     Run Keyword and Expect Error  *Unable to establish IPMI* | 
 | 123 |     ...  Run External IPMI Raw Command  ${payload_raw_cmd}  U=${userid}  P=${new_user_passwd}  L=Operator | 
 | 124 |  | 
 | 125 |  | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 126 | Verify Set User Access Payload For Invalid User | 
 | 127 |     [Documentation]  Verify set user access payload IPMI command for invalid user. | 
 | 128 |     [Tags]  Verify_Set_User_Access_Payload_For_Invalid_User | 
 | 129 |  | 
 | 130 |     # Get Random invalid user ID. | 
 | 131 |     ${invalid_userid}=  Get Invalid User ID | 
 | 132 |  | 
 | 133 |     ${raw_cmd}=  Catenate   ${IPMI_RAW_CMD['Payload']['Set_User_Access_Payload'][0]} | 
 | 134 |     ...  ${CHANNEL_NUMBER} ${invalid_userid} 0x02 0x00 0x00 0x00 | 
 | 135 |  | 
 | 136 |     Verify Invalid IPMI Command  ${raw_cmd}  0xcc | 
 | 137 |  | 
 | 138 |  | 
 | 139 | Verify Set User Access Payload For Invalid Channel Number | 
 | 140 |     [Documentation]  Verify set user access payload IPMI command for invalid channel number. | 
| George Keishing | f6b4d53 | 2022-07-08 07:07:54 -0500 | [diff] [blame] | 141 |     [Tags]  Verify_Set_User_Access_Payload_For_Invalid_Channel_Number | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 142 |     [Teardown]  Delete Created User  ${userid} | 
 | 143 |  | 
 | 144 |     ${userid}  ${username}=  Create And Verify IPMI User | 
 | 145 |  | 
 | 146 |     FOR  ${channel}  IN  @{inactive_channel_list} | 
 | 147 |  | 
 | 148 |         Verify Set User Access Payload For Invalid Channel  ${userid}  ${channel} | 
 | 149 |     END | 
 | 150 |  | 
 | 151 |  | 
 | 152 | Verify Get User Access Payload For User Access privilege | 
 | 153 |     [Documentation]   Verify get user access payload for user access(Read-only) privileged user. | 
 | 154 |     [Tags]  Verify_Get_User_Access_Payload_For_User_Access_privilege | 
 | 155 |     [Teardown]  Delete Created User  ${userid} | 
 | 156 |  | 
 | 157 |     ${userid}  ${username}=  Create And Verify IPMI User  ${user_priv}  User | 
 | 158 |  | 
 | 159 |     ${raw_command}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_User_Access_Payload'][0]} | 
 | 160 |     ...  ${CHANNEL_NUMBER} ${user_id} | 
 | 161 |  | 
 | 162 |     Run Keyword and Expect Error  *Unable to establish IPMI* | 
 | 163 |     ...  Run External IPMI Raw Command  ${raw_command}  U=${userid}  P=${new_user_passwd}  L=User | 
 | 164 |  | 
 | 165 |  | 
 | 166 | Verify Get User Access Payload For Invalid User | 
 | 167 |     [Documentation]  Verify get user access payload IPMI command for invalid user. | 
 | 168 |     [Tags]  Verify_Get_User_Access_Payload_For_Invalid_User | 
 | 169 |  | 
 | 170 |     ${invalid_userid}=  Get Invalid User ID | 
 | 171 |  | 
 | 172 |     Verify Get User Access Payload For Invalid User Or Channel  ${invalid_userid}  ${CHANNEL_NUMBER} | 
 | 173 |  | 
 | 174 |  | 
 | 175 | Verify Get User Access Payload For Invalid Channel Number | 
 | 176 |     [Documentation]  Verify get user access payload IPMI command for invalid channel number. | 
 | 177 |     [Tags]  Verify_Get_User_Access_Payload_For_Invalid_Channel_Number | 
 | 178 |     [Teardown]  Delete Created User  ${userid} | 
 | 179 |  | 
 | 180 |     ${userid}  ${username}=  Create And Verify IPMI User | 
 | 181 |     #${invalid_channels}=  Get Invalid Channel Number | 
 | 182 |  | 
 | 183 |     FOR  ${channel}  IN  @{inactive_channel_list} | 
 | 184 |         Verify Get User Access Payload For Invalid User Or Channel  ${userid}  ${channel} | 
 | 185 |     END | 
 | 186 |  | 
 | 187 |  | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 188 | Verify Get Channel Payload Version | 
 | 189 |     [Documentation]  Verify payload version for all supported payload type in | 
 | 190 |                 ...  all active channels. | 
 | 191 |     [Tags]  Verify_Get_Channel_Payload_Version | 
 | 192 |     [Template]  Verify Payload Version | 
 | 193 |  | 
 | 194 |     FOR  ${channel}  IN  @{active_channel_list} | 
 | 195 |         # Input Channel. | 
 | 196 |         ${channel} | 
 | 197 |     END | 
 | 198 |  | 
 | 199 | Verify Get Channel Payload Version For Invalid Channel | 
 | 200 |     [Documentation]  Verify get channel payload version IPMI command for invalid channel. | 
 | 201 |     [Tags]  Verify_Get_Channel_Payload_Version_For_Invalid_Channel | 
 | 202 |     [Template]  Verify Payload Version For Invalid Channel | 
 | 203 |  | 
 | 204 |     FOR  ${invalid_channel_number}  IN  @{inactive_channel_list} | 
 | 205 |         # channel number           payload types. | 
 | 206 |         ${invalid_channel_number}   &{standard_payload_types} | 
 | 207 |         ${invalid_channel_number}   &{session_setup_payload_types} | 
 | 208 |     END | 
 | 209 |  | 
 | 210 |  | 
 | 211 | Verify Get Channel Payload Support | 
 | 212 |     [Documentation]  Verify get channel payload support IPMI command for active channels. | 
 | 213 |     [Tags]  Verify_Get_Channel_Payload_Support | 
 | 214 |     [Template]  Verify Payload Support | 
 | 215 |  | 
 | 216 |     FOR  ${channel}  IN  @{active_channel_list} | 
 | 217 |         # Input channel. | 
 | 218 |         ${channel} | 
 | 219 |     END | 
 | 220 |  | 
 | 221 | Verify Get Channel Payload Support For Invalid Channel | 
 | 222 |     [Documentation]  Verify get channel payload support IPMI command for invalid channels. | 
 | 223 |     [Tags]  Verify_Get_Channel_Payload_Support_For_Invalid_Channel | 
 | 224 |     [Template]  Verify Payload Support | 
 | 225 |  | 
 | 226 |     FOR  ${channel}  IN  @{inactive_channel_list} | 
 | 227 |        # Input channel.      Invalid channel intimation. | 
 | 228 |        ${channel}            ${1} | 
 | 229 |    END | 
 | 230 |  | 
 | 231 |  | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 232 | *** Keywords *** | 
 | 233 |  | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 234 | IPMI Payload Setup Execution | 
 | 235 |     [Documentation]  Get active and inactive/invalid channels from channel_config.json file | 
 | 236 |     ...              in list type and set it as suite variable. | 
 | 237 |  | 
 | 238 |     # Get active channel list and set as a suite variable. | 
 | 239 |     @{active_channel_list}=  Get Active Ethernet Channel List  current_channel=1 | 
 | 240 |     Set Suite Variable  @{active_channel_list} | 
 | 241 |  | 
 | 242 |     # Get Inactive/Invalid channel list and set as a suite variable. | 
 | 243 |     @{inactive_channel_list}=  Get Invalid Channel Number List | 
 | 244 |     Set Suite Variable  @{inactive_channel_list} | 
 | 245 |  | 
 | 246 |  | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 247 | Get Payload Activation Status | 
 | 248 |     [Documentation]  Get payload activation status. | 
 | 249 |  | 
 | 250 |     ${resp}=  Run IPMI Command | 
 | 251 |     ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Activation_Status'][0]} | 
 | 252 |  | 
 | 253 |     @{resp}=  Split String  ${resp} | 
 | 254 |  | 
 | 255 |     ${payload_status}=  Set Variable  ${resp[1]} | 
 | 256 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 257 |     RETURN  ${payload_status} | 
| Tony Lee | 6c998f7 | 2020-03-09 18:28:35 +0800 | [diff] [blame] | 258 |  | 
 | 259 |  | 
 | 260 | Activate Payload | 
 | 261 |     [Documentation]  Activate Payload. | 
 | 262 |  | 
 | 263 |     ${resp}=  Run IPMI Command | 
 | 264 |     ...  ${IPMI_RAW_CMD['Payload']['Activate_Payload'][0]} | 
 | 265 |     Should Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Activate_Payload'][1]} | 
 | 266 |  | 
 | 267 |  | 
 | 268 | Deactivate Payload | 
 | 269 |     [Documentation]  Deactivate Payload. | 
 | 270 |  | 
 | 271 |     ${resp}=  Run IPMI Command | 
 | 272 |     ...  ${IPMI_RAW_CMD['Payload']['Deactivate_Payload'][0]} | 
 | 273 |     Should Be Empty  ${resp} | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 274 |  | 
 | 275 |  | 
 | 276 | Get User Access Payload For Given Channel | 
 | 277 |     [Documentation]  Execute get user access payload IPMI command for given channel | 
 | 278 |     ...              and return response. | 
 | 279 |     [Arguments]  ${user_id}  ${channel_number}=${CHANNEL_NUMBER} | 
 | 280 |  | 
 | 281 |     # Description of argument(s): | 
 | 282 |     # user_id         The user ID (e.g. "1", "2", etc.). | 
 | 283 |     # channel_number  Input channel number(e.g. "1", "2"). | 
 | 284 |  | 
 | 285 |     ${raw_command}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_User_Access_Payload'][0]} | 
 | 286 |     ...  ${channel_number} ${user_id} | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 287 |     ${resp}=  Run IPMI Command  ${raw_command} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 288 |     RETURN  ${resp} | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 289 |  | 
 | 290 |  | 
 | 291 | Create And Verify IPMI User | 
 | 292 |     [Documentation]  Create IPMI User, set password, set privilege and enable the user. | 
 | 293 |     [Arguments]  ${user_privilege_level}=${admin_level_priv}   ${privilege}=Administrator | 
 | 294 |  | 
 | 295 |     # Description of argument(s): | 
 | 296 |     # user_privilege_level   User Privilege level in integer. | 
 | 297 |     #                        (e.g. 4-Administrator, 3-Operator, 2-Readonly). | 
 | 298 |     # privilege              User Privilege in Wordings. | 
 | 299 |     #                        (e.g. "Administrator", "Operator", "ReadOnly"). | 
 | 300 |  | 
 | 301 |     ${random_user_id}  ${random_user_name}=  Create Random IPMI User | 
 | 302 |     Set User Password  ${random_user_id}  ${new_user_passwd}  16 | 
 | 303 |     Set And Verify User Access Privilege  ${random_user_id}  ${user_privilege_level} | 
 | 304 |     Verify Username And Password  ${random_user_name}  ${new_user_passwd}  L=${privilege} | 
 | 305 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 306 |     RETURN  ${random_user_id}  ${random_user_name} | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 307 |  | 
 | 308 |  | 
 | 309 | Set User Password | 
 | 310 |     [Documentation]  Set user password for given user ID. | 
 | 311 |     [Arguments]  ${user_id}  ${password}  ${password_option} | 
 | 312 |  | 
 | 313 |     # Description of argument(s): | 
 | 314 |     # user_id          The user ID (e.g. "1", "2", etc.). | 
 | 315 |     # password         The user password (e.g. "0penBmc", "0penBmc1", etc.). | 
 | 316 |     # password_option  Password length option to be given in IPMI command (e.g. "16", "20"). | 
 | 317 |  | 
 | 318 |     Run IPMI Standard Command  user set password ${user_id} ${password} ${password_option} | 
 | 319 |  | 
 | 320 | Set And Verify User Access Privilege | 
 | 321 |     [Documentation]  Set User Access Privilege, enable and verify user for given user ID. | 
 | 322 |     [Arguments]  ${user_id}  ${privilege_level} | 
 | 323 |  | 
 | 324 |     # Description of argument(s): | 
 | 325 |     # user_id           The user ID (e.g. "1", "2", etc.). | 
 | 326 |     # privilege_level   User Privilege level in hex value. | 
 | 327 |     #                   (e.g. 0x04-Administrator, 0x03-Operator, 0x02-Readonly). | 
 | 328 |  | 
 | 329 |     Set Channel Access  ${_user_id}  ipmi=on privilege=${privilege_level} | 
 | 330 |  | 
 | 331 |     # Delay added for user privilege to get set. | 
 | 332 |     Sleep  5s | 
 | 333 |  | 
 | 334 |     Enable IPMI User And Verify  ${user_id} | 
 | 335 |  | 
 | 336 |  | 
 | 337 | Verify Username And Password | 
 | 338 |     [Documentation]  Verify that newly created user is able to run IPMI command | 
 | 339 |     ...  with given username and password. | 
 | 340 |     [Arguments]  ${username}  ${password}  &{options} | 
 | 341 |  | 
 | 342 |     # Description of argument(s): | 
 | 343 |     # username    The user name (e.g. "root", "robert", etc.). | 
 | 344 |     # password    The user password (e.g. "0penBmc", "0penBmc1", etc.). | 
 | 345 |     # options     Additional ipmitool command options  (e.g "-L=Operator","-C=3"). | 
 | 346 |  | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 347 |     Wait Until Keyword Succeeds  15 sec  5 sec  Run IPMI Command | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 348 |     ...  ${IPMI_RAW_CMD['Device GUID']['Get'][0]}  U=${username}  P=${password}  &{options} | 
 | 349 |  | 
 | 350 |  | 
 | 351 | Verify Standard Payload | 
 | 352 |     [Documentation]  Verify standard payload is disabled or enabled. | 
 | 353 |     [Arguments]  ${user_id}  ${user_name}  ${standard_payload}=Enabled | 
 | 354 |  | 
 | 355 |     # Description of argument(s): | 
 | 356 |     # user_id            The user ID (e.g. "1", "2", etc.). | 
 | 357 |     # username           The user name (e.g. "root", "robert", etc.). | 
 | 358 |     # standard_payload   Enabled or Disabled. | 
 | 359 |  | 
 | 360 |     # Verify the standard payload 1 (sol) is disabled. | 
 | 361 |     ${get_user_access_payload}=  Get User Access Payload For Given Channel  ${user_id} | 
 | 362 |     @{get_user_access_cmd_resp_list}=  Split String  ${get_user_access_payload} | 
 | 363 |  | 
| George Keishing | 3a15f82 | 2025-06-17 22:17:48 +0530 | [diff] [blame] | 364 |     IF  '${standard_payload}' == 'Disabled' | 
 | 365 |         Should Be Equal  ${get_user_access_cmd_resp_list}[0]  00 | 
 | 366 |     ELSE | 
 | 367 |         Should Be Equal  ${get_user_access_cmd_resp_list}[0]  02 | 
 | 368 |     END | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 369 |  | 
| George Keishing | 3a15f82 | 2025-06-17 22:17:48 +0530 | [diff] [blame] | 370 |     IF  '${standard_payload}' == 'Disabled' | 
 | 371 |         Verify Sol Activate Disabled  ${user_name} | 
 | 372 |     END | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 373 |  | 
 | 374 |  | 
 | 375 | Verify Sol Activate Disabled | 
 | 376 |     [Documentation]  Verify SOL activate IPMI command is not working. | 
 | 377 |     [Arguments]  ${user_name} | 
 | 378 |  | 
 | 379 |     # Description of argument(s): | 
 | 380 |     # username    The user name (e.g. "root", "robert", etc.). | 
 | 381 |  | 
 | 382 |     ${resp}=  Run External IPMI Standard Command | 
 | 383 |     ...  sol activate  expected_rc=${1}  U=${username}  P=${new_user_passwd} | 
 | 384 |  | 
 | 385 |     Should Contain  ${resp}  SOL payload disabled | 
 | 386 |  | 
 | 387 |  | 
 | 388 | Set User Access Payload For Given User | 
 | 389 |     [Documentation]  Set the user access payload on given user, channel and return response. | 
| George Keishing | a91601b | 2023-03-21 09:35:49 +0530 | [diff] [blame] | 390 |     [Arguments]  ${user_id}  ${operation_mode}=Enable  ${oempayload_value}=0x00 | 
 | 391 |     ...          ${standard_payload_value}=0x02 | 
| nagarjunb22 | a2255de | 2022-05-25 19:15:10 +0530 | [diff] [blame] | 392 |  | 
 | 393 |     # Description of argument(s): | 
 | 394 |     # user_id                  The user ID (e.g. "1", "2", etc.). | 
 | 395 |     # operation_mode          Enable or Disable payload type. | 
 | 396 |     # oempayload_value        Oempayload in hex (e.g. "0x00", "0x01", "0x02", "0x04" etc). | 
 | 397 |     # standard_payload_value  Standard payload type IPMI or SOL. | 
 | 398 |     #                         (e.g.  0x01 - IPMI, 0x02- SOL). | 
 | 399 |  | 
 | 400 |     # If operation mode is disable 2nd byte of raw command is 4${user_id}. | 
 | 401 |     # (e.g) 2n byte will be 0x4a (if user_id is a). | 
 | 402 |     # If operation mode is enable 2nd byte of raw command is 0${user_id}. | 
 | 403 |     # (e.g.) 3rd byte will be 0x0a (if user_id is a). | 
 | 404 |     # 0x02- standard payload for SOL, 0x01 standard payload for IPMI. | 
 | 405 |     # 3rd byte represent standard payload enables 1 (SOL). | 
 | 406 |     # 4th to 6th byte represent standard payload enables 2 and OEM payload 1 & 2 respectively. | 
 | 407 |  | 
 | 408 |     ${operation_mode_value}=  Set Variable If  '${operation_mode}' == 'Enable' | 
 | 409 |     ...  0  4 | 
 | 410 |     ${set_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Set_User_Access_Payload'][0]} | 
 | 411 |     ...  ${CHANNEL_NUMBER} 0x${operation_mode_value}${user_id} ${standard_payload_value} 0x00 ${oempayload_value} 0x00 | 
 | 412 |  | 
 | 413 |     ${resp}=  Run IPMI Command  ${set_cmd} | 
 | 414 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 415 |     RETURN  ${resp} | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 416 |  | 
 | 417 |  | 
 | 418 | Get Invalid User ID | 
 | 419 |     [Documentation]  Get random invalid user ID using "channel getaccess" IPMI standard command. | 
 | 420 |  | 
 | 421 |     # Python module:  get_user_info(userid, channel_number=1) | 
| Nagarjun B | 2649914 | 2023-02-16 15:20:14 +0530 | [diff] [blame] | 422 |     ${user_info}=  Get User Info  ${EMPTY}  ${CHANNEL_NUMBER} | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 423 |     ${user_info}=  Filter Struct  ${user_info}  [('user_name', None)]  invert=1 | 
 | 424 |     ${empty_user_info}=  Filter Struct  ${user_info}  [('user_name', '')] | 
 | 425 |     @{invalid_userid_list}=  Create List | 
 | 426 |     FOR  ${user_record}  IN  @{empty_user_info} | 
 | 427 |         Append To List  ${invalid_userid_list}  ${user_record['user_id']} | 
 | 428 |     END | 
 | 429 |     ${invalid_user_id}=  Evaluate  random.choice(${invalid_userid_list})  random | 
 | 430 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 431 |     RETURN  ${invalid_user_id} | 
| nagarjunb | 765535a | 2022-06-01 12:59:00 +0530 | [diff] [blame] | 432 |  | 
 | 433 |  | 
 | 434 | Verify Set User Access Payload For Invalid Channel | 
 | 435 |     [Documentation]  Verify set user payload command for invalid channels. | 
 | 436 |     [Arguments]  ${user_id}  ${channel_number} | 
 | 437 |  | 
 | 438 |     # Description of argument(s): | 
 | 439 |     # user_id           The user ID (e.g. "1", "2", etc.). | 
 | 440 |     # channel_number    Input channel number. | 
 | 441 |  | 
 | 442 |     ${channel_number}=  Convert To Hex  ${channel_number}  prefix=0x | 
 | 443 |     ${user_id}=  Convert To Hex  ${user_id}  prefix=0x | 
 | 444 |     ${raw_cmd}=  Catenate   ${IPMI_RAW_CMD['Payload']['Set_User_Access_Payload'][0]} | 
 | 445 |     ...  ${channel_number} ${user_id} 0x02 0x00 0x00 0x00 | 
 | 446 |  | 
 | 447 |     Verify Invalid IPMI Command  ${raw_cmd}  0xcc | 
 | 448 |  | 
 | 449 |  | 
 | 450 | Verify Get User Access Payload For Invalid User Or Channel | 
 | 451 |     [Documentation]  Verify get user payload command for invalid userid or invalid channels. | 
 | 452 |     [Arguments]  ${user_id}  ${channel_number} | 
 | 453 |  | 
 | 454 |     # Description of argument(s): | 
 | 455 |     # user_id           The user ID (e.g. "1", "2", etc.). | 
 | 456 |     # channel_number    Input channel number. | 
 | 457 |  | 
 | 458 |     ${channel_number}=  Convert To Hex  ${channel_number}  prefix=0x | 
 | 459 |     ${user_id}=  Convert To Hex  ${user_id}  prefix=0x | 
 | 460 |     ${raw_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_User_Access_Payload'][0]} | 
 | 461 |     ...  ${channel_number} ${user_id} | 
 | 462 |  | 
| George Keishing | f6b4d53 | 2022-07-08 07:07:54 -0500 | [diff] [blame] | 463 |     Verify Invalid IPMI Command  ${raw_cmd}  0xcc | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 464 |  | 
 | 465 |  | 
 | 466 | Verify Payload Type Version | 
 | 467 |     [Documentation]  Verify supported payload version. | 
 | 468 |     [Arguments]  ${channel_number}  &{payload_type_dict} | 
 | 469 |  | 
 | 470 |     # Description of argument(s): | 
 | 471 |     # channel_number     Input channel number. | 
 | 472 |     # payload_type_dict  Supported payload type in dictionary type. | 
 | 473 |     #                    standard_payload_types and session_setup_payload_types which we use | 
 | 474 |     #                    in this keyword are defined in variable section. | 
 | 475 |  | 
 | 476 |     FOR  ${payload_type_name}  ${payload_type_number}  IN  &{payload_type_dict} | 
 | 477 |         ${get_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_Channel_Payload_Version'][0]} | 
 | 478 |         ...  ${channel_number} ${payload_type_number} | 
 | 479 |  | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 480 |         ${resp}=  Run IPMI Command  ${get_cmd} | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 481 |         ${resp}=  Strip String  ${resp} | 
 | 482 |         Should Be Equal  ${resp}  10 | 
 | 483 |     END | 
 | 484 |  | 
 | 485 |  | 
 | 486 | Verify Payload Version For Invalid Channel | 
 | 487 |     [Documentation]  Verify payload version for invalid channel. | 
 | 488 |     [Arguments]  ${channel_number}  &{payload_type_dict} | 
 | 489 |  | 
 | 490 |     # Description of argument(s): | 
 | 491 |     # channel_number     Input channel number. | 
 | 492 |     # payload_type_dict  Supported payload type in dictionary type. | 
 | 493 |     #                    standard_payload_types and session_setup_payload_types which we use | 
 | 494 |     #                    in this keyword are defined in variable section. | 
 | 495 |  | 
 | 496 |      ${channel_number}=  Convert To Hex  ${channel_number}  prefix=0x | 
 | 497 |      FOR  ${payload_type_name}  ${payload_type_number}  IN  &{payload_type_dict} | 
 | 498 |         ${get_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_Channel_Payload_Version'][0]} | 
 | 499 |         ...  ${channel_number} ${payload_type_number} | 
 | 500 |  | 
 | 501 |         Verify Invalid IPMI Command  ${get_cmd}  0xcc | 
 | 502 |      END | 
 | 503 |  | 
 | 504 |  | 
 | 505 | Verify Payload Version | 
 | 506 |     [Documentation]  Verify supported payload version on given channel number. | 
 | 507 |     [Arguments]  ${channel_number} | 
 | 508 |  | 
 | 509 |     # Description of argument(s): | 
 | 510 |     # channel_number     Input channel number. | 
 | 511 |  | 
 | 512 |     Verify Payload Type Version  ${channel_number}  &{standard_payload_types} | 
 | 513 |     Verify Payload Type Version  ${channel_number}  &{session_setup_payload_types} | 
 | 514 |  | 
 | 515 |  | 
 | 516 | Verify Payload Support | 
 | 517 |     [Documentation]  Verify payload support on given channel number. | 
 | 518 |     [Arguments]  ${channel_number}  ${invalid_channel}=${0} | 
 | 519 |  | 
 | 520 |     # Description of argument(s): | 
 | 521 |     # channel_number     Input channel number. | 
 | 522 |     # invalid_channel    This argument indicates whether we checking payload support command | 
 | 523 |     #                    for Invalid channel or not. | 
 | 524 |     #                    (e.g. 1 indicates checking for invalid channel, 0 indicates valid channel). | 
 | 525 |  | 
 | 526 |     ${channel_number}=  Convert To Hex  ${channel_number}  prefix=0x | 
 | 527 |     ${raw_cmd}=  Catenate  ${IPMI_RAW_CMD['Payload']['Get_Channel_Payload_Support'][0]}  ${channel_number} | 
 | 528 |  | 
 | 529 |     Run Keyword And Return If  '${invalid_channel}' == '${1}' | 
 | 530 |     ...  Verify Invalid IPMI Command  ${raw_cmd}  0xcc | 
 | 531 |  | 
 | 532 |     # will be executed only if invalid_channel == 0. | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 533 |     ${resp}=  Run IPMI Command  ${raw_cmd} | 
| nagarjunb22 | 93e6e24 | 2022-06-10 21:36:19 +0530 | [diff] [blame] | 534 |  | 
 | 535 |     ${resp}=  Strip String  ${resp} | 
 | 536 |     ${expected_resp}=  Catenate  ${standard_payload_type_resp}  ${session_setup_payload_resp} 00 00 00 00 | 
 | 537 |     Should Be Equal  ${expected_resp}  ${resp} |