blob: 169f2c776d7b8fd5353eb515af88e5b1f0b5ff40 [file] [log] [blame]
Nagarjune94e5402022-01-19 15:26:27 -05001*** 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
George Keishing87dc4422023-10-20 12:56:30 +05309Suite Setup IPMI Power On
10Suite Teardown IPMI Power On stack_mode=skip quiet=1
11
12Force Tags Get_BIOS_Post_Code
Nagarjune94e5402022-01-19 15:26:27 -050013
14*** Test Cases ***
George Keishing87dc4422023-10-20 12:56:30 +053015
Nagarjune94e5402022-01-19 15:26:27 -050016Test 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
ganesanb52d5ea52023-04-28 17:48:27 +000020 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
Nagarjune94e5402022-01-19 15:26:27 -050022 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
Nagarjune94e5402022-01-19 15:26:27 -050023 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
leet666ceaa2022-02-16 19:50:14 +000029 ${resp}= Run IPMI Standard Command chassis power cycle
ganesanb52d5ea52023-04-28 17:48:27 +000030 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}
leet666ceaa2022-02-16 19:50:14 +000032
Nagarjune94e5402022-01-19 15:26:27 -050033 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
Nagarjune94e5402022-01-19 15:26:27 -050034 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
ganesanb52d5ea52023-04-28 17:48:27 +000041 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
Nagarjune94e5402022-01-19 15:26:27 -050043
leet92a81052022-06-03 19:11:08 +000044 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} fail_on_err=0
Nagarjune94e5402022-01-19 15:26:27 -050045 Should Contain ${resp} ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]}
46
Nagarjune94e5402022-01-19 15:26:27 -050047*** Keywords ***
Nagarjune94e5402022-01-19 15:26:27 -050048Verify 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
ganesanb52d5ea52023-04-28 17:48:27 +000070Check 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}