Added new testcase for SNMP alerts submenu
Changes -
- Configure Multiple SNMP Managers Via GUI And Verify SNMP Trap
Tested :-
- Ran Successfully test_snmp_alerts_sub_menu.robot
Change-Id: I8a041017d14ee5e48d392b17964f7ce4d7fea4e7
Signed-off-by: Megha G N <Megha.G.N@ibm.com>
diff --git a/gui/gui_test/settings_menu/test_snmp_alerts_sub_menu.robot b/gui/gui_test/settings_menu/test_snmp_alerts_sub_menu.robot
index 8cfd256..c2aab2b 100644
--- a/gui/gui_test/settings_menu/test_snmp_alerts_sub_menu.robot
+++ b/gui/gui_test/settings_menu/test_snmp_alerts_sub_menu.robot
@@ -247,6 +247,20 @@
${CMD_INFORMATIONAL_ERROR} ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}
+Configure Multiple SNMP Managers Via GUI And Verify SNMP Trap
+ [Documentation] Configure multiple SNMP Managers on BMC via GUI and check trap.
+ [Tags] Configure_Multiple_SNMP_Managers_Via_GUI_And_Verify_SNMP_Trap
+ [Teardown] Run Keywords Delete SNMP Manager Via Redfish ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
+ ... AND Delete SNMP Manager Via Redfish ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+
+ Configure SNMP Manager Via GUI ${SNMP_MGR1_IP} ${SNMP_DEFAULT_PORT}
+ Configure SNMP Manager Via GUI ${SNMP_MGR2_IP} ${NON_DEFAULT_PORT1}
+
+ # Check if trap is generated and sent to SNMP managers those are configured.
+
+ Create Error Log On BMC And Verify Trap ${CMD_INTERNAL_FAILURE} ${SNMP_TRAP_BMC_INTERNAL_FAILURE}
+
+
*** Keywords ***
Suite Setup Execution
@@ -458,3 +472,60 @@
${snmp_trap}= Split String ${trap_info} \t
Verify SNMP Trap ${snmp_trap} ${trap_msg}
+
+
+Create Error Log On BMC And Verify Trap
+ [Documentation] Generate error on BMC
+ ... and check whether the trap is sent to all those are configured.
+ [Arguments] ${event_log_cmd} ${trap_msg}
+
+ # Description of argument(s):
+ # event_log_cmd Command to generate error log.
+ # trap_msg Expected trap on SNMP.
+
+ Start Multiple SNMP Managers On Specific Port
+
+ # Generate error log.
+ BMC Execute Command ${event_log_cmd}
+
+ ${alias}= Create List snmp_server1 snmp_server2
+
+ FOR ${snmp_server} IN @{alias}
+ SSHLibrary.Switch Connection ${snmp_server}
+
+ ${SNMP_LISTEN_OUT}= Read delay=1s
+
+ # Stop SNMP manager process.
+ SSHLibrary.Execute Command sudo killall snmptrapd
+
+ # Sample SNMP trap:
+ # 2021-06-16 07:05:29 xx.xx.xx.xx [UDP: [xx.xx.xx.xx]:58154->[xx.xx.xx.xx]:xxx]:
+ # DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (2100473) 5:50:04.73
+ # SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-SMI::enterprises.49871.1.0.0.1
+ # SNMPv2-SMI::enterprises.49871.1.0.1.1 = Gauge32: 369
+ # SNMPv2-SMI::enterprises.49871.1.0.1.2 = Opaque:
+ # UInt64: 1397718405502468474 SNMPv2-SMI::enterprises.49871.1.0.1.3 = INTEGER: 3
+ # SNMPv2-SMI::enterprises.49871.1.0.1.4 = STRING: "xxx.xx.xx Failure"
+
+ ${lines}= Split To Lines ${SNMP_LISTEN_OUT}
+ ${trap_info}= Get From List ${lines} -1
+ ${snmp_trap}= Split String ${trap_info} \t
+
+ Verify SNMP Trap ${snmp_trap} ${trap_msg}
+ END
+
+
+Start Multiple SNMP Managers On Specific Port
+ [Documentation] Start multiple SNMP managers on specific port.
+
+ Open Connection And Log In ${SNMP_MGR1_USERNAME} ${SNMP_MGR1_PASSWORD}
+ ... alias=snmp_server1 host=${SNMP_MGR1_IP}
+
+ SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR1_IP}:${SNMP_DEFAULT_PORT} &
+
+ Open Connection And Log In ${SNMP_MGR2_USERNAME} ${SNMP_MGR2_PASSWORD}
+ ... alias=snmp_server2 host=${SNMP_MGR2_IP}
+
+ # The execution of the SNMP_TRAPD_CMD is necessary to cause SNMP to begin
+ # listening to SNMP messages.
+ SSHLibrary.write ${SNMP_TRAPD_CMD} ${SNMP_MGR2_IP}:${NON_DEFAULT_PORT1} &