VOL-1994 - use kubectl to lookup the service end point information
Change-Id: Ie126211530f3a0c2f73ce39232fdc2c163108d21
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}