| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 1 | *** Settings *** | 
 | 2 |  | 
 | 3 | Documentation    Module to test IPMI Get BIOS POST Code Command. | 
 | 4 | Resource         ../lib/ipmi_client.robot | 
 | 5 | Resource         ../lib/boot_utils.robot | 
 | 6 | Library          ../lib/ipmi_utils.py | 
 | 7 | Variables        ../data/ipmi_raw_cmd_table.py | 
 | 8 |  | 
 | 9 | *** Variables *** | 
 | 10 | ${power_state_change}  10 | 
| leet | 666ceaa | 2022-02-16 19:50:14 +0000 | [diff] [blame] | 11 | ${host_reboot_time}  360 | 
| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 12 |  | 
 | 13 | *** Test Cases *** | 
 | 14 |  | 
 | 15 | IPMI Chassis Status On | 
| George Keishing | e16f158 | 2022-12-15 07:32:21 -0600 | [diff] [blame] | 16 |     [Documentation]  This test case verifies system power on status | 
| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 17 |     ...               using IPMI Get Chassis status command. | 
 | 18 |     [Tags]  IPMI_Chassis_Status_On | 
 | 19 |  | 
 | 20 |     # Check the chassis status. | 
 | 21 |     Verify Host PowerOn Via IPMI | 
 | 22 |     ${resp}=  Run IPMI Standard Command  chassis power status | 
 | 23 |     Should Be Equal As Strings  '${resp}'  'Chassis Power is on' | 
 | 24 |  | 
 | 25 | Test Get BIOS POST Code via IPMI Raw Command | 
 | 26 |     [Documentation]  Get BIOS POST Code via IPMI raw command. | 
 | 27 |     [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command | 
 | 28 |  | 
 | 29 |     ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} | 
 | 30 |     Sleep  10 | 
 | 31 |  | 
 | 32 |     Verify POST Code Response Length  ${resp} | 
 | 33 |  | 
 | 34 | Test Get BIOS POST Code via IPMI Raw Command After Power Cycle | 
 | 35 |     [Documentation]  Get BIOS POST Code via IPMI raw command after power cycle. | 
 | 36 |     [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_After_Power_Cycle | 
 | 37 |  | 
| leet | 666ceaa | 2022-02-16 19:50:14 +0000 | [diff] [blame] | 38 |     ${resp}=  Run IPMI Standard Command  chassis power cycle | 
 | 39 |     Sleep  ${power_state_change} | 
 | 40 |     Should Contain  ${resp}  Chassis Power Control: Cycle | 
 | 41 |     sleep  ${host_reboot_time} | 
 | 42 |     ${ipmi_state}=  Get Host State Via External IPMI | 
 | 43 |     Valid Value  ipmi_state  ['on'] | 
 | 44 |  | 
| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 45 |     ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} | 
 | 46 |     Sleep  ${host_reboot_time} | 
 | 47 |  | 
 | 48 |     Verify POST Code Response Length  ${resp} | 
 | 49 |  | 
 | 50 | Test Get BIOS POST Code via IPMI Raw Command With Host Powered Off | 
 | 51 |     [Documentation]  Get BIOS POST Code via IPMI raw command after power off. | 
 | 52 |     [Tags]  Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_With_Host_Powered_Off | 
 | 53 |  | 
 | 54 |     ${resp}=  Run IPMI Standard Command  chassis power off | 
 | 55 |     Sleep  ${power_state_change} | 
 | 56 |     Should Contain  ${resp}  Chassis Power Control: Down/Off | 
 | 57 |  | 
| leet | 92a8105 | 2022-06-03 19:11:08 +0000 | [diff] [blame] | 58 |     ${resp}=  Run IPMI Standard Command  raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}  fail_on_err=0 | 
| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 59 |     Should Contain  ${resp}  ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]} | 
 | 60 |  | 
| leet | 666ceaa | 2022-02-16 19:50:14 +0000 | [diff] [blame] | 61 |     # Turn host back on. | 
 | 62 |     IPMI Power On  stack_mode=skip  quiet=1 | 
 | 63 |     Verify Host PowerOn Via IPMI | 
 | 64 |     ${resp}=  Run IPMI Standard Command  chassis power status | 
 | 65 |     Should Be Equal As Strings  '${resp}'  'Chassis Power is on' | 
 | 66 |  | 
| Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 67 | *** Keywords *** | 
 | 68 |  | 
 | 69 | Verify Host PowerOn Via IPMI | 
 | 70 |     [Documentation]   Verify host power on operation using external IPMI command. | 
 | 71 |     [Tags]  Verify_Host_PowerOn_Via_IPMI | 
 | 72 |  | 
 | 73 |     IPMI Power On  stack_mode=skip  quiet=1 | 
 | 74 |     ${ipmi_state}=  Get Host State Via External IPMI | 
 | 75 |     Valid Value  ipmi_state  ['on'] | 
 | 76 |  | 
 | 77 |  | 
 | 78 | Verify POST Code Response Length | 
 | 79 |     [Documentation]  Verify the BIOS POST Code response byte length. | 
 | 80 |     [Tags]  Verify_POST_Code_Response_Length | 
 | 81 |     [Arguments]  ${resp} | 
 | 82 |  | 
 | 83 |     # Description of argument(s): | 
 | 84 |     # resp                          The complete response bytes from | 
 | 85 |     #                               Get BIOS POST Code command returned | 
 | 86 |     #                               in one string. | 
 | 87 |  | 
 | 88 |     @{resp_bytes}=  Split String  ${resp} | 
 | 89 |     ${string_length}=  Get Length  ${resp_bytes} | 
 | 90 |  | 
 | 91 |     # Convert response byte length to integer. | 
 | 92 |     ${value}=  Get Slice From List  ${resp_bytes}   2   4 | 
 | 93 |     Reverse List   ${value} | 
 | 94 |     ${byte_length_string}=  Evaluate   "".join(${value}) | 
 | 95 |     ${byte_length_integer}=  Convert To Integer  ${byte_length_string}  16 | 
 | 96 |     ${true_length}=  Evaluate  (${string_length} - 4) | 
 | 97 |  | 
 | 98 |     Should Be Equal  ${true_length}  ${byte_length_integer} | 
 | 99 |  |