blob: 96cddc7c5f3402628da0d7f2ff6dc2298deee083 [file] [log] [blame]
Prashanth Katti391000c2021-06-11 04:09:21 -05001*** Settings ***
2Documentation This testing requires special setup where SNMP trapd is
3... configured and installed. For download, installation and
4... configuration refer http://www.net-snmp.org/.
5
6
George Keishing269e52e2021-06-25 12:27:39 -05007Resource ../../lib/snmp/resource.robot
8Resource ../../lib/snmp/redfish_snmp_utils.robot
9Resource ../../lib/bmc_redfish_resource.robot
10Resource ../../lib/openbmc_ffdc.robot
11Resource ../../lib/logging_utils.robot
Prashanth Katti391000c2021-06-11 04:09:21 -050012
13
George Keishing81302e42022-07-20 11:24:26 -050014Test Teardown FFDC On Test Case Fail
15Suite Setup Suite Setup Execution
16Suite Teardown Suite Teardown Execution
Prashanth Katti391000c2021-06-11 04:09:21 -050017
Prashanth Katti391000c2021-06-11 04:09:21 -050018
19*** Test Cases ***
20
21Configure SNMP Manager On BMC And Verify
22 [Documentation] Configure SNMP manager on BMC via Redfish and verify.
23 [Tags] Configure_SNMP_Manager_On_BMC_And_Verify
Prashanth Kattidd99a912021-06-14 09:12:02 -050024 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
Prashanth Katti391000c2021-06-11 04:09:21 -050025
26 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} ${HTTP_CREATED}
27
28 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
29
30
George Keishing5236ec52022-01-31 12:07:58 -060031Configure SNMP Manager On BMC With Non Default Port And Verify
Prashanth Kattic744f042021-06-16 07:46:04 -050032 [Documentation] Configure SNMP Manager On BMC And Verify.
33 [Tags] Configure_SNMP_Manager_On_BMC_With_Non_Default_Port_And_Verify
34 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
35
36 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} ${HTTP_CREATED}
37
38 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
39
40
41Configure SNMP Manager On BMC With Out Of Range Port And Verify
42 [Documentation] Configure SNMP Manager On BMC with out-of range port and verify.
43 [Tags] Configure_SNMP_Manager_On_BMC_With_Out_Of_Range_Port_And_Verify
44 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${out_of_range_port}
45
46 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${out_of_range_port} ${HTTP_BAD_REQUEST}
47
48 ${status}= Run Keyword And Return Status
49 ... Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${out_of_range_port}
50
51 Should Be Equal As Strings ${status} False
52 ... msg=BMC is allowing to configure out of range port.
53
54
55Generate Error On BMC And Verify SNMP Trap
56 [Documentation] Generate error on BMC and verify trap and its fields.
57 [Tags] Generate_Error_On_BMC_And_Verify_SNMP_Trap
58 [Template] Create Error On BMC And Verify Trap
59
60 # event_log expected_error
61
62 # Generate internal failure error.
63 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
64
65 # Generate timeout error.
66 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
67
68 # Generate informational error.
69 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
70
71
Prashanth Kattib1a9c6b2021-06-18 01:36:14 -050072Configure SNMP Manager On BMC With Alpha Port And Verify
73 [Documentation] Configure SNMP Manager On BMC with alpha port and verify.
74 [Tags] Configure_SNMP_Manager_On_BMC_With_Alpha_Port_And_Verify
75 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${alpha_port}
76
77 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${alpha_port} ${HTTP_BAD_REQUEST}
78
79 ${status}= Run Keyword And Return Status
80 ... Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${alpha_port}
81
82 Should Be Equal As Strings ${status} False
83 ... msg=BMC is allowing to configure invalid port.
84
85
86Configure SNMP Manager On BMC With Empty Port And Verify
87 [Documentation] Configure SNMP Manager On BMC with empty port and verify
88 ... SNMP manager gets configured with default port.
89 [Tags] Configure_SNMP_Manager_On_BMC_With_Empty_Port_And_Verify
90 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
91
92 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${empty_port}
93
94 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
95
96
97Configure Multiple SNMP Managers And Verify
98 [Documentation] Configure multiple SNMP managers and verify.
99 [Tags] Configure_Multiple_SNMP_Managers_And_Verify
100 [Teardown] Run Keywords
101 ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
102 ... AND
103 ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
104
105 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
106 Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
107 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
108 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
109
110
George Keishinga2e8b0d2022-07-20 05:52:51 -0500111Generate Error On BMC And Verify SNMP Trap Is Sent To Non Default Port
Prashanth Kattib1a9c6b2021-06-18 01:36:14 -0500112 [Documentation] Generate error on BMC and verify trap and its fields.
George Keishinga2e8b0d2022-07-20 05:52:51 -0500113 [Tags] Generate_Error_On_BMC_And_Verify_SNMP_Trap_Is_Sent_To_Non_Default_Port
114 [Template] Create Error On BMC And Verify Trap On Non Default Port
Prashanth Kattib1a9c6b2021-06-18 01:36:14 -0500115
116 # event_log expected_error
117
118 # Generate internal failure error.
119 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
120
121 # Generate timeout error.
122 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
123
124 # Generate informational error.
125 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
126
127
Prashanth Katti7f319262021-06-21 09:10:04 -0500128Verify SNMP SysUpTime
129 [Documentation] Verify SNMP SysUpTime.
130 [Tags] Verify_SNMP_SysUpTime
131
132 Generate Error And Verify System Up Time
133
134
135Verify SNMP SysUpTime On BMC Reboot
136 [Documentation] Verify SNMP SysUpTime on BMC reboot.
137 [Tags] Verify_SNMP_SysUpTime_On_BMC_Reboot
138
139 # Reboot BMC to reset system uptime.
140 OBMC Reboot (off)
141
142 ${uptime}= Generate Error And Verify System Up Time
143
144 # Check if uptime is reset after reboot.
145 Should Be True ${uptime} <= 1 msg=SNMP SysUpTime is not reset on reboot
146
147
George Keishing5236ec52022-01-31 12:07:58 -0600148Configure Multiple SNMP Managers With Non Default Port And Verify
Prashanth Katti7f319262021-06-21 09:10:04 -0500149 [Documentation] Configure multiple SNMP Managers with non-default port And Verify.
150 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_And_Verify
151 [Teardown] Run Keywords
152 ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
153 ... AND
154 ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
155
156 # Configure multiple SNMP managers with non-default port.
157 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
158 Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
159
160 # Verify if SNMP managers are configured.
161 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
162 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
163
164
165Configure Multiple SNMP Managers With Different Ports And Verify
166 [Documentation] Configure multiple SNMP Managers with different ports And Verify.
167 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_And_Verify
168 [Teardown] Run Keywords
169 ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
170 ... AND
171 ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
172 ... AND
173 ... Delete SNMP Manager Via Redfish ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
174
George Keishing269e52e2021-06-25 12:27:39 -0500175 # Configure multiple SNMP managers with different ports.
Prashanth Katti7f319262021-06-21 09:10:04 -0500176 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
177 Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
178 Configure SNMP Manager Via Redfish ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
179
180 # Verify if SNMP managers are configured.
181 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
182 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
183 Verify SNMP Manager Configured On BMC ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
184
185
Prashanth Katti6ea399b2021-07-20 06:59:34 -0500186Configure SNMP Manager With Out Of Range IP On BMC And Verify
187 [Documentation] Configure SNMP Manager On BMC with out-of range IP and expect an error.
188 [Tags] Configure_SNMP_Manager_With_Out_Of_Range_IP_On_BMC_And_Verify
189 [Teardown] Delete SNMP Manager Via Redfish ${out_of_range_ip} ${SNMP_DEFAULT_PORT}
190
191 Configure SNMP Manager Via Redfish ${out_of_range_ip} ${SNMP_DEFAULT_PORT} ${HTTP_BAD_REQUEST}
192
193 ${status}= Run Keyword And Return Status
194 ... Verify SNMP Manager Configured On BMC ${out_of_range_ip} ${SNMP_DEFAULT_PORT}
195
196 Should Be Equal As Strings ${status} False
197 ... msg=BMC is allowing to configure out of range IP.
198
199
200Verify Persistency Of SNMP Manager And Trap On BMC Reboot
201 [Documentation] Verify persistency of SNMP manager configuration on BMC
202 ... and BMC is able to send trap after reboot.
203 [Tags] Verify_Persistency_Of_SNMP_Manager_And_Trap_On_BMC_Reboot
204 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
205
206 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} ${HTTP_CREATED}
207
208 # Reboot BMC and check persistency SNMP manager.
209 OBMC Reboot (off)
210
211 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
212
213 # Check if trap is generated and sent to SNMP manager after reboot.
214 Generate Error On BMC And Verify Trap
215 ... ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
216
217
Prashanth Katti2320c0d2021-10-12 07:31:27 -0500218Configure SNMP Manager With Less Octet IP And Verify
219 [Documentation] Configure SNMP manager on BMC with less octet IP and expect an error.
220 [Tags] Configure_SNMP_Manager_With_Less_Octet_IP_And_Verify
221 [Teardown] Delete SNMP Manager Via Redfish ${less_octet_ip} ${SNMP_DEFAULT_PORT}
222
223 Configure SNMP Manager Via Redfish ${less_octet_ip} ${SNMP_DEFAULT_PORT} ${HTTP_BAD_REQUEST}
224
225 ${status}= Run Keyword And Return Status
226 ... Verify SNMP Manager Configured On BMC ${less_octet_ip} ${SNMP_DEFAULT_PORT}
227
228 Should Be Equal As Strings ${status} False
229 ... msg=BMC is allowing to configure less octet IP.
230
231
232Configure SNMP Manager On BMC With Negative Port And Verify
233 [Documentation] Configure SNMP Manager On BMC with negative port and verify.
234 [Tags] Configure_SNMP_Manager_On_BMC_With_Negative_Port_And_Verify
235
236 [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${negative_port}
237
238 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${negative_port} ${HTTP_BAD_REQUEST}
239
240 ${status}= Run Keyword And Return Status
241 ... Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${negative_port}
242
243 Should Be Equal As Strings ${status} False
244 ... msg=BMC is allowing to configure negative port.
245
246
meghagnad102532021-10-25 05:40:15 -0500247Configure Multiple SNMP Managers On BMC And Verify Persistency On BMC Reboot
248 [Documentation] Configure multiple SNMP Managers on BMC and verify persistency on BMC reboot.
249 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_And_Verify_Persistency_On_BMC_Reboot
250 [Teardown] Run Keywords
251 ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
252 ... AND
253 ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
254
255 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
256 Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
257
258 # Reboot BMC and check persistency SNMP manager.
259 OBMC Reboot (off)
260
261 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
262 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
263
264
265Configure Multiple SNMP Managers On BMC And Check Trap On BMC Reboot
266 [Documentation] Configure multiple SNMP Managers on BMC and check trap on BMC reboot.
267 [Tags] Configure_Multiple_SNMP_Managers_On_BMC_And_Check_Trap_On_BMC_Reboot
268 [Teardown] Run Keywords
269 ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
270 ... AND
271 ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
272
273 Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
274 Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
275
276 # Reboot BMC and check persistency SNMP manager.
277 OBMC Reboot (off)
278
279 Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
280 Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
281
282 # Check if trap is generated and sent to SNMP managers after reboot.
283 Generate Error On BMC And Verify Trap
284 ... ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
285
286
Prashanth Katti391000c2021-06-11 04:09:21 -0500287*** Keywords ***
288
289Suite Setup Execution
290 [Documentation] Do suite setup execution.
291
292 Redfish.Login
293
294 # Check for SNMP configurations.
295 Valid Value SNMP_MGR1_IP
296 Valid Value SNMP_DEFAULT_PORT
Prashanth Katti7f319262021-06-21 09:10:04 -0500297
298
George Keishing81302e42022-07-20 11:24:26 -0500299Suite Teardown Execution
300 [Documentation] Do suite Teardown execution.
301
302 Run Keyword And Ignore Error Redfish Purge Event Log
303 Run Keyword And Ignore Error Redfish Delete All BMC Dumps
304
305
Prashanth Katti7f319262021-06-21 09:10:04 -0500306Generate Error And Verify System Up Time
307 [Documentation] Generate error and verify system up time.
308
309 # Get system uptime on BMC.
310 # Example output of uptime:
311 # (8055.79 15032.86)
312
313 ${cmd_output} ${stderr} ${rc}= BMC Execute Command cat /proc/uptime
314 @{times}= Split String ${cmd_output}
315
316 ${bmc_uptime_in_minutes}= Evaluate int(${times}[0])/60
317
318 ${trap}= Create Error On BMC And Verify Trap
319
320 # Extract System up time from SNMP trap.
321 # Example - SNMP trap:
322 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (252367) 0:42:03.67
323 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
324 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 54
325 # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: 4622921648578756984
326 # SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
327 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING:
328
329 @{words}= Split String ${trap}[0] =
330
331 ${timeticks}= Fetch From Right ${words}[1] (
332 ${snmp_sysuptime}= Fetch From Left ${timeticks} )
333
334 # SNMP SysUptime will be in milli seconds.
335 # Convert into minutes.
336 ${sysuptime_in_minutes}= Evaluate int(${snmp_sysuptime})/6000
337
338 Should Be Equal As Integers ${bmc_uptime_in_minutes} ${sysuptime_in_minutes}
339
340 [Return] ${sysuptime_in_minutes}