blob: a76fd4f8bacc1a351445ca8fe85ebd36da87b14b [file] [log] [blame]
You Wang0c2b3662018-10-01 16:56:17 -07001# 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*** Settings ***
16Documentation Library of functions related to kubectl and helm
17Library SSHLibrary
18Library Collections
19Library String
20Library OperatingSystem
21Library RequestsLibrary
22Library utils/utils.py
23Library restApi.py
24
25*** Keywords ***
26Helm Chart is Removed
You Wang88e1d852018-10-05 11:44:19 -070027 [Arguments] ${helm_chart}
You Wang0c2b3662018-10-01 16:56:17 -070028 [Documentation] Verify the specified helm chart has been removed
You Wang88e1d852018-10-05 11:44:19 -070029 ${rc}= Run And Return Rc ${export_kubeconfig}; helm ls -q | grep ${helm_chart}
You Wang0c2b3662018-10-01 16:56:17 -070030 Should Be Equal As Integers ${rc} 1
31
32Kubernetes PODs in Namespace are Removed
You Wang88e1d852018-10-05 11:44:19 -070033 [Arguments] ${namespace}
You Wang0c2b3662018-10-01 16:56:17 -070034 [Documentation] Verify all Kubernetes pods in specified namespace have been removed
You Wang88e1d852018-10-05 11:44:19 -070035 ${rc} ${output}= Run And Return Rc And Output ${export_kubeconfig}; kubectl get pods --no-headers -n ${namespace}
You Wang0c2b3662018-10-01 16:56:17 -070036 Should Contain ${output} No resources found
37
38Kubernetes PODs in Namespace are Running
You Wang88e1d852018-10-05 11:44:19 -070039 [Arguments] ${namespace} ${pod_num}
You Wang0c2b3662018-10-01 16:56:17 -070040 [Documentation] Verify the number of Kubernetes pods that are running in specified namespace is as expected
You Wang88e1d852018-10-05 11:44:19 -070041 ${rc} ${output}= Run And Return Rc And Output ${export_kubeconfig}; kubectl get pods -n ${namespace} | grep -i running | grep 1/1 | wc -l
You Wang0c2b3662018-10-01 16:56:17 -070042 Should Be Equal As Integers ${output} ${pod_num}
You Wang5be816a2018-10-11 16:45:31 -070043
44Reinstall Voltha
45 Run ${export_kubeconfig}; helm delete --purge voltha
46 Wait Until Keyword Succeeds 60s 10s Helm Chart is Removed voltha
47 Wait Until Keyword Succeeds 120s 10s Kubernetes PODs in Namespace are Removed voltha
48 Run ${export_kubeconfig}; cd ${HELM_CHARTS_DIR}; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
49 Run ${export_kubeconfig}; cd ${HELM_CHARTS_DIR}; helm dep up voltha
50 Run ${export_kubeconfig}; helm install -n voltha -f ${KUBERNETES_YAML} --set etcd-operator.customResources.createEtcdClusterCRD=false ${HELM_CHARTS_DIR}/voltha
51 Run ${export_kubeconfig}; helm upgrade -f ${KUBERNETES_YAML} --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ${HELM_CHARTS_DIR}/voltha
52 Wait Until Keyword Succeeds 60s 10s Kubernetes PODs in Namespace are Running voltha ${VOLTHA_POD_NUM}
53 Sleep 10s