Merge "Workaround for KVStore in DT pipeline and power switch on DT tests for ONF Demo Pod"
diff --git a/jjb/cord-test/voltha.yaml b/jjb/cord-test/voltha.yaml
index 7d4fca1..50c7040 100644
--- a/jjb/cord-test/voltha.yaml
+++ b/jjb/cord-test/voltha.yaml
@@ -223,6 +223,7 @@
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
+          power-switch: True
 
 
       # Menlo pod with olt/onu - voltha-2.3  branch,  Default tech profile and timer based job
@@ -251,6 +252,7 @@
           test-repo: 'voltha-system-tests'
           profile: '1T8GEM'
           pipeline-script: 'voltha-dt-physical-functional-tests.groovy'
+          power-switch: True
 
       # Menlo DEMO-POD - 1 1TCONT 4 4GEMs TechProfile - Manual build and test job
       - 'build_pod_manual':
diff --git a/jjb/pipeline/voltha-dt-physical-functional-tests.groovy b/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
index 99428e0..64c87f1 100644
--- a/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha-dt-physical-functional-tests.groovy
@@ -70,6 +70,27 @@
         curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v\${VC_VERSION}/voltctl-\${VC_VERSION}-\${HOSTOS}-\${HOSTARCH}
         chmod 755 $WORKSPACE/bin/voltctl
         voltctl version --clientonly
+
+        # Default kind-voltha config doesn't work on ONF demo pod for accessing kvstore.
+        # The issue is that the mgmt node is also one of the k8s nodes and so port forwarding doesn't work.
+        # We should change this. In the meantime here is a workaround.
+        set +e
+
+        voltctl loglevel 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}')"
+        else
+          export KVSTORE=""
+        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
+        # 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
         """
       }
     }