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