Waiting for adapters to be registered before marking VOLTHA as ready
Change-Id: I2f3079c0d5bab3bc8291c874af438c1611dd6ae2
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index ae8533c..594be03 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -84,6 +84,22 @@
done
"""
+ println "Wait for adapters to be registered"
+
+ // guarantee that at least two adapters are registered with VOLTHA before proceeding
+ // this is potentially open to issue if we'll run test with multiple adapter pairs (eg: adtran + open)
+ // untill then it is safe to assume we'll be ready once we have two adapters in the system
+ sh """
+ set +x
+ _TAG="voltha-voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${cfg.volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
+ adapters=\$(voltctl adapter list -q | wc -l)
+ while [[ \$adapters -lt 2 ]]; do
+ sleep 5
+ adapters=\$(voltctl adapter list -q | wc -l)
+ done
+ ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true
+ """
+
// also make sure that the ONOS config is loaded
// NOTE that this is only required for VOLTHA-2.8
println "Wait for ONOS Config loader to complete"
@@ -98,7 +114,7 @@
done
"""
// NOTE that this is only required for VOLTHA-2.9 onwards, to wait until the pod completed,
- //meaning ONOS fully deployed
+ // meaning ONOS fully deployed
sh """
set +x
config=\$(kubectl get pods -l app=onos-config-loader -n ${cfg.infraNamespace} --no-headers --field-selector=status.phase=Running | grep "0/" | wc -l)