c67d5566434764a284d532cf1602764ead03b4cf
[integration/test.git] / csit / suites / controller / cluster_singleton / partition_and_heal.robot
1 *** Settings ***
2 Documentation     Cluster Singleton testing: Partition And Heal
3 ...
4 ...               Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...               Cluster Singleton service is designed to ensure that only one instance of
11 ...               an application is registered globally in the cluster.
12 ...               The goal is to establish the service operates correctly in face of node
13 ...               failures.
14 Suite Setup       Setup_Keyword
15 Suite Teardown    SSHLibrary.Close_All_Connections
16 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
18 Default Tags      critical
19 Library           Collections
20 Library           SSHLibrary
21 Library           RequestsLibrary
22 Resource          ${CURDIR}/../../../libraries/controller/CsCommon.robot
23 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
24 Resource          ${CURDIR}/../../../libraries/MdsalLowlevel.robot
25 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
26 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
27
28 *** Variables ***
29 ${STABILITY_TIMEOUT_ISOLATED}    120s
30 ${STABILITY_TIMEOUT_REJOINED}    60s
31 @{STATUS_ISOLATED}    ${501}
32
33 *** Test Cases ***
34 Register_Singleton_Constant_On_Each_Node
35     [Documentation]    Register a candidate application on each node.
36     CsCommon.Register_Singleton_Constant_On_Nodes    ${cs_all_indices}
37
38 Verify_Singleton_Constant_On_Each_Node
39     [Documentation]    Store the owner and candidates of the application and initially verify that all
40     ...    odl nodes are used.
41     ${owner}    ${candidates}=    CsCommon.Get_And_Save_Present_CsOwner_And_CsCandidates    1
42     BuiltIn.Wait_Until_Keyword_Succeeds    15    2s    CsCommon.Verify_Singleton_Constant_On_Nodes    ${cs_all_indices}    ${CS_CONSTANT_PREFIX}${owner}
43
44 Isolate_Owner_Node
45     [Documentation]    Isolate the cluster node which is the owner. Wait until the new owner is elected and store
46     ...    new values of owner and candidates.
47     CsCommon.Isolate_Owner_And_Verify_Isolated
48
49 Monitor_Stability_While_Isolated
50     [Documentation]    Monitor the stability of the singleton application and fail the the owner is changed during the monitoring.
51     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    ${STABILITY_TIMEOUT_ISOLATED}    3s    CsCommon.Verify_Singleton_Constant_During_Isolation
52
53 Rejoin_Isolated_node
54     [Documentation]    Rejoin isolated node.
55     CsCommon.Rejoin_Node_And_Verify_Rejoined
56
57 Unregister_Singleton_Constant_On_Each_Node
58     [Documentation]    Unregister the application on every node.
59     CsCommon.Unregister_Singleton_Constant_On_Nodes    ${cs_all_indices}
60
61 *** Keywords ***
62 Setup_Keyword
63     [Documentation]    Suite setup.
64     SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=125
65     CsCommon.Cluster_Singleton_Init