Fixing mininet reads so that we always clear mininet
[integration/test.git] / test / csit / suites / controller / MD_SAL_Cluster_Datastore / 010_crud_on_leader.txt
1 *** Settings ***
2 Documentation     This test finds the leader for shards in a 3-Node cluster and executes CRUD operations on them
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
14 *** Variables ***
15 ${REST_CONTEXT}    /restconf/config/
16 ${SHARD_CAR_NAME}      shard-car-config
17 ${SHARD_PEOPLE_NAME}      shard-people-config
18 ${SHARD_CAR_PERSON_NAME}      shard-car-people-config
19
20
21 *** Test Cases ***
22 Add cars and get cars from Leader
23     [Documentation]    Add 100 cars and get added cars from Leader
24     ${CURRENT_CAR_LEADER}   GetLeader   ${SHARD_CAR_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
25     Log    CURRENT_CAR_SHARD_LEADER ${CURRENT_CAR_LEADER}
26     Set Suite Variable  ${CURRENT_CAR_LEADER}
27         ${resp}         AddCar  ${CURRENT_CAR_LEADER}   ${PORT} ${100}
28         ${resp}         Getcars ${CURRENT_CAR_LEADER}   ${PORT} ${0}
29         Should Be Equal As Strings    ${resp.status_code}    200
30         Should Contain     ${resp.content}   manufacturer1
31
32 Add persons and get persons from Leader
33     [Documentation]    Add 100 persons and get persons
34     [Documentation]    Note: There should be one person added first to enable rpc
35     ${CURRENT_PEOPLE_LEADER}   GetLeader   ${SHARD_PEOPLE_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
36     Set Suite Variable  ${CURRENT_PEOPLE_LEADER}
37         ${resp}         AddPerson       ${CURRENT_PEOPLE_LEADER}        ${PORT} ${0}
38         ${resp}         AddPerson       ${CURRENT_PEOPLE_LEADER}        ${PORT} ${100}
39         ${resp}         GetPersons      ${CURRENT_PEOPLE_LEADER}        ${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 Leader
44     [Documentation]     Add car-person and get car-person from Leader
45     [Documentation]  Note: This is done to enable working of rpc
46     ${CURRENT_CAR_PERSON_LEADER}   GetLeader   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}   ${MEMBER3}
47     Set Suite Variable  ${CURRENT_CAR_PERSON_LEADER}
48         ${resp}         AddCarPerson    ${CURRENT_CAR_PERSON_LEADER}   ${PORT}     ${0}
49         Sleep       2
50         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_PERSON_LEADER}   ${PORT}     ${0}
51         Should Be Equal As Strings    ${resp.status_code}    200
52         Should Contain     ${resp.content}   user0
53
54 Purchase 100 cars using Leader
55     [Documentation]  Purchase 100 cars using Leader
56         ${resp}         BuyCar  ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${100}
57     Sleep       2
58         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${0}
59         Should Be Equal As Strings    ${resp.status_code}    200
60
61 Get car-person mappings using Leader
62    [Documentation]      Get car-person mappings using Leader to see 100 entry
63         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${0}
64         Should Be Equal As Strings    ${resp.status_code}    200
65         Should Contain     ${resp.content}   user100
66
67 Get car-person mappings using Follower1
68    [Documentation]      Get car-person mappings using Follower1 to see 100 entry
69    ${FOLLOWERS}   GetFollowers   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${MEMBER1}   ${MEMBER2}    ${MEMBER3}
70    Log          ${FOLLOWERS}
71    SET SUITE VARIABLE  ${FOLLOWERS}
72         ${resp}         GetCarPersonMappings    ${FOLLOWERS[0]}     ${PORT}     ${0}
73         Should Be Equal As Strings    ${resp.status_code}    200
74         Should Contain     ${resp.content}   user100
75         Should Contain     ${resp.content}   user5
76
77
78 Get car-person mappings using Follower2
79    [Documentation]      Get car-person mappings using Follower2 to see 100 entry
80         ${resp}         GetCarPersonMappings    ${FOLLOWERS[1]}     ${PORT}     ${0}
81         Should Be Equal As Strings    ${resp.status_code}    200
82         Should Contain     ${resp.content}   user0
83         Should Contain     ${resp.content}   user100