[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
diff --git a/libraries/utils.robot b/libraries/utils.robot
index cc7e1df..c235383 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -126,3 +126,11 @@
Log ${result}
#Should Contain ${result} DHCPRELEASE
[Return] ${result}
+
+Check Remote File Contents For WPA Logs
+ [Arguments] ${file_should_exist} ${file} ${pattern} ${ip} ${user} ${pass}=${None} ${container_type}=${None}
+ ... ${container_name}=${None} ${prompt}=~$
+ [Documentation] Checks for particular pattern count in a file
+ ${result}= Login And Run Command On Remote System cat ${file} | grep '${pattern}' | wc -l ${ip} ${user} ${pass}
+ ... ${container_type} ${container_name} ${prompt}
+ [Return] ${result}