[VOL-4310] Extending build pipeline to inclue custom aapters, sample adtran

Change-Id: Ica1fe382f7e5e9d5fbb0b473c37599ffcc986580
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 84428df..940b610 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -25,6 +25,8 @@
 
     openoltAdapterChart: onf/voltha-adapter-openolt
 
+    oltAdapterReleaseName: open-olt
+
     <<: *test-pipe-job-boiler-plate
 
     parameters:
@@ -140,7 +142,12 @@
       - string:
           name: openoltAdapterChart
           default: '{openoltAdapterChart}'
-          description: 'OpenOLT chart name (or location on file system)'
+          description: 'Olt adapter chart name (or location on file system)'
+
+      - string:
+          name: oltAdapterReleaseName
+          default: '{oltAdapterReleaseName}'
+          description: 'Olt adapter release name'
 
     concurrent: true
 
@@ -166,6 +173,8 @@
 
     openoltAdapterChart: onf/voltha-adapter-openolt
 
+    oltAdapterReleaseName: open-olt
+
     parameters:
       - string:
           name: buildNode
@@ -249,7 +258,12 @@
       - string:
           name: openoltAdapterChart
           default: '{openoltAdapterChart}'
-          description: 'OpenOLT chart name (or location on file system)'
+          description: 'Olt adapter chart name (or location on file system)'
+
+      - string:
+          name: oltAdapterReleaseName
+          default: '{oltAdapterReleaseName}'
+          description: 'Olt adapter release name'
 
     concurrent: true
 
diff --git a/jjb/pipeline/voltha/master/physical-build.groovy b/jjb/pipeline/voltha/master/physical-build.groovy
index f5a7d74..11e3e9e 100644
--- a/jjb/pipeline/voltha/master/physical-build.groovy
+++ b/jjb/pipeline/voltha/master/physical-build.groovy
@@ -25,6 +25,12 @@
 def infraNamespace = "infra"
 def volthaNamespace = "voltha"
 
+def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) {
+  sh """
+    helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart}
+   """
+}
+
 pipeline {
 
   /* no label, executor is determined by JJB */
@@ -121,6 +127,10 @@
             // adding user specified helm flags at the end so they'll have priority over everything else
             localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
 
+            if(openoltAdapterChart != "") {
+              localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false"
+            }
+
             volthaDeploy([
               workflow: workFlow.toLowerCase(),
               extraHelmFlags: localHelmFlags,
@@ -132,6 +142,10 @@
               etcdReplica: params.NumOfEtcd,
               bbsimReplica: bbsimReplicas.toInteger(),
               ])
+
+              if(openoltAdapterChart != ""){
+                deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
+              }
           }
           sh """
           JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
diff --git a/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy b/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
index 5244628..fb860ea 100644
--- a/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
+++ b/jjb/pipeline/voltha/voltha-2.8/physical-build.groovy
@@ -25,6 +25,12 @@
 def infraNamespace = "infra"
 def volthaNamespace = "voltha"
 
+def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) {
+  sh """
+    helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart}
+   """
+}
+
 pipeline {
 
   /* no label, executor is determined by JJB */
@@ -121,6 +127,10 @@
             // adding user specified helm flags at the end so they'll have priority over everything else
             localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
 
+            if(openoltAdapterChart != "") {
+              localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false"
+            }
+
             volthaDeploy([
               workflow: workFlow.toLowerCase(),
               extraHelmFlags: localHelmFlags,
@@ -132,6 +142,10 @@
               etcdReplica: params.NumOfEtcd,
               bbsimReplica: bbsimReplicas.toInteger(),
               ])
+
+              if(openoltAdapterChart != ""){
+                deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
+              }
           }
           sh """
           JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index b3f7b19..01dbddf 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -494,11 +494,13 @@
           branch: 'voltha-2.8'
           profile: '1T8GEM'
           reinstall-olt: false
+          extraHelmFlags: "--set adapter_adtran_olt.kv_store_data_prefix='service/voltha/voltha_voltha' --set global.image_registry='10.34.90.43:443/' --set global.image_org='' --set network.netconfUserSecret='' --set adapter_adtran_olt.topics.core_topic=voltha_voltha_rwcore"
           num-of-onos: '3'
           num-of-atomix: '3'
           pipeline-script: 'voltha/voltha-2.8/physical-build.groovy'
           VolthaEtcdPort: 9999
           openoltAdapterChart: '/home/community/adtran-21.4-voltha-2.8/voltha-adapter-adtran-olt'
+          oltAdapterReleaseName: 'adtran-olt'
           time: '21'
 
       # Berlin POD adtran test job - 2.8 versions: uses 1T8GEM tech profile on voltha branch