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