Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 1 | *** Settings *** |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 2 | Documentation This testing requires special setup where SNMP trapd is |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 3 | ... configured and installed. For download, installation and |
| 4 | ... configuration refer http://www.net-snmp.org/. |
| 5 | |
Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 6 | Resource ../lib/snmp/resource.robot |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 7 | Resource ../lib/snmp/snmp_utils.robot |
Prashanth Katti | 7dae0e8 | 2019-01-09 01:35:42 -0600 | [diff] [blame] | 8 | Resource ../lib/openbmc_ffdc.robot |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 9 | Resource ../lib/logging_utils.robot |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 10 | |
| 11 | Library String |
| 12 | Library SSHLibrary |
| 13 | |
Prashanth Katti | 7dae0e8 | 2019-01-09 01:35:42 -0600 | [diff] [blame] | 14 | Test Teardown FFDC On Test Case Fail |
| 15 | |
Anves Kumar rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 16 | *** 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 Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 36 | *** Test Cases *** |
| 37 | Configure 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 | |
| 46 | Configure SNMP Manager On BMC With Non-default Port And Verify |
| 47 | [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 | |
| 55 | Configure SNMP Manager On BMC With Out Of Range Port And Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 56 | [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 Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 58 | [Template] Configure SNMP Manager On BMC |
| 59 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 60 | # SNMP manager IP Port Scenario |
| 61 | ${SNMP_MGR1_IP} ${out_of_range_port} error |
| 62 | |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 63 | Configure SNMP Manager On BMC With Alpha Port And Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 64 | [Documentation] Configure SNMP Manager On BMC with alpha port and verify. |
| 65 | [Tags] Configure_SNMP_Manager_On_BMC_With_Alpha_Port_And_Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 66 | [Template] Configure SNMP Manager On BMC |
| 67 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 68 | # SNMP manager IP Port Scenario |
| 69 | ${SNMP_MGR1_IP} ${alpha_port} error |
| 70 | |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 71 | Configure SNMP Manager On BMC With Negative Port And Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 72 | [Documentation] Configure SNMP Manager On BMC with negative port and verify. |
| 73 | [Tags] Configure_SNMP_Manager_On_BMC_With_Negative_Port_And_Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 74 | [Template] Configure SNMP Manager On BMC |
| 75 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 76 | # SNMP manager IP Port Scenario |
| 77 | ${SNMP_MGR1_IP} ${negative_port} error |
| 78 | |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 79 | Configure SNMP Manager On BMC With Empty Port And Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 80 | [Documentation] Configure SNMP Manager On BMC with empty port and verify. |
| 81 | [Tags] Configure_SNMP_Manager_On_BMC_With_Empty_Port_And_Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 82 | [Template] Configure SNMP Manager On BMC |
| 83 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 84 | # SNMP manager IP Port Scenario |
| 85 | ${SNMP_MGR1_IP} ${empty_port} error |
| 86 | |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 87 | Configure SNMP Manager On BMC With Out Of Range IP And Verify |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 88 | [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 Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 90 | [Template] Configure SNMP Manager On BMC |
| 91 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 92 | # SNMP manager IP Port Scenario |
| 93 | ${out_of_range_ip} ${SNMP_DEFAULT_PORT} error |
| 94 | |
Prashanth Katti | 081b3d9 | 2018-06-15 05:13:11 -0500 | [diff] [blame] | 95 | Configure 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 | |
| 107 | Configure Multiple SNMP Managers With Non-default Port And Verify |
| 108 | [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 | |
| 119 | Configure 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 Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 135 | Generate 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 rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 139 | [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 | |
| 144 | Generate 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 rayankula | bce13df | 2021-04-09 06:58:51 -0500 | [diff] [blame] | 154 | Configure 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 | |
Anves Kumar rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 162 | *** Keywords *** |
| 163 | |
| 164 | Create Error On BMC And Verify If Trap Is Sent |
| 165 | [Documentation] Generate Error On BMC And Verify If Trap Is Sent. |
| 166 | [Arguments] ${event_log} ${expected_error} |
| 167 | |
| 168 | # Description of argument(s): |
| 169 | # event_log Event logs to be created. |
| 170 | # expected_error Expected error on SNMP. |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 171 | |
| 172 | Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid |
| 173 | |
| 174 | Start SNMP Manager |
Anves Kumar rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 175 | BMC Execute Command ${event_log} |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 176 | SSHLibrary.Switch Connection snmp_server |
| 177 | ${SNMP_LISTEN_OUT}= Read delay=1s |
Prashanth Katti | c6a0acf | 2019-08-09 04:16:41 -0500 | [diff] [blame] | 178 | Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 179 | SSHLibrary.Execute Command sudo killall snmptrapd |
Anves Kumar rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 180 | ${lines} = Split To Lines ${SNMP_LISTEN_OUT} |
| 181 | ${trap_info}= Get From List ${lines} -1 |
| 182 | ${SNMP_TRAP} = Split String ${trap_info} \t |
Naman Navin Hegde | bf18133 | 2019-06-26 02:08:18 -0500 | [diff] [blame] | 183 | |
Anves Kumar rayankula | 9d385de | 2021-03-09 23:25:28 -0600 | [diff] [blame] | 184 | Should Contain ${SNMP_TRAP}[0] DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: |
| 185 | Should Be Equal ${SNMP_TRAP}[1] SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1 |
| 186 | Should Match Regexp ${SNMP_TRAP}[2] SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: \[0-9]* |
| 187 | Should Match Regexp ${SNMP_TRAP}[3] SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: \[0-9]* |
| 188 | Should Match Regexp ${SNMP_TRAP}[4] SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: \[0-9] |
| 189 | Should Be Equal ${SNMP_TRAP}[5] SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "${expected_error}" |