blob: e42b04c64c5ff8b96a45668087048d8d7ea6f962 [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
George Keishingff981cd2023-10-12 17:48:08 +053013Force Tags SNMP_Alerts_Sub_Menu
14
meghagn62945e22021-10-04 02:33:17 -050015*** Variables ***
16
meghagn705c3642021-10-12 04:14:02 -050017${xpath_snmp_alerts_sub_menu} //*[@data-test-id='nav-item-snmp-alerts']
rramyasr-ine71ba072022-06-13 11:12:06 -050018${xpath_snmp_alerts_heading} //h1[text()="SNMP alerts"]
meghagn705c3642021-10-12 04:14:02 -050019${xpath_select_all_snmp} //*[@data-test-id='snmpAlerts-checkbox-selectAll']
20${xpath_add_destination} //button[contains(text(),'Add destination')]
21${xpath_snmp_alert_destination_heading} //h5[contains(text(),'Add SNMP alert destination')]
22${xpath_ip_address_input_button} //*[@data-test-id='snmpAlerts-input-ipAddress']
23${xpath_port_optional_input_button} //*[@data-test-id='snmpAlerts-input-port']
24${xpath_snmp_add_destination_button} //*[@data-test-id='snmpAlerts-button-ok']
25${xpath_cancel_button} //button[contains(text(),'Cancel')]
26${xpath_delete_button} //*[@data-test-id='snmpAlerts-button-deleteRow-undefined']
27${xpath_delete_destination} //button[contains(text(),'Delete destination')]
meghagn62945e22021-10-04 02:33:17 -050028
Megha GNc7bcf7c2022-08-04 05:30:58 -050029${snmp_page_heading} SNMP alerts
30${invalid_port_error} Value must be between 0 65535
31${invalid_destination_error} Error in adding SNMP alert destination
Megha G Nb9ae25a2023-01-27 06:25:00 -060032${invalid_ip_error} Field required
Megha G N2a31e512023-01-18 04:23:20 -060033${dns_server} 10.10.10.10
Megha GNc7bcf7c2022-08-04 05:30:58 -050034
meghagn62945e22021-10-04 02:33:17 -050035
36*** Test Cases ***
37
38Verify Navigation To SNMP Alerts Page
39 [Documentation] Verify navigation to SNMP alerts page.
40 [Tags] Verify_Navigation_To_SNMP_Alerts_Page
41
42 Page Should Contain Element ${xpath_snmp_alerts_heading}
43
44
45Verify Existence Of All Input Boxes In SNMP Alerts Page
46 [Documentation] Verify existence of all sections in SNMP alerts page.
47 [Tags] Verify_Existence_Of_All_Input_Boxes_In_SNMP_Alerts_Page
48
meghagn705c3642021-10-12 04:14:02 -050049 Page Should Contain Checkbox ${xpath_select_all_snmp}
meghagn62945e22021-10-04 02:33:17 -050050
51
52Verify Existence Of All Buttons In SNMP Alerts Page
53 [Documentation] Verify existence of all buttons in SNMP alerts page.
54 [Tags] Verify_Existence_Of_All_Buttons_In_SNMP_Alerts_Page
55
56 Page should Contain Button ${xpath_add_destination}
57
58
59Verify Existence Of All Fields In Add Destination
60 [Documentation] Verify existence of all buttons and fields in add destination page.
George Keishingd6a77972022-01-31 12:50:29 -060061 [Tags] Verify_Existence_Of_All_Fields_In_Add_Destination
meghagn705c3642021-10-12 04:14:02 -050062 [Teardown] Run Keywords Click Button ${xpath_cancel_button} AND
63 ... Wait Until Keyword Succeeds 10 sec 5 sec
Megha GNc7bcf7c2022-08-04 05:30:58 -050064 ... Refresh GUI And Verify Element Value ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagn62945e22021-10-04 02:33:17 -050065
66 Click Element ${xpath_add_destination}
67 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
68 Page Should Contain Element ${xpath_ip_address_input_button}
69 Page Should Contain Element ${xpath_port_optional_input_button}
70 Page Should Contain Element ${xpath_cancel_button}
71 Page Should Contain Element ${xpath_snmp_add_destination_button}
72
73
George Keishingd6a77972022-01-31 12:50:29 -060074Configure SNMP Settings On BMC With Non Default Port Via GUI And Verify
meghagn705c3642021-10-12 04:14:02 -050075 [Documentation] Configure SNMP settings on BMC with non default port via GUI and verify.
76 [Tags] Configure_SNMP_Settings_On_BMC_With_Non_Default_Port_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -060077 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
meghagn705c3642021-10-12 04:14:02 -050078
79 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
80
meghagna80e4d42021-12-14 05:46:15 -060081 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagn705c3642021-10-12 04:14:02 -050082
83 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N2b98bc02023-01-20 02:01:48 -060084
meghagn705c3642021-10-12 04:14:02 -050085
meghagnc2436bc2021-10-11 03:49:21 -050086Configure SNMP Settings On BMC Via GUI And Verify
87 [Documentation] Configure SNMP settings on BMC via GUI and verify.
88 [Tags] Configure_SNMP_Settings_On_BMC_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -060089 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagnc2436bc2021-10-11 03:49:21 -050090
91 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
92
meghagna80e4d42021-12-14 05:46:15 -060093 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -050094
95 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
96
97
meghagnd3b19ac2021-10-22 01:09:25 -050098Configure SNMP Settings On BMC With Empty Port Via GUI And Verify
99 [Documentation] Configure SNMP settings on BMC with empty port via GUI and verify.
100 [Tags] Configure_SNMP_Settings_On_BMC_With_Empty_Port_Via_GUI_And_Verify
Megha G N8caf4a82023-02-22 01:01:03 -0600101 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${empty_port}
meghagnd3b19ac2021-10-22 01:09:25 -0500102
103 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${empty_port}
104
meghagna80e4d42021-12-14 05:46:15 -0600105 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
meghagnd3b19ac2021-10-22 01:09:25 -0500106
107 # SNMP Manager IP is set with default port number when no port number is provided.
108 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
109
110
111Configure Invalid SNMP Settings On BMC Via GUI And Verify
112
113 [Documentation] Configure invalid SNMP settings on BMC via GUI and verify.
114 [Tags] Configure_Invalid_SNMP_Settings_On_BMC_Via_GUI_And_Verify
115 [Template] Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
116
117 # snmp_manager_ip snmp_manager_port Expected status
Megha GNc7bcf7c2022-08-04 05:30:58 -0500118 ${SNMP_MGR1_IP} ${out_of_range_port} ${invalid_port_error}
119 ${SNMP_MGR1_IP} ${alpha_port} ${invalid_port_error}
120 ${SNMP_MGR1_IP} ${negative_port} ${invalid_port_error}
Megha G N999964d2022-12-06 04:38:10 -0600121 ${SNMP_MGR1_IP} ${alphanumeric_port} ${invalid_port_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600122 ${empty_ip} ${NON_DEFAULT_PORT1} ${invalid_ip_error}
Megha GNc7bcf7c2022-08-04 05:30:58 -0500123 ${out_of_range_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
124 ${alpha_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N999964d2022-12-06 04:38:10 -0600125 ${negative_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
Megha G N2b98bc02023-01-20 02:01:48 -0600126 ${less_octet_ip} ${NON_DEFAULT_PORT1} ${invalid_destination_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500127
128
meghagn5a4ddb02021-11-09 01:49:23 -0600129Configure Multiple SNMP Managers On BMC Via GUI And Verify
130 [Documentation] Configure multiple SNMP managers on BMC via GUI and verify.
George Keishingd6a77972022-01-31 12:50:29 -0600131 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify
meghagn5a4ddb02021-11-09 01:49:23 -0600132 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
133
134 # snmp_manager_ip snmp_port
135 ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
136 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
137
138
139Configure Multiple SNMP Managers With Non Default Port Via GUI And Verify
140 [Documentation] Configure multiple SNMP managers with non-default port via GUI and verify.
141 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_Via_GUI_And_Verify
142 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
143
144 # snmp_manager_ip snmp_port
145 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
146 ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
147
148
149Configure Multiple SNMP Managers With Different Ports Via GUI And Verify
150 [Documentation] Configure multiple SNMP managers with different ports via GUI and verify.
151 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_Via_GUI_And_Verify
152 [Template] Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
153
154 # snmp_manager_ip snmp_port
155 ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
156 ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
157 ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
158
159
meghagnfe16be92022-01-28 05:50:19 -0600160Configure Multiple SNMP Managers On BMC Via GUI And Verify Persistency On BMC Reboot
161 [Documentation] Login GUI SNMP alerts page and
162 ... add multiple SNMP Managers on BMC via GUI and verify persistency on BMC reboot.
163 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
Megha G Ncd990b32023-02-23 09:33:10 -0600164 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
Megha G N8caf4a82023-02-22 01:01:03 -0600165 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
meghagnfe16be92022-01-28 05:50:19 -0600166
Megha G Ncce57cc2023-02-15 23:40:15 -0600167 ${ip_address_list}= Create list ${SNMP_MGR1_IP} ${SNMP_MGR2_IP}
meghagnfe16be92022-01-28 05:50:19 -0600168 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
169 Wait Until Page Contains ${SNMP_MGR1_IP} timeout=45s
170
171 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
172 Wait Until Page Contains ${SNMP_MGR2_IP} timeout=45s
173
174 # Reboot BMC and check persistency SNMP manager.
175 Reboot BMC via GUI
176
Megha G Ncce57cc2023-02-15 23:40:15 -0600177 Navigate To SNMP Alerts Page
Megha G N8caf4a82023-02-22 01:01:03 -0600178
meghagnfe16be92022-01-28 05:50:19 -0600179 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
180 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
181
182
meghagn725ccdd2022-02-09 04:55:52 -0600183Configure SNMP Manager Via GUI And Verify SNMP Trap
184 [Documentation] Login GUI SNMP alerts page and add SNMP manager via GUI
185 ... and generate error on BMC and verify trap and its fields.
186 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap
187 [Template] Create Error On BMC And Verify Trap On Default Port
meghagn725ccdd2022-02-09 04:55:52 -0600188
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}
Megha G Ncce57cc2023-02-15 23:40:15 -0600213 Wait Until Page Contains ${SNMP_HOSTNAME} timeout=15s
214
215
216Verify Persistency Of SNMP Manager And Trap On BMC Reboot
217 [Documentation] Configure the SNMP manager and verify that it remains operational
218 ... after a BMC system reboot. Also, confirm that a trap is successfully sent.
219 [Tags] Verify_Persistency_Of_SNMP_Manager_And_Trap_On_BMC_Reboot
220 [Template] Create Error On BMC And Verify Trap On Default Port
Megha G Ncce57cc2023-02-15 23:40:15 -0600221
222 # event_log expected_error persistency_check
223
224 # Generate internal failure error.
225 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} ${True}
226
227 # Generate timeout error.
228 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} ${True}
229
230 # Generate informational error.
231 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} ${True}
Megha G N2a31e512023-01-18 04:23:20 -0600232
233
Megha G N789752a2023-03-02 05:45:47 -0600234Configure SNMP Manager Via GUI And Verify SNMP Trap On Non Default Port
235 [Documentation] Add SNMP manager via GUI SNMP alerts page, generate error on BMC
236 ... and verify trap on non default port.
237 [Tags] Configure_SNMP_Manager_Via_GUI_And_Verify_SNMP_Trap_On_Non_Default_Port
238 [Template] Generate Error Log On BMC And Verify Trap On Non Default Port
Megha G N789752a2023-03-02 05:45:47 -0600239
240 # event_log_cmd trap_msg
241
242 # Generate internal failure error.
243 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
244
245 # Generate timeout error.
246 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
247
248 # Generate informational error.
249 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
250
251
Megha G N74beeb02023-05-02 02:00:44 -0500252Configure Multiple SNMP Managers Via GUI And Verify SNMP Trap
253 [Documentation] Configure multiple SNMP Managers on BMC via GUI and check trap.
254 [Tags] Configure_Multiple_SNMP_Managers_Via_GUI_And_Verify_SNMP_Trap
255 [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
256 ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
257
258 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
259 Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
260
261 # Check if trap is generated and sent to SNMP managers those are configured.
262
263 Create Error Log On BMC And Verify Trap ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
264
265
meghagn62945e22021-10-04 02:33:17 -0500266*** Keywords ***
267
268Suite Setup Execution
269 [Documentation] Do test case setup tasks.
270
271 Launch Browser And Login GUI
272
273 Click Element ${xpath_settings_menu}
274 Click Element ${xpath_snmp_alerts_sub_menu}
275 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600276 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Rahul Maheshwari35182d82023-02-25 04:40:35 -0600277 Redfish.Login
278
meghagn705c3642021-10-12 04:14:02 -0500279
280Configure SNMP Manager Via GUI
281 [Documentation] Configure SNMP manager via GUI.
282 [Arguments] ${snmp_ip} ${port}
283
284 # Description of argument(s):
285 # snmp_ip SNMP manager IP address.
286 # port SNMP manager port.
287
288 Click Element ${xpath_add_destination}
289 Wait Until Page Contains Element ${xpath_snmp_alert_destination_heading}
290 Input Text ${xpath_ip_address_input_button} ${snmp_ip}
291 Wait Until Keyword Succeeds 30 sec 5 sec Get Value ${xpath_ip_address_input_button}
292 Input Text ${xpath_port_optional_input_button} ${port}
293 Click Element ${xpath_snmp_add_destination_button}
294
295
Megha G N8caf4a82023-02-22 01:01:03 -0600296Delete All SNMP Managers Via GUI
meghagn705c3642021-10-12 04:14:02 -0500297 [Documentation] Delete SNMP manager via GUI.
298
George Keishingfb1b6252023-03-01 10:10:52 -0600299 Wait Until Page Contains Element ${xpath_select_all_snmp} timeout=30s
meghagn705c3642021-10-12 04:14:02 -0500300 Click Element At Coordinates ${xpath_select_all_snmp} 0 0
301 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button}
302 Wait Until Page Contains Delete SNMP alert destination
303 Click Element ${xpath_delete_destination}
meghagna80e4d42021-12-14 05:46:15 -0600304 Wait Until Page Contains Successfully deleted SNMP alert destination timeout=45s
meghagnc2436bc2021-10-11 03:49:21 -0500305 Wait Until Keyword Succeeds 30 sec 10 sec Refresh GUI And Verify Element Value
Megha GNc7bcf7c2022-08-04 05:30:58 -0500306 ... ${xpath_snmp_alerts_heading} ${snmp_page_heading}
meghagnd3b19ac2021-10-22 01:09:25 -0500307
308
309Configure SNMP Manager On BMC With Invalid Setting Via GUI And Verify
310
311 [Documentation] Configure SNMP manager on BMC with invalid setting via GUI and verify.
312 [Arguments] ${snmp_manager_ip} ${snmp_manager_port} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600313 [Teardown] Close Add SNMP Alerts Destination Window ${expected_error}
meghagnd3b19ac2021-10-22 01:09:25 -0500314
315 # Description of argument(s):
316 # snmp_manager_ip SNMP manager IP address.
317 # snmp_manager_port SNMP manager port.
318 # expected_error Expected error optionally provided in testcase
319 # .... (e.g. Invalid format / Value must be between 0 – 65535).
320
321 Configure SNMP Manager Via GUI ${snmp_manager_ip} ${snmp_manager_port}
Megha G N97c35d52023-03-08 03:55:57 -0600322 Wait Until Page Contains ${expected_error} timeout=60sec
meghagnd3b19ac2021-10-22 01:09:25 -0500323 ${status}= Run Keyword And Return Status
324 ... Verify SNMP Manager Configured On BMC ${snmp_manager_ip} ${snmp_manager_port}
325 Should Be Equal As Strings ${status} False
326 ... msg=BMC is allowing to configure with invalid SNMP settings.
meghagn5a4ddb02021-11-09 01:49:23 -0600327
328
329Configure Multiple SNMP Managers On BMC With Valid Port Via GUI And Verify
330 [Documentation] Configure multiple SNMP managers on BMC with valid port value via GUI and verify.
331 [Arguments] ${snmp_ip_value} ${snmp_port_value}
Megha G N8caf4a82023-02-22 01:01:03 -0600332 [Teardown] Delete SNMP Manager Via Redfish ${snmp_ip_value} ${snmp_port_value}
meghagn5a4ddb02021-11-09 01:49:23 -0600333
334 # Description of argument(s):
335 # snmp_ip_value SNMP manager IP address.
336 # snmp_port_value SNMP manager port.
337
338 Configure SNMP Manager Via GUI ${snmp_ip_value} ${snmp_port_value}
339 Verify SNMP Manager Configured On BMC ${snmp_ip_value} ${snmp_port_value}
meghagn725ccdd2022-02-09 04:55:52 -0600340
341
342Create Error On BMC And Verify Trap On Default Port
343 [Documentation] Generate error on BMC and verify if trap is sent to default port.
344 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
Megha G Ncce57cc2023-02-15 23:40:15 -0600345 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500346 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
meghagn725ccdd2022-02-09 04:55:52 -0600347
348 # Description of argument(s):
Megha G Ncce57cc2023-02-15 23:40:15 -0600349 # event_log Event logs to be created.
350 # expected_error Expected error on SNMP.
351 # persistency_check Check whether reboot is required or not (e.g. True, False).
meghagn725ccdd2022-02-09 04:55:52 -0600352
353 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
354
Megha G Na5a2e2f2023-04-20 04:01:13 -0500355 IF ${persistency_check} == ${True}
356 Reboot BMC via GUI
357 Navigate To SNMP Alerts Page
358 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
359 END
Megha G Ncce57cc2023-02-15 23:40:15 -0600360
meghagn725ccdd2022-02-09 04:55:52 -0600361 Start SNMP Manager
362
363 # Generate error log.
364 BMC Execute Command ${event_log}
365
366 SSHLibrary.Switch Connection snmp_server
367 ${SNMP_LISTEN_OUT}= Read delay=1s
368
369 # Stop SNMP manager process.
370 SSHLibrary.Execute Command sudo killall snmptrapd
371
372 # Sample SNMP trap:
373 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
374 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
375 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
376 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
377 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
378 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
379
380 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
381 ${trap_info}= Get From List ${lines} -1
382 ${snmp_trap}= Split String ${trap_info} \t
383
384 Verify SNMP Trap ${snmp_trap} ${expected_error}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600385
386
387Close Add SNMP Alerts Destination Window
388 [Documentation] Close Add SNMP Alerts Destination window.
389 [Arguments] ${expected_error}=${invalid_port_error}
390
391 # Description of argument(s):
392 # expected_error Expected error on SNMP alerts page.
393
394 Run Keyword If '${expected_error}' == '${invalid_port_error}'
395 ... Click Element ${xpath_cancel_button}
396 ... ELSE IF '${expected_error}' == '${invalid_ip_error}'
397 ... Click Element ${xpath_cancel_button}
Megha G N2a31e512023-01-18 04:23:20 -0600398
399
400Set DNS Server IP
401 [Documentation] Add static DNS IP.
George Keishing354091f2023-02-09 23:13:01 -0600402
Megha G N8caf4a82023-02-22 01:01:03 -0600403 Wait Until Page Contains Element ${xpath_settings_menu} timeout=30s
404 Click Element ${xpath_settings_menu}
Megha G N2a31e512023-01-18 04:23:20 -0600405 Click Element ${xpath_network_sub_menu}
406 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain network
407
408 Add DNS Servers And Verify ${dns_server}
Megha G Ncce57cc2023-02-15 23:40:15 -0600409
410
411Delete Multiple SNMP Managers With Default Port Via GUI
412 [Documentation] Delete multiple SNMP managers with default port on BMC via GUI.
413 [Arguments] ${ip_address_list}
414
415 # Description of argument(s):
416 # ${ip_address_list} List of IP address.
417
418 FOR ${ip_address} IN @{ip_address_list}
419 Wait Until Keyword Succeeds 30 sec 10 sec
420 ... Delete SNMP Manager Via GUI ${ip_address} ${SNMP_DEFAULT_PORT}
421 END
422
423
424Navigate To SNMP Alerts Page
425 [Documentation] Navigate to SNMP alerts page.
426
427 Click Element ${xpath_settings_menu}
428 Click Element ${xpath_snmp_alerts_sub_menu}
429 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain snmp-alerts
Megha G N789752a2023-03-02 05:45:47 -0600430
431
432Generate Error Log On BMC And Verify Trap On Non Default Port
433 [Documentation] Generate error log on BMC and verify if trap is sent to non default port.
434 [Arguments] ${event_log_cmd} ${trap_msg}
435 ... ${persistency_check}=${False}
Megha G N1ea505e2023-03-16 05:24:10 -0500436 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600437
438 # Description of argument(s):
439 # event_log_cmd Event logs to be created.
440 # trap_msg Expected trap on SNMP.
441
Megha G N97c35d52023-03-08 03:55:57 -0600442 Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600443
444 IF ${persistency_check} == ${True}
445 Reboot BMC via GUI
446 Navigate To SNMP Alerts Page
Megha G Na5a2e2f2023-04-20 04:01:13 -0500447 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
Megha G N789752a2023-03-02 05:45:47 -0600448 END
449
Megha G Na5a2e2f2023-04-20 04:01:13 -0500450 Start SNMP Manager On Specific Port ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
Megha G N789752a2023-03-02 05:45:47 -0600451
452 # Generate error log.
453 BMC Execute Command ${event_log_cmd}
454
455 SSHLibrary.Switch Connection snmp_server
456 ${SNMP_LISTEN_OUT}= Read delay=1s
457
458 # Stop SNMP manager process.
459 SSHLibrary.Execute Command sudo killall snmptrapd
460
461 # Reference URL for SNMP MIB.
462 # https://github.com/openbmc/phosphor-snmp/blob/master/mibs/NotificationMIB.txt
463
464 # Sample SNMP trap:
465 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
466 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
467 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
468 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369 SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
469 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
470 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
471
472 ${snmp_info_list}= Split To Lines ${SNMP_LISTEN_OUT}
473 ${trap_info}= Get From List ${snmp_info_list} -1
474 ${snmp_trap}= Split String ${trap_info} \t
475
476 Verify SNMP Trap ${snmp_trap} ${trap_msg}
Megha G N74beeb02023-05-02 02:00:44 -0500477
478
479Create Error Log On BMC And Verify Trap
480 [Documentation] Generate error on BMC
481 ... and check whether the trap is sent to all those are configured.
482 [Arguments] ${event_log_cmd} ${trap_msg}
483
484 # Description of argument(s):
485 # event_log_cmd Command to generate error log.
486 # trap_msg Expected trap on SNMP.
487
488 Start Multiple SNMP Managers On Specific Port
489
490 # Generate error log.
491 BMC Execute Command ${event_log_cmd}
492
493 ${alias}= Create List snmp_server1 snmp_server2
494
495 FOR ${snmp_server} IN @{alias}
496 SSHLibrary.Switch Connection ${snmp_server}
497
498 ${SNMP_LISTEN_OUT}= Read delay=1s
499
500 # Stop SNMP manager process.
501 SSHLibrary.Execute Command sudo killall snmptrapd
502
503 # Sample SNMP trap:
504 # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
505 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
506 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
507 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369
508 # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
509 # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
510 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
511
512 ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
513 ${trap_info}= Get From List ${lines} -1
514 ${snmp_trap}= Split String ${trap_info} \t
515
516 Verify SNMP Trap ${snmp_trap} ${trap_msg}
517 END
518
519
520Start Multiple SNMP Managers On Specific Port
521 [Documentation] Start multiple SNMP managers on specific port.
522
523 Open Connection And Log In ${SNMP_MGR1_USERNAME} ${SNMP_MGR1_PASSWORD}
524 ... alias=snmp_server1 host=${SNMP_MGR1_IP}
525
526 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR1_IP}:${SNMP_DEFAULT_PORT} &
527
528 Open Connection And Log In ${SNMP_MGR2_USERNAME} ${SNMP_MGR2_PASSWORD}
529 ... alias=snmp_server2 host=${SNMP_MGR2_IP}
530
531 # The execution of the SNMP_TRAPD_CMD is necessary to cause SNMP to begin
532 # listening to SNMP messages.
533 SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR2_IP}:${NON_DEFAULT_PORT1} &