f2bb7c89d460f259175fde0f6b08e0929bdffe66
[integration/test.git] / csit / suites / controller / dom_rpc_broker / rpc_provider_partition_and_heal.robot
1 *** Settings ***
2 Documentation     DOMRpcBroker testing: RPC Provider 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 ...               This tests establishes that the RPC service operates correctly when faced
11 ...               with node failures.
12 ...               This suite supports more than three node cluster setup too.
13 Suite Setup       Setup_Kw
14 Suite Teardown    SSHLibrary.Close_All_Connections
15 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
16 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
17 Default Tags      critical
18 Library           SSHLibrary
19 Resource          ${CURDIR}/../../../libraries/controller/DrbCommons.robot
20 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
21 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
22
23 *** Variables ***
24 @{INSTALLED_RPC_MEMEBER_IDX_LIST}    ${1}    ${2}
25 ${TESTED_MEMBER_WITHOUT_RPC_IDX}    ${3}
26 @{NON_WORKING_RPC_STATUS_CODE}    ${501}
27
28 *** Test Cases ***
29 Register_Rpc_On_Two_Nodes
30     [Documentation]    Register rpc on two nodes of the odl cluster.
31     DrbCommons.Register_Rpc_On_Nodes    ${INSTALLED_RPC_MEMEBER_IDX_LIST}
32
33 Invoke_Rpc_On_Each_Node
34     [Documentation]    Invoke get-constant rpc on every node of the cluster. When requested on the node with
35     ...    local instance the local value is expected. If invoked on the node with no local instance, any remote
36     ...    value is expected.
37     DrbCommons.Verify_Constant_On_Active_Nodes
38
39 Isolate_One_Node
40     [Documentation]    Isolate one node with registered rpc.
41     ...    From the constant returned from the ${TESTED_MEMBER_WITHOUT_RPC_IDX} node (with no rpc instance) an index of
42     ...    the node to be isolated is derived. And in the tc Invoke_Rpc_On_Remaining_Nodes a different constant
43     ...    is expected.
44     ${isolated_idx} =    DrbCommons.Get_Constant_Index_From_Node    ${TESTED_MEMBER_WITHOUT_RPC_IDX}
45     BuiltIn.Set_Suite_Variable    ${isolated_idx}
46     DrbCommons.Isolate_Node    ${isolated_idx}
47
48 Invoke_Rpc_On_Isolated_Node
49     [Documentation]    Invoke rpc on isolated node. Because rpc is registered on this node, local constant
50     ...    is expected.
51     BuiltIn.Pass_Execution    Aaa has a problem to authenticate http request as it is out of cluster too (see bug 8214), skipping for now.
52     BuiltIn.Wait_Until_Keyword_Succeeds    3x    2s    DrbCommons.Verify_Constant_On_Registered_Node    ${isolated_idx}
53
54 Invoke_Rpc_On_Remaining_Nodes
55     [Documentation]    Invoke rpc on non-islolated nodes.
56     BuiltIn.Wait_Until_Keyword_Succeeds    45s    5s    DrbCommons.Verify_Constant_On_Active_Nodes
57
58 Rejoin_Isolated_Member
59     [Documentation]    Rejoin isolated node
60     DrbCommons.Rejoin_Node    ${isolated_idx}
61
62 Invoke_Rpc_On_Each_Node_Again
63     [Documentation]    Invoke rpc get-constant on every node. When requested on the node with
64     ...    local instance the local value is expected. If invoked on the node with no local instance, any remote
65     ...    value is expected.
66     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    20s    3s    DrbCommons.Verify_Constant_On_Active_Nodes
67
68 Unregister_Rpc_On_Each_Node
69     [Documentation]    Inregister rpc on both nodes.
70     DrbCommons.Unregister_Rpc_On_Nodes    ${INSTALLED_RPC_MEMEBER_IDX_LIST}
71
72 *** Keywords ***
73 Setup_Kw
74     [Documentation]    Setup keyword. Create ${possible_constants} list with possible variables of remote constants.
75     SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=30
76     DrbCommons.DrbCommons_Init