blob: c2c0ddaed6f47e57e949ae7d5aa0be3c2cc288e4 [file] [log] [blame]
meghagn62945e22021-10-04 02:33:17 -05001*** Settings ***
2
3Documentation Test OpenBMC GUI "SNMP Alerts" sub-menu of "Settings".
4
Rahul Maheshwaric27708e2021-12-21 06:35:27 -06005Resource ../../../lib/snmp/redfish_snmp_utils.robot
Megha G Nb9ae25a2023-01-27 06:25:00 -06006Resource ../../../lib/snmp/resource.robot
7Resource ../../lib/gui_resource.robot
Megha G N2a31e512023-01-18 04:23:20 -06008Resource ../../lib/bmc_network_utils.robot
meghagn705c3642021-10-12 04:14:02 -05009
meghagn62945e22021-10-04 02:33:17 -050010Suite Setup Suite Setup Execution
11Suite Teardown Close Browser
12
13
14*** Variables ***
15
meghagn705c3642021-10-12 04:14:02 -050016${xpath_snmp_alerts_sub_menu} //*[@data-test-id='nav-item-snmp-alerts']
rramyasr-ine71ba072022-06-13 11:12:06 -050017${xpath_snmp_alerts_heading} //h1[text()="SNMP alerts"]
meghagn705c3642021-10-12 04:14:02 -050018${xpath_select_all_snmp} //*[@data-test-id='snmpAlerts-checkbox-selectAll']
19${xpath_add_destination} //button[contains(text(),'Add destination')]
20${xpath_snmp_alert_destination_heading} //h5[contains(text(),'Add SNMP alert destination')]
21${xpath_ip_address_input_button} //*[@data-test-id='snmpAlerts-input-ipAddress']
22${xpath_port_optional_input_button} //*[@data-test-id='snmpAlerts-input-port']
23${xpath_snmp_add_destination_button} //*[@data-test-id='snmpAlerts-button-ok']
24${xpath_cancel_button} //button[contains(text(),'Cancel')]
25${xpath_delete_button} //*[@data-test-id='snmpAlerts-button-deleteRow-undefined']
26${xpath_delete_destination} //button[contains(text(),'Delete destination')]
meghagn62945e22021-10-04 02:33:17 -050027
Megha GNc7bcf7c2022-08-04 05:30:58 -050028${snmp_page_heading} SNMP alerts
29${invalid_port_error} Value must be between 0 65535
30${invalid_destination_error} Error in adding SNMP alert destination
Megha G Nb9ae25a2023-01-27 06:25:00 -060031${invalid_ip_error} Field required
Megha G N2a31e512023-01-18 04:23:20 -060032${dns_server} 10.10.10.10
Megha GNc7bcf7c2022-08-04 05:30:58 -050033
meghagn62945e22021-10-04 02:33:17 -050034
35*** Test Cases ***
36
37Verify Navigation To SNMP Alerts Page
38 [Documentation] Verify navigation to SNMP alerts page.
39 [Tags] Verify_Navigation_To_SNMP_Alerts_Page
40
41 Page Should Contain Element ${xpath_snmp_alerts_heading}
42
43
44Verify Existence Of All Input Boxes In SNMP Alerts Page
45 [Documentation] Verify existence of all sections in SNMP alerts page.
46 [Tags] Verify_Existence_Of_All_Input_Boxes_In_SNMP_Alerts_Page
47
meghagn705c3642021-10-12 04:14:02 -050048 Page Should Contain Checkbox ${xpath_select_all_snmp}
meghagn62945e22021-10-04 02:33:17 -050049
50
51Verify Existence Of All Buttons In SNMP Alerts Page
52 [Documentation] Verify existence of all buttons in SNMP alerts page.
53 [Tags] Verify_Existence_Of_All_Buttons_In_SNMP_Alerts_Page
54
55 Page should Contain Button ${xpath_add_destination}
56
57
58Verify Existence Of All Fields In Add Destination
59 [Documentation] Verify existence of all buttons and fields in add destination page.
George Keishingd6a77972022-01-31 12:50:29 -060060 [Tags] Verify_Existence_Of_All_Fields_In_Add_Destination
meghagn705c3642021-10-12 04:14:02 -050061 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
62 ... Wait Until Keyword Succeeds 10 sec 5 sec
Megha GNc7bcf7c2022-08-04 05:30:58 -050063 ... Refresh GUI And Verify Element Value ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagn62945e22021-10-04 02:33:17 -050064
65 Click Element ${xpath_add_destination}
66 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
67 Page Should Contain Element ${xpath_ip_address_input_button}
68 Page Should Contain Element ${xpath_port_optional_input_button}
69 Page Should Contain Element ${xpath_cancel_button}
70 Page Should Contain Element ${xpath_snmp_add_destination_button}
71
72
George Keishingd6a77972022-01-31 12:50:29 -060073Configure SNMP Settings On BMC With Non Default Port Via GUI And Verify
meghagn705c3642021-10-12 04:14:02 -050074 [Documentation] Configure SNMP settings on BMC with non default port via GUI and verify.
75 [Tags] Configure_SNMP_Settings_On_BMC_With_Non_Default_Port_Via_GUI_And_Verify
meghagnfe16be92022-01-28 05:50:19 -060076 [Teardown] Delete SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
meghagn705c3642021-10-12 04:14:02 -050077
78 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
79
meghagna80e4d42021-12-14 05:46:15 -060080 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagn705c3642021-10-12 04:14:02 -050081
82 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N2b98bc02023-01-20 02:01:48 -060083
meghagn705c3642021-10-12 04:14:02 -050084
meghagnc2436bc2021-10-11 03:49:21 -050085Configure SNMP Settings On BMC Via GUI And Verify
86 [Documentation] Configure SNMP settings on BMC via GUI and verify.
87 [Tags] Configure_SNMP_Settings_On_BMC_Via_GUI_And_Verify
meghagnfe16be92022-01-28 05:50:19 -060088 [Teardown] Delete SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagnc2436bc2021-10-11 03:49:21 -050089
90 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
91
meghagna80e4d42021-12-14 05:46:15 -060092 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -050093
94 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
95
96
meghagnd3b19ac2021-10-22 01:09:25 -050097Configure SNMP Settings On BMC With Empty Port Via GUI And Verify
98 [Documentation] Configure SNMP settings on BMC with empty port via GUI and verify.
99 [Tags] Configure_SNMP_Settings_On_BMC_With_Empty_Port_Via_GUI_And_Verify
meghagnfe16be92022-01-28 05:50:19 -0600100 [Teardown] Delete SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagnd3b19ac2021-10-22 01:09:25 -0500101
102 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${empty_port}
103
meghagna80e4d42021-12-14 05:46:15 -0600104 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnd3b19ac2021-10-22 01:09:25 -0500105
106 # SNMP Manager IP is set with default port number when no port number is provided.
107 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
108
109
110Configure Invalid SNMP Settings On BMC Via GUI And Verify
111
112 [Documentation] Configure invalid SNMP settings on BMC via GUI and verify.
113 [Tags] Configure_Invalid_SNMP_Settings_On_BMC_Via_GUI_And_Verify
114 [Template] Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
115
116 # snmp_manager_ip snmp_manager_port Expected status
Megha GNc7bcf7c2022-08-04 05:30:58 -0500117 ${SNMP_MGR1_IP} ${out_of_range_port} ${invalid_port_error}
118 ${SNMP_MGR1_IP} ${alpha_port} ${invalid_port_error}
119 ${SNMP_MGR1_IP} ${negative_port} ${invalid_port_error}
Megha G N999964d2022-12-06 04:38:10 -0600120 ${SNMP_MGR1_IP} ${alphanumeric_port} ${invalid_port_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600121 ${empty_ip} ${NON_DEFAULT_PORT1} ${invalid_ip_error}
Megha GNc7bcf7c2022-08-04 05:30:58 -0500122 ${out_of_range_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
123 ${alpha_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N999964d2022-12-06 04:38:10 -0600124 ${negative_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N2b98bc02023-01-20 02:01:48 -0600125 ${less_octet_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500126
127
meghagn5a4ddb02021-11-09 01:49:23 -0600128Configure Multiple SNMP Managers On BMC Via GUI And Verify
129 [Documentation] Configure multiple SNMP managers on BMC via GUI and verify.
George Keishingd6a77972022-01-31 12:50:29 -0600130 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify
meghagn5a4ddb02021-11-09 01:49:23 -0600131 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
132
133 # snmp_manager_ip snmp_port
134 ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
135 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
136
137
138Configure Multiple SNMP Managers With Non Default Port Via GUI And Verify
139 [Documentation] Configure multiple SNMP managers with non-default port via GUI and verify.
140 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_Via_GUI_And_Verify
141 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
142
143 # snmp_manager_ip snmp_port
144 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
145 ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
146
147
148Configure Multiple SNMP Managers With Different Ports Via GUI And Verify
149 [Documentation] Configure multiple SNMP managers with different ports via GUI and verify.
150 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_Via_GUI_And_Verify
151 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
152
153 # snmp_manager_ip snmp_port
154 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
155 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
156 ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
157
158
meghagnfe16be92022-01-28 05:50:19 -0600159Configure Multiple SNMP Managers On BMC Via GUI And Verify Persistency On BMC Reboot
160 [Documentation] Login GUI SNMP alerts page and
161 ... add multiple SNMP Managers on BMC via GUI and verify persistency on BMC reboot.
162 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
163 [Teardown] Run Keywords Delete SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
164 ... AND Delete SNMP Manager Via GUI ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
165
166 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
167 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
168
169 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
170 Wait Until Page Contains ${SNMP_MGR2_IP} timeout=45s
171
172 # Reboot BMC and check persistency SNMP manager.
173 Reboot BMC via GUI
174
175 Suite Setup Execution
Megha GNc7bcf7c2022-08-04 05:30:58 -0500176 Wait Until Page Contains ${snmp_page_heading} timeout=1min
meghagnfe16be92022-01-28 05:50:19 -0600177
178 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
179 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
180
181
meghagn725ccdd2022-02-09 04:55:52 -0600182Configure SNMP Manager Via GUI And Verify SNMP Trap
183 [Documentation] Login GUI SNMP alerts page and add SNMP manager via GUI
184 ... and generate error on BMC and verify trap and its fields.
185 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap
186 [Template] Create Error On BMC And Verify Trap On Default Port
187 [Teardown] Delete SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
188
189 # event_log expected_error
190
191 # Generate internal failure error.
192 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
193
194 # Generate timeout error.
195 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
196
197 # Generate informational error.
198 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
199
200
George Keishing354091f2023-02-09 23:13:01 -0600201Configure SNMP Manager By Its Hostname Via GUI And Verify
Megha G N2a31e512023-01-18 04:23:20 -0600202 [Documentation] Login GUI SNMP alerts page and add SNMP manager with its hostname
203 ... via GUI and verify.
204 [Tags] Configure_SNMP_Manager_By_Its_Hostname_Via_GUI_And_Verify
205
206 Set DNS Server IP
207
208 # Navigate to SNMP page and configure SNMP manager.
209 Click Element ${xpath_snmp_alerts_sub_menu}
210 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
211
212 Configure SNMP Manager Via GUI ${SNMP_HOSTNAME} ${SNMP_DEFAULT_PORT}
213 Wait Until Page Contains ${HOSTNAME} timeout=15s
214
215
meghagn62945e22021-10-04 02:33:17 -0500216*** Keywords ***
217
218Suite Setup Execution
219 [Documentation] Do test case setup tasks.
220
221 Launch Browser And Login GUI
222
223 Click Element ${xpath_settings_menu}
224 Click Element ${xpath_snmp_alerts_sub_menu}
225 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600226 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
meghagn705c3642021-10-12 04:14:02 -0500227
228Configure SNMP Manager Via GUI
229 [Documentation] Configure SNMP manager via GUI.
230 [Arguments] ${snmp_ip} ${port}
231
232 # Description of argument(s):
233 # snmp_ip SNMP manager IP address.
234 # port SNMP manager port.
235
236 Click Element ${xpath_add_destination}
237 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
238 Input Text ${xpath_ip_address_input_button} ${snmp_ip}
239 Wait Until Keyword Succeeds 30 sec 5 sec Get Value ${xpath_ip_address_input_button}
240 Input Text ${xpath_port_optional_input_button} ${port}
241 Click Element ${xpath_snmp_add_destination_button}
242
243
244Delete SNMP Manager Via GUI
245 [Documentation] Delete SNMP manager via GUI.
meghagnfe16be92022-01-28 05:50:19 -0600246 [Arguments] ${snmp_mgr_ip} ${snmp_mgr_port}
meghagn705c3642021-10-12 04:14:02 -0500247
meghagnfe16be92022-01-28 05:50:19 -0600248 # Description of argument(s):
249 # snmp_mgr_ip SNMP manager IP address.
250 # snmp_mgr_port SNMP manager port.
251
252 Wait Until Page Contains ${snmp_mgr_ip} ${snmp_mgr_port}
meghagn705c3642021-10-12 04:14:02 -0500253 Click Element At Coordinates ${xpath_select_all_snmp} 0 0
254 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button}
255 Wait Until Page Contains Delete SNMP alert destination
256 Click Element ${xpath_delete_destination}
meghagna80e4d42021-12-14 05:46:15 -0600257 Wait Until Page Contains Successfully deleted SNMP alert destination timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -0500258 Wait Until Keyword Succeeds 30 sec 10 sec Refresh GUI And Verify Element Value
Megha GNc7bcf7c2022-08-04 05:30:58 -0500259 ... ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagnd3b19ac2021-10-22 01:09:25 -0500260
261
262Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
263
264 [Documentation] Configure SNMP manager on BMC with invalid setting via GUI and verify.
265 [Arguments] ${snmp_manager_ip} ${snmp_manager_port} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600266 [Teardown] Close Add SNMP Alerts Destination Window ${expected_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500267
268 # Description of argument(s):
269 # snmp_manager_ip SNMP manager IP address.
270 # snmp_manager_port SNMP manager port.
271 # expected_error Expected error optionally provided in testcase
272 # .... (e.g. Invalid format / Value must be between 0 – 65535).
273
274 Configure SNMP Manager Via GUI ${snmp_manager_ip} ${snmp_manager_port}
275 Wait Until Page Contains ${expected_error}
276 ${status}= Run Keyword And Return Status
277 ... Verify SNMP Manager Configured On BMC ${snmp_manager_ip} ${snmp_manager_port}
278 Should Be Equal As Strings ${status} False
279 ... msg=BMC is allowing to configure with invalid SNMP settings.
meghagn5a4ddb02021-11-09 01:49:23 -0600280
281
282Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
283 [Documentation] Configure multiple SNMP managers on BMC with valid port value via GUI and verify.
284 [Arguments] ${snmp_ip_value} ${snmp_port_value}
meghagnfe16be92022-01-28 05:50:19 -0600285 [Teardown] Delete SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value}
meghagn5a4ddb02021-11-09 01:49:23 -0600286
287 # Description of argument(s):
288 # snmp_ip_value SNMP manager IP address.
289 # snmp_port_value SNMP manager port.
290
291 Configure SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value}
292 Verify SNMP Manager Configured On BMC ${snmp_ip_value} ${snmp_port_value}
meghagn725ccdd2022-02-09 04:55:52 -0600293
294
295Create Error On BMC And Verify Trap On Default Port
296 [Documentation] Generate error on BMC and verify if trap is sent to default port.
297 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
298
299 # Description of argument(s):
300 # event_log Event logs to be created.
301 # expected_error Expected error on SNMP.
302
303 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
304
305 Start SNMP Manager
306
307 # Generate error log.
308 BMC Execute Command ${event_log}
309
310 SSHLibrary.Switch Connection snmp_server
311 ${SNMP_LISTEN_OUT}= Read delay=1s
312
313 # Stop SNMP manager process.
314 SSHLibrary.Execute Command sudo killall snmptrapd
315
316 # Sample SNMP trap:
317 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
318 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
319 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
320 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
321 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
322 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
323
324 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
325 ${trap_info}= Get From List ${lines} -1
326 ${snmp_trap}= Split String ${trap_info} \t
327
328 Verify SNMP Trap ${snmp_trap} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600329
330
331Close Add SNMP Alerts Destination Window
332 [Documentation] Close Add SNMP Alerts Destination window.
333 [Arguments] ${expected_error}=${invalid_port_error}
334
335 # Description of argument(s):
336 # expected_error Expected error on SNMP alerts page.
337
338 Run Keyword If '${expected_error}' == '${invalid_port_error}'
339 ... Click Element ${xpath_cancel_button}
340 ... ELSE IF '${expected_error}' == '${invalid_ip_error}'
341 ... Click Element ${xpath_cancel_button}
Megha G N2a31e512023-01-18 04:23:20 -0600342
343
344Set DNS Server IP
345 [Documentation] Add static DNS IP.
George Keishing354091f2023-02-09 23:13:01 -0600346
Megha G N2a31e512023-01-18 04:23:20 -0600347 Click Element ${xpath_network_sub_menu}
348 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
349
350 Add DNS Servers And Verify ${dns_server}