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