blob: be931390f6c86878ab2354d3845473274cb9c73c [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
ganesanb52d5ea52023-04-28 17:48:27 +00009Suite Setup IPMI Power On
10Suite Teardown IPMI Power On stack_mode=skip quiet=1
Nagarjune94e5402022-01-19 15:26:27 -050011
12*** Test Cases ***
Nagarjune94e5402022-01-19 15:26:27 -050013Test 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
ganesanb52d5ea52023-04-28 17:48:27 +000017 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
Nagarjune94e5402022-01-19 15:26:27 -050019 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
Nagarjune94e5402022-01-19 15:26:27 -050020 Verify POST Code Response Length ${resp}
21
22Test 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
leet666ceaa2022-02-16 19:50:14 +000026 ${resp}= Run IPMI Standard Command chassis power cycle
ganesanb52d5ea52023-04-28 17:48:27 +000027 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}
leet666ceaa2022-02-16 19:50:14 +000029
Nagarjune94e5402022-01-19 15:26:27 -050030 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]}
Nagarjune94e5402022-01-19 15:26:27 -050031 Verify POST Code Response Length ${resp}
32
33Test 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
ganesanb52d5ea52023-04-28 17:48:27 +000038 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
Nagarjune94e5402022-01-19 15:26:27 -050040
leet92a81052022-06-03 19:11:08 +000041 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][0]} fail_on_err=0
Nagarjune94e5402022-01-19 15:26:27 -050042 Should Contain ${resp} ${IPMI_RAW_CMD['BIOS_POST_Code']['Get'][3]}
43
Nagarjune94e5402022-01-19 15:26:27 -050044*** Keywords ***
Nagarjune94e5402022-01-19 15:26:27 -050045Verify 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
ganesanb52d5ea52023-04-28 17:48:27 +000067Check 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
77Check 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
90Check 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
101Host 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}