Supporting multiple ONOSes in volthaInfraDeploy keyword
Change-Id: Ia67c52b29500f6e15c9f9c7d938b7a30ae42a527
diff --git a/vars/getVolthaImageFlags.groovy b/vars/getVolthaImageFlags.groovy
new file mode 100644
index 0000000..334cefd
--- /dev/null
+++ b/vars/getVolthaImageFlags.groovy
@@ -0,0 +1,37 @@
+// returns the helm flags required to override a specific image
+def call(String project = "unknown", String tag = "citest", String pullPolicy = "Never") {
+ def chart = "unknown"
+ def image = "unknown"
+ switch(project) {
+ case "ofagent-go":
+ chart = "voltha"
+ image = "ofagent"
+ break
+ case "voltha-go":
+ chart = "voltha"
+ image = "rw_core"
+ break
+ case "voltha-openonu-adapter-go":
+ chart = "voltha-adapter-openonu"
+ image = "adapter_open_onu_go"
+ break
+ // TODO remove after 2.7
+ case "voltha-openonu-adapter":
+ chart = "voltha-adapter-openonu"
+ image = "adapter_open_onu"
+ break
+ // TODO end
+ case "voltha-openolt-adapter":
+ chart = "voltha-adapter-openolt"
+ image = "adapter_open_olt"
+ break
+ case "bbsim":
+ // BBSIM has a different format that voltha, return directly
+ return "--set images.bbsim.tag=${tag},images.bbsim.pullPolicy=${pullPolicy}"
+ break
+ default:
+ break
+ }
+
+ return "--set ${chart}.images.${image}.tag=${tag},${chart}.images.${image}.pullPolicy=${pullPolicy} "
+}
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
index 37f5846..e7af5e2 100644
--- a/vars/volthaInfraDeploy.groovy
+++ b/vars/volthaInfraDeploy.groovy
@@ -49,6 +49,7 @@
// TODO support multiple replicas
sh """
helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra ${volthaInfraChart} ${cfg.extraHelmFlags} \
+ --set onos-classic.replicas=${cfg.onosReplica},onos-classic.atomix.replicas=${cfg.atomixReplica} \
-f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml
"""
}