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 | |
ganesanb | 52d5ea5 | 2023-04-28 17:48:27 +0000 | [diff] [blame] | 9 | Suite Setup IPMI Power On |
| 10 | Suite Teardown IPMI Power On stack_mode=skip quiet=1 |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 11 | |
| 12 | *** Test Cases *** |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 13 | Test Get BIOS POST Code via IPMI Raw Command |
| 14 | [Documentation] Get BIOS POST Code via IPMI raw command. |
| 15 | [Tags] Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command |
| 16 | |
ganesanb | 52d5ea5 | 2023-04-28 17:48:27 +0000 | [diff] [blame] | 17 | Wait Until Keyword Succeeds 10 min 1 sec Check Host Is Pinging ${OS_HOST} |
| 18 | Wait Until Keyword Succeeds 1 min 1 sec Check Chassis Power Status on |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 19 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 20 | Verify POST Code Response Length ${resp} |
| 21 | |
| 22 | Test Get BIOS POST Code via IPMI Raw Command After Power Cycle |
| 23 | [Documentation] Get BIOS POST Code via IPMI raw command after power cycle. |
| 24 | [Tags] Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_After_Power_Cycle |
| 25 | |
leet | 666ceaa | 2022-02-16 19:50:14 +0000 | [diff] [blame] | 26 | ${resp}= Run IPMI Standard Command chassis power cycle |
ganesanb | 52d5ea5 | 2023-04-28 17:48:27 +0000 | [diff] [blame] | 27 | Wait Until Keyword Succeeds 1 min 1 sec Check Host Is Not Pinging ${OS_HOST} |
| 28 | Wait Until Keyword Succeeds 10 min 1 sec Check Host Is Pinging ${OS_HOST} |
leet | 666ceaa | 2022-02-16 19:50:14 +0000 | [diff] [blame] | 29 | |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 30 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 31 | Verify POST Code Response Length ${resp} |
| 32 | |
| 33 | Test Get BIOS POST Code via IPMI Raw Command With Host Powered Off |
| 34 | [Documentation] Get BIOS POST Code via IPMI raw command after power off. |
| 35 | [Tags] Test_Get_BIOS_POST_Code_via_IPMI_Raw_Command_With_Host_Powered_Off |
| 36 | |
| 37 | ${resp}= Run IPMI Standard Command chassis power off |
ganesanb | 52d5ea5 | 2023-04-28 17:48:27 +0000 | [diff] [blame] | 38 | Wait Until Keyword Succeeds 1 min 1 sec Check Host Is Not Pinging ${OS_HOST} |
| 39 | Wait Until Keyword Succeeds 1 min 1 sec Check Chassis Power Status off |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 40 | |
leet | 92a8105 | 2022-06-03 19:11:08 +0000 | [diff] [blame] | 41 | ${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] | 42 | Should Contain ${resp} ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]} |
| 43 | |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 44 | *** Keywords *** |
Nagarjun | e94e540 | 2022-01-19 15:26:27 -0500 | [diff] [blame] | 45 | Verify POST Code Response Length |
| 46 | [Documentation] Verify the BIOS POST Code response byte length. |
| 47 | [Tags] Verify_POST_Code_Response_Length |
| 48 | [Arguments] ${resp} |
| 49 | |
| 50 | # Description of argument(s): |
| 51 | # resp The complete response bytes from |
| 52 | # Get BIOS POST Code command returned |
| 53 | # in one string. |
| 54 | |
| 55 | @{resp_bytes}= Split String ${resp} |
| 56 | ${string_length}= Get Length ${resp_bytes} |
| 57 | |
| 58 | # Convert response byte length to integer. |
| 59 | ${value}= Get Slice From List ${resp_bytes} 2 4 |
| 60 | Reverse List ${value} |
| 61 | ${byte_length_string}= Evaluate "".join(${value}) |
| 62 | ${byte_length_integer}= Convert To Integer ${byte_length_string} 16 |
| 63 | ${true_length}= Evaluate (${string_length} - 4) |
| 64 | |
| 65 | Should Be Equal ${true_length} ${byte_length_integer} |
| 66 | |
ganesanb | 52d5ea5 | 2023-04-28 17:48:27 +0000 | [diff] [blame] | 67 | Check Chassis Power Status |
| 68 | [Documentation] Validate chassis power status. |
| 69 | [Arguments] ${expected_state} |
| 70 | |
| 71 | # Description of argument(s): |
| 72 | # expected_state on, off |
| 73 | |
| 74 | ${resp}= Run IPMI Standard Command chassis power status |
| 75 | Should Contain ${resp} ${expected_state} |
| 76 | |
| 77 | Check Host Is Pinging |
| 78 | [Documentation] Check given ip/hostname is pinging. |
| 79 | [Arguments] ${host_ip} |
| 80 | |
| 81 | # Description of argument(s): |
| 82 | # host_ip The host name or IP of the host to ping. |
| 83 | |
| 84 | ${ping_rsp}= Host Ping ${host_ip} |
| 85 | # Should Not Contain ${ping_rsp} Destination Host Unreachable |
| 86 | # ... msg=${host_ip} is not pinging. |
| 87 | Should Not Contain ${ping_rsp} 100% packet loss |
| 88 | ... msg=${host_ip} is not pinging. |
| 89 | |
| 90 | Check Host Is Not Pinging |
| 91 | [Documentation] Check given ip/hostname is not pinging. |
| 92 | [Arguments] ${host_ip} |
| 93 | |
| 94 | # Description of argument(s): |
| 95 | # host_ip The host name or IP of the host to ping. |
| 96 | |
| 97 | ${ping_rsp}= Host Ping ${host_ip} |
| 98 | Should Contain ${ping_rsp} 100% packet loss |
| 99 | ... msg=${host_ip} is pinging. |
| 100 | |
| 101 | Host Ping |
| 102 | [Documentation] Ping the given host. |
| 103 | [Arguments] ${host_ip} |
| 104 | |
| 105 | # Description of argument(s): |
| 106 | # host_ip The host name or IP of the host to ping. |
| 107 | |
| 108 | ${cmd}= Catenate ping -c 4 ${host_ip} |
| 109 | ${output}= Run ${cmd} |
| 110 | |
| 111 | [Return] ${output} |