2 Documentation Controller functional HA testing of global singleton rpcs if jvm frozen.
4 ... Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
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
10 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
11 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
12 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
13 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
14 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
15 Resource ${CURDIR}/../../../variables/Variables.robot
17 Suite Setup Setup_Suite
18 Suite Teardown SSHLibrary.Close_All_Connections
19 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing member_index_list=${active_nodes}
20 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
26 ${RPC_URL} /rests/operations/basic-rpc-test:basic-global
28 ${SERVICE} Basic-rpc-test']
29 ${TEST_LOG_LEVEL} info
30 @{TEST_LOG_COMPONENTS} org.opendaylight.controller.remote.rpc
31 ${EOS_URL} /rests/data/entity-owners:entity-owners?content=nonconfig
32 ${active_nodes} ${EMPTY}
36 Get_Basic_Rpc_Test_Owner
37 [Documentation] Find a service owner and successors.
38 Get_Present_Brt_Owner_And_Successors 1 store=${True}
40 Rpc_Before_Freezing_On_Owner
41 [Documentation] Run rpc on the service owner.
44 Rpc_Before_Freeze_On_Successors
45 [Documentation] Run rpc on non owher cluster nodes.
46 FOR ${idx} IN @{brt_successors}
50 Freeze_Current_Owner_Member
51 [Documentation] Stop cluster node which is the owner.
52 ClusterManagement.Freeze_Single_Member ${brt_owner}
53 BuiltIn.Set_Suite_Variable ${old_brt_owner} ${brt_owner}
54 BuiltIn.Set_Suite_Variable ${old_brt_successors} ${brt_successors}
55 BuiltIn.Set_Suite_Variable ${active_nodes} ${old_brt_successors}
57 Verify_New_Basic_Rpc_Test_Owner_Elected
58 [Documentation] Verify new owner of the service is elected.
59 ${idx}= Collections.Get_From_List ${old_brt_successors} 0
60 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s Verify_Owner_Elected ${True} ${old_brt_owner} ${idx}
61 Get_Present_Brt_Owner_And_Successors ${idx} store=${True}
63 Rpc_On_Remained_Cluster_Nodes
64 [Documentation] Run rpc on remained cluster nodes.
65 FOR ${idx} IN @{old_brt_successors}
66 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s Run_Rpc ${idx}
69 Unfreeze_Frozen_Member
70 [Documentation] Restart frozen node
71 ClusterManagement.Unfreeze_Single_Member ${old_brt_owner}
72 BuiltIn.Set_Suite_Variable ${active_nodes} ${EMPTY}
74 Rpc_After_Rejoin_On_New_Owner
75 [Documentation] Run rpc on the new service owner node.
78 Rpc_After_Rejoin_On_Old_Owner
79 [Documentation] Run rpc on rejoined cluster node.
80 Run_Rpc ${old_brt_owner}
82 Rpc_After_Rejoin_On_All
83 [Documentation] Run rpc again on all nodes.
85 FOR ${idx} IN @{brt_successors}
92 [Documentation] FIXME: Add a documentation.
93 SetupUtils.Setup_Utils_For_Setup_And_Teardown http_timeout=30
94 SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All ${TEST_LOG_LEVEL} ${TEST_LOG_COMPONENTS}
97 [Documentation] Run rpc and log the entity ownership service details to karaf log.
98 ... Logging the details was a developer's request during the implementation to improve debugging.
99 [Arguments] ${node_idx}
100 ${session}= Resolve_Http_Session_For_Member member_index=${node_idx}
101 ${out}= TemplatedRequests.Get_From_Uri ${EOS_URL} session=${session}
102 KarafKeywords.Log_Message_To_Controller_Karaf EOS rest resp: ${out} member_index_list=${active_nodes}
103 TemplatedRequests.Post_To_Uri ${RPC_URL} ${EMPTY} ${HEADERS_XML} ${ACCEPT_XML} session=${session}
106 [Documentation] Verify new owner was elected or remained the same.
107 [Arguments] ${new_elected} ${old_owner} ${node_to_ask}
108 ${owner} ${successors}= Get_Present_Brt_Owner_And_Successors ${node_to_ask}
110 BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_owner} ${owner}
112 IF not ${new_elected}
113 BuiltIn.Should_Be_Equal_As_numbers ${old_owner} ${owner}
116 Get_Present_Brt_Owner_And_Successors
117 [Documentation] Find a basic rpc test service owner and successors and store them if indicated.
118 [Arguments] ${node_to_ask} ${store}=${False}
119 ${brt_owner} ${brt_successors}= ClusterManagement.Get_Owner_And_Successors_For_Device
121 ... org.opendaylight.mdsal.ServiceEntityType
123 IF ${store} BuiltIn.Set_Suite_Variable ${brt_owner} ${brt_owner}
125 BuiltIn.Set_Suite_Variable ${brt_successors} ${brt_successors}
127 RETURN ${brt_owner} ${brt_successors}