Prep work for creating jenkins v2.10 and 2.11 job views.

jjb/pipeline/voltha/master/*
----------------------------
  o Update copyright notice to be current.

jjb/pipeline/voltha/voltha-2.10/bbsim-tests.groovy
--------------------------------------------------
  o Debugging: augment script to self-identify
  o Debugging: determine if a shell command is available.

jjb/verify/bbsim.yaml
---------------------
  o Add a version definition and bbsim test job for 2.10 & 2.11

vars/installVoltctl.groovy
--------------------------
  o Convert if-then-else block into a dictionary to simplify
    version detection logic.
  o Minor cleanups for the shellcheck tool
     o Quote environment vars
     o Fold long shell pipelines across multiple lines for readability.
  o [DEBUG] Added enter/leave printlns() to help identify a problem
    source from context in the log.  Null appeared in a kubectl setup
    for etcd.

Change-Id: I3fa824dffc1f37614c569faa1e1829a7466202b3
diff --git a/jjb/pipeline/voltha/master/bbsim-tests.groovy b/jjb/pipeline/voltha/master/bbsim-tests.groovy
index edfcb6c..b99bb25 100755
--- a/jjb/pipeline/voltha/master/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/master/bbsim-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2021-present Open Networking Foundation
+// Copyright 2021-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/device-management-mock-tests.groovy b/jjb/pipeline/voltha/master/device-management-mock-tests.groovy
index 8a15ac6..28aeec6 100644
--- a/jjb/pipeline/voltha/master/device-management-mock-tests.groovy
+++ b/jjb/pipeline/voltha/master/device-management-mock-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/dmi-build-and-test.groovy b/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
index afa034f..926da46 100755
--- a/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
+++ b/jjb/pipeline/voltha/master/dmi-build-and-test.groovy
@@ -1,4 +1,4 @@
-// Copyright 2022-present Open Networking Foundation
+// Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
 
 // NOTE we are importing the library even if it's global so that it's
 // easier to change the keywords during a replay
+
 library identifier: 'cord-jenkins-libraries@master',
     retriever: modernSCM([
       $class: 'GitSCMSource',
diff --git a/jjb/pipeline/voltha/master/physical-build.groovy b/jjb/pipeline/voltha/master/physical-build.groovy
index ab8928d..2cb5b2e 100755
--- a/jjb/pipeline/voltha/master/physical-build.groovy
+++ b/jjb/pipeline/voltha/master/physical-build.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/software-upgrades.groovy b/jjb/pipeline/voltha/master/software-upgrades.groovy
index 92f772b..e21e165 100755
--- a/jjb/pipeline/voltha/master/software-upgrades.groovy
+++ b/jjb/pipeline/voltha/master/software-upgrades.groovy
@@ -1,4 +1,4 @@
-// Copyright 2021-present Open Networking Foundation
+// Copyright 2021-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/tucson-build-and-test.groovy b/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
index f9f9e04..66aeff8 100644
--- a/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
+++ b/jjb/pipeline/voltha/master/tucson-build-and-test.groovy
@@ -1,5 +1,4 @@
-
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,6 +14,7 @@
 // used to deploy VOLTHA and configure ONOS physical PODs
 // NOTE we are importing the library even if it's global so that it's
 // easier to change the keywords during a replay
+
 library identifier: 'cord-jenkins-libraries@master',
     retriever: modernSCM([
       $class: 'GitSCMSource',
diff --git a/jjb/pipeline/voltha/master/voltha-dt-physical-functional-tests.groovy b/jjb/pipeline/voltha/master/voltha-dt-physical-functional-tests.groovy
index c6e63d2..864ca3b 100644
--- a/jjb/pipeline/voltha/master/voltha-dt-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha/master/voltha-dt-physical-functional-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/voltha-physical-functional-tests.groovy b/jjb/pipeline/voltha/master/voltha-physical-functional-tests.groovy
index afc0127..1031cf9 100644
--- a/jjb/pipeline/voltha/master/voltha-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha/master/voltha-physical-functional-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/voltha-physical-soak-dt-tests.groovy b/jjb/pipeline/voltha/master/voltha-physical-soak-dt-tests.groovy
index 5039890..5e655ce 100644
--- a/jjb/pipeline/voltha/master/voltha-physical-soak-dt-tests.groovy
+++ b/jjb/pipeline/voltha/master/voltha-physical-soak-dt-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/voltha-scale-lwc-test.groovy b/jjb/pipeline/voltha/master/voltha-scale-lwc-test.groovy
index 75b48e2..8431216 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-lwc-test.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-lwc-test.groovy
@@ -1,4 +1,4 @@
-// Copyright 2019-present Open Networking Foundation
+// Copyright 2019-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
       remote: 'https://gerrit.opencord.org/ci-management.git'
 ])
 
+// [TODO] fix path, achilles heel for testing.
 def lwc_helm_chart_path="/home/jenkins/Radisys_LWC_helm_charts"
 def value_file="/home/jenkins/lwc-values.yaml"
 def workflow="dt"
diff --git a/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy b/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
index 56ddf59..29a9f62 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
@@ -1,5 +1,4 @@
-// Copyright 2019-present Open Networking Foundation
-//
+// Copyright 2019-2022 Open Networking Foundation (ONF) and the ONF Contributors//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
diff --git a/jjb/pipeline/voltha/master/voltha-scale-test.groovy b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
index dc738e7..2c757d9 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
@@ -1,4 +1,4 @@
-// Copyright 2019-present Open Networking Foundation
+// Copyright 2019-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/master/voltha-tt-physical-functional-tests.groovy b/jjb/pipeline/voltha/master/voltha-tt-physical-functional-tests.groovy
index 90470f5..a7ec0b6 100644
--- a/jjb/pipeline/voltha/master/voltha-tt-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha/master/voltha-tt-physical-functional-tests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2017-present Open Networking Foundation
+// Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
diff --git a/jjb/pipeline/voltha/voltha-2.10/bbsim-tests.groovy b/jjb/pipeline/voltha/voltha-2.10/bbsim-tests.groovy
index edfcb6c..5f68dbc 100755
--- a/jjb/pipeline/voltha/voltha-2.10/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/voltha-2.10/bbsim-tests.groovy
@@ -1,5 +1,4 @@
-// Copyright 2021-present Open Networking Foundation
-//
+// Copyright 2021-2022 Open Networking Foundation (ONF) and the ONF Contributors//
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
@@ -27,7 +26,32 @@
   def infraNamespace = "default"
   def volthaNamespace = "voltha"
   def logsDir = "$WORKSPACE/${testTarget}"
-  stage('Cleanup') {
+
+    stage('IAM')
+    {
+	script
+	{
+	    String iam = [
+		'ci-management',
+		'jjb',
+		'pipeline',
+		'voltha',
+		'voltha-2.10',
+		'bbsim-tests.groovy'
+	    ].join('/')
+            println("** ${iam}: ENTER")
+
+	    String cmd = "which pkill"
+	    def stream = sh(
+		returnStatus:false,
+		returnStdout: true,
+		script: cmd)
+	    println(" ** ${cmd}:\n${stream}")
+            println("** ${iam}: LEAVE")
+	}
+    }
+
+    stage('Cleanup') {
     if (teardown) {
       timeout(15) {
         script {
@@ -311,3 +335,5 @@
     }
   }
 }
+
+// EOF
diff --git a/jjb/pipeline/voltha/voltha-2.11/README.md b/jjb/pipeline/voltha/voltha-2.11/README.md
new file mode 100644
index 0000000..fd9d0a0
--- /dev/null
+++ b/jjb/pipeline/voltha/voltha-2.11/README.md
@@ -0,0 +1,6 @@
+# Voltha 2.11 release tests.
+
+This directory will remain empty until the release.
+Modify test sources in the master/ directory until then.
+
+Refresh all scripts in this directory at release time.
\ No newline at end of file
diff --git a/jjb/pipeline/voltha/voltha-2.11/bbsim-tests.groovy b/jjb/pipeline/voltha/voltha-2.11/bbsim-tests.groovy
new file mode 100755
index 0000000..3433a04
--- /dev/null
+++ b/jjb/pipeline/voltha/voltha-2.11/bbsim-tests.groovy
@@ -0,0 +1,323 @@
+// -*- groovy -*-
+// Copyright 2021-2022 Open Networking Foundation (ONF) and the ONF Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// voltha-2.x e2e tests for openonu-go
+// uses bbsim to simulate OLT/ONUs
+
+library identifier: 'cord-jenkins-libraries@master',
+    retriever: modernSCM([
+      $class: 'GitSCMSource',
+      remote: 'https://gerrit.opencord.org/ci-management.git'
+])
+
+def clusterName = "kind-ci"
+
+def execute_test(testTarget, workflow, testLogging, teardown, testSpecificHelmFlags = "") {
+  def infraNamespace = "default"
+  def volthaNamespace = "voltha"
+  def logsDir = "$WORKSPACE/${testTarget}"
+
+  stage('IAM')
+    {
+	print('''
+jjb/pipeline/voltha/voltha-2.11
+-----------------------------------------------------------------------
+''')
+  }
+
+  stage('Cleanup') {
+    if (teardown) {
+      timeout(15) {
+        script {
+          helmTeardown(["default", infraNamespace, volthaNamespace])
+        }
+        timeout(1) {
+          sh returnStdout: false, script: '''
+          # remove orphaned port-forward from different namespaces
+          ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
+          '''
+        }
+      }
+    }
+  }
+  stage('Deploy common infrastructure') {
+    sh '''
+    helm repo add onf https://charts.opencord.org
+    helm repo update
+    if [ ${withMonitoring} = true ] ; then
+      helm install nem-monitoring onf/nem-monitoring \
+      --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
+      --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
+    fi
+    '''
+  }
+  stage('Deploy Voltha') {
+    if (teardown) {
+      timeout(10) {
+        script {
+
+          sh """
+          mkdir -p ${logsDir}
+          _TAG=kail-startup kail -n ${infraNamespace} -n ${volthaNamespace} > ${logsDir}/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 != "" || gerritProject == "voltha-helm-charts") {
+            localCharts = true
+          }
+
+          // NOTE temporary workaround expose ONOS node ports
+          def localHelmFlags = extraHelmFlags.trim() + " --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,
+            workflow: workflow.toLowerCase(),
+            withMacLearning: enableMacLearning.toBoolean(),
+            extraHelmFlags: localHelmFlags,
+            localCharts: localCharts,
+            bbsimReplica: olts.toInteger(),
+            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
+          cd ${logsDir}
+          gzip -k onos-voltha-startup-combined.log
+          rm onos-voltha-startup-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"&
+      JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-infra-kafka" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"&
+      bbsimDmiPortFwd=50075
+      for i in {0..${olts.toInteger() - 1}}; do
+        JENKINS_NODE_COOKIE="dontKillMe" _TAG="bbsim\${i}" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/bbsim\${i} \${bbsimDmiPortFwd}:50075; done"&
+        ((bbsimDmiPortFwd++))
+      done
+      if [ ${withMonitoring} = true ] ; then
+        JENKINS_NODE_COOKIE="dontKillMe" _TAG="nem-monitoring-prometheus-server" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n default svc/nem-monitoring-prometheus-server 31301:80; done"&
+      fi
+      ps aux | grep port-forward
+      """
+      // setting ONOS log level
+      script {
+        setOnosLogLevels([
+          onosNamespace: infraNamespace,
+          apps: [
+            'org.opencord.dhcpl2relay',
+            'org.opencord.olt',
+            'org.opencord.aaa',
+            'org.opencord.maclearner',
+            'org.onosproject.net.flowobjective.impl.FlowObjectiveManager',
+            'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager'
+          ],
+          logLevel: logLevel
+        ])
+      }
+    }
+  }
+  stage('Run test ' + testTarget + ' on ' + workflow + ' workFlow') {
+    sh """
+    if [ ${withMonitoring} = true ] ; then
+      mkdir -p $WORKSPACE/voltha-pods-mem-consumption-${workflow}
+      cd $WORKSPACE/voltha-system-tests
+      make vst_venv
+      source ./vst_venv/bin/activate || true
+      # Collect initial memory consumption
+      python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} || true
+    fi
+    """
+    sh """
+    mkdir -p ${logsDir}
+    export ROBOT_MISC_ARGS="-d ${logsDir} ${params.extraRobotArgs} "
+    ROBOT_MISC_ARGS+="-v ONOS_SSH_PORT:30115 -v ONOS_REST_PORT:30120 -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace} -v container_log_dir:${logsDir} -v logging:${testLogging}"
+    export KVSTOREPREFIX=voltha/voltha_voltha
+
+    make -C $WORKSPACE/voltha-system-tests ${testTarget} || true
+    """
+    getPodsInfo("${logsDir}")
+    sh """
+      set +e
+      # collect logs collected in the Robot Framework StartLogging keyword
+      cd ${logsDir}
+      gzip *-combined.log || true
+      rm *-combined.log || true
+    """
+    sh """
+    if [ ${withMonitoring} = true ] ; then
+      cd $WORKSPACE/voltha-system-tests
+      source ./vst_venv/bin/activate || true
+      # Collect memory consumption of voltha pods once all the tests are complete
+      python scripts/mem_consumption.py -o $WORKSPACE/voltha-pods-mem-consumption-${workflow} -a 0.0.0.0:31301 -n ${volthaNamespace} || true
+    fi
+    """
+  }
+}
+
+def collectArtifacts(exitStatus) {
+  getPodsInfo("$WORKSPACE/${exitStatus}")
+  sh """
+  kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/${exitStatus}/voltha.log || true
+  """
+  archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt,**/*.html,**/voltha-pods-mem-consumption-att/*,**/voltha-pods-mem-consumption-dt/*,**/voltha-pods-mem-consumption-tt/*'
+  sh '''
+    sync
+    pkill kail || true
+    which voltctl
+    md5sum $(which voltctl)
+  '''
+  step([$class: 'RobotPublisher',
+    disableArchiveOutput: false,
+    logFileName: "**/*/log*.html",
+    otherFiles: '',
+    outputFileName: "**/*/output*.xml",
+    outputPath: '.',
+    passThreshold: 100,
+    reportFileName: "**/*/report*.html",
+    unstableThreshold: 0,
+    onlyCritical: true]);
+}
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.buildNode}"
+  }
+  options {
+    timeout(time: "${timeout}", unit: 'MINUTES')
+  }
+  environment {
+    KUBECONFIG="$HOME/.kube/kind-${clusterName}"
+    VOLTCONFIG="$HOME/.volt/config"
+    PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+    DIAGS_PROFILE="VOLTHA_PROFILE"
+    SSHPASS="karaf"
+  }
+  stages {
+    stage('Download Code') {
+      steps {
+        getVolthaCode([
+          branch: "${branch}",
+          gerritProject: "${gerritProject}",
+          gerritRefspec: "${gerritRefspec}",
+          volthaSystemTestsChange: "${volthaSystemTestsChange}",
+          volthaHelmChartsChange: "${volthaHelmChartsChange}",
+        ])
+      }
+    }
+    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 {
+          def clusterExists = sh returnStdout: true, script: """
+          kind get clusters | grep ${clusterName} | wc -l
+          """
+          if (clusterExists.trim() == "0") {
+            createKubernetesCluster([nodes: 3, name: clusterName])
+          }
+        }
+      }
+    }
+    stage('Replace voltctl') {
+      // if the project is voltctl override the downloaded one with the built one
+      when {
+        expression {
+          return gerritProject == "voltctl"
+        }
+      }
+      steps{
+        sh """
+        mv `ls $WORKSPACE/voltctl/release/voltctl-*-linux-amd*` $WORKSPACE/bin/voltctl
+        chmod +x $WORKSPACE/bin/voltctl
+        """
+      }
+    }
+    stage('Load image in kind nodes') {
+      when {
+        expression {
+          return !gerritProject.isEmpty()
+        }
+      }
+      steps {
+        loadToKind()
+      }
+    }
+    stage('Parse and execute tests') {
+        steps {
+          script {
+            def tests = readYaml text: testTargets
+
+            for(int i = 0;i<tests.size();i++) {
+              def test = tests[i]
+              def target = test["target"]
+              def workflow = test["workflow"]
+              def flags = test["flags"]
+              def teardown = test["teardown"].toBoolean()
+              def logging = test["logging"].toBoolean()
+              def testLogging = 'False'
+              if (logging) {
+                  testLogging = 'True'
+              }
+              println "Executing test ${target} on workflow ${workflow} with logging ${testLogging} and extra flags ${flags}"
+              execute_test(target, workflow, testLogging, teardown, flags)
+            }
+          }
+        }
+    }
+  }
+  post {
+    aborted {
+      collectArtifacts("aborted")
+    }
+    failure {
+      collectArtifacts("failed")
+    }
+    always {
+      collectArtifacts("always")
+    }
+  }
+}