Fixing mininet reads so that we always clear mininet
[integration/test.git] / test / csit / suites / controller / MD_SAL_Cluster_Datastore / 020_crud_on_any_follower.txt
1 *** Settings ***
2 Documentation     This test finds the followers of certain shards in a 3-Node cluster and executes CRUD operations on any one follower
3
4 Library           Collections
5 Library           ../../../libraries/RequestsLibrary.py
6 Library           ../../../libraries/Common.py
7 Library           ../../../libraries/CrudLibrary.py
8 Library           ../../../libraries/SettingsLibrary.py
9 Library           ../../../libraries/UtilLibrary.py
10 Library           ../../../libraries/ClusterStateLibrary.py
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${REST_CONTEXT}    /restconf/config/
15 ${SHARD_CAR_NAME}      shard-car-config
16 ${SHARD_PEOPLE_NAME}      shard-people-config
17 ${SHARD_CAR_PERSON_NAME}      shard-car-people-config
18
19
20 *** Test Cases ***
21 Add cars and get cars from Follower1
22     [Documentation]    Add 100 cars and get added cars from Follower1
23     ${FOLLOWERS}   GetFollowers   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
24     Log                 ${FOLLOWERS}
25     SET SUITE VARIABLE  ${FOLLOWERS}
26
27         ${resp}         AddCar  ${FOLLOWERS[0]} ${PORT} ${100}
28         Sleep   1
29         ${resp}         Getcars ${FOLLOWERS[0]} ${PORT} ${0}
30         Should Be Equal As Strings    ${resp.status_code}    200
31         Should Contain     ${resp.content}   manufacturer1
32
33 Add persons and get persons from Follower1
34     [Documentation]    Add 100 persons and get persons from Follower1
35     [Documentation]    Note: There should be one person added first to enable rpc
36         ${resp}         AddPerson       ${FOLLOWERS[0]} ${PORT} ${0}
37         ${resp}         AddPerson       ${FOLLOWERS[0]} ${PORT} ${100}
38         Sleep   1
39         ${resp}         GetPersons      ${FOLLOWERS[0]} ${PORT} ${0}
40         Should Be Equal As Strings    ${resp.status_code}    200
41         Should Contain     ${resp.content}   user5
42
43 Add car-person mapping and get car-person mapping from Follower1
44     [Documentation]     Add car-person and get car-person from Follower1
45     [Documentation]  Note: This is done to enable working of rpc
46
47         ${resp}         AddCarPerson    ${FOLLOWERS[0]} ${PORT} ${0}
48         ${resp}         GetCarPersonMappings    ${FOLLOWERS[0]} ${PORT} ${0}
49         Should Be Equal As Strings    ${resp.status_code}    200
50         Should Contain     ${resp.content}   user0
51
52 Purchase 100 cars using Follower1
53     [Documentation]  Purchase 100 cars using Follower1
54
55         ${resp}         BuyCar  ${FOLLOWERS[0]} ${PORT} ${100}
56         Sleep   1
57         ${resp}         GetCarPersonMappings    ${FOLLOWERS[0]} ${PORT} ${0}
58         Should Be Equal As Strings    ${resp.status_code}    200
59
60 Get car-person mappings using Follower1
61    [Documentation]      Get car-person mappings using follower1 to see 100 entry
62         ${resp}         GetCarPersonMappings    ${FOLLOWERS[0]} ${PORT} ${0}
63         Should Be Equal As Strings    ${resp.status_code}    200
64         Should Contain     ${resp.content}   user100
65         Should Contain     ${resp.content}   user5
66
67 Get car-person mappings using Leader
68    [Documentation]      Get car-person mappings using Leader to see 100 entry
69     ${CURRENT_CAR_LEADER}   GetLeader   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
70     Log     ${CURRENT_CAR_LEADER}
71     Sleep   1
72         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_LEADER}   ${PORT} ${0}
73         Should Be Equal As Strings    ${resp.status_code}    200
74         Should Contain     ${resp.content}   user100
75
76 Get car-person mappings using Follower2
77    [Documentation]      Get car-person mappings using Follower2 to see 100 entry
78         ${resp}         GetCarPersonMappings    ${FOLLOWERS[1]} ${PORT} ${0}
79         Should Be Equal As Strings    ${resp.status_code}    200
80         Should Contain     ${resp.content}   user0
81         Should Contain     ${resp.content}   user100