Merge "bluval engine refactoring"
[validation.git] / tests / k8s / ha / ha_services.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 services tests: docker and kubelet
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_docker_kubelet.txt
31
32
33 ## Container Runtime
34
35 *** Test Cases ***
36 Verify status of container runtime
37         [Documentation]         container runtime active
38         Start Command           systemctl is-active docker.service
39         ${stdout}=              Read Command Output
40         Append To File          ${LOG}  ${stdout}${\n}
41         Should Be Equal         ${stdout}              active
42
43
44 Fail container runtime
45         [Documentation]         container runtime stopped
46         ${output}  ${rc}=       Execute Command         systemctl stop docker.service    return_rc=True    sudo=True
47         Append To File          ${LOG}  ${output}${\n}
48         Should Be Equal As Integers  ${rc}  0
49         Sleep                   8s
50         Start Command           systemctl is-active docker.service
51         ${stdout}=              Read Command Output
52         Append To File          ${LOG}  ${stdout}${\n}
53         Should Be Equal         ${stdout}              inactive
54
55
56 Start container runtime
57         [Documentation]         container runtime active
58         Sleep                   1 minute
59         ${output}  ${rc}=       Execute Command         systemctl start docker.service    return_rc=True    sudo=True
60         Append To File          ${LOG}  ${output}${\n}
61         Should Be Equal As Integers  ${rc}  0
62         Sleep                   8s
63         Start Command           systemctl is-active docker.service
64         ${stdout}=              Read Command Output
65         Append To File          ${LOG}  ${stdout}${\n}
66         Should Be Equal         ${stdout}              active
67
68 ## Kubelet Service
69
70 Verify kubelet status
71         [Documentation]         kubelet service active
72         Start Command           systemctl is-active kubelet.service
73         ${stdout}=              Read Command Output
74         Append To File          ${LOG}  ${stdout}${\n}
75         Should Be Equal         ${stdout}              active
76
77
78 Fail kubelet service
79         [Documentation]         kubelet service stopped
80         ${output}  ${rc}=       Execute Command         systemctl stop kubelet.service    return_rc=True    sudo=True
81         Append To File          ${LOG}  ${output}${\n}
82         Should Be Equal As Integers  ${rc}  0
83         Sleep                   8s
84         Start Command           systemctl is-active kubelet.service
85         ${stdout}=              Read Command Output
86         Append To File          ${LOG}  ${stdout}${\n}
87         Should Be Equal         ${stdout}              inactive
88
89
90 Start kubelet service
91         [Documentation]         kubelet active
92         Sleep                   30s
93         ${output}  ${rc}=       Execute Command         systemctl start kubelet.service    return_rc=True    sudo=True
94         Append To File          ${LOG}  ${output}${\n}
95         Should Be Equal As Integers  ${rc}  0
96         Sleep                   8s
97         Start Command           systemctl is-active kubelet.service
98         ${stdout}=              Read Command Output
99         Append To File          ${LOG}  ${stdout}${\n}
100         Should Be Equal         ${stdout}              active
101
102
103
104 *** Keywords ***
105 Open Connection And Log In
106   Open Connection       ${HOST}
107   Login With Public Key    ${USERNAME}   /root/.ssh/${USERNAME}_id_rsa
108