2 Documentation DOMDataBroker testing: Module based shards sanity suite
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 ... The goal is to call several basic rpc form ClusterAdmin.robot and
11 ... MdsalLowlevel.robot to ensute that those rpcs can be safely used in
13 ... It also verify the ability of the odl-controller-test-app to perform
14 ... several activities.
15 Suite Setup SetupUtils.Setup_Utils_For_Setup_And_Teardown http_timeout=125
16 Suite Teardown SSHLibrary.Close_All_Connections
17 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
21 Library ${CURDIR}/../../../libraries/MdsalLowlevelPy.py
22 Resource ${CURDIR}/../../../libraries/ClusterAdmin.robot
23 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
24 Resource ${CURDIR}/../../../libraries/controller/DdbCommons.robot
25 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
30 ${TRANSACTION_RATE_1K} ${1000}
34 ${MODULE_SHARD_PREFIX} prefix-
38 [Documentation] Get shard role.
39 ${all_indices} = ClusterManagement.List_All_Indices
40 FOR ${index} IN @{all_indices}
41 ${role} = ClusterAdmin.Get_Shard_Role ${index} ${SHARD_NAME} ${SHARD_TYPE}
44 Subscribe_Listener_To_Leader
45 [Documentation] Subscribe listener to leader.
46 ${all_indices} = ClusterManagement.List_All_Indices
47 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices} verify_restconf=False
48 MdsalLowlevel.Subscribe_Dtcl ${leader}
50 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl_No_Tx ${leader}
51 BuiltIn.Should_Be_True ${copy_matches}
53 Subscribe_Listener_To_Follower
54 [Documentation] Subscribe listener to follower.
55 ${all_indices} = ClusterManagement.List_All_Indices
56 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices} verify_restconf=False
57 ${follower_idx} = Collections.Get_From_List ${follower_list} ${0}
58 MdsalLowlevel.Subscribe_Dtcl ${follower_idx}
60 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl_No_Tx ${follower_idx}
61 BuiltIn.Should_Be_True ${copy_matches}
64 [Documentation] Make the loeader local and verify.
65 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
66 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
67 ${all_indices} = ClusterManagement.List_All_Indices
68 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices} verify_restconf=False
69 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
70 ClusterAdmin.Make_Leader_Local ${follower1} ${shard_name} ${shard_type}
71 ${leader} ${follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}
72 ... ${shard_type} ${True} ${old_leader} member_index_list=${EMPTY}
73 BuiltIn.Should_Be_Equal_As_Numbers ${follower1} ${leader}
75 Remove_Leader_Shard_Replica_And_Add_It_Back
76 [Documentation] Remove and add shard replica adn verify it.
77 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
78 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
79 ${all_indices} = ClusterManagement.List_All_Indices
80 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
81 ClusterAdmin.Remove_Shard_Replica ${old_leader} ${shard_name} member-${old_leader} ${shard_type}
82 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s DdbCommons.Verify_Shard_Replica_Not_Present ${old_leader} ${shard_name} ${shard_type}
83 ${actual_leader} ${actual_follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}
84 ... verify_restconf=False shard_type=${shard_type} member_index_list=${follower_list}
85 BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_leader} ${actual_leader}
86 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterAdmin.Add_Shard_Replica ${old_leader} ${shard_name} ${shard_type}
87 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
88 ... verify_restconf=False
90 Remove_Follower_Shard_Replica_And_Add_It_Back
91 [Documentation] Remove and add shard replica adn verify it.
92 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
93 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
94 ${all_indices} = ClusterManagement.List_All_Indices
95 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices} verify_restconf=False
96 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
97 ClusterAdmin.Remove_Shard_Replica ${follower1} ${shard_name} member-${follower1} ${shard_type}
98 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s DdbCommons.Verify_Shard_Replica_Not_Present ${follower1} ${shard_name} ${shard_type}
99 ${new_indices_list} = ClusterManagement.List_Indices_Minus_Member ${follower1}
100 ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${False} ${leader} member_index_list=${new_indices_list}
101 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterAdmin.Add_Shard_Replica ${follower1} ${shard_name} ${shard_type}
102 BuiltIn.Wait_Until_Keyword_Succeeds 60s 5s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
103 ... verify_restconf=False
105 Write_Transactions_One_Node_Leader
106 [Documentation] Write transactions.
107 ${all_indices} = ClusterManagement.List_All_Indices
108 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices} verify_restconf=False
109 ${leader_idx_as_list} = BuiltIn.Create_List ${leader}
110 ${leader_ip_as_list} = ClusterManagement.Resolve_IP_Address_For_Members ${leader_idx_as_list}
111 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${leader_ip_as_list} ${leader_idx_as_list} ${MODULE_SHARD_PREFIX} ${DURATION} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
112 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
113 FOR ${resp} IN @{resp_list}
114 TemplatedRequests.Check_Status_Code @{resp}[2]
117 Write_Transactions_One_Node_Follower
118 [Documentation] Write transactions.
119 ${all_indices} = ClusterManagement.List_All_Indices
120 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices} verify_restconf=False
121 ${follower_idx} = Collections.Get_From_List ${follower_list} ${0}
122 ${follower_idx_as_list} = BuiltIn.Create_List ${follower_idx}
123 ${follower_ip_as_list} = ClusterManagement.Resolve_IP_Address_For_Members ${follower_idx_as_list}
124 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${follower_ip_as_list} ${follower_idx_as_list} ${MODULE_SHARD_PREFIX} ${DURATION} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
125 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
126 FOR ${resp} IN @{resp_list}
127 TemplatedRequests.Check_Status_Code @{resp}[2]
130 Write_Transactions_All_Nodes
131 [Documentation] Write transactions.
132 ${all_indices} = ClusterManagement.List_All_Indices
133 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
134 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${MODULE_SHARD_PREFIX} ${DURATION} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
135 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
136 FOR ${resp} IN @{resp_list}
137 TemplatedRequests.Check_Status_Code @{resp}[2]