Merge "bluval engine refactoring"
[validation.git] / ha / ha_calico_dns_proxy.robot
1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property.                             #
3 # Copyright (c) 2019 Nokia.                                                  #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License");            #
6 # you maynot use this file except in compliance with the License.            #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
9 #       http://www.apache.org/licenses/LICENSE-2.0                           #
10 #                                                                            #
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 ##############################################################################
17
18
19 *** Settings ***
20 Documentation     HA test cases for calico, coredns and haproxy
21 Library           SSHLibrary
22 Library           OperatingSystem
23 Library           BuiltIn
24 Suite Setup       Open Connection And Log In
25 Suite Teardown    Close All Connections
26
27 *** Variables ***
28 ${HOST}           localhost
29 ${USERNAME}       localadmin
30 ${LOG}            /opt/akraino/validation/ha/print_calico_coredns_haproxy.txt
31
32
33
34 *** Test Cases ***
35
36 ## Calico
37
38 Verify calico status
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
44
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}
49         Sleep                   5s
50         Should Contain          ${output}             deleted
51
52 Verify calico node re-establishment
53         [Documentation]         Calico component is auto-created and running
54         Sleep                   5s
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
59
60 ## Coredns
61
62 Verify coredns status
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
68
69
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}
74         Sleep                   30s
75         Should Contain          ${output}             deleted
76
77
78 Verify coredns re-establishment
79         [Documentation]         Coredns component is auto-created and running
80         Sleep                   5s
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
85
86 ## Haproxy
87
88 Verify haproxy status
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
94
95
96 Failure of haproxy
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}
100         Sleep                   5s
101         Should Contain          ${output}             deleted
102
103
104 Verify haproxy re-establishment
105         [Documentation]         Haproxy components auto-created and running
106         Sleep                   20s
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
111
112
113 *** Keywords ***
114 Open Connection And Log In
115   Open Connection       ${HOST}
116   Login With Public Key    ${USERNAME}   /root/.ssh/${USERNAME}_id_rsa
117
118