Merge "Workaround for KVStore in DT pipeline and power switch on DT tests for ONF Demo Pod"
diff --git a/jjb/bbr.yaml b/jjb/bbr.yaml
index 4ac6ce2..f5bd5c9 100644
--- a/jjb/bbr.yaml
+++ b/jjb/bbr.yaml
@@ -43,7 +43,7 @@
     triggers:
       - timed: |
           TZ=America/Los_Angeles
-          H * * * *
+          H H/4 * * *
 
     parameters:
       - string:
diff --git a/jjb/omec-ci.yaml b/jjb/omec-ci.yaml
index d7a46bc..0a75009 100644
--- a/jjb/omec-ci.yaml
+++ b/jjb/omec-ci.yaml
@@ -347,6 +347,16 @@
 
     parameters:
       - string:
+          name: ghprbPullId
+          default: '$ghprbPullId'
+          description: 'Pull request number to fetch changes from. Leave blank to run manually.'
+
+      - string:
+          name: branch
+          default: '$ghprbTargetBranch'
+          description: 'Branch to run. Only used when manually run.'
+
+      - string:
           name: buildNode
           default: '{build-node}'
           description: 'Name of the Jenkins executor node to run the job on'
@@ -356,6 +366,11 @@
           default: '{project}'
           description: 'Name of the project'
 
+      - string:
+          name: ghprbGhRepository
+          default: '{github-organization}/{project}'
+          description: 'Repository of the project.'
+
     triggers:
       - cord-infra-github-pr-trigger:
           github_pr_org_list: '{obj:github_pr_org_list}'
@@ -391,6 +406,16 @@
 
     parameters:
       - string:
+          name: ghprbPullId
+          default: '$ghprbPullId'
+          description: 'Pull request number to fetch changes from. Leave blank to run manually.'
+
+      - string:
+          name: branch
+          default: '$ghprbTargetBranch'
+          description: 'Branch to run. Only used when manually run.'
+
+      - string:
           name: buildNode
           default: '{build-node}'
           description: 'Name of the Jenkins executor node to run the job on'
@@ -400,6 +425,11 @@
           default: '{project}'
           description: 'Name of the project'
 
+      - string:
+          name: ghprbGhRepository
+          default: '{github-organization}/{project}'
+          description: 'Repository of the project.'
+
     triggers:
       - cord-infra-github-pr-trigger:
           github_pr_org_list: '{obj:github_pr_org_list}'
diff --git a/jjb/pipeline/omec-fossa-scan.groovy b/jjb/pipeline/omec-fossa-scan.groovy
index 24c6cab..c70f3eb 100644
--- a/jjb/pipeline/omec-fossa-scan.groovy
+++ b/jjb/pipeline/omec-fossa-scan.groovy
@@ -37,6 +37,9 @@
         }
 
         stage ("Checkout Pull Request") {
+            when {
+                expression {return params.ghprbPullId != ""}
+            }
             steps {
                 checkout([
                     $class: 'GitSCM',
@@ -47,6 +50,20 @@
             }
         }
 
+        stage ("Checkout Repo (manual)") {
+            when {
+                expression {return params.ghprbPullId == ""}
+            }
+            steps {
+                checkout([
+                    $class: 'GitSCM',
+                    userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}" ]],
+                    extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
+                    ],
+                )
+            }
+        }
+
         stage ("Perform License Scan") {
             steps {
                 withCredentials([string(credentialsId: 'fossa-api-key', variable: 'FOSSA_API_KEY')]) {
@@ -54,7 +71,12 @@
                         #!/usr/bin/env bash
 
                         cd ${params.project}
-                        git checkout FETCH_HEAD
+                        if [ ! -z ${params.ghprbPullId} ]
+                        then
+                          git checkout FETCH_HEAD
+                        else
+                          git checkout ${params.branch}
+                        fi
                         git show
 
                         echo "Testing project: ${params.project}"
diff --git a/jjb/pipeline/omec-reuse-scan.groovy b/jjb/pipeline/omec-reuse-scan.groovy
index 55aa0c4..605f285 100644
--- a/jjb/pipeline/omec-reuse-scan.groovy
+++ b/jjb/pipeline/omec-reuse-scan.groovy
@@ -37,6 +37,9 @@
         }
 
         stage ("Checkout Pull Request") {
+            when {
+                expression {return params.ghprbPullId != ""}
+            }
             steps {
                 checkout([
                     $class: 'GitSCM',
@@ -47,16 +50,35 @@
             }
         }
 
+        stage ("Checkout Repo (manual)") {
+            when {
+                expression {return params.ghprbPullId == ""}
+            }
+            steps {
+                checkout([
+                    $class: 'GitSCM',
+                    userRemoteConfigs: [[ url: "https://github.com/${params.ghprbGhRepository}" ]],
+                    extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${params.project}"]],
+                    ],
+                )
+            }
+        }
+
         stage("Run REUSE Linter"){
             steps {
-                sh  '''
+                sh  """
                     #!/usr/bin/env bash
 
-                    cd $project
-                    git checkout FETCH_HEAD
+                    cd ${params.project}
+                    if [ ! -z ${params.ghprbPullId} ]
+                    then
+                      git checkout FETCH_HEAD
+                    else
+                      git checkout ${params.branch}
+                    fi
                     git show
                     reuse lint
-                    '''
+                    """
             }
         }
     }
diff --git a/jjb/pipeline/voltha-physical-build-and-tests.groovy b/jjb/pipeline/voltha-physical-build-and-tests.groovy
index 86c394d..b943573 100644
--- a/jjb/pipeline/voltha-physical-build-and-tests.groovy
+++ b/jjb/pipeline/voltha-physical-build-and-tests.groovy
@@ -208,13 +208,15 @@
           kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
           ./voltha up
 
+          set +e
+
           # Remove noise from voltha-core logs
-          voltctl loglevel set WARN read-write-core#github.com/opencord/voltha-go/db/model
-          voltctl loglevel set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
+          voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model
+          voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
           # Remove noise from openolt logs
-          voltctl loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
-          voltctl loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
-          voltctl loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
+          voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
+          voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
+          voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
           """
         }
       }
diff --git a/jjb/pipeline/voltha-physical-functional-tests.groovy b/jjb/pipeline/voltha-physical-functional-tests.groovy
index c4c9dc2..6772519 100644
--- a/jjb/pipeline/voltha-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha-physical-functional-tests.groovy
@@ -76,7 +76,7 @@
         # We should change this. In the meantime here is a workaround.
         set +e
 
-        voltctl loglevel list
+        voltctl log level list
         if [ \$? -ne 0 ]
         then
           export KVSTORE="-e \$(kubectl -n voltha get svc voltha-etcd-cluster-client -o jsonpath='{.spec.clusterIP}:{.spec.ports[0].port}')"
@@ -85,12 +85,12 @@
         fi
 
         # Remove noise from voltha-core logs
-        voltctl \$KVSTORE loglevel set WARN read-write-core#github.com/opencord/voltha-go/db/model
-        voltctl \$KVSTORE loglevel set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
+        voltctl \$KVSTORE log level set WARN read-write-core#github.com/opencord/voltha-go/db/model
+        voltctl \$KVSTORE log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
         # Remove noise from openolt logs
-        voltctl \$KVSTORE loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
-        voltctl \$KVSTORE loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
-        voltctl \$KVSTORE loglevel set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
+        voltctl \$KVSTORE log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
+        voltctl \$KVSTORE log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
+        voltctl \$KVSTORE log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
         """
       }
     }