adding missing example flows
[integration/test.git] / test / csit / suites / clustering / datastore / basic / 010_restconf_rpc_crud_test_01_execute_on_leader.txt
1 *** Settings ***
2 Documentation     Test suite for testing Distributed Datastore main operations performed from leader
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}     ${LEADER}   ${FOLLOWER1}    ${FOLLOWER2}
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}     ${LEADER}   ${FOLLOWER1}    ${FOLLOWER2}
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}     ${LEADER}   ${FOLLOWER1}    ${FOLLOWER2}
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
57         ${resp}         BuyCar  ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${100}
58     Sleep       2
59         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${0}
60         Should Be Equal As Strings    ${resp.status_code}    200
61
62 Get car-person mappings using Leader
63    [Documentation]      Get car-person mappings using Leader to see 100 entry
64         ${resp}         GetCarPersonMappings    ${CURRENT_CAR_PERSON_LEADER}    ${PORT} ${0}
65         Should Be Equal As Strings    ${resp.status_code}    200
66         Should Contain     ${resp.content}   user100
67
68 Get car-person mappings using Follower1
69    [Documentation]      Get car-person mappings using Follower1 to see 100 entry
70    ${FOLLOWERS}   GetFollowers   ${SHARD_CAR_PERSON_NAME}   ${3}    ${3}    ${1}    ${PORT}     ${LEADER}   ${FOLLOWER1}    ${FOLLOWER2}
71    Log          ${FOLLOWERS}
72    SET SUITE VARIABLE  ${FOLLOWERS}
73         ${resp}         GetCarPersonMappings    ${FOLLOWERS[0]}     ${PORT}     ${0}
74         Should Be Equal As Strings    ${resp.status_code}    200
75         Should Contain     ${resp.content}   user100
76         Should Contain     ${resp.content}   user5
77
78
79 Get car-person mappings using Follower2
80    [Documentation]      Get car-person mappings using Follower2 to see 100 entry
81         ${resp}         GetCarPersonMappings    ${FOLLOWERS[1]}     ${PORT}     ${0}
82         Should Be Equal As Strings    ${resp.status_code}    200
83         Should Contain     ${resp.content}   user0
84         Should Contain     ${resp.content}   user100