Added new SNMP testcase for settings menu

Changes:
    - Added "Verify Persistency Of SNMP Manager And Trap On BMC Reboot" testcase
    - Added "Delete Multiple SNMP Managers With Default Port Via GUI" keyword
    - Added "Navigate To SNMP Alerts Page" keyword
    - Modified
    "Configure Multiple SNMP Managers On BMC Via GUI And Verify Persistency On BMC Reboot"

Tested:
    - Ran successfully test_snmp_alerts_sub_menu.robot

Change-Id: Ife57a992b2e4fb91f91539cea27c377513e085e9
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 c2c0dda..265f282 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
@@ -160,9 +160,9 @@
     [Documentation]  Login GUI SNMP alerts page and
     ...  add multiple SNMP Managers on BMC via GUI and verify persistency on BMC reboot.
     [Tags]  Configure_Multiple_SNMP_Managers_On_BMC_Via_GUI_And_Verify_Persistency_On_BMC_Reboot
-    [Teardown]   Run Keywords  Delete SNMP Manager Via GUI  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}
-    ...  AND  Delete SNMP Manager Via GUI  ${SNMP_MGR2_IP}  ${SNMP_DEFAULT_PORT}
+    [Teardown]  Delete Multiple SNMP Managers With Default Port Via GUI  ${ip_address_list}
 
+    ${ip_address_list}=  Create list  ${SNMP_MGR1_IP}  ${SNMP_MGR2_IP}
     Configure SNMP Manager Via GUI  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}
     Wait Until Page Contains  ${SNMP_MGR1_IP}  timeout=45s
 
@@ -172,9 +172,8 @@
     # Reboot BMC and check persistency SNMP manager.
     Reboot BMC via GUI
 
-    Suite Setup Execution
-    Wait Until Page Contains  ${snmp_page_heading}  timeout=1min
-
+    Navigate To SNMP Alerts Page
+    
     Verify SNMP Manager Configured On BMC  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}
     Verify SNMP Manager Configured On BMC  ${SNMP_MGR2_IP}  ${SNMP_DEFAULT_PORT}
 
@@ -210,7 +209,26 @@
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  snmp-alerts
 
     Configure SNMP Manager Via GUI  ${SNMP_HOSTNAME}  ${SNMP_DEFAULT_PORT}
-    Wait Until Page Contains  ${HOSTNAME}  timeout=15s
+    Wait Until Page Contains  ${SNMP_HOSTNAME}  timeout=15s
+
+
+Verify Persistency Of SNMP Manager And Trap On BMC Reboot
+    [Documentation]  Configure the SNMP manager and verify that it remains operational
+    ...  after a BMC system reboot. Also, confirm that a trap is successfully sent.
+    [Tags]  Verify_Persistency_Of_SNMP_Manager_And_Trap_On_BMC_Reboot
+    [Template]  Create Error On BMC And Verify Trap On Default Port
+    [Teardown]  Delete SNMP Manager Via GUI  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}
+
+    # event_log                 expected_error                           persistency_check
+
+    # Generate internal failure error.
+    ${CMD_INTERNAL_FAILURE}     ${SNMP_TRAP_BMC_INTERNAL_FAILURE}        ${True}
+
+    # Generate timeout error.
+    ${CMD_FRU_CALLOUT}          ${SNMP_TRAP_BMC_CALLOUT_ERROR}           ${True}
+
+    # Generate informational error.
+    ${CMD_INFORMATIONAL_ERROR}  ${SNMP_TRAP_BMC_INFORMATIONAL_ERROR}     ${True}
 
 
 *** Keywords ***
@@ -272,7 +290,7 @@
     # ....                (e.g. Invalid format / Value must be between 0 – 65535).
 
     Configure SNMP Manager Via GUI  ${snmp_manager_ip}  ${snmp_manager_port}
-    Wait Until Page Contains   ${expected_error}
+    Wait Until Page Contains   ${expected_error}  timeout=10sec
     ${status}=  Run Keyword And Return Status
     ...  Verify SNMP Manager Configured On BMC  ${snmp_manager_ip}  ${snmp_manager_port}
     Should Be Equal As Strings  ${status}  False
@@ -295,13 +313,18 @@
 Create Error On BMC And Verify Trap On Default Port
     [Documentation]  Generate error on BMC and verify if trap is sent to default port.
     [Arguments]  ${event_log}=${CMD_INTERNAL_FAILURE}  ${expected_error}=${SNMP_TRAP_BMC_INTERNAL_FAILURE}
+    ...  ${persistency_check}=${False}
 
     # Description of argument(s):
-    # event_log       Event logs to be created.
-    # expected_error  Expected error on SNMP.
+    # event_log          Event logs to be created.
+    # expected_error     Expected error on SNMP.
+    # persistency_check  Check whether reboot is required or not (e.g. True, False).
 
     Configure SNMP Manager Via GUI  ${SNMP_MGR1_IP}  ${SNMP_DEFAULT_PORT}
 
+    Run Keyword If  ${persistency_check} == ${True}
+    ...  Run Keywords  Reboot BMC via GUI  AND  Navigate To SNMP Alerts Page
+
     Start SNMP Manager
 
     # Generate error log.
@@ -348,3 +371,24 @@
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
 
     Add DNS Servers And Verify  ${dns_server}
+
+
+Delete Multiple SNMP Managers With Default Port Via GUI
+    [Documentation]  Delete multiple SNMP managers with default port on BMC via GUI.
+    [Arguments]  ${ip_address_list}
+
+    # Description of argument(s):
+    # ${ip_address_list}   List of IP address.
+
+    FOR  ${ip_address}  IN  @{ip_address_list}
+      Wait Until Keyword Succeeds   30 sec  10 sec
+      ...  Delete SNMP Manager Via GUI  ${ip_address}  ${SNMP_DEFAULT_PORT}
+    END
+
+
+Navigate To SNMP Alerts Page
+    [Documentation]  Navigate to SNMP alerts page.
+
+    Click Element  ${xpath_settings_menu}
+    Click Element  ${xpath_snmp_alerts_sub_menu}
+    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  snmp-alerts