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
9 Suite Setup Setup_Suite
10 Suite Teardown SSHLibrary.Close_All_Connections
11 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing member_index_list=${active_nodes}
12 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
14 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
15 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
16 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
17 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
18 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
19 Resource ${CURDIR}/../../../variables/Variables.robot
22 ${RPC_URL} /restconf/operations/basic-rpc-test:basic-global
24 ${SERVICE} Basic-rpc-test']
25 ${TEST_LOG_LEVEL} info
26 @{TEST_LOG_COMPONENTS} org.opendaylight.controller.remote.rpc
27 ${EOS_URL} /restconf/operational/entity-owners:entity-owners
29 ${active_nodes} ${EMPTY}
32 Get_Basic_Rpc_Test_Owner
33 [Documentation] Find a service owner and successors.
35 Get_Present_Brt_Owner_And_Successors 1 store=${True}
37 Rpc_Before_Freezing_On_Owner
38 [Documentation] Run rpc on the service owner.
41 Rpc_Before_Freeze_On_Successors
42 [Documentation] Run rpc on non owher cluster nodes.
43 : FOR ${idx} IN @{brt_successors}
46 Freeze_Current_Owner_Member
47 [Documentation] Stop cluster node which is the owner.
49 ClusterManagement.Freeze_Single_Member ${brt_owner}
50 BuiltIn.Set_Suite_Variable ${old_brt_owner} ${brt_owner}
51 BuiltIn.Set_Suite_Variable ${old_brt_successors} ${brt_successors}
52 BuiltIn.Set_Suite_Variable ${active_nodes} ${old_brt_successors}
54 Verify_New_Basic_Rpc_Test_Owner_Elected
55 [Documentation] Verify new owner of the service is elected.
56 ${idx}= Collections.Get_From_List ${old_brt_successors} 0
57 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_Owner_Elected ${True} ${old_brt_owner} ${idx}
58 Get_Present_Brt_Owner_And_Successors ${idx} store=${True}
60 Rpc_On_Remained_Cluster_Nodes
61 [Documentation] Run rpc on remained cluster nodes.
62 : FOR ${idx} IN @{old_brt_successors}
65 Unfreeze_Frozen_Member
66 [Documentation] Restart frozen node
68 ClusterManagement.Unfreeze_Single_Member ${old_brt_owner}
69 BuiltIn.Set_Suite_Variable ${active_nodes} ${EMPTY}
71 Verify_New_Owner_Remained_After_Rejoin
72 [Documentation] Verify no owner change happened after rejoin.
73 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 15s 2s Verify_Owner_Elected ${False} ${brt_owner} ${brt_owner}
75 Rpc_After_Rejoin_On_New_Owner
76 [Documentation] Run rpc on the new service owner node.
79 Rpc_After_Rejoin_On_Old_Owner
80 [Documentation] Run rpc on rejoined cluster node.
81 Run_Rpc ${old_brt_owner}
83 Rpc_After_Rejoin_On_All
84 [Documentation] Run rpc again on all nodes.
86 : FOR ${idx} IN @{brt_successors}
91 SetupUtils.Setup_Utils_For_Setup_And_Teardown
92 SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All ${TEST_LOG_LEVEL} ${TEST_LOG_COMPONENTS}
95 [Arguments] ${node_idx}
96 [Documentation] Run rpc and log the entity ownership service details to karaf log.
97 ... Logging the details was a developer's request during the implementation to improve debugging.
98 ${session} = Resolve_Http_Session_For_Member member_index=${node_idx}
99 ${out} = TemplatedRequests.Get_From_Uri ${EOS_URL} session=${session}
100 KarafKeywords.Log_Message_To_Controller_Karaf EOS rest resp: ${out} member_index_list=${active_nodes}
101 TemplatedRequests.Post_To_Uri ${RPC_URL} ${EMPTY} ${EMPTY_DICT} ${EMPTY_DICT} session=${session}
104 [Arguments] ${new_elected} ${old_owner} ${node_to_ask}
105 [Documentation] Verify new owner was elected or remained the same.
106 ${owner} ${successors}= Get_Present_Brt_Owner_And_Successors ${node_to_ask}
107 BuiltIn.Run_Keyword_If ${new_elected} BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_owner} ${owner}
108 BuiltIn.Run_Keyword_Unless ${new_elected} BuiltIn.Should_Be_Equal_As_numbers ${old_owner} ${owner}
110 Get_Present_Brt_Owner_And_Successors
111 [Arguments] ${node_to_ask} ${store}=${False}
112 [Documentation] Find a basic rpc test service owner and successors and store them if indicated.
113 ${brt_owner} ${brt_successors}= ClusterManagement.Get_Owner_And_Successors_For_Device ${SERVICE} org.opendaylight.mdsal.ServiceEntityType ${node_to_ask}
114 BuiltIn.Run_Keyword_If ${store} BuiltIn.Set_Suite_Variable ${brt_owner} ${brt_owner}
115 BuiltIn.Run_Keyword_If ${store} BuiltIn.Set_Suite_Variable ${brt_successors} ${brt_successors}
116 BuiltIn.Return_From_Keyword ${brt_owner} ${brt_successors}