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 | |
Prashanth Katti | c744f04 | 2021-06-16 07:46:04 -0500 | [diff] [blame] | 30 | Configure SNMP Manager On BMC With Non-default Port And Verify |
| 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 | |
| 147 | Configure Multiple SNMP Managers With Non-default Port And Verify |
| 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 | 391000c | 2021-06-11 04:09:21 -0500 | [diff] [blame] | 217 | *** Keywords *** |
| 218 | |
| 219 | Suite Setup Execution |
| 220 | [Documentation] Do suite setup execution. |
| 221 | |
| 222 | Redfish.Login |
| 223 | |
| 224 | # Check for SNMP configurations. |
| 225 | Valid Value SNMP_MGR1_IP |
| 226 | Valid Value SNMP_DEFAULT_PORT |
Prashanth Katti | 7f31926 | 2021-06-21 09:10:04 -0500 | [diff] [blame] | 227 | |
| 228 | |
| 229 | Generate Error And Verify System Up Time |
| 230 | [Documentation] Generate error and verify system up time. |
| 231 | |
| 232 | # Get system uptime on BMC. |
| 233 | # Example output of uptime: |
| 234 | # (8055.79 15032.86) |
| 235 | |
| 236 | ${cmd_output} ${stderr} ${rc}= BMC Execute Command cat /proc/uptime |
| 237 | @{times}= Split String ${cmd_output} |
| 238 | |
| 239 | ${bmc_uptime_in_minutes}= Evaluate int(${times}[0])/60 |
| 240 | |
| 241 | ${trap}= Create Error On BMC And Verify Trap |
| 242 | |
| 243 | # Extract System up time from SNMP trap. |
| 244 | # Example - SNMP trap: |
| 245 | # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (252367) 0:42:03.67 |
| 246 | # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1 |
| 247 | # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 54 |
| 248 | # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: 4622921648578756984 |
| 249 | # SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3 |
| 250 | # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: |
| 251 | |
| 252 | @{words}= Split String ${trap}[0] = |
| 253 | |
| 254 | ${timeticks}= Fetch From Right ${words}[1] ( |
| 255 | ${snmp_sysuptime}= Fetch From Left ${timeticks} ) |
| 256 | |
| 257 | # SNMP SysUptime will be in milli seconds. |
| 258 | # Convert into minutes. |
| 259 | ${sysuptime_in_minutes}= Evaluate int(${snmp_sysuptime})/6000 |
| 260 | |
| 261 | Should Be Equal As Integers ${bmc_uptime_in_minutes} ${sysuptime_in_minutes} |
| 262 | |
| 263 | [Return] ${sysuptime_in_minutes} |