Merge "Adding Code of Conduct"
diff --git a/jjb/cord-test/nightly-build-pipeline.yaml b/jjb/cord-test/nightly-build-pipeline.yaml
index 728ccad..f565c37 100644
--- a/jjb/cord-test/nightly-build-pipeline.yaml
+++ b/jjb/cord-test/nightly-build-pipeline.yaml
@@ -903,9 +903,13 @@
                   Copyright (c) 2017 Open Networking Foundation (ONF)
 
     <<: *test-pipe-job-boiler-plate
+    pipeline-script: 'voltha-physical-functional-tests.groovy'
+    manifest-url: 'https://gerrit.opencord.org/voltha-test-manifest.git'
+    manifest-branch: 'master'
+
     parameters:
       - string:
-          name: TestNodeName
+          name: buildNode
           default: '{testvm}'
           description: 'Jenkins node name of TestVM Node'
 
@@ -947,21 +951,23 @@
       - string:
           name: branch
           default: '{branch}'
+          description: 'Branch of the test libraries to check out'
 
       - string:
-          name: notificationEmail
-          default: 'you@opennetworking.org, suchitra@opennetworking.org'
-          description: ''
+          name: manifestUrl
+          default: '{manifest-url}'
+          description: 'Repo manifest URL for code checkout (so we can display changes in Jenkins)'
+
+      - string:
+          name: manifestBranch
+          default: '{manifest-branch}'
+          description: 'Repo manifest branch for code checkout (so we can display changes in Jenkins)'
+
 
     concurrent: true
 
-    pipeline-scm:
-      script-path: '{Jenkinsfile}'
-      scm:
-        - git:
-            url: '{gerrit-server-url}/voltha-system-tests'
-            branches:
-              - '{branch}'
+    project-type: pipeline
+    dsl: !include-raw-escape: ../pipeline/{pipeline-script}
 
     triggers:
       - reverse:
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 60bf08f..642f738 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -9,22 +9,22 @@
     build-timeout: '300'
 
     jobs:
-      # flex OCP pod with olt/onu - release voltha master build job
+      # flex OCP pod with olt/onu - manual test job, voltha master build job
       - 'build_pod_manual':
           testvm: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
           release: 'master'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
-          profile: '1T4GEM'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt_asfvolt16.deb'
+          profile: '1T4GEM-bal31'
 
       # flex pod1 test job - using voltha branch
       - 'build_pod_test':
           testvm: 'qa-testvm-pod'
           config-pod: 'flex-ocp-cord'
-          profile: '1T4GEM'
+          profile: '1T4GEM-bal31'
           branch: 'master'
           test-repo: 'voltha-system-tests'
           Jenkinsfile: 'Jenkinsfile-voltha-test'
@@ -57,8 +57,8 @@
           branch: 'master'
           released: false
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt_asfvolt16.deb'
           configurePod: true
           profile: 'Default'
           time: '1'
@@ -71,7 +71,6 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: 'Default'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
 
       # flex OCP pod with olt/onu - uses 1TCONT/4GEMs tech profile on voltha - timer based job
       - 'build_voltha_pod_release':
@@ -81,10 +80,10 @@
           branch: 'master'
           released: false
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt_asfvolt16.deb'
           configurePod: true
-          profile: '1T4GEM'
+          profile: '1T4GEM-bal31'
           time: '2'
 
       # flex pod1 test job - test job uses 1TCONT/4GEMs tech profile - using voltha branch
@@ -94,8 +93,7 @@
           release: 'master'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          profile: '1T4GEM'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
+          profile: '1T4GEM-bal31'
 
       # flex OCP pod with olt/onu - Released versions Default tech profile and timer based job
       - 'build_voltha_pod_release':
@@ -104,8 +102,8 @@
           release: 'release'
           branch: 'master'
           test-repo: 'voltha-system-tests'
-          Jenkinsfile: 'Jenkinsfile-voltha-build'
-          oltDebVersion: 'openolt-seba-2.0.deb'
+          Jenkinsfile: 'Jenkinsfile-voltha-bal31-build'
+          oltDebVersion: 'openolt_asfvolt16.deb'
           configurePod: true
           released: true
           profile: 'Default'
@@ -119,7 +117,6 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: 'Default'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
 
       # Menlo pod with olt/onu - Default tech profile and timer based job
       - 'build_voltha_pod_release':
@@ -143,7 +140,6 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: 'Default'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
 
       # Menlo pod with olt/onu - 1T4GEM tech profile and timer based job
       - 'build_voltha_pod_release':
@@ -167,7 +163,6 @@
           branch: 'master'
           test-repo: 'voltha-system-tests'
           profile: '1T4GEM-bal31'
-          Jenkinsfile: 'Jenkinsfile-voltha-test'
 
       # Menlo DEMO-POD - 1 1TCONT 4 4GEMs TechProfile - Manual build and test job
       - 'build_pod_manual':
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 4ef0994..456e7bd 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -86,7 +86,7 @@
 
     # matching repos that should be version tagged by the version-tag job
     # (basically the same as imagebuilder projects + helm charts + tools
-    version-tag-projects-regexp: '^(xos.*|.*helm-charts|automation-tools|cord-tester|chameleon|rcord|mcord|ecord|acordion|addressmanager|epc-service|exampleservice|fabric|fabric-crossconnect|globalxos|hippie-oss|hss_db|hypercache|internetemulator|kubernetes-service|monitoring|olt-service|onos-service|openstack|progran|sdn-controller|simpleexampleservice|templateservice|vEE|vEG|vBBU|venb|vHSS|vMME|vnaas|vPGWC|vPGWU|vrouter|vsg|vsg-hw|vSGW|vSM|vspgwc|vspgwu|vtn-service|vtr|att-workflow-driver|tt-workflow-driver|ves-agent|voltha-bbsim|openolt|sadis-server|kafka-topic-exporter|pyvoltha||plyxproto|voltha-protos|alpine-grpc-base|cordctl|voltha-go|voltha-onos|device-management|cord-workflow.*|voltha-system-tests|openairinterface|omec-.*|bbsim|omci-sim|ponsim|pppoel2relay|voltha-api-server|aaa|config|dhcpl2relay|igmp|igmpproxy|kafka-onos|mcast|olt|sadis|vtn|voltha-.*-adapter|voltha-lib-go|voltha-python-base|mn-stratum-siab|ofagent.*)$'
+    version-tag-projects-regexp: '^(xos.*|.*helm-charts|automation-tools|cord-tester|chameleon|rcord|mcord|ecord|acordion|addressmanager|epc-service|exampleservice|fabric|fabric-crossconnect|globalxos|hippie-oss|hss_db|hypercache|internetemulator|kubernetes-service|monitoring|olt-service|onos-service|openstack|progran|sdn-controller|simpleexampleservice|templateservice|vEE|vEG|vBBU|venb|vHSS|vMME|vnaas|vPGWC|vPGWU|vrouter|vsg|vsg-hw|vSGW|vSM|vspgwc|vspgwu|vtn-service|vtr|att-workflow-driver|tt-workflow-driver|ves-agent|voltha-bbsim|openolt|sadis-server|kafka-topic-exporter|pyvoltha||plyxproto|voltha-protos|alpine-grpc-base|cordctl|voltha-go|voltha-onos|device-management|cord-workflow.*|voltha-system-tests|openairinterface|omec-.*|bbsim|omci-sim|ponsim|pppoel2relay|voltha-api-server|aaa|config|dhcpl2relay|igmp|igmpproxy|kafka-onos|mcast|olt|sadis|vtn|voltha-.*-adapter|voltha-lib-go|voltha-python-base|mn-stratum-siab|ofagent.*|bng)$'
 
     # PyPI related publishing variables
     #
diff --git a/jjb/pipeline/voltha-go-tests.groovy b/jjb/pipeline/voltha-go-tests.groovy
index b485696..5af4195 100644
--- a/jjb/pipeline/voltha-go-tests.groovy
+++ b/jjb/pipeline/voltha-go-tests.groovy
@@ -44,6 +44,7 @@
 
     stage('Repo') {
       steps {
+        step([$class: 'WsCleanup'])
         checkout(changelog: true,
           poll: false,
           scm: [$class: 'RepoScm',
@@ -80,7 +81,7 @@
     stage('Run E2E Tests') {
       steps {
         sh '''
-           rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
+           mkdir -p $WORKSPACE/RobotLogs
            git clone https://gerrit.opencord.org/voltha-system-tests
            make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
            '''
@@ -118,10 +119,8 @@
              kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
            fi
          done
-         ## clean up node
+         ## shut down voltha
          WAIT_ON_DOWN=y ./voltha down
-         cd $WORKSPACE/
-         rm -rf kind-voltha/ voltha-system-tests/ || true
          '''
          step([$class: 'RobotPublisher',
             disableArchiveOutput: false,
diff --git a/jjb/pipeline/voltha-physical-tests.groovy b/jjb/pipeline/voltha-physical-build-and-tests.groovy
similarity index 100%
rename from jjb/pipeline/voltha-physical-tests.groovy
rename to jjb/pipeline/voltha-physical-build-and-tests.groovy
diff --git a/jjb/pipeline/voltha-physical-functional-tests.groovy b/jjb/pipeline/voltha-physical-functional-tests.groovy
new file mode 100644
index 0000000..aa9a782
--- /dev/null
+++ b/jjb/pipeline/voltha-physical-functional-tests.groovy
@@ -0,0 +1,129 @@
+// Copyright 2017-present Open Networking Foundation
+//
+// 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.
+
+node {
+  // Need this so that deployment_config has global scope when it's read later
+  deployment_config = null
+}
+
+pipeline {
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.buildNode}"
+  }
+  options {
+    timeout(time: 60, unit: 'MINUTES')
+  }
+
+  environment {
+    KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
+    VOLTCONFIG="$HOME/.volt/config-minimal"
+    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin"
+  }
+
+  stages {
+    stage ('Initialize') {
+      steps {
+        step([$class: 'WsCleanup'])
+        sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
+        script {
+          deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
+        }
+        // This checkout is just so that we can show changes in Jenkins
+        checkout(changelog: true,
+          poll: false,
+          scm: [$class: 'RepoScm',
+            manifestRepositoryUrl: "${params.manifestUrl}",
+            manifestBranch: "${params.manifestBranch}",
+            currentBranch: true,
+            destinationDir: 'voltha',
+            forceSync: true,
+            resetFirst: true,
+            quiet: true,
+            jobs: 4,
+            showAllChanges: true]
+          )
+        sh returnStdout: true, script: """
+        cd voltha
+        git clone -b ${branch} ${cordRepoUrl}/cord-tester
+        git clone -b ${branch} ${cordRepoUrl}/voltha # NOTE do we need the voltha source code??
+        """
+      }
+    }
+    stage('Subscriber Validation and Ping Tests') {
+      environment {
+        ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
+        ROBOT_MISC_ARGS="--removekeywords wuks -d $WORKSPACE/RobotLogs -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir}"
+        ROBOT_FILE="Voltha_PODTests.robot"
+      }
+      steps {
+        sh """
+        mkdir -p $WORKSPACE/RobotLogs
+        make -C $WORKSPACE/voltha/voltha-system-tests voltha-test || true
+        """
+      }
+    }
+  }
+
+  post {
+    always {
+      sh returnStdout: true, script: """
+      set +e
+      kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
+      kubectl get nodes -o wide
+      kubectl get pods -n voltha -o wide
+      ## get default pod logs
+      for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
+      do
+        if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
+          kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
+        else
+          kubectl logs \$pod> $WORKSPACE/\$pod.log;
+        fi
+      done
+      ## get voltha pod logs
+      for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
+      do
+        if [[ \$pod == *"-api-"* ]]; then
+          kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
+        else
+          kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
+        fi
+      done
+      """
+      script {
+        deployment_config.olts.each { olt ->
+          sh returnStdout: true, script: """
+          sshpass -p ${olt.pass} scp ${olt.user}@${olt.ip}:/var/log/openolt.log $WORKSPACE/openolt-${olt.ip}.log || true
+          sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.ip}.log  # Remove escape sequences
+          """
+        }
+      }
+      step([$class: 'RobotPublisher',
+        disableArchiveOutput: false,
+        logFileName: 'RobotLogs/log*.html',
+        otherFiles: '',
+        outputFileName: 'RobotLogs/output*.xml',
+        outputPath: '.',
+        passThreshold: 100,
+        reportFileName: 'RobotLogs/report*.html',
+        unstableThreshold: 0
+        ]);
+      archiveArtifacts artifacts: '*.log'
+    }
+    unstable {
+      step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
+    }
+  }
+}
diff --git a/jjb/shell/licensecheck.sh b/jjb/shell/licensecheck.sh
index 5bbcdf8..c358294 100755
--- a/jjb/shell/licensecheck.sh
+++ b/jjb/shell/licensecheck.sh
@@ -67,6 +67,7 @@
   ! -name "*.p12" \
   ! -name "*.patch" \
   ! -name "*.pb.go" \
+  ! -name "*.pb.gw.go" \
   ! -name "*.pdf" \
   ! -name "*.pcap" \
   ! -name "*.pem" \
diff --git a/jjb/verify/bng.yaml b/jjb/verify/bng.yaml
new file mode 100644
index 0000000..34b4aa8
--- /dev/null
+++ b/jjb/verify/bng.yaml
@@ -0,0 +1,18 @@
+---
+# jobs for 'bng' repo
+
+- project:
+    name: bng
+    project: '{name}'
+
+    jobs:
+      - 'bng-jobs':
+          branch-regexp: '^(.*)$'
+
+- job-group:
+    name: 'bng-jobs'
+    jobs:
+      - 'verify-licensed'
+      - 'tag-collision-reject'
+      - 'maven-install'
+      - 'maven-publish'
diff --git a/jjb/voltha-e2e.yaml b/jjb/voltha-e2e.yaml
index e499738..99273e5 100644
--- a/jjb/voltha-e2e.yaml
+++ b/jjb/voltha-e2e.yaml
@@ -33,7 +33,6 @@
           testvm: 'tucson-pod'
           config-pod: 'tucson-pod'
           branch: 'master'
-          pipeline-script: 'voltha-physical-tests.groovy'
           oltDebVersion: 'openolt_asfvolt16.deb'
           profile: 'Default'
           withPatchset: true
@@ -45,7 +44,6 @@
           testvm: 'tucson-pod'
           config-pod: 'tucson-pod'
           branch: 'master'
-          pipeline-script: 'voltha-physical-tests.groovy'
           oltDebVersion: 'openolt_asfvolt16.deb'
           profile: 'Default'
           withPatchset: false
@@ -97,7 +95,7 @@
           description: 'Repo manifest branch for code checkout (so we can display changes in Jenkins)'
 
     project-type: pipeline
-    concurrent: false
+    concurrent: true
 
     dsl: !include-raw-escape: pipeline/{pipeline-script}
 
@@ -188,6 +186,7 @@
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     project-type: pipeline
     sandbox: true
+    pipeline-script: 'voltha-physical-build-and-tests.groovy'
 
     properties:
       - cord-infra-properties:
@@ -322,6 +321,7 @@
                   Copyright (c) 2019 Open Networking Foundation (ONF)
     project-type: pipeline
     sandbox: true
+    pipeline-script: 'voltha-physical-build-and-tests.groovy'
 
     properties:
       - cord-infra-properties: