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/lib/snmp/resource.robot b/lib/snmp/resource.robot
index 9ddb262..7ff3ed7 100644
--- a/lib/snmp/resource.robot
+++ b/lib/snmp/resource.robot
@@ -21,3 +21,12 @@
 ${alpha_port}         ab
 ${negative_port}      ${-12}
 ${empty_port}         ${EMPTY}
+
+# User Name Password
+${SNMP_MGR1_USERNAME}    ${EMPTY}
+${SNMP_MGR1_PASSWORD}    ${EMPTY}
+
+# SNMP Command
+${SNMP_TRAPD_CMD}       snmptrapd -f -c
+...                     /usr/local/etc/snmp/snmptrapd.conf -Lo
+${SNMP_TRAP_BMC_ERROR}  example.xyz.openbmc_project.Example.Elog.AutoTestSimple
diff --git a/lib/snmp/snmp_utils.robot b/lib/snmp/snmp_utils.robot
index 27594b5..2bdf401 100644
--- a/lib/snmp/snmp_utils.robot
+++ b/lib/snmp/snmp_utils.robot
@@ -123,3 +123,14 @@
     ${status}=  Run Keyword And Return Status  Verify SNMP Manager
     ...  ${snmp_ip}  ${port}
     Should Be Equal  ${status}  ${False}  msg=SNMP manager is not deleted.
+
+
+Start SNMP Manager
+    [Documentation]  Start SNMP listener on the remote SNMP manager.
+
+    Open Connection And Log In  ${SNMP_MGR1_USERNAME}  ${SNMP_MGR1_PASSWORD}
+    ...  alias=snmp_server  host=${SNMP_MGR1_IP}
+
+    # The execution of the SNMP_TRAPD_CMD is necessary to cause SNMP to begin
+    # listening to SNMP messages.
+    SSHLibrary.write  ${SNMP_TRAPD_CMD} &