[VOL-2478]
integrate tests to nightly jobs

Change-Id: I57eb8f5295b8f3cd1c513693593603fc0ffcdb6e
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 24a1ca6..9a21190 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -335,11 +335,3 @@
     ...    kubectl -n ${namespace} get pods -l ${key}=${value} -o json | jq -r ".items[].status.phase" | wc -l
     Should Be Equal as Integers    ${count}    ${number}
 
-Reboot ONU
-    [Arguments]    ${onu_id}    ${src}   ${dst}
-    [Documentation]   Using voltctl command reboot ONU and verify that ONU comes up to running state
-    ${rc}    ${devices}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device reboot ${onu_id}
-    Should Be Equal As Integers    ${rc}    0
-    Run Keyword and Ignore Error    Wait Until Keyword Succeeds    30   1s    Validate Device
-    ...    ENABLED    ACTIVATING    UNREACHABLE   ${onu_id}    onu=True
-
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index 7ad15b1..00c85c4 100644
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -409,3 +409,13 @@
         Append To List    ${ids}    ${device_id}
     END
     List Should Not Contain Value    ${ids}    ${id}
+
+Reboot ONU
+    [Arguments]    ${onu_id}    ${src}   ${dst}
+    [Documentation]   Using voltctl command reboot ONU and verify that ONU comes up to running state
+    ${rc}    ${devices}=    Run and Return Rc and Output    ${VOLTCTL_CONFIG}; voltctl device reboot ${onu_id}
+    Should Be Equal As Integers    ${rc}    0
+    Run Keyword and Ignore Error    Wait Until Keyword Succeeds    60s   1s    Validate Device
+    ...    ENABLED    DISCOVERED    UNREACHABLE   ${onu_id}    onu=True
+
+
diff --git a/tests/functional/Voltha_FailureScenarios.robot b/tests/functional/Voltha_FailureScenarios.robot
index eb242d0..3eaa53d 100644
--- a/tests/functional/Voltha_FailureScenarios.robot
+++ b/tests/functional/Voltha_FailureScenarios.robot
@@ -11,7 +11,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-# FIXME Can we use the same test against BBSim and Hardware?
 
 *** Settings ***
 Documentation     Test various failure scenarios
@@ -61,12 +60,14 @@
     [Documentation]    Restart ofagent container after VOLTHA is operational.
     ...    Please note this test case should be run before the restart of other containers.
     ...    Prerequisite : ONUs are authenticated and pingable.
-    [Tags]    functional   VOL-2409   ofagentRestart   notready
+    [Tags]    functional   VOL-2409   ofagentRestart
     [Setup]    Run Keywords    Announce Message    START TEST ofagentRestart
     ...        AND             Start Logging    ofagentRestart
     [Teardown]    Run Keywords    Collect Logs
     ...           AND             Stop Logging    ofagentRestart
     ...           AND             Announce Message    END TEST ofagentRestart
+    # Add OLT device
+    setup
     # Performing Sanity Test to make sure subscribers are all AUTH+DHCP and pingable
     Run Keyword If    ${has_dataplane}    Clean Up Linux
     Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test
@@ -95,8 +96,8 @@
     ...           AND             Announce Message    END TEST RestartPods
     ${waitforRestart}    Set Variable    120s
     # Remove the Sanity Check after enabling first failure test (OLT Adapter Test)
-    Run Keyword If    ${has_dataplane}    Clean Up Linux
-    Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test
+    #Run Keyword If    ${has_dataplane}    Clean Up Linux
+    #Wait Until Keyword Succeeds    ${timeout}    2s    Perform Sanity Test
     ${podStatusOutput}=    Run    kubectl get pods -n ${NAMESPACE}
     Log    ${podStatusOutput}
     ${countBforRestart}=    Run    kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
@@ -201,9 +202,26 @@
         ${src}=    Set Variable    ${hosts.src[${I}]}
         ${dst}=    Set Variable    ${hosts.dst[${I}]}
         ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
+        ${onu_port}=    Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2s
+        ...    Get ONU Port in ONOS    ${src['onu']}    ${of_id}
         Reboot ONU    ${onu_device_id}   ${src}   ${dst}
         Verify ping is succesful except for given device     ${num_onus}    ${onu_device_id}
-        Run Keyword If    ${has_dataplane}    Clean Up Linux
-        #Check after reboot that ONUs are active, authenticated/DHCP/pingable
-        Perform Sanity Test
+        # Check ONU port is Enabled in ONOS
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds   120s   2s
+        ...    Verify ONU Port Is Enabled   ${k8s_node_ip}    ${ONOS_SSH_PORT}    ${onu_port}
+        # Verify EAPOL flows are added for the ONU port
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    2s
+        ...    Verify Eapol Flows Added For ONU    ${k8s_node_ip}    ${ONOS_SSH_PORT}    ${onu_port}
+        # Verify ONU state in voltha
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Validate Device
+        ...    ENABLED    ACTIVE    REACHABLE
+        ...    ${src['onu']}    onu=True    onu_reason=omci-flows-pushed
+        # Verify pings are successful after reboot on the current ONU
+        Run Keyword If    ${has_dataplane}    Run Keyword And Continue On Failure
+        ...    Wait Until Keyword Succeeds    60s    2s
+        ...    Check Ping    True    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}    ${src['container_type']}    ${src['container_name']}
     END
+    #Run Keyword If    ${has_dataplane}    Clean Up Linux
+    #Check after reboot that ONUs are active, authenticated/DHCP/pingable
+    #Perform Sanity Test
diff --git a/tests/functional/Voltha_PODTests.robot b/tests/functional/Voltha_PODTests.robot
index c728747..6f3ed05 100644
--- a/tests/functional/Voltha_PODTests.robot
+++ b/tests/functional/Voltha_PODTests.robot
@@ -405,7 +405,7 @@
     Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    ${timeout}    5s    Test Empty Device List
     #Adding setup here to add the devices back since this TC removes the devices
     Run Keyword If    ${has_dataplane}    sleep    180s
-    setup
+    #setup
 
 Sanity E2E Test for OLT/ONU on POD With Core Fail and Restart
     [Documentation]    Deploys an device instance and waits for it to authenticate. After