blob: 8cfd25618540c199f8cee71e48e23602de2b17db [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
meghagn62945e22021-10-04 02:33:17 -0500250*** Keywords ***
251
252Suite Setup Execution
253 [Documentation] Do test case setup tasks.
254
255 Launch Browser And Login GUI
256
257 Click Element ${xpath_settings_menu}
258 Click Element ${xpath_snmp_alerts_sub_menu}
259 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600260 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Rahul Maheshwari35182d82023-02-25 04:40:35 -0600261 Redfish.Login
262
meghagn705c3642021-10-12 04:14:02 -0500263
264Configure SNMP Manager Via GUI
265 [Documentation] Configure SNMP manager via GUI.
266 [Arguments] ${snmp_ip} ${port}
267
268 # Description of argument(s):
269 # snmp_ip SNMP manager IP address.
270 # port SNMP manager port.
271
272 Click Element ${xpath_add_destination}
273 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
274 Input Text ${xpath_ip_address_input_button} ${snmp_ip}
275 Wait Until Keyword Succeeds 30 sec 5 sec Get Value ${xpath_ip_address_input_button}
276 Input Text ${xpath_port_optional_input_button} ${port}
277 Click Element ${xpath_snmp_add_destination_button}
278
279
Megha G N8caf4a82023-02-22 01:01:03 -0600280Delete All SNMP Managers Via GUI
meghagn705c3642021-10-12 04:14:02 -0500281 [Documentation] Delete SNMP manager via GUI.
282
George Keishingfb1b6252023-03-01 10:10:52 -0600283 Wait Until Page Contains Element ${xpath_select_all_snmp} timeout=30s
meghagn705c3642021-10-12 04:14:02 -0500284 Click Element At Coordinates ${xpath_select_all_snmp} 0 0
285 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button}
286 Wait Until Page Contains Delete SNMP alert destination
287 Click Element ${xpath_delete_destination}
meghagna80e4d42021-12-14 05:46:15 -0600288 Wait Until Page Contains Successfully deleted SNMP alert destination timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -0500289 Wait Until Keyword Succeeds 30 sec 10 sec Refresh GUI And Verify Element Value
Megha GNc7bcf7c2022-08-04 05:30:58 -0500290 ... ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagnd3b19ac2021-10-22 01:09:25 -0500291
292
293Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
294
295 [Documentation] Configure SNMP manager on BMC with invalid setting via GUI and verify.
296 [Arguments] ${snmp_manager_ip} ${snmp_manager_port} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600297 [Teardown] Close Add SNMP Alerts Destination Window ${expected_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500298
299 # Description of argument(s):
300 # snmp_manager_ip SNMP manager IP address.
301 # snmp_manager_port SNMP manager port.
302 # expected_error Expected error optionally provided in testcase
303 # .... (e.g. Invalid format / Value must be between 0 – 65535).
304
305 Configure SNMP Manager Via GUI ${snmp_manager_ip} ${snmp_manager_port}
Megha G N97c35d52023-03-08 03:55:57 -0600306 Wait Until Page Contains ${expected_error} timeout=60sec
meghagnd3b19ac2021-10-22 01:09:25 -0500307 ${status}= Run Keyword And Return Status
308 ... Verify SNMP Manager Configured On BMC ${snmp_manager_ip} ${snmp_manager_port}
309 Should Be Equal As Strings ${status} False
310 ... msg=BMC is allowing to configure with invalid SNMP settings.
meghagn5a4ddb02021-11-09 01:49:23 -0600311
312
313Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
314 [Documentation] Configure multiple SNMP managers on BMC with valid port value via GUI and verify.
315 [Arguments] ${snmp_ip_value} ${snmp_port_value}
Megha G N8caf4a82023-02-22 01:01:03 -0600316 [Teardown] Delete SNMP Manager Via Redfish ${snmp_ip_value} ${snmp_port_value}
meghagn5a4ddb02021-11-09 01:49:23 -0600317
318 # Description of argument(s):
319 # snmp_ip_value SNMP manager IP address.
320 # snmp_port_value SNMP manager port.
321
322 Configure SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value}
323 Verify SNMP Manager Configured On BMC ${snmp_ip_value} ${snmp_port_value}
meghagn725ccdd2022-02-09 04:55:52 -0600324
325
326Create Error On BMC And Verify Trap On Default Port
327 [Documentation] Generate error on BMC and verify if trap is sent to default port.
328 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
Megha G Ncce57cc2023-02-15 23:40:15 -0600329 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500330 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagn725ccdd2022-02-09 04:55:52 -0600331
332 # Description of argument(s):
Megha G Ncce57cc2023-02-15 23:40:15 -0600333 # event_log Event logs to be created.
334 # expected_error Expected error on SNMP.
335 # persistency_check Check whether reboot is required or not (e.g. True, False).
meghagn725ccdd2022-02-09 04:55:52 -0600336
337 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
338
Megha G Na5a2e2f2023-04-20 04:01:13 -0500339 IF ${persistency_check} == ${True}
340 Reboot BMC via GUI
341 Navigate To SNMP Alerts Page
342 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
343 END
Megha G Ncce57cc2023-02-15 23:40:15 -0600344
meghagn725ccdd2022-02-09 04:55:52 -0600345 Start SNMP Manager
346
347 # Generate error log.
348 BMC Execute Command ${event_log}
349
350 SSHLibrary.Switch Connection snmp_server
351 ${SNMP_LISTEN_OUT}= Read delay=1s
352
353 # Stop SNMP manager process.
354 SSHLibrary.Execute Command sudo killall snmptrapd
355
356 # Sample SNMP trap:
357 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
358 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
359 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
360 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
361 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
362 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
363
364 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
365 ${trap_info}= Get From List ${lines} -1
366 ${snmp_trap}= Split String ${trap_info} \t
367
368 Verify SNMP Trap ${snmp_trap} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600369
370
371Close Add SNMP Alerts Destination Window
372 [Documentation] Close Add SNMP Alerts Destination window.
373 [Arguments] ${expected_error}=${invalid_port_error}
374
375 # Description of argument(s):
376 # expected_error Expected error on SNMP alerts page.
377
378 Run Keyword If '${expected_error}' == '${invalid_port_error}'
379 ... Click Element ${xpath_cancel_button}
380 ... ELSE IF '${expected_error}' == '${invalid_ip_error}'
381 ... Click Element ${xpath_cancel_button}
Megha G N2a31e512023-01-18 04:23:20 -0600382
383
384Set DNS Server IP
385 [Documentation] Add static DNS IP.
George Keishing354091f2023-02-09 23:13:01 -0600386
Megha G N8caf4a82023-02-22 01:01:03 -0600387 Wait Until Page Contains Element ${xpath_settings_menu} timeout=30s
388 Click Element ${xpath_settings_menu}
Megha G N2a31e512023-01-18 04:23:20 -0600389 Click Element ${xpath_network_sub_menu}
390 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
391
392 Add DNS Servers And Verify ${dns_server}
Megha G Ncce57cc2023-02-15 23:40:15 -0600393
394
395Delete Multiple SNMP Managers With Default Port Via GUI
396 [Documentation] Delete multiple SNMP managers with default port on BMC via GUI.
397 [Arguments] ${ip_address_list}
398
399 # Description of argument(s):
400 # ${ip_address_list} List of IP address.
401
402 FOR ${ip_address} IN @{ip_address_list}
403 Wait Until Keyword Succeeds 30 sec 10 sec
404 ... Delete SNMP Manager Via GUI ${ip_address} ${SNMP_DEFAULT_PORT}
405 END
406
407
408Navigate To SNMP Alerts Page
409 [Documentation] Navigate to SNMP alerts page.
410
411 Click Element ${xpath_settings_menu}
412 Click Element ${xpath_snmp_alerts_sub_menu}
413 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
Megha G N789752a2023-03-02 05:45:47 -0600414
415
416Generate Error Log On BMC And Verify Trap On Non Default Port
417 [Documentation] Generate error log on BMC and verify if trap is sent to non default port.
418 [Arguments] ${event_log_cmd} ${trap_msg}
419 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500420 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600421
422 # Description of argument(s):
423 # event_log_cmd Event logs to be created.
424 # trap_msg Expected trap on SNMP.
425
Megha G N97c35d52023-03-08 03:55:57 -0600426 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600427
428 IF ${persistency_check} == ${True}
429 Reboot BMC via GUI
430 Navigate To SNMP Alerts Page
Megha G Na5a2e2f2023-04-20 04:01:13 -0500431 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
Megha G N789752a2023-03-02 05:45:47 -0600432 END
433
Megha G Na5a2e2f2023-04-20 04:01:13 -0500434 Start SNMP Manager On Specific Port ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600435
436 # Generate error log.
437 BMC Execute Command ${event_log_cmd}
438
439 SSHLibrary.Switch Connection snmp_server
440 ${SNMP_LISTEN_OUT}= Read delay=1s
441
442 # Stop SNMP manager process.
443 SSHLibrary.Execute Command sudo killall snmptrapd
444
445 # Reference URL for SNMP MIB.
446 # https://github.com/openbmc/phosphor-snmp/blob/master/mibs/NotificationMIB.txt
447
448 # Sample SNMP trap:
449 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
450 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
451 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
452 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
453 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
454 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
455
456 ${snmp_info_list}= Split To Lines ${SNMP_LISTEN_OUT}
457 ${trap_info}= Get From List ${snmp_info_list} -1
458 ${snmp_trap}= Split String ${trap_info} \t
459
460 Verify SNMP Trap ${snmp_trap} ${trap_msg}