1*** Settings *** 2 3Documentation Module to test IPMI Get BIOS POST Code Command. 4Resource ../lib/ipmi_client.robot 5Resource ../lib/boot_utils.robot 6Library ../lib/ipmi_utils.py 7Variables ../data/ipmi_raw_cmd_table.py 8 9Suite Setup IPMI Power On 10Suite Teardown IPMI Power On stack_mode=skip quiet=1 11 12Force Tags Get_BIOS_Post_Code 13 14*** Test Cases *** 15 16Test 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 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 22 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} 23 Verify POST Code Response Length ${resp} 24 25Test 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 29 ${resp}= Run IPMI Standard Command chassis power cycle 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} 32 33 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} 34 Verify POST Code Response Length ${resp} 35 36Test 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 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 43 44 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} fail_on_err=0 45 Should Contain ${resp} ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]} 46 47*** Keywords *** 48Verify 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 70Check 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 80Check 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 93Check 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 104Host 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} 115