048dbcb1fcec62bd44cb74bdb5b50b36e9444ae6
[validation.git] / ceph / ceph_service.resource
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 Library           BuiltIn
21 Library           SSHLibrary
22 Resource          variables.resource
23
24
25 *** Keywords ***
26 Open Connection And Log In
27     Open Connection          ${HOST}
28     Login With Public Key    ${USERNAME}  ${KEYFILE}
29
30 Start Ceph Manager
31     [Arguments]              @{nodes}
32     :FOR  ${node}  IN  @{nodes}
33     \   ${result}=           Run Manager Start  ${node}
34
35 Start Ceph Monitor
36     [Arguments]              @{nodes}
37     :FOR  ${node}  IN  @{nodes}
38     \   ${result}=           Run Monitor Start  ${node}
39
40 Kill Ceph Manager
41     [Arguments]              @{nodes}
42     :FOR  ${node}  IN  @{nodes}
43     \   ${stdout}=           Execute Command  ${SSH_CMD} ${node} "sudo pkill -u ceph ceph-mgr"
44
45 Kill Ceph Monitor
46     [Arguments]              @{nodes}
47     :FOR  ${node}  IN  @{nodes}
48     \   ${stdout}=           Execute Command  ${SSH_CMD} ${node} "sudo pkill -u ceph ceph-mon"
49
50 Ceph Should Be Healthy
51     ${stdout}=               Execute Command  ceph health --connect-timeout 20  sudo=True
52     Should Contain  ${stdout}  HEALTH_OK
53
54 Ceph Health Should Be Degraded
55     ${stdout}=               Execute Command  ceph health --connect-timeout 20  sudo=True
56     Should Contain  ${stdout}  HEALTH_WARN
57
58 Run Manager Start
59     [Arguments]              ${node}
60     Execute Command          ${SSH_CMD} ${node} "sudo systemctl start ceph-mgr@${node}"
61     ${stdout}=               Execute Command  ${SSH_CMD} ${node} "systemctl is-active ceph-mgr@${node}"
62     Return From Keyword If   '${stdout}' == 'active'
63     Execute Command          ${SSH_CMD} ${node} "sudo systemctl reset-failed ceph-mgr@${node}"
64     Execute Command          ${SSH_CMD} ${node} "sudo systemctl start ceph-mgr@${node}"
65     ${stdout}=               Execute Command  ${SSH_CMD} ${node} "systemctl is-active ceph-mgr@${node}"
66     Should Be Equal As Strings  ${stdout}  active
67
68 Run Monitor Start
69     [Arguments]              ${node}
70     Execute Command          ${SSH_CMD} ${node} "sudo systemctl start ceph-mon@${node}"
71     ${stdout}=               Execute Command  ${SSH_CMD} ${node} "systemctl is-active ceph-mon@${node}"
72     Return From Keyword If   '${stdout}' == 'active'
73     Execute Command          ${SSH_CMD} ${node} "sudo systemctl reset-failed ceph-mon@${node}"
74     Execute Command          ${SSH_CMD} ${node} "sudo systemctl start ceph-mon@${node}"
75     ${stdout}=               Execute Command  ${SSH_CMD} ${node} "systemctl is-active ceph-mon@${node}"
76     Should Be Equal As Strings  ${stdout}  active