2 Documentation Controller functional HA testing of global singleton rpcs.
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/ShardStability.robot
13 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
14 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
15 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
16 Resource ${CURDIR}/../../../variables/Variables.robot
18 Suite Setup Setup_Suite
19 Suite Teardown SSHLibrary.Close_All_Connections
20 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
21 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
27 ${RPC_URL} /restconf/operations/basic-rpc-test:basic-global
29 ${SERVICE} Basic-rpc-test']
30 ${TEST_LOG_LEVEL} info
31 @{TEST_LOG_COMPONENTS} org.opendaylight.controller.remote.rpc
32 ${EOS_URL} /restconf/operational/entity-owners:entity-owners
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_Stopping_On_Owner
41 [Documentation] Run rpc on the service owner.
44 Rpc_Before_Stop_On_Successors
45 [Documentation] Run rpc on non owher cluster nodes.
46 FOR ${idx} IN @{brt_successors}
50 Stop_Current_Owner_Member
51 [Documentation] Stop cluster node which is the owner.
52 ClusterManagement.Stop_Single_Member ${brt_owner}
53 BuiltIn.Set Suite variable ${old_brt_owner} ${brt_owner}
54 BuiltIn.Set Suite variable ${old_brt_successors} ${brt_successors}
56 Verify_New_Basic_Rpc_Test_Owner_Elected
57 [Documentation] Verify new owner of the service is elected.
58 ${idx}= Collections.Get_From_List ${old_brt_successors} 0
59 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s Verify_Owner_Elected ${True} ${old_brt_owner} ${idx}
60 Get_Present_Brt_Owner_And_Successors ${idx} store=${True}
62 Rpc_On_Remained_Cluster_Nodes
63 [Documentation] Run rpc on remained cluster nodes.
64 FOR ${idx} IN @{old_brt_successors}
65 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s Run_Rpc ${idx}
68 Restart_Stopped_Member
69 [Documentation] Restart stopped node
70 ClusterManagement.Start_Single_Member ${old_brt_owner}
72 Verify_New_Owner_Remained_After_Rejoin
73 [Documentation] Verify no owner change happened after rejoin.
74 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout
77 ... Verify_Owner_Elected
81 BuiltIn.Wait_Until_Keyword_Succeeds
84 ... ShardStability.Shards_Stability_Get_Details
85 ... ${DEFAULT_SHARD_LIST}
87 Rpc_After_Rejoin_On_New_Owner
88 [Documentation] Run rpc on the new service owner node.
91 Rpc_After_Rejoin_On_Old_Owner
92 [Documentation] Run rpc on rejoined cluster node.
93 Run_Rpc ${old_brt_owner}
95 Rpc_After_Rejoin_On_All
96 [Documentation] Run rpc again on all nodes.
98 FOR ${idx} IN @{brt_successors}
105 [Documentation] FIXME: Add a documentation.
106 SetupUtils.Setup_Utils_For_Setup_And_Teardown http_timeout=30
107 SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All ${TEST_LOG_LEVEL} ${TEST_LOG_COMPONENTS}
110 [Documentation] Run rpc and log the entity ownership service details to karaf log.
111 ... Logging the details was a developer's request during the implementation to improve debugging.
112 [Arguments] ${node_idx}
113 ${session}= Resolve_Http_Session_For_Member member_index=${node_idx}
114 ${out}= TemplatedRequests.Get_From_Uri ${EOS_URL} session=${session}
115 KarafKeywords.Log_Message_To_Controller_Karaf EOS rest resp: ${out}
116 TemplatedRequests.Post_To_Uri ${RPC_URL} ${EMPTY} ${HEADERS_XML} ${ACCEPT_XML} session=${session}
119 [Documentation] Verify new owner was elected or remained the same.
120 [Arguments] ${new_elected} ${old_owner} ${node_to_ask}
121 ${owner} ${successors}= Get_Present_Brt_Owner_And_Successors ${node_to_ask}
123 BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_owner} ${owner}
125 IF not ${new_elected}
126 BuiltIn.Should_Be_Equal_As_numbers ${old_owner} ${owner}
129 Get_Present_Brt_Owner_And_Successors
130 [Documentation] Find a basic rpc test service owner and successors and store them if indicated.
131 [Arguments] ${node_to_ask} ${store}=${False}
132 ${brt_owner} ${brt_successors}= ClusterManagement.Get_Owner_And_Successors_For_Device
134 ... org.opendaylight.mdsal.ServiceEntityType
136 IF ${store} BuiltIn.Set_Suite_Variable ${brt_owner} ${brt_owner}
138 BuiltIn.Set_Suite_Variable ${brt_successors} ${brt_successors}
140 RETURN ${brt_owner} ${brt_successors}