Generate Error On BMC And Verify If Trap Is Sent

Resolve openbmc/openbmc-test-automation#1763

Change-Id: I9ff7500e0497780d1fbf1a3aac05174f527a945f
Signed-off-by: Naman Navin Hegde <nhegde89@in.ibm.com>
diff --git a/snmp/test_bmc_snmp_config.robot b/snmp/test_bmc_snmp_config.robot
index f70eddf..6a81337 100644
--- a/snmp/test_bmc_snmp_config.robot
+++ b/snmp/test_bmc_snmp_config.robot
@@ -1,11 +1,12 @@
 *** Settings ***
-Documentation  This testing require special setup where SNMP trapd is
+Documentation  This testing requires special setup where SNMP trapd is
 ...            configured and installed. For download, installation and
 ...            configuration refer http://www.net-snmp.org/.
 
 Resource  ../lib/snmp/resource.robot
 Resource  ../lib/snmp/snmp_utils.robot
 Resource  ../lib/openbmc_ffdc.robot
+Resource  ../lib/logging_utils.robot
 
 Library  String
 Library  SSHLibrary
@@ -111,3 +112,18 @@
     Delete SNMP Manager And Object  ${SNMP_MGR2_IP}  ${NON_DEFAULT_PORT1}
     Delete SNMP Manager And Object  ${SNMP_MGR3_IP}  ${NON_DEFAULT_PORT2}
 
+Generate Error On BMC And Verify If Trap Is Sent
+    [Documentation]  Generate Error On BMC And Verify If Trap Is Sent.
+    [Tags]  Generate_Error_On_BMC_And_Verify_If_Trap_Is_Sent
+    [Setup]  Install Tarball
+
+    Configure SNMP Manager On BMC  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}  Valid
+
+    Start SNMP Manager
+    BMC Execute Command  /tmp/tarball/bin/logging-test -c AutoTestSimple
+    SSHLibrary.Switch Connection  snmp_server
+    ${SNMP_LISTEN_OUT}=  Read  delay=1s
+    SSHLibrary.Execute Command  sudo killall snmptrapd
+
+    Should Contain  ${SNMP_LISTEN_OUT}  ${SNMP_TRAP_BMC_ERROR}
+    ...  msg=Failed to receive trap message.