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 BuiltIn.Run_Keywords ClusterManagement.ClusterManagement_Setup http_timeout=10
16 ... AND SetupUtils.Setup_Utils_For_Setup_And_Teardown
17 ... AND DdbCommons.Create_Prefix_Based_Shard_And_Verify
18 Suite Teardown BuiltIn.Run_Keywords DdbCommons.Remove_Prefix_Based_Shard_And_Verify
19 ... AND 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
24 Library ${CURDIR}/../../../libraries/MdsalLowlevelPy.py
25 Resource ${CURDIR}/../../../libraries/ClusterAdmin.robot
26 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
27 Resource ${CURDIR}/../../../libraries/controller/DdbCommons.robot
28 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
31 ${PREF_BASED_SHARD} id-ints
33 ${TRANSACTION_RATE_1K} ${1000}
37 ${SHARD_PREFIX} member-
42 [Documentation] Write transactions.
43 ${all_indices} = ClusterManagement.List_All_Indices
44 ${all_ip_list} = ClusterManagement.Resolve_IP_Address_For_Members ${all_indices}
45 MdsalLowlevelPy.Start_Produce_Transactions_On_Nodes ${all_ip_list} ${all_indices} ${ID_PREFIX} ${DURATION_10S} ${TRANSACTION_RATE_1K}
46 ${resp_list} = MdsalLowlevelPy.Wait_For_Transactions
47 : FOR ${resp} IN @{resp_list}
48 \ TemplatedRequests.Check_Status_Code ${resp}
51 [Documentation] Make the loeader local and verify.
52 ${shard_name} = BuiltIn.Set_Variable ${PREF_BASED_SHARD}
53 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
54 ${all_indices} = ClusterManagement.List_All_Indices
55 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
56 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
57 MdsalLowlevel.Become_Prefix_Leader ${follower1} ${shard_name} ${ID_PREFIX}
58 ${leader} ${follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 30s 3s ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!!
59 ... ${shard_type} ${True} ${old_leader} member_index_list=${EMPTY}
60 BuiltIn.Should_Be_Equal_As_Numbers ${follower1} ${leader}
62 Remove_Leader_Prefix_Shard_Replica_And_Add_It_Back
63 [Documentation] Remove and add shard replica adn verify it.
64 ${shard_name} = BuiltIn.Set_Variable ${PREF_BASED_SHARD}
65 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
66 ${all_indices} = ClusterManagement.List_All_Indices
67 ${old_leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
68 ClusterAdmin.Remove_Prefix_Shard_Replica ${old_leader} ${shard_name} member-${old_leader} ${shard_type}
69 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s Verify_Shard_Replica_Removed ${old_leader} ${shard_name}!! ${shard_type}
70 ${actual_leader} ${actual_follower_list} = BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!!
71 ... shard_type=${shard_type} member_index_list=${follower_list}
72 ClusterAdmin.Add_Prefix_Shard_Replica ${old_leader} ${shard_name} ${shard_type}
73 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}
75 Remove_Follower_Prefix_Shard_Replica_And_Add_It_Back
76 [Documentation] Remove and add shard replica adn verify it.
77 ${shard_name} = BuiltIn.Set_Variable ${PREF_BASED_SHARD}
78 ${shard_type} = BuiltIn.Set_Variable ${SHARD_TYPE}
79 ${all_indices} = ClusterManagement.List_All_Indices
80 ${leader} ${follower_list} = ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=${shard_name}!! shard_type=${shard_type} member_index_list=${all_indices}
81 ${follower1} = Collections.Get_From_List ${follower_list} ${0}
82 ClusterAdmin.Remove_Prefix_Shard_Replica ${follower1} ${shard_name} member-${follower1} ${shard_type}
83 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s DdbCommons.Verify_Shard_Replica_Removed ${follower1} ${shard_name}!! ${shard_type}
84 ${new_indices_list} = ClusterManagement.List_Indices_Minus_Member ${follower1}
85 ClusterManagement.Verify_Shard_Leader_Elected ${shard_name}!! ${shard_type} ${False} ${leader} member_index_list=${new_indices_list}
86 ClusterAdmin.Add_Prefix_Shard_Replica ${follower1} ${shard_name} ${shard_type}
87 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}