1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you maynot use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ##############################################################################
20 Documentation HA test cases for calico, coredns and haproxy
22 Library OperatingSystem
24 Suite Setup Open Connection And Log In
25 Suite Teardown Close All Connections
29 ${USERNAME} localadmin
30 ${LOG} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}.log
39 [Documentation] Calico nodes are active
40 Start Command kubectl get pod -n kube-system -o wide -l k8s-app=calico-node sudo=True
41 ${stdout}= Read Command Output
42 Append To File ${LOG} ${stdout}${\n}
43 Should Contain ${stdout} Running
45 Failure of calico nodes
46 [Documentation] Calico pods deleted
47 ${output}= Execute Command kubectl delete pod -n kube-system -l k8s-app=calico-node sudo=True
48 Append To File ${LOG} ${output}${\n}
50 Should Contain ${output} deleted
52 Verify calico node re-establishment
53 [Documentation] Calico component is auto-created and running
55 Start Command kubectl get pod -n kube-system -o wide -l k8s-app=calico-node sudo=True
56 ${stdout}= Read Command Output
57 Append To File ${LOG} ${stdout}${\n}
58 Should Contain ${stdout} Running
63 [Documentation] Coredns components active
64 Start Command kubectl get pod -n kube-system -o wide -l coredns=enabled sudo=True
65 ${stdout}= Read Command Output
66 Append To File ${LOG} ${stdout}${\n}
67 Should Contain ${stdout} Running
70 Failure of coredns in control plane node
71 [Documentation] coredns pod is deleted
72 ${output}= Execute Command kubectl delete pod -n kube-system -l coredns=enabled sudo=True
73 Append To File ${LOG} ${output}${\n}
75 Should Contain ${output} deleted
78 Verify coredns re-establishment
79 [Documentation] Coredns component is auto-created and running
81 Start Command kubectl get pod -n kube-system -l coredns=enabled sudo=True
82 ${stdout}= Read Command Output
83 Append To File ${LOG} ${stdout}${\n}
84 Should Contain ${stdout} Running
89 [Documentation] All haproxy pods are active
90 Start Command kubectl get pod -n kube-system -o wide -l application=haproxy sudo=True
91 ${stdout}= Read Command Output
92 Append To File ${LOG} ${stdout}${\n}
93 Should Contain ${stdout} Running
97 [Documentation] Haproxy components deleted
98 ${output}= Execute Command kubectl delete pod -n kube-system -l application=haproxy sudo=True
99 Append To File ${LOG} ${output}${\n}
101 Should Contain ${output} deleted
104 Verify haproxy re-establishment
105 [Documentation] Haproxy components auto-created and running
107 Start Command kubectl get pod -n kube-system -o wide -l application=haproxy sudo=True
108 ${stdout}= Read Command Output
109 Append To File ${LOG} ${stdout}${\n}
110 Should Contain ${stdout} Running
114 Open Connection And Log In
115 Open Connection ${HOST}
116 Login With Public Key ${USERNAME} /root/.ssh/${USERNAME}_id_rsa