Workaround issue with 'voltctl loglevel' on ONF demo pod

Change-Id: I37b7f014ba98bfc5f04b6c5cb167229fa962bf79
diff --git a/jjb/pipeline/voltha-physical-functional-tests.groovy b/jjb/pipeline/voltha-physical-functional-tests.groovy
index 1ac0a71..f46dc56 100644
--- a/jjb/pipeline/voltha-physical-functional-tests.groovy
+++ b/jjb/pipeline/voltha-physical-functional-tests.groovy
@@ -71,13 +71,24 @@
         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.
+        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 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 \$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 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 \$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
         """
       }
     }