blob: a6ba5c5454790b0c4a6946fc1210b3dc7b1d677b [file] [log] [blame]
Prashanth Katti081b3d92018-06-15 05:13:11 -05001*** Settings ***
Naman Navin Hegdebf181332019-06-26 02:08:18 -05002Documentation This testing requires special setup where SNMP trapd is
Prashanth Katti081b3d92018-06-15 05:13:11 -05003... configured and installed. For download, installation and
4... configuration refer http://www.net-snmp.org/.
5
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06006Resource ../lib/snmp/resource.robot
Prashanth Katti081b3d92018-06-15 05:13:11 -05007Resource ../lib/snmp/snmp_utils.robot
Prashanth Katti7dae0e82019-01-09 01:35:42 -06008Resource ../lib/openbmc_ffdc.robot
Naman Navin Hegdebf181332019-06-26 02:08:18 -05009Resource ../lib/logging_utils.robot
Prashanth Katti081b3d92018-06-15 05:13:11 -050010
11Library String
12Library SSHLibrary
13
Prashanth Katti7dae0e82019-01-09 01:35:42 -060014Test Teardown FFDC On Test Case Fail
15
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -060016*** Variables ***
17
18${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
19... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
20... xyz.openbmc_project.Logging.Entry.Level.Error 0
21
22${CMD_FRU_CALLOUT} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
23... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.Timeout
24... xyz.openbmc_project.Logging.Entry.Level.Error 2 "TIMEOUT_IN_MSEC" "5"
25... "CALLOUT_INVENTORY_PATH" "/xyz/openbmc_project/inventory/system/chassis/motherboard"
26
27${CMD_INFORMATIONAL_ERROR} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
28... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.TestError2
29... xyz.openbmc_project.Logging.Entry.Level.Informational 0
30
31${CMD_DEBUG_TRABALL_ERROR}= /tmp/tarball/bin/logging-test -c AutoTestSimple
32${SNMP_TRAP_BMC_INTERNAL_FAILURE} xyz.openbmc_project.Common.Error.InternalFailure
33${SNMP_TRAP_BMC_CALLOUT_ERROR} xyz.openbmc_project.Common.Error.Timeout
34${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} xyz.openbmc_project.Common.Error.TestError2
35
Prashanth Katti081b3d92018-06-15 05:13:11 -050036*** Test Cases ***
37Configure SNMP Manager On BMC And Verify
38 [Documentation] Configure SNMP Manager On BMC And Verify.
39 [Tags] Configure_SNMP_Manager_On_BMC_And_Verify
40
41 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid
42 Verify SNMP Manager ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
43
44 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
45
George Keishingb98036a2022-01-31 12:39:47 -060046Configure SNMP Manager On BMC With Non Default Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050047 [Documentation] Configure SNMP Manager On BMC And Verify.
48 [Tags] Configure_SNMP_Manager_On_BMC_With_Non_Default_Port_And_Verify
49
50 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} Valid
51 Verify SNMP Manager ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
52
53 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
54
55Configure SNMP Manager On BMC With Out Of Range Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050056 [Documentation] Configure SNMP Manager On BMC with out-of range port and verify.
57 [Tags] Configure_SNMP_Manager_On_BMC_With_Out_Of_Range_Port_And_Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050058 [Template] Configure SNMP Manager On BMC
59
George Keishing5abfe602018-07-05 11:54:37 -050060 # SNMP manager IP Port Scenario
61 ${SNMP_MGR1_IP} ${out_of_range_port} error
62
Prashanth Katti081b3d92018-06-15 05:13:11 -050063Configure SNMP Manager On BMC With Alpha Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050064 [Documentation] Configure SNMP Manager On BMC with alpha port and verify.
65 [Tags] Configure_SNMP_Manager_On_BMC_With_Alpha_Port_And_Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050066 [Template] Configure SNMP Manager On BMC
67
George Keishing5abfe602018-07-05 11:54:37 -050068 # SNMP manager IP Port Scenario
69 ${SNMP_MGR1_IP} ${alpha_port} error
70
Prashanth Katti081b3d92018-06-15 05:13:11 -050071Configure SNMP Manager On BMC With Negative Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050072 [Documentation] Configure SNMP Manager On BMC with negative port and verify.
73 [Tags] Configure_SNMP_Manager_On_BMC_With_Negative_Port_And_Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050074 [Template] Configure SNMP Manager On BMC
75
George Keishing5abfe602018-07-05 11:54:37 -050076 # SNMP manager IP Port Scenario
77 ${SNMP_MGR1_IP} ${negative_port} error
78
Prashanth Katti081b3d92018-06-15 05:13:11 -050079Configure SNMP Manager On BMC With Empty Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050080 [Documentation] Configure SNMP Manager On BMC with empty port and verify.
81 [Tags] Configure_SNMP_Manager_On_BMC_With_Empty_Port_And_Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050082 [Template] Configure SNMP Manager On BMC
83
George Keishing5abfe602018-07-05 11:54:37 -050084 # SNMP manager IP Port Scenario
85 ${SNMP_MGR1_IP} ${empty_port} error
86
Prashanth Katti081b3d92018-06-15 05:13:11 -050087Configure SNMP Manager On BMC With Out Of Range IP And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050088 [Documentation] Configure SNMP Manager On BMC with out-of range IP and verify.
89 [Tags] Configure_SNMP_Manager_On_BMC_With_Out_Of_Range_IP_And_Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -050090 [Template] Configure SNMP Manager On BMC
91
George Keishing5abfe602018-07-05 11:54:37 -050092 # SNMP manager IP Port Scenario
93 ${out_of_range_ip} ${SNMP_DEFAULT_PORT} error
94
Prashanth Katti081b3d92018-06-15 05:13:11 -050095Configure Multiple SNMP Managers And Verify
96 [Documentation] Configure multiple SNMP Managers And Verify.
97 [Tags] Configure_Multiple_SNMP_Managers_And_Verify
98
99 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid
100 Configure SNMP Manager On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} Valid
101 Verify SNMP Manager ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
102 Verify SNMP Manager ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
103
104 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
105 Delete SNMP Manager And Object ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT}
106
George Keishingb98036a2022-01-31 12:39:47 -0600107Configure Multiple SNMP Managers With Non Default Port And Verify
Prashanth Katti081b3d92018-06-15 05:13:11 -0500108 [Documentation] Configure multiple SNMP Managers with non-default port And Verify.
109 [Tags] Configure_Multiple_SNMP_Managers_With_Non_Default_Port_And_Verify
110
111 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} Valid
112 Configure SNMP Manager On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1} Valid
113 Verify SNMP Manager ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
114 Verify SNMP Manager ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
115
116 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1}
117 Delete SNMP Manager And Object ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
118
119Configure Multiple SNMP Managers With Different Ports And Verify
120 [Documentation] Configure multiple SNMP Managers with different ports And Verify.
121 [Tags] Configure_Multiple_SNMP_Managers_With_Different_Ports_And_Verify
122
123 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid
124 Configure SNMP Manager On BMC ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1} Valid
125 Configure SNMP Manager On BMC ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2} Valid
126
127 Verify SNMP Manager ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
128 Verify SNMP Manager ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
129 Verify SNMP Manager ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
130
131 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
132 Delete SNMP Manager And Object ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
133 Delete SNMP Manager And Object ${SNMP_MGR3_IP} ${NON_DEFAULT_PORT2}
134
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500135Generate Error On BMC And Verify If Trap Is Sent
136 [Documentation] Generate Error On BMC And Verify If Trap Is Sent.
137 [Tags] Generate_Error_On_BMC_And_Verify_If_Trap_Is_Sent
138 [Setup] Install Tarball
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600139 [Template] Create Error On BMC And Verify If Trap Is Sent
140
141 # event_log expected_error
142 ${CMD_DEBUG_TRABALL_ERROR} ${SNMP_TRAP_BMC_ERROR}
143
144Generate Error On BMC And Verify Trap On SNMP
145 [Documentation] Generate error on bmc and verify trap on SNMP.
146 [Tags] Generate_Error_On_BMC_And_Verify_Trap_On_SNMP
147 [Template] Create Error On BMC And Verify If Trap Is Sent
148
149 # event_log expected_error
150 ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
151 ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR}
152 ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
153
Anves Kumar rayankulabce13df2021-04-09 06:58:51 -0500154Configure SNMP Manager With Less Octet IP And Verify
155 [Documentation] Configure SNMP manager on BMC with less octet IP and verify.
156 [Tags] Configure_SNMP_Manager_With_Less_Octet_IP_And_Verify
157 [Template] Configure SNMP Manager On BMC
158
159 # SNMP manager IP Port Scenario
160 10.10.10 ${SNMP_DEFAULT_PORT} error
161
Prashanth Katti04b9ab92021-06-03 08:54:35 -0500162Verify SNMP SysUpTime
163 [Documentation] Verify SNMP SysUpTime.
164 [Tags] Verify_SNMP_SysUpTime
165
166 Generate Error And Verify System Up Time
167
168
169Verify SNMP SysUpTime On BMC Reboot
170 [Documentation] Verify SNMP SysUpTime on BMC reboot.
171 [Tags] Verify_SNMP_SysUpTime_On_BMC_Reboot
172
173 # Reboot BMC to reset system uptime.
174 OBMC Reboot (off)
175
176 ${uptime}= Generate Error And Verify System Up Time
177
178 # Check if uptime is reset after reboot.
179 Should Be True ${uptime} <= 1 msg=SNMP SysUpTime is not reset on reboot
180
181
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600182*** Keywords ***
183
184Create Error On BMC And Verify If Trap Is Sent
Prashanth Katti04b9ab92021-06-03 08:54:35 -0500185 [Documentation] Generate error on BMC and verify if trap is sent.
186 [Arguments] ${event_log}=${CMD_INTERNAL_FAILURE} ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600187
188 # Description of argument(s):
189 # event_log Event logs to be created.
190 # expected_error Expected error on SNMP.
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500191
192 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid
193
194 Start SNMP Manager
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600195 BMC Execute Command ${event_log}
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500196 SSHLibrary.Switch Connection snmp_server
197 ${SNMP_LISTEN_OUT}= Read delay=1s
Prashanth Kattic6a0acf2019-08-09 04:16:41 -0500198 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500199 SSHLibrary.Execute Command sudo killall snmptrapd
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600200 ${lines} = Split To Lines ${SNMP_LISTEN_OUT}
201 ${trap_info}= Get From List ${lines} -1
202 ${SNMP_TRAP} = Split String ${trap_info} \t
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500203
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600204 Should Contain ${SNMP_TRAP}[0] DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks:
205 Should Be Equal ${SNMP_TRAP}[1] SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
206 Should Match Regexp ${SNMP_TRAP}[2] SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: \[0-9]*
207 Should Match Regexp ${SNMP_TRAP}[3] SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: \[0-9]*
208 Should Match Regexp ${SNMP_TRAP}[4] SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: \[0-9]
209 Should Be Equal ${SNMP_TRAP}[5] SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "${expected_error}"
Prashanth Katti04b9ab92021-06-03 08:54:35 -0500210
211 [Return] ${SNMP_TRAP}
212
213
214Generate Error And Verify System Up Time
215 [Documentation] Generate error and verify system up time.
216
217 # Get system uptime on BMC.
218 # Example output of uptime:
219 # (8055.79 15032.86)
220
221 ${cmd_output} ${stderr} ${rc}= BMC Execute Command cat /proc/uptime
222 @{times}= Split String ${cmd_output}
223
224 ${bmc_uptime_in_minutes}= Evaluate int(${times}[0])/60
225
226 ${trap}= Create Error On BMC And Verify If Trap Is Sent
227
228 # Extract System up time from SNMP trap.
229 # Example - SNMP trap:
230 # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (252367) 0:42:03.67
231 # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
232 # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 54
233 # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: 4622921648578756984
234 # SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
235 # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING:
236
237 @{words}= Split String ${trap}[0] =
238
239 ${timeticks}= Fetch From Right ${words}[1] (
240 ${snmp_sysuptime}= Fetch From Left ${timeticks} )
241
242 # SNMP SysUptime will be in milli seconds.
243 # Convert into minutes.
244 ${sysuptime_in_minutes}= Evaluate int(${snmp_sysuptime})/6000
245
246 Should Be Equal As Integers ${bmc_uptime_in_minutes} ${sysuptime_in_minutes}
247
248 [Return] ${sysuptime_in_minutes}