[VOL-2431]Multiple ONU Reboot Scenario

Change-Id: I0ec6a3e80d9a266b85a8c8e99b877e8a9e6f9857
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 246a6a5..c3b67fe 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -299,3 +299,12 @@
     ${rc}    ${count}    Run and Return Rc and Output
     ...    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/utils.robot b/libraries/utils.robot
index 5e0c05b..6b8b51d 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -281,3 +281,17 @@
     Run Keyword and Ignore Error    Get Device Output from Voltha    ${olt_device_id}
     Run Keyword and Ignore Error    Get Logical Device Output from Voltha    ${logical_id}
     Run Keyword If    ${external_libs}    Get ONOS Status    ${k8s_node_ip}
+
+Verify ping is succesful except for given device
+    [Arguments]    ${num_onus}    ${exceptional_onu_id}
+    [Documentation]    Checks that ping for all the devices are successful except the given ONU.
+    ${pingStatus}     Set Variable    True
+    FOR    ${I}    IN RANGE    0    ${num_onus}
+        ${src}=    Set Variable    ${hosts.src[${I}]}
+        ${dst}=    Set Variable    ${hosts.dst[${I}]}
+        ${onu_device_id}=    Get Device ID From SN    ${src['onu']}
+        ${pingStatus}     Run Keyword If    '${onu_device_id}' == '${exceptional_onu_id}'    Set Variable     False
+        Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    60s    2s
+        ...    Check Ping    ${pingStatus}    ${dst['dp_iface_ip_qinq']}    ${src['dp_iface_name']}
+        ...    ${src['ip']}    ${src['user']}    ${src['pass']}   ${src['container_type']}    ${src['container_name']}
+    END