[VOL-1959] Failure scenario: test ONU adapter crash
Change-Id: I55cc222d1b007a7eae5b6258b3130570db6d6c90
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 781d0b2..62a5b11 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -52,6 +52,20 @@
${rc} ${output}= Run and Return Rc and Output kubectl delete pod ${restart_pod_name} -n ${namespace} --grace-period=0 --force
Log ${output}
+Validate Pod Status
+ [Arguments] ${pod_name} ${namespace} ${expectedStatus}
+ [Documentation] To run the kubectl command and check the status of the given pod matches the expected status
+ ${length}= Run ${KUBECTL_CONFIG}; kubectl get pod -n ${namespace} | wc -l
+ FOR ${index} IN RANGE ${length}-1
+ ${currentPodName}= Run ${KUBECTL_CONFIG}; kubectl get pod -n ${namespace} -o jsonpath={.items[${index}].status.containerStatuses[0].name}
+ Log Required Pod : ${pod_name}
+ Log Current Pod: ${currentPodName}
+ Run Keyword and Ignore Error Run Keyword If '${currentPodName}'=='${pod_name}' Exit For Loop
+ END
+ ${currentStatusofPod}= Run ${KUBECTL_CONFIG}; kubectl get pod -n ${namespace} -o jsonpath={.items[${index}].status.phase}
+ Log ${currentStatusofPod}
+ Should Contain ${currentStatusofPod} ${expectedStatus}
+
Verify All Voltha Pods For Any Error Logs
[Arguments] ${datetime}
[Documentation] This keyword checks for the error occurence in the voltha pods