[VOL-2963] - Restart all adapter-open-onu PODs
Change-Id: I39e0b6f7d9420ee5262d0c3f2e05a60cbf89781f
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 5861025..d1ef61c 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -124,6 +124,16 @@
Log ${currentStatusofPod}
Should Contain ${currentStatusofPod} ${expectedStatus}
+Validate Pods Status By Label
+ [Arguments] ${namespace} ${label_key} ${label_value} ${expectedStatus}
+ [Documentation] To run the kubectl command and check the status of all pods filter
+ ... by label matche the expected status
+ ${command}= Catenate
+ ... kubectl -n ${namespace} get pods -l ${label_key}=${label_value}
+ ... -o=jsonpath="{.items[?(.status.phase=='${expectedStatus}')].status.phase}"
+ ${pods_status}= Run ${command}
+ Should Not Be Equal ${pods_status} ${EMPTY} Can't filter out Pods with exptected status ${expectedStatus}
+
Verify All Voltha Pods For Any Error Logs
[Arguments] ${datetime}
[Documentation] This keyword checks for the error occurence in the voltha pods
diff --git a/tests/functional/Voltha_FailureScenarios.robot b/tests/functional/Voltha_FailureScenarios.robot
index 41177c2..4b3e74c 100644
--- a/tests/functional/Voltha_FailureScenarios.robot
+++ b/tests/functional/Voltha_FailureScenarios.robot
@@ -366,7 +366,7 @@
Sleep 60s
# Restart the onu
${podName} Set Variable adapter-open-onu
- Wait Until Keyword Succeeds ${timeout} 15s Restart Pod ${NAMESPACE} ${podName}
+ Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
# Validate ONU Ports
FOR ${I} IN RANGE 0 ${num_onus}
${src}= Set Variable ${hosts.src[${I}]}
@@ -381,8 +381,8 @@
... ${src['container_type']} ${src['container_name']}
Run Keyword If ${has_dataplane} Should Contain ${output} SUCCESS
END
- Wait Until Keyword Succeeds ${timeout} 2s Validate Pod Status ${podName} ${NAMESPACE}
- ... Running
+ Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
+ ... app ${podName} Running
# Wait for adapter to resync
Sleep 60s
Run Keyword If ${has_dataplane} Clean Up Linux