VOL-1994 - use kubectl to lookup the service end point information

Change-Id: Ie126211530f3a0c2f73ce39232fdc2c163108d21
diff --git a/.gitignore b/.gitignore
index ad8b8eb..6a1f015 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 output.xml
 report.xml
 log.html
+report.html
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
new file mode 100644
index 0000000..c2067ae
--- /dev/null
+++ b/libraries/k8s.robot
@@ -0,0 +1,41 @@
+# 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.
+
+# voltctl common functions
+
+*** Settings ***
+Documentation     Library for various utilities
+Library           SSHLibrary
+Library           HttpLibrary.HTTP
+Library           String
+Library           DateTime
+Library           Process
+Library           Collections
+Library           RequestsLibrary
+Library           OperatingSystem
+
+*** Keywords ***
+Lookup Service IP
+    [Arguments]    ${namespace}    ${name}
+    [Documentation]    Uses kubeclt to resolve a service name to an IP
+    ${rc}    ${ip}=    Run and Return Rc and Output    kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.clusterIP}
+    Should Be Equal as Integers    ${rc}    0
+    [Return]    ${ip}
+
+Lookup Service PORT
+    [Arguments]    ${namespace}    ${name}
+    [Documentation]    Uses kubeclt to resolve a service name to an PORT
+    ${rc}    ${port}=    Run and Return Rc and Output    kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.ports[0].port}
+    Should Be Equal as Integers    ${rc}    0
+    [Return]    ${port}
diff --git a/tests/sanity/sanity.robot b/tests/sanity/sanity.robot
index 2fb7794..fe5e759 100644
--- a/tests/sanity/sanity.robot
+++ b/tests/sanity/sanity.robot
@@ -24,11 +24,12 @@
 Resource          ${CURDIR}/../../libraries/onos.robot
 Resource          ${CURDIR}/../../libraries/voltctl.robot
 Resource          ${CURDIR}/../../libraries/utils.robot
+Resource          ${CURDIR}/../../libraries/k8s.robot
 Resource          ${CURDIR}/../../variables/variables.robot
 
 *** Variables ***
 ${server_ip}      localhost
-${timeout}        90s
+${timeout}        240s
 ${num_onus}       1
 
 *** Test Cases ***
@@ -38,7 +39,9 @@
     ...    re-validate deployment
     [Tags]    sanity
     #create/preprovision device
-    ${olt_device_id}=    Create Device    ${BBSIM_IP}    ${BBSIM_PORT}
+    ${bbsim_ip}=    Lookup Service IP    voltha    bbsim
+    ${bbsim_port}=    Lookup Service Port    voltha    bbsim
+    ${olt_device_id}=    Create Device    ${bbsim_ip}    ${bbsim_port}
     Set Suite Variable    ${olt_device_id}
     #enable device
     Enable Device    ${olt_device_id}
diff --git a/variables/variables.robot b/variables/variables.robot
index 6a78c6e..95196c9 100644
--- a/variables/variables.robot
+++ b/variables/variables.robot
@@ -13,9 +13,6 @@
 # limitations under the License.
 
 *** Variables ***
-${BBSIM_IP}       bbsim.voltha.svc
-${BBSIM_PORT}     50060
-${BBSIM_DEVICE_ID}    of:0000626273696d76
 ${BBSIM_OLT_SN}    BBSIMOLT000
 ${BBSIM_ONU_SN}    BBSM00000001
 ${ONOS_REST_PORT}    30120