blob: 1009eda17bab8b7585293aa7f4695a8433e93ec9 [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.
14
15# voltha 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 Pod That Owns Device
30 [Arguments] ${device_id}
31 [Documentation] Uses a utility script to lookup which RW Core has current ownership of an OLT
32 ${rc} ${pod}= Run and Return Rc and Output
33 ... ../scripts/which_pod_owns_device.sh ${device_id}
34 Should Be Equal as Integers ${rc} 0
35 [Return] ${pod}
36
37Lookup Deployment That Owns Device
38 [Arguments] ${device_id}
39 [Documentation] Uses a utility script to lookup which RW Core has current ownership of an OLT
40 ${rc} ${deploy}= Run and Return Rc and Output
41 ... which_deployment_owns_device.sh ${device_id}
42 Should Be Equal as Integers ${rc} 0
43 [Return] ${deploy}
44
45Restart VOLTHA Port Foward
46 [Arguments] ${name}
47 [Documentation] Uses a script to restart a kubectl port-forward
48 ${rc} ${pid} Run And Return Rc And Output
49 ... ps e -ww | grep _TAG=${name} | grep -v grep | awk '{printf(\"%s %s\\n\",$1,$5)}' | grep -v bash | awk '{print $1}'
50 Should Be Equal as Integers ${rc} 0
51 Run Keyword If '${pid}' != '' Run And Return Rc kill -9 ${pid}
52 Should Be Equal as Integers ${rc} 0