blob: 4ae2f1b7dc1c8753ee9594fb546664e2c7d1216b [file] [log] [blame]
David Bainbridge117d23e2019-09-30 20:37:51 +00001# 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 ***
18Documentation Library for various utilities
19Library SSHLibrary
20Library HttpLibrary.HTTP
21Library String
22Library DateTime
23Library Process
24Library Collections
25Library RequestsLibrary
26Library OperatingSystem
27
28*** Keywords ***
29Lookup Service IP
30 [Arguments] ${namespace} ${name}
31 [Documentation] Uses kubeclt to resolve a service name to an IP
Gilles Depatie675a2062019-10-22 12:44:42 -040032 ${rc} ${ip}= Run and Return Rc and Output
33 ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.clusterIP}
David Bainbridge117d23e2019-09-30 20:37:51 +000034 Should Be Equal as Integers ${rc} 0
35 [Return] ${ip}
36
37Lookup Service PORT
38 [Arguments] ${namespace} ${name}
39 [Documentation] Uses kubeclt to resolve a service name to an PORT
Gilles Depatie675a2062019-10-22 12:44:42 -040040 ${rc} ${port}= Run and Return Rc and Output
41 ... kubectl get svc -n ${namespace} ${name} -o jsonpath={.spec.ports[0].port}
David Bainbridge117d23e2019-09-30 20:37:51 +000042 Should Be Equal as Integers ${rc} 0
43 [Return] ${port}
suraj gourd64356b2019-11-07 13:26:20 +000044
45Restart Pod
46 [Arguments] ${namespace} ${name}
47 [Documentation] Uses kubectl to force delete pod
48 ${rc} ${restart_pod_name}= Run and Return Rc and Output kubectl get pods --template $'{{range .items}}{{.metadata.name}}{{"\\n"}}{{end}}', -n ${namespace} | grep ${name}
49 Log ${restart_pod_name}
50 ${rc} ${output}= Run and Return Rc and Output kubectl delete pod ${restart_pod_name} -n ${namespace} --grace-period=0 --force
51 Log ${output}