[VOL-3490] Checking number of ONOS instances prior to HA test
Change-Id: I2445a8d7e5f472a08770fca5efcf546e7d837298
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 5d8eb5a..09db866 100755
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -400,3 +400,10 @@
${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}
+
+Get Number of Running Pods Number By Label
+ [Arguments] ${namespace} ${key} ${value}
+ [Documentation] Returns the number of pods for a given label
+ ${rc} ${count} Run and Return Rc and Output
+ ... kubectl -n ${namespace} get pods -l ${key}=${value} -o name | wc -l
+ [Return] ${count}
diff --git a/tests/functional/Voltha_ONOSHATests.robot b/tests/functional/Voltha_ONOSHATests.robot
index 4ad78ee..1ba78af 100644
--- a/tests/functional/Voltha_ONOSHATests.robot
+++ b/tests/functional/Voltha_ONOSHATests.robot
@@ -49,6 +49,7 @@
${logical_id} 0
${has_dataplane} True
${teardown_device} True
+${numOfOnos} 1
${scripts} ../../scripts
${workflow} ATT
@@ -64,6 +65,9 @@
[Setup] Start Logging onosMasterRestart
[Teardown] Run Keywords Collect Logs
... AND Stop Logging onosMasterRestart
+ ${numOfOnos}= Wait Until Keyword Succeeds 20s 5s Get Number of Running Pods Number By Label default
+ ... app onos-onos-classic
+ Pass Execution If ${numOfOnos} == 1 Skipping test: just one instance of ONOS
Delete All Devices and Verify
Setup
Run Keyword If ${has_dataplane} Clean Up Linux