blob: 9630e83b704dd55f651faba876705fe1c58d22be [file] [log] [blame]
Sushil Singh8023a8c2020-03-16 05:56:39 -05001*** Settings ***
Sushil Singhc5e9ebc2020-04-09 03:32:57 -05002Documentation Test to discover the BMC. Before running suit,
3... check BMC and Avahi browse machine should be in same subnet.
Sushil Singh8023a8c2020-03-16 05:56:39 -05004
5Variables ../../data/variables.py
6Library SSHLibrary
7Library ../../lib/external_intf/management_console_utils.py
8Library ../../lib/gen_robot_print.py
9Library ../../lib/gen_print.py
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050010Library ../../lib/gen_misc.py
11Resource ../../lib/external_intf/management_console_utils.robot
Sushil Singha2bf3f32020-04-15 05:23:57 -050012Resource ../../lib/redfish_code_update_utils.robot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050013Resource ../../lib/boot_utils.robot
Sushil Singh8023a8c2020-03-16 05:56:39 -050014Resource ../../syslib/utils_os.robot
Sushil Singha313c972020-05-12 09:04:48 -050015Resource ../../lib/code_update_utils.robot
Sushil Singh8023a8c2020-03-16 05:56:39 -050016
17Suite Setup Suite Setup Execution
Sushil Singh51be1342020-05-05 00:19:40 -050018Suite Teardown Redfish.Logout
19Test Setup Printn
Sushil Singha2bf3f32020-04-15 05:23:57 -050020Test Teardown FFDC On Test Case Fail
Sushil Singh8023a8c2020-03-16 05:56:39 -050021
22*** Test Cases ***
23
24Discover BMC With Different Service Type
25 [Documentation] Discover all the BMC with different service type support.
26 [Tags] Discover_BMC_With_Different_Service_Type
27 [Template] Discover BMC With Service Type
28
29 # Service type
30 _obmc_rest._tcp
31 _obmc_redfish._tcp
32
33
Sushil Singhe6edfad2020-04-13 07:45:03 -050034Discover BMC Pre And Post Reboot
35 [Documentation] Discover BMC before and after reboot.
36 [Tags] Discover_BMC_Pre_And_Post_Reboot
37 [Template] Set Daemon And Discover BMC After Reboot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -050038
39 # Service type
40 _obmc_rest._tcp
41 _obmc_redfish._tcp
42
Sushil Singhe6edfad2020-04-13 07:45:03 -050043
44Disable AvahiDaemon And Discover BMC After Reboot
George Keishinge20f82c2020-05-13 10:51:02 -050045 [Documentation] BMC should be discoverable in next reboot even after disabling Avahi daemon.
Sushil Singhe6edfad2020-04-13 07:45:03 -050046 [Tags] Disable_AvahiDaemon_And_Discover_BMC_After_Reboot
47 [Template] Set Daemon And Discover BMC After Reboot
48
49 # Service type skip
50 _obmc_rest._tcp True
51 _obmc_redfish._tcp True
52
Sushil Singha2bf3f32020-04-15 05:23:57 -050053
Sushil Singhe46ba2d2020-05-07 07:39:34 -050054Discover BMC Pre And Post Firmware Update Of Same Release
55 [Documentation] Discover BMC, when firmware update occurs for same release.
56 [Tags] Discover_BMC_Pre_And_Post_Firmware_Update_Of_Same_Release
Sushil Singha2bf3f32020-04-15 05:23:57 -050057 [Template] Discover BMC Pre And Post Firmware Update
58
Sushil Singhe46ba2d2020-05-07 07:39:34 -050059 # Service type Service type status
60 _obmc_rest._tcp _obmc_redfish._tcp True
Sushil Singha2bf3f32020-04-15 05:23:57 -050061
Sushil Singh6a8cb082020-04-15 06:50:28 -050062
Sushil Singhe46ba2d2020-05-07 07:39:34 -050063Discover BMC Pre And Post Firmware Update Of Different Release
64 [Documentation] Discover BMC, when firmware update occurs for different release.
65 [Tags] Discover_BMC_Pre_And_Post_Firmware_Update_Of_Different_Release
Sushil Singh6a8cb082020-04-15 06:50:28 -050066 [Template] Discover BMC Pre And Post Firmware Update
67
Sushil Singhe46ba2d2020-05-07 07:39:34 -050068 # Service type Service type status
69 _obmc_rest._tcp _obmc_redfish._tcp True
Sushil Singh6a8cb082020-04-15 06:50:28 -050070
Sushil Singh51be1342020-05-05 00:19:40 -050071
Sushil Singhe46ba2d2020-05-07 07:39:34 -050072Discover BMC Fail After Firmware Update Of Different Release
73 [Documentation] Discover BMC fail, when firmware update occurs for different release.
74 [Tags] Discover_BMC_Fail_After_Firmware_Update_Of_Different_Release
75 [Template] Discover BMC Pre And Post Firmware Update
76
77 # Service type Service type status
78 _obmc_rest._tcp _obmc_redfish._tcp False
79
80
81Discover BMC Pre And Post When Host Boot InProgress
82 [Documentation] Discover BMC, when Host boot in progress.
83 [Tags] Discover_BMC_Pre_And_Post_When_Host_Boot_InProgress
84 [Template] Discover BMC Pre And Post When Host Boot
Sushil Singh51be1342020-05-05 00:19:40 -050085
86 # Service type Service type
87 _obmc_rest._tcp _obmc_redfish._tcp
88
Sushil Singh8023a8c2020-03-16 05:56:39 -050089*** Keywords ***
90
91Suite Setup Execution
92 [Documentation] Do the suite setup.
93
94 Should Not Be Empty ${AVAHI_CLIENT}
95 Should Not Be Empty ${AVAHI_CLIENT_USERNAME}
96 Should Not Be Empty ${AVAHI_CLIENT_PASSWORD}
97 Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD}
98 Check Avahi Package
Sushil Singh51be1342020-05-05 00:19:40 -050099 Redfish.Login
Sushil Singh8023a8c2020-03-16 05:56:39 -0500100
101
102Check Avahi Package
103 [Documentation] To check for avahi-tools package.
104
105 # Expected command output as below.
106 # avahi-tools-0.6.31-19.el7.x86_64
107
108 ${command}= Set Variable rpm -qa | grep avahi-tools
109 ${resp_rpm} ${stderr}= Execute Command ${command} return_stderr=True
110 Should Be Empty ${stderr}
111 Should Contain ${resp_rpm} avahi-tools ignore_case=True msg=avahi-tools is not available.
112
113
114Discover BMC With Service Type
115 [Documentation] To get the discoverd BMC list.
116 [Arguments] ${service_type}
117
118 # Description of argument(s):
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500119 # service_type BMC service type e.g.
120 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
Sushil Singh8023a8c2020-03-16 05:56:39 -0500121
122 # bmc_list:
123 # [1]:
124 # [service]: _obmc_XXXX._tcp
125 # [hostname]: System Name
126 # [address]: XXX.XXX.XXX.XXX
127 # [port]: XXX
128 # [txt]:
129 # [2]:
130 # [service]: _obmc_XXXX._tcp
131 # [hostname]: System Name
132 # [address]: XXX.XXX.XXX.XXX
133 # [port]: XXX
134 # [txt]:
135
136 ${resp_service} ${stderr}= Execute Command avahi-browse -rt ${service_type} return_stderr=True
137 ${bmc_list} ${exc_msg}= Get BMC Records ${service_type} ${resp_service}
138 Print Timen Exception message is ${exc_msg}
139 Should Not Be Empty ${bmc_list}
140 Rprint Vars bmc_list
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500141 [Return] ${bmc_list}
142
143
144Verify Existence Of BMC Record From List
145 [Documentation] Verify the existence of BMC record from list of BMC records.
146 [Arguments] ${service_type}
147
148 # Description of argument(s):
149 # service_type BMC service type e.g.
150 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
151
152 ${bmc_list}= Discover BMC With Service Type ${service_type}
153 ${openbmc_host_name} ${openbmc_ip}= Get Host Name IP host=${OPENBMC_HOST}
154 ${resp}= Check BMC Record Exists ${bmc_list} ${openbmc_ip}
155 Should Be True 'True' == '${resp}'
156
157
Sushil Singhe6edfad2020-04-13 07:45:03 -0500158Set Daemon And Discover BMC After Reboot
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500159 [Documentation] Discover BMC After reboot.
Sushil Singhe6edfad2020-04-13 07:45:03 -0500160 [Arguments] ${service_type} ${skip}=False
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500161
162 # Description of argument(s):
163 # service_type BMC service type e.g.
164 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
Sushil Singhe6edfad2020-04-13 07:45:03 -0500165 # skip Default value set to False.
166 # If the value is True, Disable the AvahiDaemon.
167 # If the value is False, skip the step to disable the AvahiDaemon.
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500168
Sushil Singhe6edfad2020-04-13 07:45:03 -0500169 Verify Existence Of BMC Record From List ${service_type}
170 Run Keyword If '${skip}' == 'True' Set AvahiDaemon Service command=stop
Sushil Singhc5e9ebc2020-04-09 03:32:57 -0500171 Redfish OBMC Reboot (off)
172 Verify AvahiDaemon Service Status message=start
173 Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD}
174 Wait Until Keyword Succeeds 2 min 30 sec
175 ... Verify Existence Of BMC Record From List ${service_type}
Sushil Singha2bf3f32020-04-15 05:23:57 -0500176
177
Sushil Singha313c972020-05-12 09:04:48 -0500178Redfish Update Firmware
179 [Documentation] Update the BMC firmware via redfish interface and verify the bmc version
180 ... and apply time.
181 [Arguments] ${apply_time}
182
183 # Description of argument(s):
184 # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate").
185
186 ${post_code_update_actions}= Get Post Boot Action
187 ${state}= Get Pre Reboot State
188 Rprint Vars state
189 Set ApplyTime policy=${apply_Time}
190 Redfish Upload Image And Check Progress State
191 Run Key ${post_code_update_actions['BMC image']['${apply_time}']}
192 Redfish.Login
193 Redfish Verify BMC Version ${IMAGE_FILE_PATH}
194 Verify Get ApplyTime ${apply_time}
195
196
Sushil Singha2bf3f32020-04-15 05:23:57 -0500197Discover BMC Pre And Post Firmware Update
198 [Documentation] Discover BMC, After code update.
Sushil Singha313c972020-05-12 09:04:48 -0500199 [Arguments] ${service_type1} ${service_type2} ${status}
Sushil Singha2bf3f32020-04-15 05:23:57 -0500200
201 # Description of argument(s):
Sushil Singh51be1342020-05-05 00:19:40 -0500202 # service_type BMC service type e.g.
203 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
Sushil Singha313c972020-05-12 09:04:48 -0500204 # status True or False
Sushil Singha2bf3f32020-04-15 05:23:57 -0500205
206 Valid File Path IMAGE_FILE_PATH
207 Verify Existence Of BMC Record From List ${service_type1}
208 Verify Existence Of BMC Record From List ${service_type2}
Sushil Singha313c972020-05-12 09:04:48 -0500209 Redfish Update Firmware apply_time=Immediate
Sushil Singhe46ba2d2020-05-07 07:39:34 -0500210 ${keyword_status}= Run Keyword And Return Status
211 ... Verify Existence Of BMC Record From List ${service_type1}
212 Should Be Equal '${status}' '${keyword_status}'
213 ${keyword_status}= Run Keyword And Return Status
214 ... Verify Existence Of BMC Record From List ${service_type2}
215 Should Be Equal '${status}' '${keyword_status}'
Sushil Singh51be1342020-05-05 00:19:40 -0500216
217
Sushil Singhe46ba2d2020-05-07 07:39:34 -0500218Discover BMC Pre And Post When Host Boot
Sushil Singha313c972020-05-12 09:04:48 -0500219 [Documentation] Discover BMC, when host boot in progress.
Sushil Singh51be1342020-05-05 00:19:40 -0500220 [Arguments] ${service_type1} ${service_type2}
221
222 # Description of argument(s):
223 # service_type BMC service type e.g.
224 # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
225
226 Verify Existence Of BMC Record From List ${service_type1}
227 Verify Existence Of BMC Record From List ${service_type2}
228 Redfish Power Off stack_mode=skip
229 Get Host Power State
230 Redfish Power Operation reset_type=On
231 Sleep 15s
232 Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD}
233 FOR ${index} IN RANGE 10
234 Sleep 3s
235 Verify Existence Of BMC Record From List ${service_type1}
236 Verify Existence Of BMC Record From List ${service_type2}
237 END
238 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted