[VOL-3703] more flexible portforwarding of external-kafka-service for pm-data

Change-Id: I75af38a77a474308104b569397b9c40555736585
diff --git a/tests/pm-data/Voltha_ONUPMTests.robot b/tests/pm-data/Voltha_ONUPMTests.robot
index 17b810b..5012b83 100755
--- a/tests/pm-data/Voltha_ONUPMTests.robot
+++ b/tests/pm-data/Voltha_ONUPMTests.robot
@@ -20,6 +20,7 @@
 ...               --set externalAccess.service.nodePorts[0]=${KAFKA_PORT},
 ...               --set externalAccess.service.domain=${KAFKA_IP}
 ...               with e.g. service.domain=10.0.02.15 or 127.0.0.1 and service.nodePorts[0]=30201!
+...               For voltha-infra prefix kafka. is needed e.g.: --set kafka.externalAccess.enabled=true
 Suite Setup       Setup Suite
 Suite Teardown    Teardown Suite
 Test Setup        Setup
@@ -186,9 +187,10 @@
     Set Suite Variable  ${onos_ssh_connection}
     ${switch_type}=    Get Variable Value    ${web_power_switch.type}
     Run Keyword If  "${switch_type}"!=""    Set Global Variable    ${powerswitch_type}    ${switch_type}
-    # todo: set ${kafka} depending on environment!!!
-#    ${kafka}=    Set Variable    kafka-0-external
-    ${kafka}=    Set Variable    voltha-infra-kafka-0-external
+    # set ${kafka} depending on environment in case of port-forward is needed
+    ${rc}    ${kafka}=    Run Keyword If    ${PORT_FORWARDING}    Run and Return Rc and Output
+    ...    kubectl get svc -n default | grep kafka-0-external | awk '{print $1}'
+    Run Keyword If    ${PORT_FORWARDING}    Should Not Be Empty    ${kafka}    Service kafka-0-external not found
     # start port forwarding if needed (when voltha runs in k8s)
     ${portFwdHandle} =    Run Keyword If    ${PORT_FORWARDING}    Start Process
     ...    kubectl port-forward --address 0.0.0.0 --namespace default svc/${kafka} ${KAFKA_PORT}:${KAFKA_SVC_PORT} &