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-
38 [Documentation] Make the loeader local and verify.
39 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
40 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
41 ${all_indices} = ClusterManagement.List_All_Indices
42 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${SHARD_NAME} shard_type=${SHARD_TYPE} member_index_list=${all_indices}
43 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
44 ClusterAdmin.Make_Leader_Local ${follower1} ${shard_name} ${shard_type}
45 ${leader} ${follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}
46 ... ${shard_type} ${True} ${old_leader} member_index_list=${EMPTY}
47 BuiltIn.Should_Be_Equal_As_Numbers ${follower1} ${leader}
49 Remove_Leader_Shard_Replica_And_Add_It_Back
50 [Documentation] Remove and add shard replica adn verify it.
51 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
52 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
53 ${all_indices} = ClusterManagement.List_All_Indices
54 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
55 ClusterAdmin.Remove_Shard_Replica ${old_leader} ${shard_name} member-${old_leader} ${shard_type}
56 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s DdbCommons.Verify_Shard_Replica_Removed ${old_leader} ${shard_name} ${shard_type}
57 ${actual_leader} ${actual_follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}
58 ... shard_type=${shard_type} member_index_list=${follower_list}
59 BuiltIn.Should_Not_Be_Equal_As_Numbers ${old_leader} ${actual_leader}
60 ClusterAdmin.Add_Shard_Replica ${old_leader} ${shard_name} ${shard_type}
61 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}
63 Remove_Follower_Shard_Replica_And_Add_It_Back
64 [Documentation] Remove and add shard replica adn verify it.
65 ${shard_name} = BuiltIn.Set_Variable ${SHARD_NAME}
66 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
67 ${all_indices} = ClusterManagement.List_All_Indices
68 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name} shard_type=${shard_type} member_index_list=${all_indices}
69 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
70 ClusterAdmin.Remove_Shard_Replica ${follower1} ${shard_name} member-${follower1} ${shard_type}
71 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s DdbCommons.Verify_Shard_Replica_Removed ${follower1} ${shard_name} ${shard_type}
72 ${new_indices_list} = ClusterManagement.List_Indices_Minus_Member ${follower1}
73 ClusterManagement.Verify_Shard_Leader_Elected ${shard_name} ${shard_type} ${False} ${leader} member_index_list=${new_indices_list}
74 ClusterAdmin.Add_Shard_Replica ${follower1} ${shard_name} ${shard_type}
75 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}
78 [Documentation] Write transactions.
79 ${all_indices} = ClusterManagement.List_All_Indices
80 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
81 MdsalLowlevelPy.Start_Write_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${MODULE_SHARD_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K} chained_flag=${CHAINED_TX}
82 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
83 : FOR ${resp} IN @{resp_list}
84 \ TemplatedRequests.Check_Status_Code ${resp}