Migrate Get Requests invocations(libraries)
[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
27 *** Test Cases ***
28 Register_Rpc_On_Two_Nodes
29     [Documentation]    Register rpc on two nodes of the odl cluster.
30     DrbCommons.Register_Rpc_On_Nodes    ${INSTALLED_RPC_MEMEBER_IDX_LIST}
31
32 Invoke_Rpc_On_Each_Node
33     [Documentation]    Invoke get-constant rpc on every node of the cluster. When requested on the node with
34     ...    local instance the local value is expected. If invoked on the node with no local instance, any remote
35     ...    value is expected.
36     DrbCommons.Verify_Constant_On_Active_Nodes
37
38 Isolate_One_Node
39     [Documentation]    Isolate one node with registered rpc.
40     ...    From the constant returned from the ${TESTED_MEMBER_WITHOUT_RPC_IDX} node (with no rpc instance) an index of
41     ...    the node to be isolated is derived. And in the tc Invoke_Rpc_On_Remaining_Nodes a different constant
42     ...    is expected.
43     ${isolated_idx} =    DrbCommons.Get_Constant_Index_From_Node    ${TESTED_MEMBER_WITHOUT_RPC_IDX}
44     BuiltIn.Set_Suite_Variable    ${isolated_idx}
45     DrbCommons.Isolate_Node    ${isolated_idx}
46
47 Invoke_Rpc_On_Nonisolated_Nodes
48     [Documentation]    Invoke rpc on non-islolated nodes.
49     BuiltIn.Wait_Until_Keyword_Succeeds    60s    5s    DrbCommons.Verify_Constant_On_Active_Nodes
50
51 Rejoin_Isolated_Member
52     [Documentation]    Rejoin isolated node
53     DrbCommons.Rejoin_Node    ${isolated_idx}
54
55 Invoke_Rpc_On_Each_Node_Again
56     [Documentation]    Invoke rpc get-constant on every node. When requested on the node with
57     ...    local instance the local value is expected. If invoked on the node with no local instance, any remote
58     ...    value is expected.
59     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    20s    3s    DrbCommons.Verify_Constant_On_Active_Nodes
60
61 Unregister_Rpc_On_Each_Node
62     [Documentation]    Inregister rpc on both nodes.
63     DrbCommons.Unregister_Rpc_On_Nodes    ${INSTALLED_RPC_MEMEBER_IDX_LIST}
64
65 *** Keywords ***
66 Setup_Kw
67     [Documentation]    Setup keyword. Create ${possible_constants} list with possible variables of remote constants.
68     SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=125
69     DrbCommons.DrbCommons_Init