Added test to verify enabling SSH via GUI

Change-Id: Ie206475ba3830e6f034069e7465e40532a213e82
Signed-off-by: meghagn12345 <Megha.GN@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 c5e177a..afdfd46 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
@@ -1,9 +1,8 @@
 *** Settings ***
 
-Documentation    Test OpenBMC GUI "Policies" sub-menu of "Security and access" menu.
+Documentation    Test OpenBMC GUI "Policies" sub-menu of "Security and Access" menu.
 
 Resource         ../../lib/gui_resource.robot
-
 Suite Setup      Launch Browser And Login GUI
 Suite Teardown   Close Browser
 Test Setup       Test Setup Execution
@@ -11,15 +10,15 @@
 
 *** Variables ***
 
-${xpath_policies_heading}           //h1[text()="Policies"]
-${xpath_bmc_ssh_toggle}             //*[@data-test-id='policies-toggle-bmcShell']
-${xpath_network_ipmi_toggle}        //*[@data-test-id='polices-toggle-networkIpmi']
+${xpath_policies_heading}       //h1[text()="Policies"]
+${xpath_bmc_ssh_toggle}         //*[@data-test-id='policies-toggle-bmcShell']/following-sibling::label
+${xpath_network_ipmi_toggle}    //*[@data-test-id='polices-toggle-networkIpmi']
 
 
 *** Test Cases ***
 
 Verify Navigation To Policies Page
-    [Documentation]  Verify navigation to Policies page.
+    [Documentation]  Verify navigation to policies page.
     [Tags]  Verify_Navigation_To_Policies_Page
 
     Page Should Contain Element  ${xpath_policies_heading}
@@ -42,11 +41,37 @@
     Page Should Contain Element  ${xpath_network_ipmi_toggle}
 
 
+Enable SSH Via GUI And Verify
+    [Documentation]  Verify that SSH to BMC starts working after enabling SSH.
+    [Tags]  Enable_SSH_Via_GUI_And_Verify
+    [Teardown]  Run Keywords  Redfish.Patch  /redfish/v1/Managers/bmc/NetworkProtocol
+    ...  body={"SSH":{"ProtocolEnabled":True}}  valid_status_codes=[200, 204]  AND
+    ...  Wait Until Keyword Succeeds  30 sec  5 sec  Open Connection And Login
+
+    # Disable ssh via Redfish.
+    Redfish.Patch  /redfish/v1/Managers/bmc/NetworkProtocol  body={"SSH":{"ProtocolEnabled":False}}
+    ...   valid_status_codes=[200, 204]
+
+    # Wait for GUI to reflect disable SSH status.
+    Wait Until Keyword Succeeds  30 sec  10 sec
+    ...  Refresh GUI And Verify Element Value  ${xpath_bmc_ssh_toggle}  Disabled
+
+    # Enable ssh via GUI.
+    Click Element  ${xpath_bmc_ssh_toggle}
+
+    # Wait for GUI to reflect enable SSH status.
+    Wait Until Keyword Succeeds  30 sec  10 sec
+    ...  Refresh GUI And Verify Element Value  ${xpath_bmc_ssh_toggle}  Enabled
+
+    Wait Until Keyword Succeeds  10 sec  5 sec  Open Connection And Login
+
+
 *** Keywords ***
 
 Test Setup Execution
     [Documentation]  Do test case setup tasks.
-
     Click Element  ${xpath_secuity_and_accesss_menu}
     Click Element  ${xpath_policies_sub_menu}
     Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  policies
+
+