blob: c2aab2b51f7f0c52022817867aa659578ffdf5ca [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
Rahul Maheshwari35182d82023-02-25 04:40:35 -060011Suite Teardown Run Keywords Redfish.Logout AND Close Browser
meghagn62945e22021-10-04 02:33:17 -050012
13*** Variables ***
14
meghagn705c3642021-10-12 04:14:02 -050015${xpath_snmp_alerts_sub_menu} //*[@data-test-id='nav-item-snmp-alerts']
rramyasr-ine71ba072022-06-13 11:12:06 -050016${xpath_snmp_alerts_heading} //h1[text()="SNMP alerts"]
meghagn705c3642021-10-12 04:14:02 -050017${xpath_select_all_snmp} //*[@data-test-id='snmpAlerts-checkbox-selectAll']
18${xpath_add_destination} //button[contains(text(),'Add destination')]
19${xpath_snmp_alert_destination_heading} //h5[contains(text(),'Add SNMP alert destination')]
20${xpath_ip_address_input_button} //*[@data-test-id='snmpAlerts-input-ipAddress']
21${xpath_port_optional_input_button} //*[@data-test-id='snmpAlerts-input-port']
22${xpath_snmp_add_destination_button} //*[@data-test-id='snmpAlerts-button-ok']
23${xpath_cancel_button} //button[contains(text(),'Cancel')]
24${xpath_delete_button} //*[@data-test-id='snmpAlerts-button-deleteRow-undefined']
25${xpath_delete_destination} //button[contains(text(),'Delete destination')]
meghagn62945e22021-10-04 02:33:17 -050026
Megha GNc7bcf7c2022-08-04 05:30:58 -050027${snmp_page_heading} SNMP alerts
28${invalid_port_error} Value must be between 0 65535
29${invalid_destination_error} Error in adding SNMP alert destination
Megha G Nb9ae25a2023-01-27 06:25:00 -060030${invalid_ip_error} Field required
Megha G N2a31e512023-01-18 04:23:20 -060031${dns_server} 10.10.10.10
Megha GNc7bcf7c2022-08-04 05:30:58 -050032
meghagn62945e22021-10-04 02:33:17 -050033
34*** Test Cases ***
35
36Verify Navigation To SNMP Alerts Page
37 [Documentation] Verify navigation to SNMP alerts page.
38 [Tags] Verify_Navigation_To_SNMP_Alerts_Page
39
40 Page Should Contain Element ${xpath_snmp_alerts_heading}
41
42
43Verify Existence Of All Input Boxes In SNMP Alerts Page
44 [Documentation] Verify existence of all sections in SNMP alerts page.
45 [Tags] Verify_Existence_Of_All_Input_Boxes_In_SNMP_Alerts_Page
46
meghagn705c3642021-10-12 04:14:02 -050047 Page Should Contain Checkbox ${xpath_select_all_snmp}
meghagn62945e22021-10-04 02:33:17 -050048
49
50Verify Existence Of All Buttons In SNMP Alerts Page
51 [Documentation] Verify existence of all buttons in SNMP alerts page.
52 [Tags] Verify_Existence_Of_All_Buttons_In_SNMP_Alerts_Page
53
54 Page should Contain Button ${xpath_add_destination}
55
56
57Verify Existence Of All Fields In Add Destination
58 [Documentation] Verify existence of all buttons and fields in add destination page.
George Keishingd6a77972022-01-31 12:50:29 -060059 [Tags] Verify_Existence_Of_All_Fields_In_Add_Destination
meghagn705c3642021-10-12 04:14:02 -050060 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
61 ... Wait Until Keyword Succeeds 10 sec 5 sec
Megha GNc7bcf7c2022-08-04 05:30:58 -050062 ... Refresh GUI And Verify Element Value ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagn62945e22021-10-04 02:33:17 -050063
64 Click Element ${xpath_add_destination}
65 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
66 Page Should Contain Element ${xpath_ip_address_input_button}
67 Page Should Contain Element ${xpath_port_optional_input_button}
68 Page Should Contain Element ${xpath_cancel_button}
69 Page Should Contain Element ${xpath_snmp_add_destination_button}
70
71
George Keishingd6a77972022-01-31 12:50:29 -060072Configure SNMP Settings On BMC With Non Default Port Via GUI And Verify
meghagn705c3642021-10-12 04:14:02 -050073 [Documentation] Configure SNMP settings on BMC with non default port via GUI and verify.
74 [Tags] Configure_SNMP_Settings_On_BMC_With_Non_Default_Port_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -060075 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
meghagn705c3642021-10-12 04:14:02 -050076
77 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
78
meghagna80e4d42021-12-14 05:46:15 -060079 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagn705c3642021-10-12 04:14:02 -050080
81 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N2b98bc02023-01-20 02:01:48 -060082
meghagn705c3642021-10-12 04:14:02 -050083
meghagnc2436bc2021-10-11 03:49:21 -050084Configure SNMP Settings On BMC Via GUI And Verify
85 [Documentation] Configure SNMP settings on BMC via GUI and verify.
86 [Tags] Configure_SNMP_Settings_On_BMC_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -060087 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagnc2436bc2021-10-11 03:49:21 -050088
89 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
90
meghagna80e4d42021-12-14 05:46:15 -060091 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -050092
93 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
94
95
meghagnd3b19ac2021-10-22 01:09:25 -050096Configure SNMP Settings On BMC With Empty Port Via GUI And Verify
97 [Documentation] Configure SNMP settings on BMC with empty port via GUI and verify.
98 [Tags] Configure_SNMP_Settings_On_BMC_With_Empty_Port_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -060099 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${empty_port}
meghagnd3b19ac2021-10-22 01:09:25 -0500100
101 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${empty_port}
102
meghagna80e4d42021-12-14 05:46:15 -0600103 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnd3b19ac2021-10-22 01:09:25 -0500104
105 # SNMP Manager IP is set with default port number when no port number is provided.
106 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
107
108
109Configure Invalid SNMP Settings On BMC Via GUI And Verify
110
111 [Documentation] Configure invalid SNMP settings on BMC via GUI and verify.
112 [Tags] Configure_Invalid_SNMP_Settings_On_BMC_Via_GUI_And_Verify
113 [Template] Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
114
115 # snmp_manager_ip snmp_manager_port Expected status
Megha GNc7bcf7c2022-08-04 05:30:58 -0500116 ${SNMP_MGR1_IP} ${out_of_range_port} ${invalid_port_error}
117 ${SNMP_MGR1_IP} ${alpha_port} ${invalid_port_error}
118 ${SNMP_MGR1_IP} ${negative_port} ${invalid_port_error}
Megha G N999964d2022-12-06 04:38:10 -0600119 ${SNMP_MGR1_IP} ${alphanumeric_port} ${invalid_port_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600120 ${empty_ip} ${NON_DEFAULT_PORT1} ${invalid_ip_error}
Megha GNc7bcf7c2022-08-04 05:30:58 -0500121 ${out_of_range_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
122 ${alpha_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N999964d2022-12-06 04:38:10 -0600123 ${negative_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N2b98bc02023-01-20 02:01:48 -0600124 ${less_octet_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500125
126
meghagn5a4ddb02021-11-09 01:49:23 -0600127Configure Multiple SNMP Managers On BMC Via GUI And Verify
128 [Documentation] Configure multiple SNMP managers on BMC via GUI and verify.
George Keishingd6a77972022-01-31 12:50:29 -0600129 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify
meghagn5a4ddb02021-11-09 01:49:23 -0600130 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
131
132 # snmp_manager_ip snmp_port
133 ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
134 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
135
136
137Configure Multiple SNMP Managers With Non Default Port Via GUI And Verify
138 [Documentation] Configure multiple SNMP managers with non-default port via GUI and verify.
139 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_Via_GUI_And_Verify
140 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
141
142 # snmp_manager_ip snmp_port
143 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
144 ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
145
146
147Configure Multiple SNMP Managers With Different Ports Via GUI And Verify
148 [Documentation] Configure multiple SNMP managers with different ports via GUI and verify.
149 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_Via_GUI_And_Verify
150 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
151
152 # snmp_manager_ip snmp_port
153 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
154 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
155 ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
156
157
meghagnfe16be92022-01-28 05:50:19 -0600158Configure Multiple SNMP Managers On BMC Via GUI And Verify Persistency On BMC Reboot
159 [Documentation] Login GUI SNMP alerts page and
160 ... add multiple SNMP Managers on BMC via GUI and verify persistency on BMC reboot.
161 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
Megha G Ncd990b32023-02-23 09:33:10 -0600162 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
Megha G N8caf4a82023-02-22 01:01:03 -0600163 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
meghagnfe16be92022-01-28 05:50:19 -0600164
Megha G Ncce57cc2023-02-15 23:40:15 -0600165 ${ip_address_list}= Create list ${SNMP_MGR1_IP} ${SNMP_MGR2_IP}
meghagnfe16be92022-01-28 05:50:19 -0600166 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
Megha G Ncce57cc2023-02-15 23:40:15 -0600175 Navigate To SNMP Alerts Page
Megha G N8caf4a82023-02-22 01:01:03 -0600176
meghagnfe16be92022-01-28 05:50:19 -0600177 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
178 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
179
180
meghagn725ccdd2022-02-09 04:55:52 -0600181Configure SNMP Manager Via GUI And Verify SNMP Trap
182 [Documentation] Login GUI SNMP alerts page and add SNMP manager via GUI
183 ... and generate error on BMC and verify trap and its fields.
184 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap
185 [Template] Create Error On BMC And Verify Trap On Default Port
meghagn725ccdd2022-02-09 04:55:52 -0600186
187 # event_log expected_error
188
189 # Generate internal failure error.
190 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
191
192 # Generate timeout error.
193 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
194
195 # Generate informational error.
196 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
197
198
George Keishing354091f2023-02-09 23:13:01 -0600199Configure SNMP Manager By Its Hostname Via GUI And Verify
Megha G N2a31e512023-01-18 04:23:20 -0600200 [Documentation] Login GUI SNMP alerts page and add SNMP manager with its hostname
201 ... via GUI and verify.
202 [Tags] Configure_SNMP_Manager_By_Its_Hostname_Via_GUI_And_Verify
203
204 Set DNS Server IP
205
206 # Navigate to SNMP page and configure SNMP manager.
207 Click Element ${xpath_snmp_alerts_sub_menu}
208 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
209
210 Configure SNMP Manager Via GUI ${SNMP_HOSTNAME} ${SNMP_DEFAULT_PORT}
Megha G Ncce57cc2023-02-15 23:40:15 -0600211 Wait Until Page Contains ${SNMP_HOSTNAME} timeout=15s
212
213
214Verify Persistency Of SNMP Manager And Trap On BMC Reboot
215 [Documentation] Configure the SNMP manager and verify that it remains operational
216 ... after a BMC system reboot. Also, confirm that a trap is successfully sent.
217 [Tags] Verify_Persistency_Of_SNMP_Manager_And_Trap_On_BMC_Reboot
218 [Template] Create Error On BMC And Verify Trap On Default Port
Megha G Ncce57cc2023-02-15 23:40:15 -0600219
220 # event_log expected_error persistency_check
221
222 # Generate internal failure error.
223 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} ${True}
224
225 # Generate timeout error.
226 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} ${True}
227
228 # Generate informational error.
229 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} ${True}
Megha G N2a31e512023-01-18 04:23:20 -0600230
231
Megha G N789752a2023-03-02 05:45:47 -0600232Configure SNMP Manager Via GUI And Verify SNMP Trap On Non Default Port
233 [Documentation] Add SNMP manager via GUI SNMP alerts page, generate error on BMC
234 ... and verify trap on non default port.
235 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap_On_Non_Default_Port
236 [Template] Generate Error Log On BMC And Verify Trap On Non Default Port
Megha G N789752a2023-03-02 05:45:47 -0600237
238 # event_log_cmd trap_msg
239
240 # Generate internal failure error.
241 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
242
243 # Generate timeout error.
244 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
245
246 # Generate informational error.
247 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
248
249
Megha G N74beeb02023-05-02 02:00:44 -0500250Configure Multiple SNMP Managers Via GUI And Verify SNMP Trap
251 [Documentation] Configure multiple SNMP Managers on BMC via GUI and check trap.
252 [Tags] Configure_Multiple_SNMP_Managers_Via_GUI_And_Verify_SNMP_Trap
253 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
254 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
255
256 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
257 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
258
259 # Check if trap is generated and sent to SNMP managers those are configured.
260
261 Create Error Log On BMC And Verify Trap ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
262
263
meghagn62945e22021-10-04 02:33:17 -0500264*** Keywords ***
265
266Suite Setup Execution
267 [Documentation] Do test case setup tasks.
268
269 Launch Browser And Login GUI
270
271 Click Element ${xpath_settings_menu}
272 Click Element ${xpath_snmp_alerts_sub_menu}
273 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600274 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Rahul Maheshwari35182d82023-02-25 04:40:35 -0600275 Redfish.Login
276
meghagn705c3642021-10-12 04:14:02 -0500277
278Configure SNMP Manager Via GUI
279 [Documentation] Configure SNMP manager via GUI.
280 [Arguments] ${snmp_ip} ${port}
281
282 # Description of argument(s):
283 # snmp_ip SNMP manager IP address.
284 # port SNMP manager port.
285
286 Click Element ${xpath_add_destination}
287 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
288 Input Text ${xpath_ip_address_input_button} ${snmp_ip}
289 Wait Until Keyword Succeeds 30 sec 5 sec Get Value ${xpath_ip_address_input_button}
290 Input Text ${xpath_port_optional_input_button} ${port}
291 Click Element ${xpath_snmp_add_destination_button}
292
293
Megha G N8caf4a82023-02-22 01:01:03 -0600294Delete All SNMP Managers Via GUI
meghagn705c3642021-10-12 04:14:02 -0500295 [Documentation] Delete SNMP manager via GUI.
296
George Keishingfb1b6252023-03-01 10:10:52 -0600297 Wait Until Page Contains Element ${xpath_select_all_snmp} timeout=30s
meghagn705c3642021-10-12 04:14:02 -0500298 Click Element At Coordinates ${xpath_select_all_snmp} 0 0
299 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button}
300 Wait Until Page Contains Delete SNMP alert destination
301 Click Element ${xpath_delete_destination}
meghagna80e4d42021-12-14 05:46:15 -0600302 Wait Until Page Contains Successfully deleted SNMP alert destination timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -0500303 Wait Until Keyword Succeeds 30 sec 10 sec Refresh GUI And Verify Element Value
Megha GNc7bcf7c2022-08-04 05:30:58 -0500304 ... ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagnd3b19ac2021-10-22 01:09:25 -0500305
306
307Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
308
309 [Documentation] Configure SNMP manager on BMC with invalid setting via GUI and verify.
310 [Arguments] ${snmp_manager_ip} ${snmp_manager_port} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600311 [Teardown] Close Add SNMP Alerts Destination Window ${expected_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500312
313 # Description of argument(s):
314 # snmp_manager_ip SNMP manager IP address.
315 # snmp_manager_port SNMP manager port.
316 # expected_error Expected error optionally provided in testcase
317 # .... (e.g. Invalid format / Value must be between 0 – 65535).
318
319 Configure SNMP Manager Via GUI ${snmp_manager_ip} ${snmp_manager_port}
Megha G N97c35d52023-03-08 03:55:57 -0600320 Wait Until Page Contains ${expected_error} timeout=60sec
meghagnd3b19ac2021-10-22 01:09:25 -0500321 ${status}= Run Keyword And Return Status
322 ... Verify SNMP Manager Configured On BMC ${snmp_manager_ip} ${snmp_manager_port}
323 Should Be Equal As Strings ${status} False
324 ... msg=BMC is allowing to configure with invalid SNMP settings.
meghagn5a4ddb02021-11-09 01:49:23 -0600325
326
327Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
328 [Documentation] Configure multiple SNMP managers on BMC with valid port value via GUI and verify.
329 [Arguments] ${snmp_ip_value} ${snmp_port_value}
Megha G N8caf4a82023-02-22 01:01:03 -0600330 [Teardown] Delete SNMP Manager Via Redfish ${snmp_ip_value} ${snmp_port_value}
meghagn5a4ddb02021-11-09 01:49:23 -0600331
332 # Description of argument(s):
333 # snmp_ip_value SNMP manager IP address.
334 # snmp_port_value SNMP manager port.
335
336 Configure SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value}
337 Verify SNMP Manager Configured On BMC ${snmp_ip_value} ${snmp_port_value}
meghagn725ccdd2022-02-09 04:55:52 -0600338
339
340Create Error On BMC And Verify Trap On Default Port
341 [Documentation] Generate error on BMC and verify if trap is sent to default port.
342 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
Megha G Ncce57cc2023-02-15 23:40:15 -0600343 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500344 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagn725ccdd2022-02-09 04:55:52 -0600345
346 # Description of argument(s):
Megha G Ncce57cc2023-02-15 23:40:15 -0600347 # event_log Event logs to be created.
348 # expected_error Expected error on SNMP.
349 # persistency_check Check whether reboot is required or not (e.g. True, False).
meghagn725ccdd2022-02-09 04:55:52 -0600350
351 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
352
Megha G Na5a2e2f2023-04-20 04:01:13 -0500353 IF ${persistency_check} == ${True}
354 Reboot BMC via GUI
355 Navigate To SNMP Alerts Page
356 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
357 END
Megha G Ncce57cc2023-02-15 23:40:15 -0600358
meghagn725ccdd2022-02-09 04:55:52 -0600359 Start SNMP Manager
360
361 # Generate error log.
362 BMC Execute Command ${event_log}
363
364 SSHLibrary.Switch Connection snmp_server
365 ${SNMP_LISTEN_OUT}= Read delay=1s
366
367 # Stop SNMP manager process.
368 SSHLibrary.Execute Command sudo killall snmptrapd
369
370 # Sample SNMP trap:
371 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
372 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
373 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
374 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
375 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
376 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
377
378 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
379 ${trap_info}= Get From List ${lines} -1
380 ${snmp_trap}= Split String ${trap_info} \t
381
382 Verify SNMP Trap ${snmp_trap} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600383
384
385Close Add SNMP Alerts Destination Window
386 [Documentation] Close Add SNMP Alerts Destination window.
387 [Arguments] ${expected_error}=${invalid_port_error}
388
389 # Description of argument(s):
390 # expected_error Expected error on SNMP alerts page.
391
392 Run Keyword If '${expected_error}' == '${invalid_port_error}'
393 ... Click Element ${xpath_cancel_button}
394 ... ELSE IF '${expected_error}' == '${invalid_ip_error}'
395 ... Click Element ${xpath_cancel_button}
Megha G N2a31e512023-01-18 04:23:20 -0600396
397
398Set DNS Server IP
399 [Documentation] Add static DNS IP.
George Keishing354091f2023-02-09 23:13:01 -0600400
Megha G N8caf4a82023-02-22 01:01:03 -0600401 Wait Until Page Contains Element ${xpath_settings_menu} timeout=30s
402 Click Element ${xpath_settings_menu}
Megha G N2a31e512023-01-18 04:23:20 -0600403 Click Element ${xpath_network_sub_menu}
404 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
405
406 Add DNS Servers And Verify ${dns_server}
Megha G Ncce57cc2023-02-15 23:40:15 -0600407
408
409Delete Multiple SNMP Managers With Default Port Via GUI
410 [Documentation] Delete multiple SNMP managers with default port on BMC via GUI.
411 [Arguments] ${ip_address_list}
412
413 # Description of argument(s):
414 # ${ip_address_list} List of IP address.
415
416 FOR ${ip_address} IN @{ip_address_list}
417 Wait Until Keyword Succeeds 30 sec 10 sec
418 ... Delete SNMP Manager Via GUI ${ip_address} ${SNMP_DEFAULT_PORT}
419 END
420
421
422Navigate To SNMP Alerts Page
423 [Documentation] Navigate to SNMP alerts page.
424
425 Click Element ${xpath_settings_menu}
426 Click Element ${xpath_snmp_alerts_sub_menu}
427 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
Megha G N789752a2023-03-02 05:45:47 -0600428
429
430Generate Error Log On BMC And Verify Trap On Non Default Port
431 [Documentation] Generate error log on BMC and verify if trap is sent to non default port.
432 [Arguments] ${event_log_cmd} ${trap_msg}
433 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500434 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600435
436 # Description of argument(s):
437 # event_log_cmd Event logs to be created.
438 # trap_msg Expected trap on SNMP.
439
Megha G N97c35d52023-03-08 03:55:57 -0600440 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600441
442 IF ${persistency_check} == ${True}
443 Reboot BMC via GUI
444 Navigate To SNMP Alerts Page
Megha G Na5a2e2f2023-04-20 04:01:13 -0500445 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
Megha G N789752a2023-03-02 05:45:47 -0600446 END
447
Megha G Na5a2e2f2023-04-20 04:01:13 -0500448 Start SNMP Manager On Specific Port ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600449
450 # Generate error log.
451 BMC Execute Command ${event_log_cmd}
452
453 SSHLibrary.Switch Connection snmp_server
454 ${SNMP_LISTEN_OUT}= Read delay=1s
455
456 # Stop SNMP manager process.
457 SSHLibrary.Execute Command sudo killall snmptrapd
458
459 # Reference URL for SNMP MIB.
460 # https://github.com/openbmc/phosphor-snmp/blob/master/mibs/NotificationMIB.txt
461
462 # Sample SNMP trap:
463 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
464 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
465 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
466 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
467 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
468 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
469
470 ${snmp_info_list}= Split To Lines ${SNMP_LISTEN_OUT}
471 ${trap_info}= Get From List ${snmp_info_list} -1
472 ${snmp_trap}= Split String ${trap_info} \t
473
474 Verify SNMP Trap ${snmp_trap} ${trap_msg}
Megha G N74beeb02023-05-02 02:00:44 -0500475
476
477Create Error Log On BMC And Verify Trap
478 [Documentation] Generate error on BMC
479 ... and check whether the trap is sent to all those are configured.
480 [Arguments] ${event_log_cmd} ${trap_msg}
481
482 # Description of argument(s):
483 # event_log_cmd Command to generate error log.
484 # trap_msg Expected trap on SNMP.
485
486 Start Multiple SNMP Managers On Specific Port
487
488 # Generate error log.
489 BMC Execute Command ${event_log_cmd}
490
491 ${alias}= Create List snmp_server1 snmp_server2
492
493 FOR ${snmp_server} IN @{alias}
494 SSHLibrary.Switch Connection ${snmp_server}
495
496 ${SNMP_LISTEN_OUT}= Read delay=1s
497
498 # Stop SNMP manager process.
499 SSHLibrary.Execute Command sudo killall snmptrapd
500
501 # Sample SNMP trap:
502 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
503 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
504 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
505 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369
506 # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
507 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
508 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
509
510 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
511 ${trap_info}= Get From List ${lines} -1
512 ${snmp_trap}= Split String ${trap_info} \t
513
514 Verify SNMP Trap ${snmp_trap} ${trap_msg}
515 END
516
517
518Start Multiple SNMP Managers On Specific Port
519 [Documentation] Start multiple SNMP managers on specific port.
520
521 Open Connection And Log In ${SNMP_MGR1_USERNAME} ${SNMP_MGR1_PASSWORD}
522 ... alias=snmp_server1 host=${SNMP_MGR1_IP}
523
524 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR1_IP}:${SNMP_DEFAULT_PORT} &
525
526 Open Connection And Log In ${SNMP_MGR2_USERNAME} ${SNMP_MGR2_PASSWORD}
527 ... alias=snmp_server2 host=${SNMP_MGR2_IP}
528
529 # The execution of the SNMP_TRAPD_CMD is necessary to cause SNMP to begin
530 # listening to SNMP messages.
531 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR2_IP}:${NON_DEFAULT_PORT1} &