Updated dmi-build-and-test pipeline with option to choose Voltha Infra and Stack deployments

Change-Id: Iec45b090782eb53bf990f5807d21a46374dddd12
diff --git a/jjb/pipeline/voltha/master/dmi-build-and-test.groovy b/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
index 3138e81..afa034f 100755
--- a/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
+++ b/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
@@ -93,11 +93,6 @@
       }
     }
     stage('Install Voltha')  {
-      when {
-        expression {
-          return installVoltha.toBoolean()
-        }
-      }
       steps {
         timeout(20) {
           installVoltctl("${branch}")
@@ -156,14 +151,18 @@
               etcdReplica: params.NumOfEtcd,
               bbsimReplica: bbsimReplicas.toInteger(),
               adaptersToWait: numberOfAdaptersToWait,
+              withVolthaInfra: installVolthaInfra.toBoolean(),
+              withVolthaStack: installVolthaStack.toBoolean(),
               ])
 
-            if(openoltAdapterChart != "onf/voltha-adapter-openolt"){
-              extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}"
-              deploy_custom_chart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
-              waitForAdapters([
-                adaptersToWait: 2
-              ])
+            if(installVolthaStack.toBoolean()) {
+              if(openoltAdapterChart != "onf/voltha-adapter-openolt"){
+                extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}"
+                deploy_custom_chart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
+                waitForAdapters([
+                  adaptersToWait: 2
+                ])
+              }
             }
           }
           sh """
diff --git a/jjb/voltha-test/voltha-nightly-jobs.yaml b/jjb/voltha-test/voltha-nightly-jobs.yaml
index 626e393..30a2194 100644
--- a/jjb/voltha-test/voltha-nightly-jobs.yaml
+++ b/jjb/voltha-test/voltha-nightly-jobs.yaml
@@ -709,7 +709,8 @@
     <<: *voltha-pipe-job-boiler-plate
     # default values
     pipeline-script: 'voltha/master/dmi-build-and-test.groovy'
-    installVoltha: true
+    installVolthaInfra: true
+    installVolthaStack: true
     VolthaEtcdPort: 2379
     num-of-openonu: 1
     num-of-onos: 3
@@ -802,9 +803,14 @@
           description: 'Installs and uses the specified work flow on the POD'
 
       - bool:
-          name: installVoltha
-          default: '{installVoltha}'
-          description: "Whether to install VOLTHA"
+          name: installVolthaInfra
+          default: '{installVolthaInfra}'
+          description: "Whether to install VOLTHA Infra"
+
+      - bool:
+          name: installVolthaStack
+          default: '{installVolthaStack}'
+          description: "Whether to install VOLTHA Stack"
 
       - string:
           name: extraHelmFlags
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index c091a4e..0d1d267 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -589,7 +589,8 @@
           release: 'master'
           branch: 'master'
           profile: 'Default'
-          installVoltha: false
+          installVolthaInfra: true
+          installVolthaStack: false
           reinstall-olt: false
           restart-olt: false
           extraHelmFlags: " -f /home/community/SDX_Device_Manager_21.4/helm/values-onf.yaml "
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index 7936e5a..aad754b 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -19,6 +19,8 @@
       localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
       dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
       kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
+      withVolthaInfra: true,
+      withVolthaStack: true,
     ]
 
     if (!config) {
@@ -50,7 +52,11 @@
 
     println "Deploying VOLTHA with the following parameters: ${cfg}."
 
-    volthaInfraDeploy(cfg)
+    if (cfg.withVolthaInfra) {
+      volthaInfraDeploy(cfg)
+    }
 
-    volthaStackDeploy(cfg)
+    if (cfg.withVolthaStack) {
+      volthaStackDeploy(cfg)
+    }
 }