Added new testcases to policies sub-menu

Changes :
    - Added test to enable SSH and IPMI via GUI and verify it's state
    - Added test to disable SSH and IPMI via GUI and verify it's state
    - Added test to enable SSH and disable IPMI via GUI and verify it's state
    - Added test to disable SSH and enable IPMI via GUI and verify it's state

Tested:
    - Ran successfully test_policies_sub_menu.robot

Change-Id: Ie42ae1b9a2b8895c71dd26afb59d6925bf8573d3
Signed-off-by: Megha G N <Megha.G.N@ibm.com>
diff --git a/gui/gui_test/security_and_access_menu/test_policies_sub_menu.robot b/gui/gui_test/security_and_access_menu/test_policies_sub_menu.robot
index 1a4a06a..9700928 100644
--- a/gui/gui_test/security_and_access_menu/test_policies_sub_menu.robot
+++ b/gui/gui_test/security_and_access_menu/test_policies_sub_menu.robot
@@ -169,12 +169,27 @@
     ...  msg=IPMI command is working after disabling IPMI.
 
 
+Configure SSH And IPMI Settings Via GUI And Verify
+    [Documentation]  Login to GUI Policies page,set SSH and IPMI toggle and
+    ...  verify SSH & IPMI after the settings.
+    [Tags]  Configure_SSH_And_IPMI_Settings_Via_GUI_And_Verify
+    [Setup]  Fetch IPMI And SSH Settings
+    [Template]  Set SSH And IPMI State Via GUI
+    [Teardown]  Set SSH And IPMI State Via GUI  ${initial_ssh_setting}  ${initial_ipmi_setting}
+
+    # ssh_state     ipmi_state
+    Enabled         Enabled
+    Disabled        Disabled
+    Enabled         Disabled
+    Disabled        Enabled
+
+
 *** Keywords ***
 
 Test Setup Execution
     [Documentation]  Do test case setup tasks.
 
-    Click Element  ${xpath_secuity_and_accesss_menu}
+    Wait Until Keyword Succeeds  30 sec  15 sec  Click Element  ${xpath_secuity_and_accesss_menu}
     Click Element  ${xpath_policies_sub_menu}
     Wait Until Keyword Succeeds  30 sec  15 sec  Location Should Contain  policies
 
@@ -210,3 +225,67 @@
     # Wait for GUI to reflect policy status.
     Wait Until Keyword Succeeds  1 min  30 sec
     ...  Refresh GUI And Verify Element Value  ${policy_toggle_button}  ${state}
+
+
+Verify Policy State
+    [Documentation]  Verify if the current SSH and IPMI setting matches with
+    ...  given values.
+
+    # Verify SSH state value.
+    ${status}=  Run Keyword And Return Status
+    ...  Open Connection And Login
+
+    Run Keyword If  '${status}' == 'True'
+    ...  Element Text Should Be  ${xpath_bmc_ssh_toggle}  Enabled
+    ...  ELSE IF  '${status}' == 'False'
+    ...  Element Text Should Be  ${xpath_bmc_ssh_toggle}  Disabled
+
+    # Verify IPMI state value.
+    ${status}=  Run Keyword And Return Status
+    ...  Wait Until Keyword Succeeds  ${NETWORK_TIMEOUT}  ${NETWORK_RETRY_TIME}  Run IPMI Standard Command  sel info
+
+    Run Keyword If  '${status}' == 'True'
+    ...  Element Text Should Be  ${xpath_network_ipmi_toggle}  Enabled
+    ...  ELSE IF  '${status}' == 'False'
+    ...  Element Text Should Be  ${xpath_network_ipmi_toggle}  Disabled
+
+
+Set SSH And IPMI State Via GUI
+    [Documentation]  Set SSH and IPMI states via GUI.
+    [Arguments]  ${ssh_state}  ${ipmi_state}
+
+    # Description of argument(s):
+    # ssh_state     State of SSH to be set (e.g. Enabled, Disabled).
+    # ipmi_state    State of IPMI to be set (e.g. Enabled, Disbaled).
+
+    ${current_ssh_state}=  Get Text  ${xpath_bmc_ssh_toggle}
+
+    Run Keyword If  '${ssh_state}' == '${current_ssh_state}'
+    # When SSH state is already set to given value, click SSH toggle
+    # button twice to reset SSH value back to its original value.
+    ...  Run Keywords  Click Element  ${xpath_bmc_ssh_toggle}
+    ...  AND  Click Element  ${xpath_bmc_ssh_toggle}
+    ...  ELSE IF  '${ssh_state}' != '${current_ssh_state}'
+    ...  Click Element  ${xpath_bmc_ssh_toggle}
+
+    ${current_ipmi_state}=  Get Text  ${xpath_network_ipmi_toggle}
+
+    Run Keyword If  '${ipmi_state}' == '${current_ipmi_state}'
+    # When IPMI state is already set to given value, click IPMI toggle
+    # button twice to reset IPMI value back to its original value.
+    ...  Run Keywords  Click Element  ${xpath_network_ipmi_toggle}
+    ...  AND  Click Element  ${xpath_network_ipmi_toggle}
+    ...  ELSE IF  '${ipmi_state}' != '${current_ipmi_state}'
+    ...  Click Element  ${xpath_network_ipmi_toggle}
+
+    Wait Until Keyword Succeeds  30 sec  15 sec  Verify Policy State  ${ssh_state}  ${ipmi_state}
+
+
+Fetch IPMI And SSH Settings
+    [Documentation]  Note down the initial states of SSH and IPMI.
+
+    Test Setup Execution
+    ${initial_ssh_setting}=  Get Text  ${xpath_bmc_ssh_toggle}
+    Set Suite Variable  ${initial_ssh_setting}
+    ${initial_ipmi_setting}=  Get Text  ${xpath_network_ipmi_toggle}
+    Set Suite Variable  ${initial_ipmi_setting}