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=30
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-
37 Write_Transactions_One_Node_Leader
38 [Documentation] Write transactions.
39 ${all_indices} = ClusterManagement.List_All_Indices
40 ${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
41 ${leader_idx_as_list} = BuiltIn.Create_List ${leader}
42 ${leader_ip_as_list} = ClusterManagement.Resolve_IP_Address_For_Members ${leader_idx_as_list}
43 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}
44 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
45 : FOR ${resp} IN @{resp_list}
46 \ TemplatedRequests.Check_Status_Code ${resp}
48 Write_Transactions_One_Node_Follower
49 [Documentation] Write transactions.
50 ${all_indices} = ClusterManagement.List_All_Indices
51 ${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
52 ${follower_idx} = Collections.Get_From_List ${follower_list} ${0}
53 ${follower_idx_as_list} = BuiltIn.Create_List ${follower_idx}
54 ${follower_ip_as_list} = ClusterManagement.Resolve_IP_Address_For_Members ${follower_idx_as_list}
55 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}
56 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
57 : FOR ${resp} IN @{resp_list}
58 \ TemplatedRequests.Check_Status_Code ${resp}
61 [Documentation] Make the loeader local and verify.
62 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
63 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
64 ${all_indices} = ClusterManagement.List_All_Indices
65 ${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
66 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
67 ClusterAdmin.Make_Leader_Local ${follower1} ${shard_name} ${shard_type}
68 ${leader} ${follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}
69 ... ${shard_type} ${True} ${old_leader} member_index_list=${EMPTY}
70 BuiltIn.Should_Be_Equal_As_Numbers ${follower1} ${leader}
72 Remove_Leader_Shard_Replica_And_Add_It_Back
73 [Documentation] Remove and add shard replica adn verify it.
74 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
75 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
76 ${all_indices} = ClusterManagement.List_All_Indices
77 ${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
78 ClusterAdmin.Remove_Shard_Replica ${old_leader} ${shard_name} member-${old_leader} ${shard_type}
79 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s DdbCommons.Verify_Shard_Replica_Removed ${old_leader} ${shard_name} ${shard_type}
80 ${actual_leader} ${actual_follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}
81 ... verify_restconf=False shard_type=${shard_type} member_index_list=${follower_list}
82 BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_leader} ${actual_leader}
83 ClusterAdmin.Add_Shard_Replica ${old_leader} ${shard_name} ${shard_type}
84 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
85 ... verify_restconf=False
87 Remove_Follower_Shard_Replica_And_Add_It_Back
88 [Documentation] Remove and add shard replica adn verify it.
89 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
90 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
91 ${all_indices} = ClusterManagement.List_All_Indices
92 ${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
93 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
94 ClusterAdmin.Remove_Shard_Replica ${follower1} ${shard_name} member-${follower1} ${shard_type}
95 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s DdbCommons.Verify_Shard_Replica_Removed ${follower1} ${shard_name} ${shard_type}
96 ${new_indices_list} = ClusterManagement.List_Indices_Minus_Member ${follower1}
97 ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${False} ${leader} member_index_list=${new_indices_list}
98 ClusterAdmin.Add_Shard_Replica ${follower1} ${shard_name} ${shard_type}
99 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
100 ... verify_restconf=False
102 Write_Transactions_All_Nodes
103 [Documentation] Write transactions.
104 ${all_indices} = ClusterManagement.List_All_Indices
105 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
106 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${MODULE_SHARD_PREFIX} ${DURATION} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
107 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
108 : FOR ${resp} IN @{resp_list}
109 \ TemplatedRequests.Check_Status_Code ${resp}
111 Subscribe_Listener_To_Leader
112 [Documentation] Subscribe listener to leader.
113 ${all_indices} = ClusterManagement.List_All_Indices
114 ${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
115 MdsalLowlevel.Subscribe_Dtcl ${leader}
117 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl ${leader}
118 BuiltIn.Should_Be_True ${copy_matches}
120 Subscribe_Listener_To_Follower
121 [Documentation] Subscribe listener to follower.
122 ${all_indices} = ClusterManagement.List_All_Indices
123 ${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
124 ${follower_idx} = Collections.Get_From_List ${follower_list} ${0}
125 MdsalLowlevel.Subscribe_Dtcl ${follower_idx}
127 ${copy_matches} = MdsalLowlevel.Unsubscribe_Dtcl ${follower_idx}
128 BuiltIn.Should_Be_True ${copy_matches}