Usage : pybot -v LEADER:10.195.128.18 -v PORT:8181 -v FOLLOWER1:10.195.128.35 -v FOLLOWER2:10.195.128.19 -v USERNAME:root -v PASSWORD:Ecp123 -v KARAFHOME:/root/Documents/dist 010_restconf_rpc_crud_test_09_execute_on_last_node.txt
Change-Id: I6e4c00c34cdc9cef74fae65d253656d04c1ce59d
Signed-off-by: Harman Singh <harmasin@cisco.com>
--- /dev/null
+*** Settings ***
+Documentation Run this test after running test no 03
+Library ../../../../libraries/CrudLibrary.py
+Library ../../../../libraries/UtilLibrary.py
+Library ../../../../libraries/ClusterStateLibrary.py
+
+*** Variables ***
+${SHARD} shard-car-config
+
+*** Test Cases ***
+Switch Leader
+ [Documentation] stop leader and elect new leader
+ ${OLD_LEADER} GetLeader ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Stopcontroller ${OLD_LEADER} ${USERNAME} ${PASSWORD} ${KARAFHOME}
+ Sleep 30
+ ${NEW_LEADER} GetLeader ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${NEW_LEADER}
+ Set Suite Variable ${NEW_LEADER}
+
+Delete cars at new leader
+ [Documentation] delete cars
+ DeleteAllCars ${NEW_LEADER} ${PORT} ${0}
+ ${resp} Getcars ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Delete people at new leader
+ [Documentation] delete people
+ DeleteAllPersons ${NEW_LEADER} ${PORT} ${0}
+ ${resp} GetPersons ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Add cars and get cars from new leader
+ [Documentation] Add 50 cars and get added cars from Leader
+ ${resp} AddCar ${NEW_LEADER} ${PORT} ${50}
+ Sleep 10
+ ${resp} Getcars ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} manufacturer1
+ Should Contain ${resp.content} manufacturer50
+ Should Not Contain ${resp.content} manufacturer60
+
+Add people and get people from leader
+ [Documentation] Add 50 persons and get people
+ [Documentation] Note: There should be one person added first to enable rpc
+ ${resp} AddPerson ${NEW_LEADER} ${PORT} ${0}
+ ${resp} AddPerson ${NEW_LEADER} ${PORT} ${50}
+ Sleep 10
+ ${resp} GetPersons ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user2
+ Should Contain ${resp.content} user50
+ Should Not Contain ${resp.content} user60
+
+Purchase 50 cars at new leader
+ [Documentation] Add car-person and get car-person from Leader
+ [Documentation] Note: This is done to enable working of rpc
+ [Documentation] Purchase 50 cars using Leader
+ ${resp} AddCarPerson ${NEW_LEADER} ${PORT} ${0}
+ ${resp} GetCarPersonMappings ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user0
+ ${resp} BuyCar ${NEW_LEADER} ${PORT} ${50}
+ Sleep 10
+
+Get car-person mappings at new Leader
+ [Documentation] Get car-person mappings using new leader to see 50 entry
+ ${resp} GetCarPersonMappings ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user5
+ Should Contain ${resp.content} user50
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation Run this test after running test no 05
+Library ../../../../libraries/CrudLibrary.py
+Library ../../../../libraries/ClusterStateLibrary.py
+
+*** Variables ***
+${SHARD} shard-car-config
+
+*** Test Cases ***
+Find follower
+ [Documentation] find follower
+ ${FOLLOWERS} GetFollowers ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${FOLLOWERS}
+ ${LAST_FOLLOWER} Set Variable ${FOLLOWERS[0]}
+ Set Suite Variable ${LAST_FOLLOWER}
+
+Get cars from last follower
+ [Documentation] get 50 cars from last follower
+ ${resp} Getcars ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} manufacturer1
+ Should Contain ${resp.content} manufacturer50
+ Should Not Contain ${resp.content} manufacturer60
+
+Get people from last follower
+ [Documentation] get 50 people
+ ${resp} GetPersons ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user2
+ Should Contain ${resp.content} user50
+ Should Not Contain ${resp.content} user60
+
+Get car-person mappings at last follower
+ [Documentation] Get car-person mappings using last to see 50 entry
+ ${resp} GetCarPersonMappings ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user5
+ Should Contain ${resp.content} user50
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation Run this test after running test no 06
+Library ../../../../libraries/CrudLibrary.py
+Library ../../../../libraries/ClusterStateLibrary.py
+
+*** Variables ***
+${SHARD} shard-car-config
+
+*** Test Cases ***
+Find follower
+ [Documentation] find follower
+ ${FOLLOWERS} GetFollowers ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${FOLLOWERS}
+ ${LAST_FOLLOWER} Set Variable ${FOLLOWERS[0]}
+ Set Suite Variable ${LAST_FOLLOWER}
+
+Delete cars at last follower
+ [Documentation] delete cars
+ DeleteAllCars ${LAST_FOLLOWER} ${PORT} ${0}
+ ${resp} Getcars ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Delete people at last follower
+ [Documentation] delete people
+ DeleteAllPersons ${LAST_FOLLOWER} ${PORT} ${0}
+ ${resp} GetPersons ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 404
+
+Add cars and get cars from last follower
+ [Documentation] Add 40 cars and get added cars from last follower
+ ${resp} AddCar ${LAST_FOLLOWER} ${PORT} ${40}
+ Sleep 8
+ ${resp} Getcars ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} manufacturer1
+ Should Contain ${resp.content} manufacturer40
+ Should Not Contain ${resp.content} manufacturer50
+
+Add people and get people from last follower
+ [Documentation] Add 40 persons and get people
+ [Documentation] Note: There should be one person added first to enable rpc
+ ${resp} AddPerson ${LAST_FOLLOWER} ${PORT} ${0}
+ ${resp} AddPerson ${LAST_FOLLOWER} ${PORT} ${40}
+ Sleep 8
+ ${resp} GetPersons ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user2
+ Should Contain ${resp.content} user40
+ Should Not Contain ${resp.content} user50
+
+Purchase 40 cars at last follower
+ [Documentation] Add car-person and get car-person from last follower
+ [Documentation] Note: This is done to enable working of rpc
+ [Documentation] Purchase 40 cars using Leader
+ ${resp} AddCarPerson ${LAST_FOLLOWER} ${PORT} ${0}
+ ${resp} GetCarPersonMappings ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user0
+ ${resp} BuyCar ${LAST_FOLLOWER} ${PORT} ${40}
+ Sleep 8
+
+Get car-person mappings at last follower
+ [Documentation] Get car-person mappings using last follower to see 40 entry
+ ${resp} GetCarPersonMappings ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user5
+ Should Contain ${resp.content} user40
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation Run this test after running test no 07
+Library ../../../../libraries/CrudLibrary.py
+Library ../../../../libraries/ClusterStateLibrary.py
+
+*** Variables ***
+${SHARD} shard-car-config
+
+*** Test Cases ***
+Find Leader
+ [Documentation] find new leader
+ ${NEW_LEADER} GetLeader ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${NEW_LEADER}
+ Set Suite Variable ${NEW_LEADER}
+
+Get cars from new leader
+ [Documentation] get 40 cars from new leader
+ ${resp} Getcars ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} manufacturer1
+ Should Contain ${resp.content} manufacturer40
+ Should Not Contain ${resp.content} manufacturer50
+
+Get people from new leader
+ [Documentation] get 40 people from new leader
+ ${resp} GetPersons ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user2
+ Should Contain ${resp.content} user40
+ Should Not Contain ${resp.content} user50
+
+Get car-person mappings at new leader
+ [Documentation] Get car-person mappings using last to see 40 entry
+ ${resp} GetCarPersonMappings ${NEW_LEADER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} user5
+ Should Contain ${resp.content} user40
\ No newline at end of file
--- /dev/null
+*** Settings ***
+Documentation Run this test after running test no 05
+Library ../../../../libraries/CrudLibrary.py
+Library ../../../../libraries/UtilLibrary.py
+Library ../../../../libraries/ClusterStateLibrary.py
+
+*** Variables ***
+${SHARD} shard-car-config
+
+*** Test Cases ***
+Stop Leader
+ [Documentation] find new leader
+ ${FOLLOWERS} GetFollowers ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${FOLLOWERS}
+ ${LAST_FOLLOWER} Set Variable ${FOLLOWERS[0]}
+ Set Suite Variable ${LAST_FOLLOWER}
+ ${NEW_LEADER} GetLeader ${SHARD} ${3} ${3} ${2} ${8181} ${LEADER} ${FOLLOWER1} ${FOLLOWER2}
+ Log ${NEW_LEADER}
+ Stopcontroller ${NEW_LEADER} ${USERNAME} ${PASSWORD} ${KARAFHOME}
+ Sleep 30
+
+
+Get cars from last follower
+ [Documentation] get cars from last follower
+ ${resp} Getcars ${LAST_FOLLOWER} ${PORT} ${0}
+ Should Be Equal As Strings ${resp.status_code} 500
+
+Add cars and get cars from last follower
+ [Documentation] Add 80 cars and get added cars from last follower
+ ${resp} AddCar ${LAST_FOLLOWER} ${PORT} ${80}
+ Should Be Equal As Strings ${resp.status_code} 500