Bug 5423: Fix for ERROR messages when intents were deleted.
[integration/test.git] / csit / suites / controller / Clustering_Routedrpc / 023_routed_rpc_crud_test.robot
index b63b11d821e844dbe82660888bb06dde269d11b5..087d9fd13032a5690ba1e09dfefd473f67a5cf45 100644 (file)
 Documentation     Test suite for Routed RPC.
 Library           Collections
 Library           RequestsLibrary
-Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
-Library           ../../../libraries/SettingsLibrary.py
-Library           ../../../libraries/UtilLibrary.py
 Resource          ../../../libraries/ClusterKeywords.robot
+Resource          ../../../libraries/CarsAndPeople.robot
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+@{controllers}    ${ODL_SYSTEM_IP}    ${ODL_SYSTEM_2_IP}    ${ODL_SYSTEM_3_IP}
 ${SHARD_CAR_NAME}    shard-car-config
 ${SHARD_PEOPLE_NAME}    shard-people-config
 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
 ${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
+${NUM_ENTRIES}    ${100}
+${START_TIMEOUT}    300s
+${STOP_TIMEOUT}    180s
 
 *** Test Cases ***
-Delete all entries from shards
+Delete All Entries
     [Documentation]    Make sure the shards are cleared for testing.
-    : FOR    ${ip}    IN    @{controllers}
-    \    Delete All Cars And Verify    ${ip}
-    : FOR    ${ip}    IN    @{controllers}
-    \    Delete All People And Verify    ${ip}
-    : FOR    ${ip}    IN    @{controllers}
-    \    Delete All Cars-Persons And Verify    ${ip}
+    Delete All Entries From Shards    @{controllers}
 
 Get Car Leader And Followers
-    ${CURRENT_CAR_LEADER}    Wait For Leader To Be Found    ${SHARD_CAR_NAME}
+    [Documentation]    Find leader and followers in the car shard
+    ${CURRENT_CAR_LEADER}    Get Leader And Verify    ${SHARD_CAR_NAME}
     Set Suite Variable    ${CURRENT_CAR_LEADER}
     @{CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
     Set Suite Variable    ${CAR_FOLLOWERS}
 
-Add cars and get cars from Leader
+Add Cars And Get Cars From Leader
     [Documentation]    Add 100 cars and get added cars from Leader
-    ${resp}=    InitCar    ${CURRENT_CAR_LEADER}    ${PORT}
-    ${resp}=    AddCar    ${CURRENT_CAR_LEADER}    ${PORT}    ${100}
-    ${resp}=    Getcars    ${CURRENT_CAR_LEADER}    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer1    cars not added!
-
-Add persons and get persons from Leader
-    [Documentation]    Add 100 persons and get persons Note: There should be one person added first to enable rpc
-    ${resp}    AddPerson    ${CURRENT_CAR_LEADER}    ${PORT}    ${0}
-    ${resp}    AddPerson    ${CURRENT_CAR_LEADER}    ${PORT}    ${100}
-    ${resp}    GetPersons    ${CURRENT_CAR_LEADER}    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user5    people not added!
-
-Add car-person mapping and get car-person mapping from Follower1
-    [Documentation]    Add car-person and get car-person from Leader Note: This is done to enable working of rpc
-    Log    @{CAR_FOLLOWERS}[0]
-    ${resp}    AddCarPerson    @{CAR_FOLLOWERS}[0]    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    204
-    ${resp}    GetCarPersonMappings    @{CAR_FOLLOWERS}[0]    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user0    car-person not initialized!
+    Add Cars And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
+
+Add Persons And Get Persons From Car Leader
+    [Documentation]    Add 100 persons and get persons from Leader
+    Add People And Verify    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
+
+Add Car-Person Mapping And Get Car-Person Mapping From Car Follower1
+    [Documentation]    Add car-person and get car-person from Leader
+    Add Car Person And Verify    @{CAR_FOLLOWERS}[0]
 
-Purchase 100 cars using Follower1
+Purchase 100 Cars Using Car Follower1
     [Documentation]    Purchase 100 cars using Follower1
-    BuyCar    @{CAR_FOLLOWERS}[0]    ${PORT}    ${100}
+    Buy Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
 
-Check Contents of Leader Shards
+Check Contents Of Car Leader Shards
     [Documentation]    Check all content using Leader
-    wait until keyword succeeds    30    1    Check Cars    ${CURRENT_CAR_LEADER}    ${PORT}    100
-    wait until keyword succeeds    30    1    Check People    ${CURRENT_CAR_LEADER}    ${PORT}    100
-    wait until keyword succeeds    30    1    Check CarPeople    ${CURRENT_CAR_LEADER}    ${PORT}    100
+    Check Elements In Shards    ${CURRENT_CAR_LEADER}    ${NUM_ENTRIES}
 
-Check Contents of First Follower Shards
+Check Contents Of Car Follower1 Shards
     [Documentation]    Check all content using first follower
-    wait until keyword succeeds    30    1    Check Cars    @{CAR_FOLLOWERS}[0]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check People    @{CAR_FOLLOWERS}[0]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check CarPeople    @{CAR_FOLLOWERS}[0]    ${PORT}    100
+    Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
 
-Check Contents of Second Follower Shards
+Check Contents Of Car Follower2 Shards
     [Documentation]    Check all content using second follower
-    wait until keyword succeeds    30    1    Check Cars    @{CAR_FOLLOWERS}[1]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check People    @{CAR_FOLLOWERS}[1]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check CarPeople    @{CAR_FOLLOWERS}[1]    ${PORT}    100
+    Check Elements In Shards    @{CAR_FOLLOWERS}[1]    ${NUM_ENTRIES}
 
-Switch Car leader
-    [Documentation]    Stop the leader to cause a new leader to be elected
-    ${OLD_CAR_LEADER}=    Set Variable    ${CURRENT_CAR_LEADER}
+Get Old Car Leader
+    [Documentation]    Find leader in the car shard
+    ${OLD_CAR_LEADER}    Get Leader And Verify    ${SHARD_CAR_NAME}
     Set Suite Variable    ${OLD_CAR_LEADER}
-    ${NEW_CAR_LEADER}    Switch Leader    ${SHARD_CAR_NAME}    ${CURRENT_CAR_LEADER}
+
+Switch Car Leader
+    [Documentation]    Stop the leader to cause a new leader to be elected
+    Stop One Or More Controllers    ${OLD_CAR_LEADER}
+    Wait For Controller Down    ${STOP_TIMEOUT}    ${OLD_CAR_LEADER}
+    ${NEW_CAR_LEADER}    Wait Until Keyword Succeeds    30s    2s    Get Leader And Verify    ${SHARD_CAR_NAME}    ${OLD_CAR_LEADER}
     Set Suite Variable    ${NEW_CAR_LEADER}
 
-Get New Car Follower
-    [Documentation]    Find the new leader for the car shard.
+Get New Car Followers
+    [Documentation]    Find the new followers for the car shard.
     @{CAR_FOLLOWERS}    Get All Followers    ${SHARD_CAR_NAME}
     Set Suite Variable    ${CAR_FOLLOWERS}
     Log    @{CAR_FOLLOWERS}[0]
 
-Overwrite cars and get cars from New Leader
-    [Documentation]    Overwrite 100 cars and get added cars from Leader
-    ${resp}=    AddCar    ${NEW_CAR_LEADER}    ${PORT}    ${100}
-    ${resp}=    Getcars    ${NEW_CAR_LEADER}    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer1    cars not added!
-
-Overwrite persons and get persons from New Leader
-    [Documentation]    Overwrite 100 persons and get persons Note: There should be one person added first to enable rpc
-    ${resp}    AddPerson    ${NEW_CAR_LEADER}    ${PORT}    ${100}
-    ${resp}    GetPersons    ${NEW_CAR_LEADER}    ${PORT}    ${0}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user5    people not added!
-
-RePurchase 100 cars using New Follower1
-    [Documentation]    RePurchase 100 cars using Follower1
-    BuyCar    @{CAR_FOLLOWERS}[0]    ${PORT}    ${100}
-
-Check Contents of New Leader Shards
-    [Documentation]    Check all content using Leader
-    Log    ${NEW_CAR_LEADER}
-    wait until keyword succeeds    30    1    Check Cars    ${NEW_CAR_LEADER}    ${PORT}    100
-    wait until keyword succeeds    30    1    Check People    ${NEW_CAR_LEADER}    ${PORT}    100
-    wait until keyword succeeds    30    1    Check CarPeople    ${NEW_CAR_LEADER}    ${PORT}    100
+Check Cars In New Car Leader
+    [Documentation]    Check cars in new Leader
+    Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
+
+Check Contents Of New Car Leader Shards
+    [Documentation]    Check all content using new Leader
+    Check Elements In Shards    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
 
-Check Contents of New First Follower Shards
+Check Contents Of New Car Follower1 Shards
     [Documentation]    Check all content using first follower
-    wait until keyword succeeds    30    1    Check Cars    @{CAR_FOLLOWERS}[0]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check People    @{CAR_FOLLOWERS}[0]    ${PORT}    100
-    wait until keyword succeeds    30    1    Check CarPeople    @{CAR_FOLLOWERS}[0]    ${PORT}    100
+    Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
+
+Readd People From New Car Leader
+    [Documentation]    Add 100 persons and get persons from Leader
+    Add People And Verify Without Init    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
+
+Repurchase 100 Cars Using New Car Follower1
+    [Documentation]    Repurchase 100 cars using Follower1
+    Buy Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
 
-Start Leader
+Check Contents Of New Car Leader Shards After Repurchase
+    [Documentation]    Check all content using new Leader
+    Check Elements In Shards    ${NEW_CAR_LEADER}    ${NUM_ENTRIES}
+
+Check Contents Of New Car First Follower Shards After Repurchase
+    [Documentation]    Check all content using first follower
+    Check Elements In Shards    @{CAR_FOLLOWERS}[0]    ${NUM_ENTRIES}
+
+Start Old Car Leader
     [Documentation]    Start Leader controller
     Start One Or More Controllers    ${OLD_CAR_LEADER}
+    Wait For Controller Sync    ${START_TIMEOUT}    ${OLD_CAR_LEADER}
+
+Check Cars In Old Car Leader
+    [Documentation]    Check cars in old Leader
+    Wait Until Keyword Succeeds    ${START_TIMEOUT}    2s    Check Cars    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
+
+Check Contents Of Old Leader Shards
+    [Documentation]    Check all content using old Leader
+    Check Elements In Shards    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
+
+Readd People From Old Leader
+    [Documentation]    Add 100 persons and get persons from Leader
+    Wait Until Keyword Succeeds    30    2s    Add People And Verify Without Init    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
+
+Repurchase 100 Cars Using Old Leader
+    [Documentation]    Repurchase 100 cars using Follower1
+    Buy Cars And Verify    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}
+
+Check Contents Of Old Leader Shards After Repurchase
+    [Documentation]    Check all content using Leader
+    Check Elements In Shards    ${OLD_CAR_LEADER}    ${NUM_ENTRIES}