Merge "clean up and rename openonu go targets (This is one part of a patch pair, the other one is https://gerrit.opencord.org/c/voltha-system-tests/+/24547)"
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
index 2e2179c..7a6fd92 100644
--- a/jjb/pipeline/voltha/master/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -178,14 +178,14 @@
     aborted {
       getPodsInfo("$WORKSPACE/failed")
       sh """
-      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log
+      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
       """
       archiveArtifacts artifacts: '**/*.log,**/*.txt'
     }
     failure {
       getPodsInfo("$WORKSPACE/failed")
       sh """
-      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs
+      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
       """
       archiveArtifacts artifacts: '**/*.log,**/*.txt'
     }
diff --git a/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy b/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
index 5cb38ed..ebacea8 100644
--- a/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/periodic-bbsim-tests.groovy
@@ -47,6 +47,11 @@
       timeout(20) {
         script {
 
+          sh """
+          mkdir -p $WORKSPACE/${testTarget}-components
+          _TAG=kail-startup kail -n infra -n voltha > $WORKSPACE/${testTarget}-components/onos-voltha-startup-combined.log &
+          """
+
           // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
           def localCharts = false
           if (volthaHelmChartsChange != "") {
@@ -54,10 +59,16 @@
           }
 
           // NOTE temporary workaround expose ONOS node ports
-          def localHelmFlags = extraHelmFlags + " --set onos-classic.onosSshPort=30115 " +
+          def localHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel.toUpperCase()} " +
+          " --set onos-classic.onosSshPort=30115 " +
           " --set onos-classic.onosApiPort=30120 " +
           " --set onos-classic.onosOfPort=31653 " +
           " --set onos-classic.individualOpenFlowNodePorts=true " + testSpecificHelmFlags
+
+          if (gerritProject != "") {
+            localHelmFlags = "${localHelmFlags} " + getVolthaImageFlags("${gerritProject}")
+          }
+
           volthaDeploy([
             infraNamespace: infraNamespace,
             volthaNamespace: volthaNamespace,
@@ -68,12 +79,18 @@
             dockerRegistry: registry,
             ])
         }
+
+        // stop logging
+        sh """
+          P_IDS="\$(ps e -ww -A | grep "_TAG=kail-startup" | grep -v grep | awk '{print \$1}')"
+          if [ -n "\$P_IDS" ]; then
+            echo \$P_IDS
+            for P_ID in \$P_IDS; do
+              kill -9 \$P_ID
+            done
+          fi
+        """
       }
-      // start logging
-      sh """
-      mkdir -p $WORKSPACE/${testTarget}-components
-      _TAG=kail-${workflow} kail -n infra -n voltha > $WORKSPACE/${testTarget}-components/onos-voltha-combined.log &
-      """
       sh """
       JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
       JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-etcd" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-etcd 2379:2379; done"&
@@ -83,6 +100,11 @@
     }
   }
   stage('Run test ' + testTarget + ' on ' + workflow + ' workFlow') {
+    // start logging
+    sh """
+    mkdir -p $WORKSPACE/${testTarget}-components
+    _TAG=kail-${workflow} kail -n infra -n voltha > $WORKSPACE/${testTarget}-components/onos-voltha-combined.log &
+    """
     sh """
     mkdir -p $WORKSPACE/${robotLogsDir}/${testTarget}-robot
     export ROBOT_MISC_ARGS="-d $WORKSPACE/${robotLogsDir}/${testTarget}-robot "
@@ -108,7 +130,7 @@
 def collectArtifacts(exitStatus) {
   getPodsInfo("$WORKSPACE/${exitStatus}")
   sh """
-  kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log
+  kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log || true
   """
   archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt,**/*.html'
   sh '''
@@ -156,6 +178,19 @@
         ])
       }
     }
+    stage('Build patch') {
+      // build the patch only if gerritProject is specified
+      when {
+        expression {
+          return !gerritProject.isEmpty()
+        }
+      }
+      steps {
+        // NOTE that the correct patch has already been checked out
+        // during the getVolthaCode step
+        buildVolthaComponent("${gerritProject}")
+      }
+    }
     stage('Create K8s Cluster') {
       steps {
         script {
@@ -168,6 +203,16 @@
         }
       }
     }
+    stage('Load image in kind nodes') {
+      when {
+        expression {
+          return !gerritProject.isEmpty()
+        }
+      }
+      steps {
+        loadToKind()
+      }
+    }
     stage('Parse and execute tests') {
         steps {
           script {
diff --git a/jjb/pipeline/voltha/master/physical-build.groovy b/jjb/pipeline/voltha/master/physical-build.groovy
index 4a0a9d6..fcffecf 100644
--- a/jjb/pipeline/voltha/master/physical-build.groovy
+++ b/jjb/pipeline/voltha/master/physical-build.groovy
@@ -338,6 +338,20 @@
   }
 
   post {
+    aborted {
+      getPodsInfo("$WORKSPACE/failed")
+      sh """
+      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
+      """
+      archiveArtifacts artifacts: '**/*.log,**/*.txt'
+    }
+    failure {
+      getPodsInfo("$WORKSPACE/failed")
+      sh """
+      kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
+      """
+      archiveArtifacts artifacts: '**/*.log,**/*.txt'
+    }
     always {
       archiveArtifacts artifacts: '*.txt'
     }
diff --git a/jjb/pipeline/voltha/master/software-upgrades.groovy b/jjb/pipeline/voltha/master/software-upgrades.groovy
index 16c0bcb..86443a3 100644
--- a/jjb/pipeline/voltha/master/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/master/software-upgrades.groovy
@@ -206,6 +206,11 @@
         """
       }
     }
+    stage('Create K8s Cluster') {
+      steps {
+        createKubernetesCluster([nodes: 3])
+      }
+    }
     stage('Run Test') {
       steps {
         test_software_upgrade("onos-app-upgrade")
diff --git a/jjb/pipeline/voltha/voltha-2.7/software-upgrades.groovy b/jjb/pipeline/voltha/voltha-2.7/software-upgrades.groovy
index e9623d6..124e05b 100644
--- a/jjb/pipeline/voltha/voltha-2.7/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/voltha-2.7/software-upgrades.groovy
@@ -202,6 +202,11 @@
         """
       }
     }
+    stage('Create K8s Cluster') {
+      steps {
+        createKubernetesCluster([nodes: 3])
+      }
+    }
     stage('Run Test') {
       steps {
         test_software_upgrade("onos-app-upgrade")
diff --git a/jjb/software-upgrades.yaml b/jjb/software-upgrades.yaml
index 170fea5..971511d 100644
--- a/jjb/software-upgrades.yaml
+++ b/jjb/software-upgrades.yaml
@@ -9,7 +9,7 @@
       - 'software-upgrades-test':
           name: 'periodic-software-upgrade-test-bbsim'
           pipeline-script: 'voltha/master/software-upgrades.groovy'
-          build-node: 'qct-pod4-node2'
+          build-node: 'ubuntu18.04-basebuild-8c-15g'
           code-branch: 'master'
           aaa-version: '2.4.0.SNAPSHOT'
           aaa-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.4.0-SNAPSHOT/aaa-app-2.4.0-20210504.145538-2.oar'
@@ -39,7 +39,7 @@
       - 'software-upgrades-test':
           name: 'periodic-software-upgrade-test-bbsim-2.7'
           pipeline-script: 'voltha/voltha-2.7/software-upgrades.groovy'
-          build-node: 'qct-pod4-node2'
+          build-node: 'ubuntu18.04-basebuild-8c-15g'
           code-branch: 'voltha-2.7'
           aaa-version: '2.3.0'
           aaa-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/aaa-app/2.3.0/aaa-app-2.3.0.oar'
@@ -56,7 +56,7 @@
           kafka-version: '2.6.0'
           kafka-oar-url: 'https://oss.sonatype.org/content/groups/public/org/opencord/kafka/2.6.0/kafka-2.6.0.oar'
           adapter-open-olt-image: 'voltha/voltha-openolt-adapter:3.1.8'
-          adapter-open-onu-image: 'voltha/voltha-openonu-adapter-go:1.2.8'
+          adapter-open-onu-image: 'voltha/voltha-openonu-adapter-go:1.2.11'
           rw-core-image: 'voltha/voltha-rw-core:2.7.0'
           ofagent-image: 'voltha/voltha-ofagent-go:1.5.2'
           onu-image-name: 'software-image.img'
diff --git a/jjb/verify/kind-voltha.yaml b/jjb/verify/kind-voltha.yaml
index cf7e1ff..8b43798 100644
--- a/jjb/verify/kind-voltha.yaml
+++ b/jjb/verify/kind-voltha.yaml
@@ -21,3 +21,4 @@
           pipeline-script: 'voltha/voltha-2.7/voltha-bbsim-tests.groovy'
           name-extension: '-2.7'
           override-branch: 'voltha-2.7'
+          kindVolthaChange: '$GERRIT_REFSPEC'
diff --git a/jjb/verify/opendevice-manager.yaml b/jjb/verify/opendevice-manager.yaml
index f3ee4b4..14f09ae 100644
--- a/jjb/verify/opendevice-manager.yaml
+++ b/jjb/verify/opendevice-manager.yaml
@@ -8,6 +8,8 @@
     jobs:
       - 'verify-opendevice-manager-jobs':
           branch-regexp: '{all-branches-regexp}'
+      - 'publish-voltha-opendevice-manager-jobs':
+          branch-regexp: '{all-branches-regexp}'
 
 - job-group:
     name: 'verify-opendevice-manager-jobs'
@@ -20,3 +22,13 @@
           # opendm-agent uses gtest which outputs in xunit format
           junit-allow-empty-results: true
           xunit-skip-if-no-test-files: false
+
+- job-group:
+    name: 'publish-voltha-opendevice-manager-jobs'
+    jobs:
+      - 'docker-publish':
+          build-timeout: 30
+          docker-repo: 'voltha'
+          dependency-jobs: 'version-tag'
+
+
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index 27f6c51..b211dd4 100755
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -24,12 +24,8 @@
       - 'voltha-periodic-test':
           name: 'periodic-voltha-test-bbsim'
           code-branch: 'master'
-          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master --set onu=2,pon=2'
+          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
           time-trigger: "H H/23 * * *"
-          # NOTE why not a remote executor?
-          build-node: 'qct-pod4-node2'
-          registry: 'registry.menlo.onlab.us'
-          volthaSystemTestsChange: refs/changes/92/24492/1
           testTargets: |
             - target: functional-single-kind
               workflow: att
@@ -50,9 +46,6 @@
 
       - 'voltha-periodic-test':
           name: 'periodic-voltha-multiple-olts-test-bbsim'
-          # NOTE why not a remote executor?
-          build-node: 'qct-pod4-node2'
-          registry: 'registry.menlo.onlab.us'
           code-branch: 'master'
           olts: 2
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master --set onu=2,pon=2'
@@ -97,6 +90,7 @@
           code-branch: 'master'
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
           time-trigger: "H H/12 * * *"
+          logLevel: 'DEBUG'
           testTargets: |
             - target: 1t1gem-openonu-go-adapter-test
               workflow: att
@@ -129,11 +123,12 @@
 
       - 'voltha-periodic-test':
           name: 'patchset-voltha-openonu-go-test-bbsim'
-          trigger-comment: "voltha test openonu"
+          trigger-comment: "voltha test openonu singleolt"
           code-branch: '$GERRIT_BRANCH'
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
           gerrit-project: '$GERRIT_PROJECT'
           gerritRefspec: '$GERRIT_REFSPEC'
+          logLevel: 'DEBUG'
           testTargets: |
             - target: 1t1gem-openonu-go-adapter-test
               workflow: att
@@ -181,10 +176,9 @@
       - 'voltha-periodic-test':
           name: 'periodic-voltha-multiple-olts-openonu-go-test-bbsim'
           code-branch: 'master'
-          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
+          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master --set onu=2,pon=2'
           olts: 2
-          onus: 2
-          pons: 2
+          logLevel: 'DEBUG'
           testTargets: |
             - target: 1t1gem-openonu-go-adapter-multi-olt-test
               workflow: att
@@ -216,10 +210,10 @@
           name: 'patchset-voltha-multiple-olts-openonu-go-test-bbsim'
           trigger-comment: "voltha test openonu multiolt"
           code-branch: '$GERRIT_BRANCH'
-          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
+          extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master --set onu=2,pon=2'
           gerrit-project: '$GERRIT_PROJECT'
           gerritRefspec: '$GERRIT_REFSPEC'
-          extraHelmFlags: '--set onu=2,pon=2'
+          logLevel: 'DEBUG'
           testTargets: |
             - target: 1t1gem-openonu-go-adapter-multi-olt-test
               workflow: att
@@ -266,9 +260,6 @@
 
       - 'voltha-periodic-test':
           name: 'periodic-voltha-test-DMI'
-          # NOTE why not a remote executor?
-          build-node: 'qct-pod4-node2'
-          registry: 'registry.menlo.onlab.us'
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
           code-branch: 'master'
           time-trigger: "H H/23 * * *"
@@ -297,8 +288,6 @@
           make-target-alarmtest: bbsim-alarms-kind
           withAlarms: true
           code-branch: 'voltha-2.7'
-          onus: 2
-          pons: 2
           time-trigger: "H H * * *"
 
       - 'voltha-periodic-test':
@@ -325,9 +314,6 @@
 
       - 'voltha-periodic-test':
           name: 'periodic-voltha-sanity-test-multi-runs'
-          # NOTE why not a remote executor?
-          build-node: 'qct-pod4-node2'
-          registry: 'registry.menlo.onlab.us'
           code-branch: 'master'
           time-trigger: "H H/23 * * *"
           extraHelmFlags: '--set global.image_tag=master --set onos-classic.image.tag=master'
@@ -462,6 +448,7 @@
     registry:  mirror.registry.opennetworking.org
     sandbox: true
     olts: 1
+    logLevel: 'INFO'
 
     trigger-comment: vv7CBoQQYYonvaN8xcru
     time-trigger: 0 0 29 2 *
@@ -546,6 +533,11 @@
           default: '{registry}'
           description: 'Which registry to use (amazon vs menlo)'
 
+      - string:
+          name: logLevel
+          default: '{logLevel}'
+          description: 'Log level for all the components'
+
     project-type: pipeline
     concurrent: true
 
@@ -751,6 +743,7 @@
     volthaHelmChartsChange: ''
     extraHelmFlags: ''
     branch-regexp: '{all-branches-regexp}'
+    kindVolthaChange: '' # this is only needed to test kind-voltha patches
 
     description: |
       <!-- Managed by Jenkins Job Builder -->
@@ -803,6 +796,12 @@
           default: '{override-branch}'
           description: 'Name of the branch to use'
 
+      # Used in the 2.7 based pipeline, can be removed after 2.8
+      - string:
+          name: kindVolthaChange
+          default: '{kindVolthaChange}'
+          description: 'Download a change for gerrit in the kind-voltha repo, example value: "refs/changes/32/19132/1" (only used to test kind-voltha changes in 2.7)'
+
     project-type: pipeline
     concurrent: true
 
diff --git a/jjb/voltha-test/voltha-nightly-jobs.yaml b/jjb/voltha-test/voltha-nightly-jobs.yaml
index a682632..e9e960e 100644
--- a/jjb/voltha-test/voltha-nightly-jobs.yaml
+++ b/jjb/voltha-test/voltha-nightly-jobs.yaml
@@ -151,7 +151,7 @@
           default: '{cordTesterChange}'
           description: 'Download a change for gerrit in the kind-voltha repo, example value: "refs/changes/32/19132/1"'
 
-      # NOTE is this needed/used?
+      # this is used in the Adtran DT job
       - string:
           name: openoltAdapterChart
           default: '{openoltAdapterChart}'
diff --git a/jjb/voltha-test/voltha.yaml b/jjb/voltha-test/voltha.yaml
index 6091b84..12a4a36 100644
--- a/jjb/voltha-test/voltha.yaml
+++ b/jjb/voltha-test/voltha.yaml
@@ -371,7 +371,7 @@
           pipeline-script: 'voltha-physical-soak-dt-tests.groovy'
           time-trigger: "H H */3 * *"
 
-        # Berlin pod with olt/onu - master versions timer based job , two OLTs
+      # Certification (Radisys) pod with olt/onu - master versions timer based job , two OLTs
       - 'build_voltha_pod_release_timer':
           build-node: 'menlo-certification-pod'
           config-pod: 'menlo-certification-pod-radisys-gpon'
@@ -382,7 +382,7 @@
           profile: '1T8GEM-unencrypted'
           time: '1'
 
-          # Berlin POD test job - master versions: uses tech profile on voltha branch
+      # Certification (Radisys) POD test job - master versions: uses tech profile on voltha branch
       - 'build_voltha_pod_test':
           build-node: 'menlo-certification-pod'
           config-pod: 'menlo-certification-pod-radisys-gpon'
@@ -575,3 +575,32 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-test'
+
+      # Berlin pod with adtran gpon olt/onu - master 1T8GEM tech profile and timer based job
+      - 'build_voltha_pod_release_timer':
+          build-node: 'dt-berlin-community-pod'
+          config-pod: 'dt-berlin-pod-gpon-adtran'
+          release: '2.6'
+          branch: 'voltha-2.6'
+          VolthaEtcdPort: 9999
+          name-extension: '_DT'
+          work-flow: 'DT'
+          profile: '1T8GEM'
+          reinstall-olt: false
+          Jenkinsfile: 'Jenkinsfile-voltha-build' # we are cloning voltha-system-test@2.6 that still has it
+          openoltAdapterChart: '/home/community/adtran-2021-01-29/voltha-adapter-adtran-olt'
+          time: '7'
+
+      # Berlin POD adtran test job - master versions: uses 1T8GEM tech profile on voltha branch
+      - 'build_voltha_pod_test':
+          build-node: 'dt-berlin-community-pod'
+          config-pod: 'dt-berlin-pod-gpon-adtran'
+          name-extension: '_DT'
+          work-flow: 'DT'
+          release: '2.6'
+          branch: 'voltha-2.6'
+          test-repo: 'voltha-system-tests'
+          profile: '1T8GEM'
+          power-switch: True
+          oltAdapterAppLabel: 'adapter-adtran-olt'
+          pipeline-script: 'voltha-dt-physical-functional-tests.groovy'