[VOL-3246] Adding ONU Reboots to voltha-2.3 tests

Change-Id: Ibbd6fcff7f076e819fb5780c9bf4bfd13fdf9bd5
diff --git a/tests/dt-workflow/Voltha_DT_PODTests.robot b/tests/dt-workflow/Voltha_DT_PODTests.robot
index 5ea7b4c..e91ec4d 100644
--- a/tests/dt-workflow/Voltha_DT_PODTests.robot
+++ b/tests/dt-workflow/Voltha_DT_PODTests.robot
@@ -31,6 +31,7 @@
 Resource          ../../libraries/utils.robot
 Resource          ../../libraries/k8s.robot
 Resource          ../../variables/variables.robot
+Resource          ../../libraries/power_switch.robot
 
 *** Variables ***
 ${POD_NAME}       flex-ocp-cord
@@ -55,6 +56,23 @@
 ${container_log_dir}    ${None}
 
 *** Test Cases ***
+Reboot ONUs Physically
+    [Documentation]   This test reboots ONUs physically before execution all the tests
+    ...    Test case runs only on the PODs that are configured with PowerSwitch that
+    ...    controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
+    [Tags]    functional   PowerSwitch    RebootAllONUs
+    [Setup]    Start Logging    RebootAllONUs
+    [Teardown]    Run Keywords    Collect Logs
+    ...           AND             Stop Logging    RebootAllONUs
+    Power Switch Connection Suite    ${web_power_switch.ip}    ${web_power_switch.user}    ${web_power_switch.password}
+    FOR    ${I}    IN RANGE    0    ${num_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        Disable Switch Outlet    ${src['power_switch_port']}
+        Sleep    60s
+        Enable Switch Outlet    ${src['power_switch_port']}
+        Sleep    60s
+    END
+
 Sanity E2E Test for OLT/ONU on POD for DT
     [Documentation]    Validates E2E Ping Connectivity and object states for the given scenario:
     ...    Validate successful DHCP/E2E ping (no EAPOL and DHCP flows) for the tech profile that is used
@@ -254,6 +272,9 @@
     Common Test Suite Setup
     #Restore all ONUs
     #Run Keyword If    ${has_dataplane}    RestoreONUs    ${num_onus}
+    ${switch_type}=    Get Variable Value    ${web_power_switch.type}
+    Run Keyword If  "${switch_type}"!=""    Set Global Variable    ${powerswitch_type}    ${switch_type}
+
 
 Clear All Devices Then Create New Device
     [Documentation]    Remove any devices from VOLTHA and ONOS
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index b5277b1..405a327 100644
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -31,6 +31,7 @@
 Resource          ../../libraries/utils.robot
 Resource          ../../libraries/k8s.robot
 Resource          ../../variables/variables.robot
+Resource          ../../libraries/power_switch.robot
 
 *** Variables ***
 ${POD_NAME}       flex-ocp-cord
@@ -55,6 +56,23 @@
 ${container_log_dir}    ${None}
 
 *** Test Cases ***
+Reboot ONUs Physically
+    [Documentation]   This test reboots ONUs physically before execution all the tests
+    ...    Test case runs only on the PODs that are configured with PowerSwitch that
+    ...    controls the power off/on ONUs/OLT remotely (simulating a physical reboot)
+    [Tags]    functional   PowerSwitch    RebootAllONUs
+    [Setup]    Start Logging    RebootAllONUs
+    [Teardown]    Run Keywords    Collect Logs
+    ...           AND             Stop Logging    RebootAllONUs
+    Power Switch Connection Suite    ${web_power_switch.ip}    ${web_power_switch.user}    ${web_power_switch.password}
+    FOR    ${I}    IN RANGE    0    ${num_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        Disable Switch Outlet    ${src['power_switch_port']}
+        Sleep    60s
+        Enable Switch Outlet    ${src['power_switch_port']}
+        Sleep    60s
+    END
+
 Sanity E2E Test for OLT/ONU on POD
     [Documentation]    Validates E2E Ping Connectivity and object states for the given scenario:
     ...    Validate successful authentication/DHCP/E2E ping for the tech profile that is used
@@ -467,6 +485,9 @@
     Common Test Suite Setup
     #Restore all ONUs
     #Run Keyword If    ${has_dataplane}    RestoreONUs    ${num_onus}
+    ${switch_type}=    Get Variable Value    ${web_power_switch.type}
+    Run Keyword If  "${switch_type}"!=""    Set Global Variable    ${powerswitch_type}    ${switch_type}
+
 
 Clear All Devices Then Create New Device
     [Documentation]    Remove any devices from VOLTHA and ONOS