blob: cac2e92bcde1c9f57a3b396fe816a070271edce4 [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
46Configure 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
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
107Configure 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
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
154*** Keywords ***
155
156Create Error On BMC And Verify If Trap Is Sent
157 [Documentation] Generate Error On BMC And Verify If Trap Is Sent.
158 [Arguments] ${event_log} ${expected_error}
159
160 # Description of argument(s):
161 # event_log Event logs to be created.
162 # expected_error Expected error on SNMP.
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500163
164 Configure SNMP Manager On BMC ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT} Valid
165
166 Start SNMP Manager
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600167 BMC Execute Command ${event_log}
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500168 SSHLibrary.Switch Connection snmp_server
169 ${SNMP_LISTEN_OUT}= Read delay=1s
Prashanth Kattic6a0acf2019-08-09 04:16:41 -0500170 Delete SNMP Manager And Object ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500171 SSHLibrary.Execute Command sudo killall snmptrapd
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600172 ${lines} = Split To Lines ${SNMP_LISTEN_OUT}
173 ${trap_info}= Get From List ${lines} -1
174 ${SNMP_TRAP} = Split String ${trap_info} \t
Naman Navin Hegdebf181332019-06-26 02:08:18 -0500175
Anves Kumar rayankula9d385de2021-03-09 23:25:28 -0600176 Should Contain ${SNMP_TRAP}[0] DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks:
177 Should Be Equal ${SNMP_TRAP}[1] SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
178 Should Match Regexp ${SNMP_TRAP}[2] SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: \[0-9]*
179 Should Match Regexp ${SNMP_TRAP}[3] SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque: UInt64: \[0-9]*
180 Should Match Regexp ${SNMP_TRAP}[4] SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: \[0-9]
181 Should Be Equal ${SNMP_TRAP}[5] SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "${expected_error}"