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 | |
| 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/bmc_redfish_resource.robot |
| 12 | Resource ../../lib/openbmc_ffdc.robot |
| 13 | Resource ../../lib/logging_utils.robot |
| 14 | |
| 15 | |
| 16 | Test Teardown FFDC On Test Case Fail |
| 17 | Suite Setup Suite Setup Execution |
| 18 | |
| 19 | *** Variables *** |
| 20 | |
| 21 | ${snmp_function} SNMPTrap |
| 22 | ${snmp_version} SNMPv2c |
| 23 | ${subscription_uri} /redfish/v1/EventService/Subscriptions |
| 24 | |
Prashanth Katti | c744f04 | 2021-06-16 07:46:04 -0500 | [diff] [blame] | 25 | ${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging |
| 26 | ... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure |
| 27 | ... xyz.openbmc_project.Logging.Entry.Level.Error 0 |
| 28 | |
| 29 | ${CMD_FRU_CALLOUT} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging |
| 30 | ... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.Timeout |
| 31 | ... xyz.openbmc_project.Logging.Entry.Level.Error 2 "TIMEOUT_IN_MSEC" "5" |
| 32 | ... "CALLOUT_INVENTORY_PATH" "/xyz/openbmc_project/inventory/system/chassis/motherboard" |
| 33 | |
| 34 | ${CMD_INFORMATIONAL_ERROR} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging |
| 35 | ... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.TestError2 |
| 36 | ... xyz.openbmc_project.Logging.Entry.Level.Informational 0 |
| 37 | |
| 38 | ${SNMP_TRAP_BMC_INTERNAL_FAILURE} xyz.openbmc_project.Common.Error.InternalFailure |
| 39 | ${SNMP_TRAP_BMC_CALLOUT_ERROR} xyz.openbmc_project.Common.Error.Timeout |
| 40 | ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} xyz.openbmc_project.Common.Error.TestError2 |
| 41 | |
Prashanth Katti | 391000c | 2021-06-11 04:09:21 -0500 | [diff] [blame] | 42 | |
| 43 | *** Test Cases *** |
| 44 | |
| 45 | Configure SNMP Manager On BMC And Verify |
| 46 | [Documentation] Configure SNMP manager on BMC via Redfish and verify. |
| 47 | [Tags] Configure_SNMP_Manager_On_BMC_And_Verify |
Prashanth Katti | dd99a91 | 2021-06-14 09:12:02 -0500 | [diff] [blame] | 48 | [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
Prashanth Katti | 391000c | 2021-06-11 04:09:21 -0500 | [diff] [blame] | 49 | |
| 50 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} ${HTTP_CREATED} |
| 51 | |
| 52 | Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 53 | |
| 54 | |
Prashanth Katti | c744f04 | 2021-06-16 07:46:04 -0500 | [diff] [blame] | 55 | Configure SNMP Manager On BMC With Non-default Port And Verify |
| 56 | [Documentation] Configure SNMP Manager On BMC And Verify. |
| 57 | [Tags] Configure_SNMP_Manager_On_BMC_With_Non_Default_Port_And_Verify |
| 58 | [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} |
| 59 | |
| 60 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} ${HTTP_CREATED} |
| 61 | |
| 62 | Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${NON_DEFAULT_PORT1} |
| 63 | |
| 64 | |
| 65 | Configure SNMP Manager On BMC With Out Of Range Port And Verify |
| 66 | [Documentation] Configure SNMP Manager On BMC with out-of range port and verify. |
| 67 | [Tags] Configure_SNMP_Manager_On_BMC_With_Out_Of_Range_Port_And_Verify |
| 68 | [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${out_of_range_port} |
| 69 | |
| 70 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${out_of_range_port} ${HTTP_BAD_REQUEST} |
| 71 | |
| 72 | ${status}= Run Keyword And Return Status |
| 73 | ... Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${out_of_range_port} |
| 74 | |
| 75 | Should Be Equal As Strings ${status} False |
| 76 | ... msg=BMC is allowing to configure out of range port. |
| 77 | |
| 78 | |
| 79 | Generate Error On BMC And Verify SNMP Trap |
| 80 | [Documentation] Generate error on BMC and verify trap and its fields. |
| 81 | [Tags] Generate_Error_On_BMC_And_Verify_SNMP_Trap |
| 82 | [Template] Create Error On BMC And Verify Trap |
| 83 | |
| 84 | # event_log expected_error |
| 85 | |
| 86 | # Generate internal failure error. |
| 87 | ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} |
| 88 | |
| 89 | # Generate timeout error. |
| 90 | ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} |
| 91 | |
| 92 | # Generate informational error. |
| 93 | ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} |
| 94 | |
| 95 | |
Prashanth Katti | b1a9c6b | 2021-06-18 01:36:14 -0500 | [diff] [blame] | 96 | Configure SNMP Manager On BMC With Alpha Port And Verify |
| 97 | [Documentation] Configure SNMP Manager On BMC with alpha port and verify. |
| 98 | [Tags] Configure_SNMP_Manager_On_BMC_With_Alpha_Port_And_Verify |
| 99 | [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${alpha_port} |
| 100 | |
| 101 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${alpha_port} ${HTTP_BAD_REQUEST} |
| 102 | |
| 103 | ${status}= Run Keyword And Return Status |
| 104 | ... Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${alpha_port} |
| 105 | |
| 106 | Should Be Equal As Strings ${status} False |
| 107 | ... msg=BMC is allowing to configure invalid port. |
| 108 | |
| 109 | |
| 110 | Configure SNMP Manager On BMC With Empty Port And Verify |
| 111 | [Documentation] Configure SNMP Manager On BMC with empty port and verify |
| 112 | ... SNMP manager gets configured with default port. |
| 113 | [Tags] Configure_SNMP_Manager_On_BMC_With_Empty_Port_And_Verify |
| 114 | [Teardown] Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 115 | |
| 116 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${empty_port} |
| 117 | |
| 118 | Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 119 | |
| 120 | |
| 121 | Configure Multiple SNMP Managers And Verify |
| 122 | [Documentation] Configure multiple SNMP managers and verify. |
| 123 | [Tags] Configure_Multiple_SNMP_Managers_And_Verify |
| 124 | [Teardown] Run Keywords |
| 125 | ... Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 126 | ... AND |
| 127 | ... Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} |
| 128 | |
| 129 | Configure SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 130 | Configure SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} |
| 131 | Verify SNMP Manager Configured On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} |
| 132 | Verify SNMP Manager Configured On BMC ${SNMP_MGR2_IP} ${SNMP_DEFAULT_PORT} |
| 133 | |
| 134 | |
| 135 | Generate Error On BMC And Verify SNMP Trap Is Sent To Non-Default Port |
| 136 | [Documentation] Generate error on BMC and verify trap and its fields. |
| 137 | [Tags] Generate_Error_On_BMC_And_Verify_SNMP_Trap_Is_Sent_To_Non-Default_Port |
| 138 | [Template] Create Error On BMC And Verify Trap On Non-Default Port |
| 139 | |
| 140 | # event_log expected_error |
| 141 | |
| 142 | # Generate internal failure error. |
| 143 | ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE} |
| 144 | |
| 145 | # Generate timeout error. |
| 146 | ${CMD_FRU_CALLOUT} ${SNMP_TRAP_BMC_CALLOUT_ERROR} |
| 147 | |
| 148 | # Generate informational error. |
| 149 | ${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR} |
| 150 | |
| 151 | |
Prashanth Katti | 391000c | 2021-06-11 04:09:21 -0500 | [diff] [blame] | 152 | *** Keywords *** |
| 153 | |
| 154 | Suite Setup Execution |
| 155 | [Documentation] Do suite setup execution. |
| 156 | |
| 157 | Redfish.Login |
| 158 | |
| 159 | # Check for SNMP configurations. |
| 160 | Valid Value SNMP_MGR1_IP |
| 161 | Valid Value SNMP_DEFAULT_PORT |