087d9fd13032a5690ba1e09dfefd473f67a5cf45
[integration/test.git] / csit / suites / controller / Clustering_Routedrpc / 023_routed_rpc_crud_test.robot
1 *** Settings ***
2 Documentation     Test suite for Routed RPC.
3 Library           Collections
4 Library           RequestsLibrary
5 Library           ../../../libraries/CrudLibrary.py
6 Resource          ../../../libraries/ClusterKeywords.robot
7 Resource          ../../../libraries/CarsAndPeople.robot
8 Variables         ../../../variables/Variables.py
9
10 *** Variables ***
11 @{controllers}    ${ODL_SYSTEM_IP}    ${ODL_SYSTEM_2_IP}    ${ODL_SYSTEM_3_IP}
12 ${SHARD_CAR_NAME}    shard-car-config
13 ${SHARD_PEOPLE_NAME}    shard-people-config
14 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
15 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
16 ${NUM_ENTRIES}    ${100}
17 ${START_TIMEOUT}    300s
18 ${STOP_TIMEOUT}    180s
19
20 *** Test Cases ***
21 Delete All Entries
22     [Documentation]    Make sure the shards are cleared for testing.
23     Delete All Entries From Shards    @{controllers}
24
25 Get Car Leader And Followers
26     [Documentation]    Find leader and followers in the car shard
27     ${CURRENT_CAR_LEADER}    Get Leader And Verify    ${SHARD_CAR_NAME}
28     Set Suite Variable    ${CURRENT_CAR_LEADER}
29     @{CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
30     Set Suite Variable    ${CAR_FOLLOWERS}
31
32 Add Cars And Get Cars From Leader
33     [Documentation]    Add 100 cars and get added cars from Leader
34     Add Cars And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
35
36 Add Persons And Get Persons From Car Leader
37     [Documentation]    Add 100 persons and get persons from Leader
38     Add People And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
39
40 Add Car-Person Mapping And Get Car-Person Mapping From Car Follower1
41     [Documentation]    Add car-person and get car-person from Leader
42     Add Car Person And Verify    @{CAR_FOLLOWERS}[0]
43
44 Purchase 100 Cars Using Car Follower1
45     [Documentation]    Purchase 100 cars using Follower1
46     Buy Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
47
48 Check Contents Of Car Leader Shards
49     [Documentation]    Check all content using Leader
50     Check Elements In Shards    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
51
52 Check Contents Of Car Follower1 Shards
53     [Documentation]    Check all content using first follower
54     Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
55
56 Check Contents Of Car Follower2 Shards
57     [Documentation]    Check all content using second follower
58     Check Elements In Shards    @{CAR_FOLLOWERS}[1]    ${NUM_ENTRIES}
59
60 Get Old Car Leader
61     [Documentation]    Find leader in the car shard
62     ${OLD_CAR_LEADER}    Get Leader And Verify    ${SHARD_CAR_NAME}
63     Set Suite Variable    ${OLD_CAR_LEADER}
64
65 Switch Car Leader
66     [Documentation]    Stop the leader to cause a new leader to be elected
67     Stop One Or More Controllers    ${OLD_CAR_LEADER}
68     Wait For Controller Down    ${STOP_TIMEOUT}    ${OLD_CAR_LEADER}
69     ${NEW_CAR_LEADER}    Wait Until Keyword Succeeds    30s    2s    Get Leader And Verify    ${SHARD_CAR_NAME}    ${OLD_CAR_LEADER}
70     Set Suite Variable    ${NEW_CAR_LEADER}
71
72 Get New Car Followers
73     [Documentation]    Find the new followers for the car shard.
74     @{CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
75     Set Suite Variable    ${CAR_FOLLOWERS}
76     Log    @{CAR_FOLLOWERS}[0]
77
78 Check Cars In New Car Leader
79     [Documentation]    Check cars in new Leader
80     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
81
82 Check Contents Of New Car Leader Shards
83     [Documentation]    Check all content using new Leader
84     Check Elements In Shards    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
85
86 Check Contents Of New Car Follower1 Shards
87     [Documentation]    Check all content using first follower
88     Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
89
90 Readd People From New Car Leader
91     [Documentation]    Add 100 persons and get persons from Leader
92     Add People And Verify Without Init    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
93
94 Repurchase 100 Cars Using New Car Follower1
95     [Documentation]    Repurchase 100 cars using Follower1
96     Buy Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
97
98 Check Contents Of New Car Leader Shards After Repurchase
99     [Documentation]    Check all content using new Leader
100     Check Elements In Shards    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
101
102 Check Contents Of New Car First Follower Shards After Repurchase
103     [Documentation]    Check all content using first follower
104     Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
105
106 Start Old Car Leader
107     [Documentation]    Start Leader controller
108     Start One Or More Controllers    ${OLD_CAR_LEADER}
109     Wait For Controller Sync    ${START_TIMEOUT}    ${OLD_CAR_LEADER}
110
111 Check Cars In Old Car Leader
112     [Documentation]    Check cars in old Leader
113     Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
114
115 Check Contents Of Old Leader Shards
116     [Documentation]    Check all content using old Leader
117     Check Elements In Shards    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
118
119 Readd People From Old Leader
120     [Documentation]    Add 100 persons and get persons from Leader
121     Wait Until Keyword Succeeds    30    2s    Add People And Verify Without Init    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
122
123 Repurchase 100 Cars Using Old Leader
124     [Documentation]    Repurchase 100 cars using Follower1
125     Buy Cars And Verify    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
126
127 Check Contents Of Old Leader Shards After Repurchase
128     [Documentation]    Check all content using Leader
129     Check Elements In Shards    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}