David Bainbridge | 117d23e | 2019-09-30 20:37:51 +0000 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # voltctl common functions |
| 16 | |
| 17 | *** Settings *** |
| 18 | Documentation Library for various utilities |
| 19 | Library SSHLibrary |
| 20 | Library HttpLibrary.HTTP |
| 21 | Library String |
| 22 | Library DateTime |
| 23 | Library Process |
| 24 | Library Collections |
| 25 | Library RequestsLibrary |
| 26 | Library OperatingSystem |
| 27 | |
| 28 | *** Keywords *** |
| 29 | Lookup Service IP |
| 30 | [Arguments] ${namespace} ${name} |
| 31 | [Documentation] Uses kubeclt to resolve a service name to an IP |
| 32 | ${rc} ${ip}= Run and Return Rc and Output kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.clusterIP} |
| 33 | Should Be Equal as Integers ${rc} 0 |
| 34 | [Return] ${ip} |
| 35 | |
| 36 | Lookup Service PORT |
| 37 | [Arguments] ${namespace} ${name} |
| 38 | [Documentation] Uses kubeclt to resolve a service name to an PORT |
| 39 | ${rc} ${port}= Run and Return Rc and Output kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.ports[0].port} |
| 40 | Should Be Equal as Integers ${rc} 0 |
| 41 | [Return] ${port} |