blob: f1f47aa5132a215f4d35e4c1c5e71d5b525d4997 [file] [log] [blame]
David Bainbridgef81cd642019-11-20 00:14:47 +00001# Copyright 2019-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.
David Bainbridgef81cd642019-11-20 00:14:47 +000014# voltha common functions
15
16*** Settings ***
17Documentation Library for various utilities
18Library SSHLibrary
David Bainbridgef81cd642019-11-20 00:14:47 +000019Library String
20Library DateTime
21Library Process
22Library Collections
23Library RequestsLibrary
24Library OperatingSystem
25
26*** Keywords ***
27Lookup Pod That Owns Device
28 [Arguments] ${device_id}
29 [Documentation] Uses a utility script to lookup which RW Core has current ownership of an OLT
30 ${rc} ${pod}= Run and Return Rc and Output
31 ... ../scripts/which_pod_owns_device.sh ${device_id}
32 Should Be Equal as Integers ${rc} 0
33 [Return] ${pod}
34
35Lookup Deployment That Owns Device
36 [Arguments] ${device_id}
37 [Documentation] Uses a utility script to lookup which RW Core has current ownership of an OLT
38 ${rc} ${deploy}= Run and Return Rc and Output
39 ... which_deployment_owns_device.sh ${device_id}
40 Should Be Equal as Integers ${rc} 0
41 [Return] ${deploy}
42
43Restart VOLTHA Port Foward
44 [Arguments] ${name}
45 [Documentation] Uses a script to restart a kubectl port-forward
46 ${rc} ${pid} Run And Return Rc And Output
Zack Williamsa8fe75a2020-01-10 14:25:27 -070047 ... ps e -ww | grep _TAG=${name} | awk '{printf(\"%s %s\\n\",$1,$5)}' | grep kubectl | awk '{print $1}'
David Bainbridgef81cd642019-11-20 00:14:47 +000048 Should Be Equal as Integers ${rc} 0
49 Run Keyword If '${pid}' != '' Run And Return Rc kill -9 ${pid}
50 Should Be Equal as Integers ${rc} 0