Update clustering tests for Continuous Integration
authorPhillip Shea <phillip.shea@hp.com>
Fri, 19 Jun 2015 17:30:38 +0000 (10:30 -0700)
committerPhillip Shea <phillip.shea@hp.com>
Mon, 22 Jun 2015 18:44:32 +0000 (11:44 -0700)
This commit is a re-try of the following commit:
https://git.opendaylight.org/gerrit/#/c/22652/

The following changes were made:
    Change global variables to match those used in CI
    All ssh sign-ins now use certificates rather than passwords
    Remove Sleeps where possible.
    Move repeated variables into variables.py.
    Move repeated keywords into libraries.

Change-Id: I3c67c9fa5cbbfb1219f38cb9741481c28357185a
Signed-off-by: Phillip Shea <phillip.shea@hp.com>
14 files changed:
test/csit/libraries/ClusterKeywords.txt
test/csit/libraries/Utils.txt
test/csit/suites/clustering/datastore/001_start_cluster.robot
test/csit/suites/clustering/datastore/010_crud_on_leader.robot
test/csit/suites/clustering/datastore/020_crud_on_any_follower.robot
test/csit/suites/clustering/datastore/030_car_failover_crud_on_new_leader.robot
test/csit/suites/clustering/datastore/040_people_failover_crud_on_new_leader.robot
test/csit/suites/clustering/datastore/050_car_persistence_recovery.robot
test/csit/suites/clustering/datastore/140_recovery_restart_follower.robot
test/csit/suites/clustering/datastore/999_cleanup.robot
test/csit/suites/clustering/routedrpc/001_start_cluster.robot
test/csit/suites/clustering/routedrpc/023_routed_rpc_crud_test.robot
test/csit/suites/clustering/routedrpc/024_routed_rpc_crud_test.robot
test/csit/variables/Variables.py

index e000d8e31598e8ff3b5903f52c0f5c9913583ea1..a114f5bee8aa1fa97a3d782124460e51315b65bd 100644 (file)
@@ -1,11 +1,12 @@
 *** Settings ***
+Resource          Utils.txt
 
 *** Variables ***
 
 *** Keywords ***
 Get Leader And Verify
     [Arguments]   ${shard_name}  ${old_leader}=${EMPTY}
-    ${leader}   GetLeader   ${shard_name}  ${3}  ${3}  ${1}  ${PORT}  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
+    ${leader}   GetLeader   ${shard_name}  ${3}  ${3}  ${1}  ${PORT}  ${CONTROLLER}  ${CONTROLLER1}  ${CONTROLLER2}
     Should Not Be Equal As Strings   ${leader}   None
     Run Keyword If  '${old_leader}'!='${EMPTY}'  Should Not Be Equal  ${old_leader}  ${leader}
     [Return]   ${leader}
@@ -18,14 +19,15 @@ Wait For Leader
 
 Switch Leader
     [Arguments]   ${shard_name}  ${current_leader}
-    StopController  ${current_leader}  ${USERNAME}  ${PASSWORD}  ${KARAFHOME}
+    Stop One Or More Controllers  ${current_leader}
     ${new_leader}  Wait Until Keyword Succeeds   60s  2s  Get Leader And Verify  ${shard_name}  ${current_leader}
+    # TODO: Future enhanement: make sure the other controller is a follower and not a master or candidate.
     Log   ${new_leader}
     [Return]   ${new_leader}
 
 Get All Followers
     [Arguments]   ${shard_name}
-    ${followers}  GetFollowers  ${shard_name}  ${3}  ${3}  ${1}  ${PORT}  ${MEMBER1}  ${MEMBER2}  ${MEMBER3}
+    ${followers}  GetFollowers  ${shard_name}  ${3}  ${3}  ${1}  ${PORT}  ${CONTROLLER}  ${CONTROLLER1}  ${CONTROLLER2}
     Log  ${followers}
     Should Not Be Empty  ${followers}
     [Return]  ${followers}
index f186dbb5963c1124c9daff6548580e637d658bd7..4c7113155fa4759bcf6d34e45fb3a2945bc59111 100644 (file)
@@ -91,9 +91,9 @@ Check For Elements Not At URI
     \    Should Not Contain    ${resp.content}    ${i}
 
 Clean Mininet System
-    [Arguments]     ${mininet_system}=${MININET}
-    Run Command On Remote System    ${mininet_system}   sudo mn -c
-    Run Command On Remote System    ${mininet_system}   sudo ps -elf | egrep 'usr/local/bin/mn' | egrep python | awk '{print "sudo kill -9",$4}' | sh
+    [Arguments]    ${mininet_system}=${MININET}
+    Run Command On Remote System    ${mininet_system}    sudo mn -c
+    Run Command On Remote System    ${mininet_system}    sudo ps -elf | egrep 'usr/local/bin/mn' | egrep python | awk '{print "sudo kill -9",$4}' | sh
 
 Extract Value From Content
     [Arguments]    ${content}    ${index}    ${strip}=nostrip
@@ -104,10 +104,10 @@ Extract Value From Content
     [Return]    ${value}
 
 Get Process ID Based On Regex On Remote System
-    [Documentation]    Uses ps to find a process that matches the supplied regex.  Returns the PID of that process
+    [Arguments]    ${remote_system}    ${regex_string_to_match_on}
+    [Documentation]    Uses ps to find a process that matches the supplied regex. Returns the PID of that process
     ...    The ${regex_string_to_match_on} should produce a unique process otherwise the PID returned may not be
     ...    the expected PID
-    [Arguments]    ${remote_system}    ${regex_string_to_match_on}
     # doing the extra -v grep in this command to exclude the grep process itself from the output
     ${output}=    Run Command On Remote System    ${remote_system}    ps -elf | grep -v grep | grep ${regex_string_to_match_on} | awk '{print $4}'
     # ${output} contains the system prompt and all we want is the value of the number
@@ -115,8 +115,8 @@ Get Process ID Based On Regex On Remote System
     [Return]    ${pid}
 
 Get Process Thread Count On Remote System
+    [Arguments]    ${remote_system}    ${pid}
     [Documentation]    Executes the ps command to retrieve the lightweight process (aka thread) count.
-    [Arguments]     ${remote_system}    ${pid}
     ${output}=    Run Command On Remote System    ${remote_system}    ps --no-headers -o nlwp ${pid}
     # ${output} contains the system prompt and all we want is the value of the number
     ${thread_count}=    Fetch From Left    ${output}    \r
@@ -129,15 +129,15 @@ Strip Quotes
     [Return]    ${string_to_return}
 
 Run Command On Remote System
-    [Arguments]    ${remote_system}    ${cmd}    ${user}=${MININET_USER}    ${prompt}=${LINUX_PROMPT}    ${prompt_timeout}=30s
+    [Arguments]    ${remote_system}    ${cmd}    ${user}=${MININET_USER}    ${prompt}=${LINUX_PROMPT}    ${prompt_timeout}=30s    ${keyfile_pass}=all
     [Documentation]    Reduces the common work of running a command on a remote system to a single higher level robot keyword,
     ...    taking care to log in with a public key and. The command given is written and the output returned. No test conditions
     ...    are checked.
-    Log    Attempting to execute ${cmd} on ${remote_system}
+    Log    Attempting to execute ${cmd} on ${remote_system} by ${user} with ${keyfile_pass} and ${prompt}
     ${conn_id}=    SSHLibrary.Open Connection    ${remote_system}    prompt=${prompt}    timeout=${prompt_timeout}
-    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    ${keyfile_pass}
     SSHLibrary.Write    ${cmd}
-    ${output}=    SSHLibrary.Read Until    ${LINUX_PROMPT}
+    ${output}=    SSHLibrary.Read Until    ${prompt}
     SSHLibrary.Close Connection
     Log    ${output}
     [Return]    ${output}
@@ -200,3 +200,50 @@ Add Elements To URI From File
     ${body}    OperatingSystem.Get File    ${data_file}
     ${resp}    RequestsLibrary.Put    session    ${dest_uri}    data=${body}    headers=${headers}
     Should Be Equal As Strings    ${resp.status_code}    200
+
+Stop One Or More Controllers
+    [Arguments]    @{controllers}
+    [Documentation]    Give this keyword a scalar or list of controllers to be stopped.
+    ${cmd} =    Set Variable    ${KARAF_HOME}/bin/stop
+    : FOR    ${ip}    IN    @{controllers}
+    \    Run Command On Remote System    ${ip}    ${cmd}    ${USER}    ${LINUX_PROMPT}    30s
+    \    ...    ${keyfile_pass}
+    : FOR    ${ip}    IN    @{controllers}
+    \    Wait Until Keyword Succeeds    20 s    3 s    Controller Down Check    ${ip}
+
+Start One Or More Controllers
+    [Arguments]    @{controllers}
+    [Documentation]    Give this keyword a scalar or list of controllers to be started.
+    ${cmd} =    Set Variable    ${KARAF_HOME}/bin/start
+    : FOR    ${ip}    IN    @{controllers}
+    \    Run Command On Remote System    ${ip}    ${cmd}    ${USER}    ${LINUX_PROMPT}    30s
+    \    ...    ${keyfile_pass}
+    : FOR    ${ip}    IN    @{controllers}
+    \    UtilLibrary.Wait For Controller Up    ${ip}    ${PORT}
+
+Kill One Or More Controllers
+    [Arguments]    @{controllers}
+    [Documentation]    Give this keyword a scalar or list of controllers to be stopped.
+    ${cmd} =    Set Variable    ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh
+    : FOR    ${ip}    IN    @{controllers}
+    \    Run Command On Remote System    ${ip}    ${cmd}    ${USER}    ${LINUX_PROMPT}    30s
+    \    ...    ${keyfile_pass}
+    : FOR    ${ip}    IN    @{controllers}
+    \    Wait Until Keyword Succeeds    20 s    3 s    Controller Down Check    ${ip}
+
+Controller Down Check
+    [Arguments]    ${ip}
+    [Documentation]    Checks to see if a controller is down by verifying that the karaf process isn't present.
+    ${cmd} =    Set Variable    ps axf | grep karaf | grep -v grep | wc -l
+    ${response}    Run Command On Remote System    ${ip}    ${cmd}    ${USER}    ${LINUX_PROMPT}    30s
+    ...    ${keyfile_pass}
+    Log    Number of controller instances running: ${response}
+    Should Start With    ${response}    0    There may be extra instances of karaf running on the host machine.
+
+Clean One Or More Journals
+    [Arguments]    @{controllers}
+    [Documentation]    Give this keyword a scalar or list of controllers on which to clean journals.
+    ${del_cmd} =    Set Variable    rm -rf ${KARAF_HOME}/journal
+    : FOR    ${ip}    IN    @{controllers}
+    \    Run Command On Remote System    ${ip}    ${del_cmd}    ${USER}    ${LINUX_PROMPT}    30s
+    \    ...    ${keyfile_pass}
index 2d0f1526a08252e564f2a290dc5877ae1f8081da..da7b7d492d8b02bd637b5e48d4199d8c93aafdf5 100644 (file)
@@ -1,31 +1,20 @@
 *** Settings ***
 Documentation     Start the controllers
 Default Tags      3-node-cluster
-Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
-Library           ../../../libraries/Common.py
-Library           ../../../libraries/CrudLibrary.py
-Library           ../../../libraries/SettingsLibrary.py
-Library           ../../../libraries/UtilLibrary.py
-Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
+@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
 
 *** Test Cases ***
 Stop All Controllers
     [Documentation]    Stop all the controllers in the cluster
-    StopAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${MEMBER1}    ${MEMBER2}    ${MEMBER3}
+    Stop One Or More Controllers    @{controllers}
 
 Clean All Journals
     [Documentation]    Clean the journals of all the controllers in the cluster
-    CleanJournal    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Sleep    5
+    Clean One Or More Journals    @{controllers}
 
 Start All Controllers
     [Documentation]    Start all the controllers in the cluster
-    ${rc}    StartAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${RESTCONFPORT}    ${MEMBER1}
-    ...    ${MEMBER2}    ${MEMBER3}
-    Should Be True    ${rc}
+    Start One Or More Controllers    @{controllers}
index 34fa8fdca9511b905c0d1742ec3b9e756041f5b8..08e0aa976b3d705c5625382438fbc397256185f9 100644 (file)
@@ -2,7 +2,7 @@
 Documentation     This test finds the leader for shards in a 3-Node cluster and executes CRUD operations on them
 Default Tags      3-node-cluster
 Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
+Library           RequestsLibrary
 Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
 Library           ../../../libraries/SettingsLibrary.py
@@ -12,7 +12,6 @@ Resource          ../../../libraries/ClusterKeywords.txt
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
 ${SHARD_CAR_NAME}    shard-car-config
 ${SHARD_PEOPLE_NAME}    shard-people-config
 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
index e71dfcd36c0157261a2271269f3fc16ab9306429..ca88816588da4f012317385c589087d58c6311dc 100644 (file)
@@ -2,7 +2,6 @@
 Documentation     This test finds the followers of certain shards in a 3-Node cluster and executes CRUD operations on any one follower
 Default Tags      3-node-cluster
 Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
 Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
 Library           ../../../libraries/SettingsLibrary.py
@@ -12,7 +11,6 @@ Resource          ../../../libraries/ClusterKeywords.txt
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
 ${SHARD_CAR_NAME}    shard-car-config
 ${SHARD_PEOPLE_NAME}    shard-people-config
 ${SHARD_CAR_PERSON_NAME}    shard-car-people-config
index 98aff4efc681a36ae5690583b09dd0766d43d9dd..2cba2d4223d24d9a24ca2bfe63a207e4f7f81afb 100644 (file)
@@ -5,6 +5,7 @@ Library           ../../../libraries/CrudLibrary.py
 Library           ../../../libraries/UtilLibrary.py
 Library           ../../../libraries/ClusterStateLibrary.py
 Resource          ../../../libraries/ClusterKeywords.txt
+Resource          ../../../libraries/Utils.txt
 
 *** Variables ***
 ${CAR_SHARD}      shard-car-config
@@ -57,7 +58,7 @@ Get added cars from new leader
     Wait Until Keyword Succeeds    60s    2s    Get Cars And Verify    ${NEW_CAR_LEADER}    ${NUM_CARS}
 
 Restart old Car leader
-    StartController    ${OLD_CAR_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${PORT}
+    Start One Or More Controllers    ${OLD_CAR_LEADER}
 
 Get added cars from old leader
     [Documentation]    Get the added cars from the old leader
index c75128d60d3c25f2cb321adceb335bf87c659d8e..3450ab8c0211a2b2a3d497a8a89811a4b3bb776e 100644 (file)
@@ -43,7 +43,7 @@ Get added people from new leader
     Wait Until Keyword Succeeds    60s    2s    Get People And Verify    ${NEW_PEOPLE_LEADER}    ${NUM_ENTRIES}
 
 Restart old People leader
-    StartController    ${OLD_PEOPLE_LEADER}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${PORT}
+    Start One Or More Controllers    ${OLD_PEOPLE_LEADER}
 
 Get added people from old leader
     Wait Until Keyword Succeeds    60s    2s    Get People And Verify    ${OLD_PEOPLE_LEADER}    ${NUM_ENTRIES}
index 3d8a40c3aa608d5f7fcc051425e59e84631a492e..9333cf94e8b64a273b707d9ea2bd40b3c4a2bfb8 100644 (file)
@@ -20,27 +20,27 @@ Delete cars from leader
     Delete All Cars And Verify    ${CAR_LEADER}
 
 Stop all controllers after delete
-    StopAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${MEMBER1}    ${MEMBER2}    ${MEMBER3}
+    @{controllers} =    Create List    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+    Stop One Or More Controllers    @{controllers}
 
 Start all controllers after delete
-    ${rc}    StartAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${RESTCONFPORT}    ${MEMBER1}
-    ...    ${MEMBER2}    ${MEMBER3}
-    Should Be True    ${rc}
+    @{controllers} =    Create List    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+    Start One Or More Controllers    @{controllers}
 
 Verify no cars on leader after restart
-    ${resp}    Getcars    ${CAR_LEADER}    ${PORT}    ${0}
+    ${resp}    Getcars    ${CAR_LEADER}    ${RESTCONFPORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    404
 
 Add cars on leader
     Add Cars And Verify    ${CAR_LEADER}    ${NUM_CARS}
 
 Stop all controllers after add
-    StopAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${MEMBER1}    ${MEMBER2}    ${MEMBER3}
+    @{controllers} =    Create List    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+    Stop One Or More Controllers    @{controllers}
 
 Start all controllers after add
-    ${rc}    StartAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${RESTCONFPORT}    ${MEMBER1}
-    ...    ${MEMBER2}    ${MEMBER3}
-    Should Be True    ${rc}
+    @{controllers} =    Create List    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+    Start One Or More Controllers    @{controllers}
 
 Get cars from leader after restart
     Wait Until Keyword Succeeds    60s    2s    Get Cars And Verify    ${CAR_LEADER}    ${NUM_CARS}
index 3ae9680a857734573f74b9f6f6774f50a967e806..cd0511c420e9ba9ab1f443258ca9a3fbb499d3fe 100644 (file)
@@ -12,26 +12,22 @@ Resource          ../../../libraries/ClusterKeywords.txt
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
 ${CAR_SHARD}      shard-car-config
 ${NUM_CARS}       ${60}
+@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
 
 *** Test Cases ***
 Stop All Controllers
     [Documentation]    Stop all the controllers in the cluster
-    StopAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${MEMBER1}    ${MEMBER2}    ${MEMBER3}
+    Stop One Or More Controllers    @{controllers}
 
 Clean All Journals
     [Documentation]    Clean the journals of all the controllers in the cluster
-    CleanJournal    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
+    Clean One Or More Journals    @{controllers}
 
 Start All Controllers
     [Documentation]    Start all the controllers in the cluster
-    ${rc}    StartAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${RESTCONFPORT}    ${MEMBER1}
-    ...    ${MEMBER2}    ${MEMBER3}
-    Should Be True    ${rc}
+    Start One Or More Controllers    @{controllers}
 
 Get car leader and followers
     ${CURRENT_CAR_LEADER}    Wait For Leader    ${CAR_SHARD}
@@ -40,31 +36,30 @@ Get car leader and followers
     Set Suite Variable    ${CAR_FOLLOWERS}
 
 Stop both of the followers
-    StopAllControllers    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    @{CAR_FOLLOWERS}[0]    @{CAR_FOLLOWERS}[1]
-    Wait Until Keyword Succeeds    30s    2s    Expect No Leader
+    @{followers} =    Create List    @{CAR_FOLLOWERS}[0]    @{CAR_FOLLOWERS}[1]
+    Stop One Or More Controllers    @{followers}
 
-Attempt to add a car from the leader
+Attempt to add a car to the leader
     [Documentation]    Should fail as both followers are down
-    AddCar    ${CURRENT_CAR_LEADER}    ${PORT}    ${1}
+    AddCar    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}
     Sleep    2
-    ${resp}    Getcars    ${CURRENT_CAR_LEADER}    ${PORT}    ${1}
+    ${resp}    Getcars    ${CURRENT_CAR_LEADER}    ${RESTCONFPORT}    ${1}
     Should Not Be Equal As Strings    ${resp.status_code}    200
 
 Restart the first follower
-    StartController    @{CAR_FOLLOWERS}[0]    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${PORT}
-    Sleep    1
+    Start One Or More Controllers    @{CAR_FOLLOWERS}[0]
 
-Add cars from the first follower
-    Wait Until Keyword Succeeds    60s    2s    Add Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}    4s
+Add cars to the first follower
+    Add Cars And Verify    @{CAR_FOLLOWERS}[0]    ${NUM_CARS}    4s
 
 Restart the second follower
-    StartController    @{CAR_FOLLOWERS}[1]    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}    ${PORT}
+    Start One Or More Controllers    @{CAR_FOLLOWERS}[1]
 
 Get all the cars from the second follower
-    Wait Until Keyword Succeeds    60s    2s    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}
+    Get Cars And Verify    @{CAR_FOLLOWERS}[1]    ${NUM_CARS}
 
 *** Keywords ***
 Expect No Leader
-    ${leader}    GetLeader    ${CAR_SHARD}    ${3}    ${1}    ${1}    ${PORT}
+    ${leader}    GetLeader    ${CAR_SHARD}    ${3}    ${1}    ${1}    ${RESTCONFPORT}
     ...    ${CURRENT_CAR_LEADER}
     Should Be Equal As Strings    ${leader}    None
index ec7496f19bdbedb910f19ef3f620cd8553109e19..5727d77afa2e9607feb818dcba143427ac3d1d3a 100644 (file)
@@ -1,16 +1,18 @@
 *** Settings ***
 Documentation     Test cleanup
 Default Tags      3-node-cluster
+Resource          ../../../libraries/Utils.txt
 Library           ../../../libraries/UtilLibrary.py
 Variables         ../../../variables/Variables.py
 
+*** Variables ***
+@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
+
 *** Test Cases ***
 Kill All Controllers
-    KillController    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    KillController    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    KillController    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
+    [Documentation]    Kill all the karaf processes in the cluster
+    Kill One Or More Controllers    @{controllers}
 
 Clean All Journals
-    CleanJournal    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
+    [Documentation]    Clean the journals of all the controllers in the cluster
+    Clean One Or More Journals    @{controllers}
index e33150314f36b9fac184255d60efbb2598a31ecf..da7b7d492d8b02bd637b5e48d4199d8c93aafdf5 100644 (file)
@@ -1,37 +1,20 @@
 *** Settings ***
 Documentation     Start the controllers
-Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
-Library           ../../../libraries/Common.py
-Library           ../../../libraries/CrudLibrary.py
-Library           ../../../libraries/SettingsLibrary.py
-Library           ../../../libraries/UtilLibrary.py
-Variables         ../../../variables/Variables.py
+Default Tags      3-node-cluster
+Resource          ../../../libraries/Utils.txt
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
+@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
 
 *** Test Cases ***
 Stop All Controllers
     [Documentation]    Stop all the controllers in the cluster
-    Stopcontroller    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Stopcontroller    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Stopcontroller    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Sleep    30
-    KillController    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    KillController    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    KillController    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
+    Stop One Or More Controllers    @{controllers}
 
 Clean All Journals
     [Documentation]    Clean the journals of all the controllers in the cluster
-    CleanJournal    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    CleanJournal    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Sleep    5
+    Clean One Or More Journals    @{controllers}
 
 Start All Controllers
     [Documentation]    Start all the controllers in the cluster
-    Startcontroller    ${MEMBER1}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Startcontroller    ${MEMBER2}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Startcontroller    ${MEMBER3}    ${USER_NAME}    ${PASSWORD}    ${KARAF_HOME}
-    Sleep    120
+    Start One Or More Controllers    @{controllers}
index bfa3d8e4f121d20994a6ef633e5822f8baab43db..c7eb7815bb84793ebb5fd3a0bfcb705d1d196e38 100644 (file)
@@ -1,7 +1,7 @@
 *** Settings ***
 Documentation     Test suite for Routed RPC.
 Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
+Library           RequestsLibrary
 Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
 Library           ../../../libraries/SettingsLibrary.py
@@ -9,54 +9,52 @@ Library           ../../../libraries/UtilLibrary.py
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-${REST_CONTEXT}    /restconf/config/
+@{controllers}    ${CONTROLLER}    ${CONTROLLER1}    ${CONTROLLER2}
 
 *** Test Cases ***
 Add cars and get cars from Leader
     [Documentation]    Add 100 cars and get added cars from Leader
-    ${resp}    InitCar    ${MEMBER1}    ${PORT}
-    ${resp}    AddCar    ${MEMBER1}    ${PORT}    ${100}
-    ${resp}    Getcars    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    InitCar    ${CONTROLLER}    ${PORT}
+    ${resp}    AddCar    ${CONTROLLER}    ${PORT}    ${100}
+    ${resp}    Getcars    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer1
+    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    ${MEMBER1}    ${PORT}    ${0}
-    ${resp}    AddPerson    ${MEMBER1}    ${PORT}    ${100}
-    ${resp}    GetPersons    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER}    ${PORT}    ${100}
+    ${resp}    GetPersons    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user5
-    SLEEP    10
+    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
-    ${resp}    AddCarPerson    ${MEMBER2}    ${PORT}    ${0}
-    ${resp}    GetCarPersonMappings    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    AddCarPerson    ${CONTROLLER1}    ${PORT}    ${0}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user0
-    SLEEP    5
+    Should Contain    ${resp.content}    user0    car-person not initialized!
 
 Purchase 100 cars using Follower1
     [Documentation]    Purchase 100 cars using Follower1
-    ${resp}    BuyCar    ${MEMBER2}    ${PORT}    ${100}
-    ${resp}    GetCarPersonMappings    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    BuyCar    ${CONTROLLER1}    ${PORT}    ${100}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Get Cars from Leader
     [Documentation]    Get 100 using Leader
-    ${resp}    Getcars    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    Getcars    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    manufacturer99
 
 Get persons from Leader
     [Documentation]    Get 101 Persons from Leader
-    ${resp}    GetPersons    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    GetPersons    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    user100
 
 Get car-person mappings using Leader
     [Documentation]    Get 101 car-person mappings using Leader to see 100 entry
-    ${resp}    GetCarPersonMappings    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    user100
index b4344cdf242fe3d4a45948f28dcbe524b8f8c97e..88477c14b5729a9356392c77eb46f5edf774a9ed 100644 (file)
@@ -1,7 +1,8 @@
 *** Settings ***
 Documentation     Test suite for Routed RPC.
+Resource          ../../../libraries/Utils.txt
 Library           Collections
-Library           ../../../libraries/RequestsLibrary.py
+Library           RequestsLibrary
 Library           ../../../libraries/Common.py
 Library           ../../../libraries/CrudLibrary.py
 Library           ../../../libraries/SettingsLibrary.py
@@ -9,107 +10,99 @@ Library           ../../../libraries/UtilLibrary.py
 Library           ../../../libraries/ClusterStateLibrary.py
 Variables         ../../../variables/Variables.py
 
-*** Variables ***
-${REST_CONTEXT}    /restconf/config/
-
 *** Test Cases ***
 Add cars and get cars from Leader
     [Documentation]    Add 100 cars and get added cars from Leader
-    ${resp}    InitCar    ${MEMBER1}    ${PORT}
-    ${resp}    AddCar    ${MEMBER1}    ${PORT}    ${100}
-    ${resp}    Getcars    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    InitCar    ${CONTROLLER}    ${PORT}
+    ${resp}    AddCar    ${CONTROLLER}    ${PORT}    ${100}
+    ${resp}    Getcars    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    manufacturer1
 
 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    ${MEMBER1}    ${PORT}    ${0}
-    ${resp}    AddPerson    ${MEMBER1}    ${PORT}    ${100}
-    ${resp}    GetPersons    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER}    ${PORT}    ${100}
+    ${resp}    GetPersons    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    user5
 
 Add car-person mapping and get car-person mapping from Follower1
     [Documentation]    Add car-person and get car-person from Follower1 Note: This is done to enable working of rpc
-    ${resp}    AddCarPerson    ${MEMBER2}    ${PORT}    ${0}
-    ${resp}    GetCarPersonMappings    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    AddCarPerson    ${CONTROLLER1}    ${PORT}    ${0}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    user0
 
 Purchase 100 cars using Follower
     [Documentation]    Purchase 100 cars using Follower
-    SLEEP    10
-    ${resp}    BuyCar    ${MEMBER2}    ${PORT}    ${100}
-    ${resp}    GetCarPersonMappings    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    BuyCar    ${CONTROLLER1}    ${PORT}    ${100}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Get Cars from Leader
     [Documentation]    Get 100 using Leader
-    ${resp}    Getcars    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    Getcars    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer9
+    Should Contain    ${resp.content}    manufacturer9    cars not returned!
 
 Get persons from Leader
     [Documentation]    Get 11 Persons from Leader
-    ${resp}    GetPersons    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    GetPersons    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user100
+    Should Contain    ${resp.content}    user100    people not returned!
 
 Get car-person mappings using Leader
     [Documentation]    Get car-person mappings using Leader to see 100 entry
-    ${resp}    GetCarPersonMappings    ${MEMBER1}    ${PORT}    ${0}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user100
+    Should Contain    ${resp.content}    user100    car-people not returned!
 
 Stop Leader
     [Documentation]    Stop Leader controller
-    ${resp}    Stopcontroller    ${MEMBER1}    ${USERNAME}    ${PASSWORD}    ${KARAF_HOME}
-    SLEEP    30
-    ${resp}    Killcontroller    ${MEMBER1}    ${USERNAME}    ${PASSWORD}    ${KARAF_HOME}
+    Stop One Or More Controllers    ${CONTROLLER}
+    Kill One Or More Controllers    ${CONTROLLER}
 
 Add cars and get cars from Follower1
     [Documentation]    Add 100 cars and get added cars from Follower
-    ${resp    InitCar    ${MEMBER2}    ${PORT}
-    ${resp}    AddCar    ${MEMBER2}    ${PORT}    ${100}
-    ${resp}    Getcars    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    InitCar    ${CONTROLLER1}    ${PORT}
+    ${resp}    AddCar    ${CONTROLLER1}    ${PORT}    ${100}
+    ${resp}    Getcars    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer1
+    Should Contain    ${resp.content}    manufacturer1    cars not added!
 
 Add persons and get persons from Follower1
     [Documentation]    Add 100 persons and get persons Note: There should be one person added first to enable rpc
-    ${resp}    AddPerson    ${MEMBER2}    ${PORT}    ${0}
-    ${resp}    AddPerson    ${MEMBER2}    ${PORT}    ${100}
-    ${resp}    GetPersons    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER1}    ${PORT}    ${0}
+    ${resp}    AddPerson    ${CONTROLLER1}    ${PORT}    ${100}
+    ${resp}    GetPersons    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user5
-    SLEEP    10
+    Should Contain    ${resp.content}    user5    car-people not initialized!
 
 Purchase 100 cars using Follower2
     [Documentation]    Purchase 100 cars using Follower2
-    ${resp}    BuyCar    ${MEMBER3}    ${PORT}    ${100}
-    SLEEP    10
-    ${resp}    GetCarPersonMappings    ${MEMBER3}    ${PORT}    ${0}
+    ${resp}    BuyCar    ${CONTROLLER2}    ${PORT}    ${100}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER2}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Get Cars from Follower1
     [Documentation]    Get 100 using Follower1
-    ${resp}    Getcars    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    Getcars    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    manufacturer9
+    Should Contain    ${resp.content}    manufacturer9    cars not returned!
 
 Get persons from Follower1
     [Documentation]    Get 11 Persons from Follower1
-    ${resp}    GetPersons    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    GetPersons    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user100
+    Should Contain    ${resp.content}    user100    people not returned!
 
 Get car-person mappings using Follower1
     [Documentation]    Get car-person mappings using Follower1 to see 100 entry
-    ${resp}    GetCarPersonMappings    ${MEMBER2}    ${PORT}    ${0}
+    ${resp}    GetCarPersonMappings    ${CONTROLLER1}    ${PORT}    ${0}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    user100
+    Should Contain    ${resp.content}    user100    car-people not returned!
 
 Start Leader
     [Documentation]    Start Leader controller
-    ${resp}    Startcontroller    ${MEMBER1}    ${USERNAME}    ${PASSWORD}    ${KARAF_HOME}
-    SLEEP    20
+    Start One Or More Controllers    ${CONTROLLER}
index d7f4861c3603c13bad5841c930cad19cc62e67f5..16548cd996fe53fed10abebcb3e2f8f62f978905 100644 (file)
@@ -14,6 +14,7 @@ PROMPT = '>'
 CONTAINER = 'default'
 USER = 'admin'
 PWD = 'admin'
+PASSWORD = 'EMPTY'
 AUTH = [u'admin', u'admin']
 SCOPE = 'sdn'
 HEADERS = {'Content-Type': 'application/json'}
@@ -23,12 +24,14 @@ ODL_CONTROLLER_SESSION = None
 TOPO_TREE_LEVEL = 2
 TOPO_TREE_DEPTH = 3
 TOPO_TREE_FANOUT = 2
+CONTROLLERS = ['CONTROLLER', 'CONTROLLER1', 'CONTROLLER2']
 
 # KARAF Varaiable
 KARAF_SHELL_PORT = '8101'
 KARAF_PROMPT = 'opendaylight-user'
 KARAF_USER = 'karaf'
 KARAF_PASSWORD = 'karaf'
+KARAF_HOME = '/tmp/${BUNDLEFOLDER}'
 
 # VM Environment Variables
 LINUX_PROMPT = '>'
@@ -77,6 +80,7 @@ CONTROLLER_CONFIG_MOUNT = ('/restconf/config/network-topology:'
                            'network-topology/topology'
                            '/topology-netconf/node/'
                            'controller-config/yang-ext:mount')
+CONFIG_API = '/restconf/config/'
 
 # TOKEN
 AUTH_TOKEN_API = '/oauth2/token'