Merge "disabling seba jobs on flex pod and use voltha"
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index ccc679b..84b884c 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -5,7 +5,7 @@
     name: global
 
     # lftools
-    lftools-version: <1.0.0
+    lftools-version: '~=0.26.2'
 
     # name of the SSH key to use in most cases
     jenkins-ssh-credential: 'cord-jenkins-ssh'
diff --git a/jjb/pipeline/docker-publish.groovy b/jjb/pipeline/docker-publish.groovy
index 9b2e74b..2b55663 100644
--- a/jjb/pipeline/docker-publish.groovy
+++ b/jjb/pipeline/docker-publish.groovy
@@ -64,8 +64,10 @@
           then
             for tag in $git_tags
             do
-              echo "Building image with tag: \$tag (should reuse cached layers)"
-              make DOCKER_TAG="\$tag" docker-build
+              # remove leading 'v' on funky golang tags
+              clean_tag=$(echo \$tag | sed 's/^v//g')
+              echo "Building image with tag: \$clean_tag (should reuse cached layers)"
+              make DOCKER_TAG="\$clean_tag" docker-build
             done
           fi
         """)
@@ -98,8 +100,10 @@
               then
                 for tag in $git_tags
                 do
-                  echo "Pushing image with tag: \$tag (should reuse cached layers)"
-                  make DOCKER_TAG="\$tag" docker-push
+                  # remove leading 'v' on funky golang tags
+                  clean_tag=$(echo \$tag | sed 's/^v//g')
+                  echo "Pushing image with tag: \$clean_tag (should reuse cached layers)"
+                  make DOCKER_TAG="\$clean_tag" docker-push
                 done
               fi
             """)
diff --git a/jjb/pipeline/voltha-bbsim-tests.groovy b/jjb/pipeline/voltha-bbsim-tests.groovy
index 97942e2..8fa78d9 100644
--- a/jjb/pipeline/voltha-bbsim-tests.groovy
+++ b/jjb/pipeline/voltha-bbsim-tests.groovy
@@ -23,7 +23,7 @@
     label "${params.executorNode}"
   }
   options {
-      timeout(time: 120, unit: 'MINUTES')
+      timeout(time: 90, unit: 'MINUTES')
   }
 
   stages {
@@ -69,8 +69,10 @@
     stage('Build Images') {
       steps {
         sh """
-           cd $WORKSPACE/voltha/${gerritProject}/
-           make DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
+           if [ "${gerritProject}" != "voltha-helm-charts" ]; then
+             cd $WORKSPACE/voltha/${gerritProject}/
+             make DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
+           fi
            """
       }
     }
@@ -78,21 +80,24 @@
     stage('Push Images') {
       steps {
         sh '''
-           export GOROOT=/usr/local/go
-           export GOPATH=\$(pwd)
-           export TYPE=minimal
-           export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
-           export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
-           export PATH=/w/workspace/${gerritProject}_sanity-system-test/kind-voltha/bin:$PATH
-           docker images | grep citest
-           for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$TYPE --nodes voltha-\$TYPE-worker,voltha-\$TYPE-worker2; done
+           if [ "${gerritProject}" != "voltha-helm-charts" ]; then
+
+             export GOROOT=/usr/local/go
+             export GOPATH=\$(pwd)
+             export TYPE=minimal
+             export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
+             export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
+             export PATH=/w/workspace/${gerritProject}_sanity-system-test/kind-voltha/bin:$PATH
+             docker images | grep citest
+             for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$TYPE --nodes voltha-\$TYPE-worker,voltha-\$TYPE-worker2; done
+           fi
            '''
       }
     }
     stage('Deploy Voltha') {
       steps {
-        sh """
-           HELM_FLAG="--set defaults.image_tag=voltha-2.1 "
+        sh '''
+           HELM_FLAG="--set defaults.image_tag=voltha-2.1,wpa_wait=10,dhcp_wait=10 "
 
            if [ "${gerritProject}" = "voltha-go" ]; then
              HELM_FLAG+="-f $WORKSPACE/voltha-system-tests/tests/data/ci-test.yaml"
@@ -110,10 +115,24 @@
              HELM_FLAG+="--set images.bbsim.tag=citest,images.bbsim.pullPolicy=Never"
            fi
 
-           cd kind-voltha/
+           if [ "${gerritProject}" = "voltha-api-server" ]; then
+             HELM_FLAG+="--set images.afrouter.tag=citest,images.afrouter.pullPolicy=Never,images.afrouterd.tag=citest,images.afrouterd.pullPolicy=Never"
+           fi
+
+           if [ "${gerritProject}" = "voltha-helm-charts" ]; then
+             export CHART_PATH=$WORKSPACE/voltha/voltha-helm-charts
+             export VOLTHA_CHART=\$CHART_PATH/voltha
+             export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt
+             export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu
+             helm dep update \$VOLTHA_CHART
+             helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART
+             helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART
+           fi
+
+           cd $WORKSPACE/kind-voltha/
            echo \$HELM_FLAG
            EXTRA_HELM_FLAGS=\$HELM_FLAG VOLTHA_LOG_LEVEL=DEBUG TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y FANCY=0 ./voltha up
-           """
+           '''
       }
     }
 
@@ -134,6 +153,7 @@
   post {
     always {
       sh '''
+         set +e
          # copy robot logs
          if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
          cp -r $WORKSPACE/voltha-system-tests/tests/sanity/*ml ./RobotLogs || true
@@ -183,3 +203,4 @@
     }
   }
 }
+
diff --git a/jjb/shell/github-release.sh b/jjb/shell/github-release.sh
index 2ab2c94..2ded191 100644
--- a/jjb/shell/github-release.sh
+++ b/jjb/shell/github-release.sh
@@ -44,7 +44,8 @@
 pushd "$GERRIT_PROJECT"
   GIT_VERSION=$(git tag -l --points-at HEAD)
 
-  if [[ "$GIT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
+  # match bare versions or v-prefixed golang style version
+  if [[ "$GIT_VERSION" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
   then
     echo "git has a SemVer released version tag: '$GIT_VERSION'"
     echo "Building artifacts for GitHub release."
diff --git a/jjb/shell/pypi-publish.sh b/jjb/shell/pypi-publish.sh
index b7f3526..3118df7 100755
--- a/jjb/shell/pypi-publish.sh
+++ b/jjb/shell/pypi-publish.sh
@@ -26,7 +26,8 @@
 # check that we're on a semver released version
 GIT_VERSION=$(git tag -l --points-at HEAD)
 
-if [[ "$GIT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
+# match bare versions or v-prefixed golang style version
+if [[ "$GIT_VERSION" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
 then
   echo "git has a SemVer released version tag: '$GIT_VERSION', publishing to PyPI"
 else
diff --git a/jjb/shell/tagcollisionreject.sh b/jjb/shell/tagcollisionreject.sh
index 49d6e21..309e35c 100755
--- a/jjb/shell/tagcollisionreject.sh
+++ b/jjb/shell/tagcollisionreject.sh
@@ -21,6 +21,7 @@
 
 VERSIONFILE="" # file path to file containing version number
 NEW_VERSION="" # version number found in $VERSIONFILE
+TAG_VERSION="" # version file that might have a leading v to work around go mod funkyness
 
 SEMVER_STRICT=${SEMVER_STRICT:-0} # require semver versions
 
@@ -37,13 +38,25 @@
   then
     NEW_VERSION=$(head -n1 "VERSION")
     VERSIONFILE="VERSION"
+
+    # If this is a golang project, use funky v-prefixed versions
+    if [ -f "Gopkg.toml" ] || [ -f "go.mod" ]
+    then
+      echo "go-based project found, using v-prefixed version for git tags: v${NEW_VERSION}"
+      TAG_VERSION=v${NEW_VERSION}
+    else
+      TAG_VERSION=${NEW_VERSION}
+    fi
+
   elif [ -f "package.json" ]
   then
     NEW_VERSION=$(python -c 'import json,sys;obj=json.load(sys.stdin); print obj["version"]' < package.json)
+    TAG_VERSION=$NEW_VERSION
     VERSIONFILE="package.json"
   elif [ -f "pom.xml" ]
   then
     NEW_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)
+    TAG_VERSION=$NEW_VERSION
     VERSIONFILE="pom.xml"
   else
     echo "ERROR: No versioning file found!"
@@ -51,18 +64,6 @@
   fi
 }
 
-# check if the version is already a tag in git
-function is_git_tag_duplicated {
-  for existing_tag in $(git tag)
-  do
-    if [ "$NEW_VERSION" = "$existing_tag" ]
-    then
-      echo "ERROR: Duplicate tag: $existing_tag"
-      exit 2
-    fi
-  done
-}
-
 # check if the version is a released version
 function check_if_releaseversion {
   if [[ "$NEW_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
@@ -80,6 +81,18 @@
   fi
 }
 
+# check if the version is already a tag in git
+function is_git_tag_duplicated {
+  for existing_tag in $(git tag)
+  do
+    if [ "$TAG_VERSION" = "$existing_tag" ]
+    then
+      echo "ERROR: Duplicate tag: $existing_tag"
+      exit 2
+    fi
+  done
+}
+
 # check if Dockerfiles have a released version as their parent
 function dockerfile_parentcheck {
   while IFS= read -r -d '' dockerfile
diff --git a/jjb/shell/versiontag.sh b/jjb/shell/versiontag.sh
index a75087b..cc01f97 100755
--- a/jjb/shell/versiontag.sh
+++ b/jjb/shell/versiontag.sh
@@ -22,6 +22,7 @@
 
 VERSIONFILE="" # file path to file containing version number
 NEW_VERSION="" # version number found in $VERSIONFILE
+TAG_VERSION="" # version file that might have a leading v to work around go mod funkyness
 
 SEMVER_STRICT=${SEMVER_STRICT:-0} # require semver versions
 
@@ -38,13 +39,25 @@
   then
     NEW_VERSION=$(head -n1 "VERSION")
     VERSIONFILE="VERSION"
+
+    # If this is a golang project, use funky v-prefixed versions
+    if [ -f "Gopkg.toml" ] || [ -f "go.mod" ]
+    then
+      echo "go-based project found, using v-prefixed version for git tags: v${NEW_VERSION}"
+      TAG_VERSION=v${NEW_VERSION}
+    else
+      TAG_VERSION=${NEW_VERSION}
+    fi
+
   elif [ -f "package.json" ]
   then
     NEW_VERSION=$(python -c 'import json,sys;obj=json.load(sys.stdin); print obj["version"]' < package.json)
+    TAG_VERSION=$NEW_VERSION
     VERSIONFILE="package.json"
   elif [ -f "pom.xml" ]
   then
     NEW_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)
+    TAG_VERSION=$NEW_VERSION
     VERSIONFILE="pom.xml"
   else
     echo "ERROR: No versioning file found!"
@@ -73,7 +86,7 @@
 function is_git_tag_duplicated {
   for existing_tag in $(git tag)
   do
-    if [ "$NEW_VERSION" = "$existing_tag" ]
+    if [ "$TAG_VERSION" = "$existing_tag" ]
     then
       echo "ERROR: Duplicate tag: $existing_tag"
       exit 2
@@ -134,18 +147,18 @@
 
 # create a git tag
 function create_git_tag {
-  echo "Creating git tag: $NEW_VERSION"
+  echo "Creating git tag: $TAG_VERSION"
   git checkout "$GERRIT_PATCHSET_REVISION"
 
   git config --global user.email "do-not-reply@opencord.org"
   git config --global user.name "Jenkins"
 
-  git tag -a "$NEW_VERSION" -m "Tagged by CORD Jenkins version-tag job: $BUILD_NUMBER, for Gerrit patchset: $GERRIT_CHANGE_NUMBER"
+  git tag -a "$TAG_VERSION" -m "Tagged by CORD Jenkins version-tag job: $BUILD_NUMBER, for Gerrit patchset: $GERRIT_CHANGE_NUMBER"
 
   echo "Tags including new tag:"
   git tag -n
 
-  git push origin "$NEW_VERSION"
+  git push origin "$TAG_VERSION"
 }
 
 echo "Checking git repo with remotes:"
diff --git a/jjb/verify/igmp.yaml b/jjb/verify/igmp.yaml
index 128d5ab..143d8c4 100644
--- a/jjb/verify/igmp.yaml
+++ b/jjb/verify/igmp.yaml
@@ -13,7 +13,7 @@
           branch-regexp: '^(master)$'
 
       - 'igmp-jobs-legacy':
-          branch-regexp: '^(igmp-1.5)$'
+          branch-regexp: '^(igmp-1.4)$'
           jdk-distribution: 'java-1.8.0-amazon-corretto'
           name-extension: '-jdk8'
 
diff --git a/jjb/verify/mcast.yaml b/jjb/verify/mcast.yaml
index e8f478c..be99a4d 100644
--- a/jjb/verify/mcast.yaml
+++ b/jjb/verify/mcast.yaml
@@ -13,7 +13,7 @@
           branch-regexp: '^(master)$'
 
       - 'mcast-jobs-legacy':
-          branch-regexp: '^(mcast-1.5)$'
+          branch-regexp: '^(mcast-1.4)$'
           jdk-distribution: 'java-1.8.0-amazon-corretto'
           name-extension: '-jdk8'
 
diff --git a/jjb/verify/olt.yaml b/jjb/verify/olt.yaml
index a26f31b..a654a96 100644
--- a/jjb/verify/olt.yaml
+++ b/jjb/verify/olt.yaml
@@ -13,7 +13,7 @@
           branch-regexp: '^(master)$'
 
       - 'olt-jobs-legacy':
-          branch-regexp: '^(olt-2.2)$'
+          branch-regexp: '^(olt-3.0)$'
           jdk-distribution: 'java-1.8.0-amazon-corretto'
           name-extension: '-jdk8'
 
diff --git a/jjb/verify/sadis.yaml b/jjb/verify/sadis.yaml
index fe700d0..9728ebf 100644
--- a/jjb/verify/sadis.yaml
+++ b/jjb/verify/sadis.yaml
@@ -13,7 +13,7 @@
           branch-regexp: '^(master)$'
 
       - 'sadis-jobs-legacy':
-          branch-regexp: '^(sadis-3.1)$'
+          branch-regexp: '^(sadis-3.0)$'
           jdk-distribution: 'java-1.8.0-amazon-corretto'
           name-extension: '-jdk8'
 
diff --git a/jjb/verify/voltha-api-server.yaml b/jjb/verify/voltha-api-server.yaml
index da1390a..9d0116c 100644
--- a/jjb/verify/voltha-api-server.yaml
+++ b/jjb/verify/voltha-api-server.yaml
@@ -18,11 +18,13 @@
       - 'tag-collision-reject':
           dependency-jobs: 'verify_voltha-api-server_licensed'
       - 'make-unit-test':
-          build-node: 'ubuntu16.04-basebuild-1c-2g'
+          build-node: 'ubuntu16.04-basebuild-2c-4g'
           dest-gopath: "github.com/opencord"
-          unit-test-targets: 'lint sca test docker-build'
+          unit-test-targets: 'lint test docker-build'
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
+      - 'voltha-patch-test':
+         pipeline: 'voltha-bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-api-server-jobs'
@@ -31,9 +33,3 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
-
-- job-group:
-    name: 'voltha-api-server-system-tests'
-    jobs:
-      - 'voltha-patch-test':
-         pipeline: 'voltha-bbsim-tests.groovy'
diff --git a/jjb/verify/voltha-bbsim.yaml b/jjb/verify/voltha-bbsim.yaml
index 4ef56b4..c947e9b 100644
--- a/jjb/verify/voltha-bbsim.yaml
+++ b/jjb/verify/voltha-bbsim.yaml
@@ -23,7 +23,7 @@
           junit-allow-empty-results: true
           build-node: 'ubuntu16.04-basebuild-1c-2g'
       - 'voltha-patch-test':
-         pipeline: 'voltha-bbsim-tests.groovy'
+          pipeline: 'voltha-bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-bbsim-jobs'
diff --git a/jjb/verify/voltha-go.yaml b/jjb/verify/voltha-go.yaml
index 42a2c6d..f7fa935 100644
--- a/jjb/verify/voltha-go.yaml
+++ b/jjb/verify/voltha-go.yaml
@@ -10,8 +10,6 @@
           branch-regexp: '{all-branches-regexp}'
       - 'publish-voltha-go-jobs':
           branch-regexp: '{all-branches-regexp}'
-      - 'voltha-go-system-tests':
-          branch-regexp: '{voltha-stablization-branch}'
 
 - job-group:
     name: 'verify-voltha-go-jobs'
@@ -20,6 +18,8 @@
       - 'tag-collision-reject':
           dependency-jobs: 'verify_voltha-go_licensed'
       - 'make-unit-test':
+          build-node: 'ubuntu16.04-basebuild-2c-4g'
+          build-timeout: 20
           dest-gopath: "github.com/opencord"
           name-extension: "-lint"
           unit-test-targets: 'lint'
@@ -31,6 +31,9 @@
           name-extension: "-tests"
           unit-test-targets: 'test'
           unit-test-keep-going: 'true'
+      - 'voltha-patch-test':
+          buildImages: true
+          pipeline: 'voltha-bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-go-jobs'
@@ -39,9 +42,3 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
-
-- job-group:
-    name: 'voltha-go-system-tests'
-    jobs:
-      - 'voltha-patch-test':
-         pipeline: 'voltha-bbsim-tests.groovy'
diff --git a/jjb/verify/voltha-helm-charts.yaml b/jjb/verify/voltha-helm-charts.yaml
index 50b1399..86092ac 100644
--- a/jjb/verify/voltha-helm-charts.yaml
+++ b/jjb/verify/voltha-helm-charts.yaml
@@ -17,4 +17,7 @@
           dependency-jobs: 'verify_voltha-helm-charts_licensed'
       - 'verify-helm-lint':
           dependency-jobs: 'verify_voltha-helm-charts_tag-collision'
+      - 'voltha-patch-test':
+          build-timeout: 20
+          pipeline: 'voltha-bbsim-tests.groovy'
 
diff --git a/jjb/verify/voltha-openolt-adapter.yaml b/jjb/verify/voltha-openolt-adapter.yaml
index 3f9790d..7d1aa71 100644
--- a/jjb/verify/voltha-openolt-adapter.yaml
+++ b/jjb/verify/voltha-openolt-adapter.yaml
@@ -10,8 +10,6 @@
           branch-regexp: '{all-branches-regexp}'
       - 'publish-voltha-openolt-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
-      - 'voltha-openolt-adapter-system-tests':
-          branch-regexp: '{voltha-stablization-branch}'
 
 - job-group:
     name: 'verify-voltha-openolt-adapter-jobs'
@@ -25,13 +23,16 @@
           unit-test-targets: 'lint sca'
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
-          build-node: 'ubuntu16.04-basebuild-1c-2g'
+          build-node: 'ubuntu16.04-basebuild-2c-4g'
       - 'make-unit-test':
           dest-gopath: "github.com/opencord"
           name-extension: "-tests"
           unit-test-targets: 'test'
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
+          build-node: 'ubuntu16.04-basebuild-2c-4g'
+      - 'voltha-patch-test':
+          pipeline: 'voltha-bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-openolt-adapter-jobs'
@@ -40,9 +41,3 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
-
-- job-group:
-    name: 'voltha-openolt-adapter-system-tests'
-    jobs:
-      - 'voltha-patch-test':
-         pipeline: 'voltha-bbsim-tests.groovy'
diff --git a/jjb/verify/voltha-openonu-adapter.yaml b/jjb/verify/voltha-openonu-adapter.yaml
index 8c41c58..903e2b6 100644
--- a/jjb/verify/voltha-openonu-adapter.yaml
+++ b/jjb/verify/voltha-openonu-adapter.yaml
@@ -10,8 +10,6 @@
           branch-regexp: '{all-branches-regexp}'
       - 'publish-voltha-openonu-adapter-jobs':
           branch-regexp: '{all-branches-regexp}'
-      - 'voltha-openonu-adapter-system-tests':
-          branch-regexp: '{voltha-stablization-branch}'
 
 - job-group:
     name: 'verify-voltha-openonu-adapter-jobs'
@@ -24,6 +22,8 @@
           unit-test-keep-going: 'true'
           junit-allow-empty-results: true
           build-timeout: 15
+      - 'voltha-patch-test':
+          pipeline: 'voltha-bbsim-tests.groovy'
 
 - job-group:
     name: 'publish-voltha-openonu-adapter-jobs'
@@ -32,9 +32,3 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
-
-- job-group:
-    name: 'voltha-openonu-adapter-system-tests'
-    jobs:
-      - 'voltha-patch-test':
-         pipeline: 'voltha-bbsim-tests.groovy'