Added test cases for topology of the clustering manager and forwarding rule manager...
authorArash Eghtesadi <aeghtesadi@inocybe.ca>
Thu, 20 Feb 2014 16:06:36 +0000 (11:06 -0500)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 22 Feb 2014 13:46:19 +0000 (13:46 +0000)
Change-Id: Ia6ecf41d582f419ddfba66d88f46ccf7af7eb46d
Signed-off-by: Arash Eghtesadi <aeghtesadi@inocybe.ca>
test/csit/suites/ha/005__two_controller_running.txt [new file with mode: 0644]
test/csit/suites/ha/010__c1_fails.txt [new file with mode: 0644]
test/csit/suites/ha/015__c2_fails.txt [new file with mode: 0644]
test/csit/suites/ha/020__c1_recovers.txt [new file with mode: 0644]
test/csit/suites/ha/025__two_controllers_fail.txt [new file with mode: 0644]
test/csit/suites/ha/030__two_controller_see_flow.txt [new file with mode: 0644]
test/csit/suites/ha/035__installed_flow_remains.txt [new file with mode: 0644]
test/csit/suites/ha/__init__.txt [new file with mode: 0644]
test/csit/suites/ha/resource.txt [new file with mode: 0644]

diff --git a/test/csit/suites/ha/005__two_controller_running.txt b/test/csit/suites/ha/005__two_controller_running.txt
new file mode 100644 (file)
index 0000000..f8458fd
--- /dev/null
@@ -0,0 +1,154 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+*** Test Cases ***
+Two controllers running
+    Given C1 a controller in cluster of two controllers
+    And C2 a controller in cluster of two controllers
+    And all switches are introduced to both controllers
+    When C1 is up and running
+    And C2 is up and running
+    Then the system is working with C1 and C2
+     
+
+
+*** Keywords ***
+C1 is up and running
+    Open Browser To Login Page 1
+    Input Username    admin
+    Input Password    admin
+    Submit Credentials
+    Welcome Page 1 Should Be Open
+    [Teardown]    Close Browser
+
+C2 is up and running
+    Open Browser To Login Page 2
+    Input Username    admin
+    Input Password    admin
+    Submit Credentials
+    Welcome Page 2 Should Be Open
+    [Teardown]    Close Browser
+
+
+Open Browser To Login Page 1
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL1}    ${BROWSER}
+    Maximize Browser Window
+    Login Page Should Be Open
+
+Open Browser To Login Page 2
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL2}    ${BROWSER}
+    Maximize Browser Window
+    Login Page Should Be Open
+
+Login Page Should Be Open
+    Title Should Be    OpenDaylight - Login
+
+Input Username
+    [Arguments]    ${username}
+    Input Text    j_username    ${username}
+
+Input Password
+    [Arguments]    ${password}
+    Input Text    j_password    ${password}
+
+Submit Credentials
+    Click Button    Log In
+
+Welcome Page 1 Should Be Open
+    Location Should Be    ${LOGIN URL1}
+    Title Should Be    OpenDaylight
+
+Welcome Page 2 Should Be Open
+    Location Should Be    ${LOGIN URL2}
+    Title Should Be    OpenDaylight
+
+C1 a controller in cluster of two controllers
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+    Open Connection    ${Controller2_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+all switches are introduced to both controllers
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+the system is working with C1 and C2
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+
+
diff --git a/test/csit/suites/ha/010__c1_fails.txt b/test/csit/suites/ha/010__c1_fails.txt
new file mode 100644 (file)
index 0000000..d612f9b
--- /dev/null
@@ -0,0 +1,115 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+*** Test Cases ***
+Controller1 fails
+    Given C1 a controller in cluster of two controllers
+    And C2 a controller in cluster of two controllers
+    And all switches are introduced to both controllers
+    When C1 goes down
+    Then C2 takes over 
+    And the system is working with C2
+
+
+*** Keywords ***
+C1 goes down
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL1}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL1}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+all switches are introduced to both controllers
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+the system is working with C2
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+
+C2 takes over 
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain X Times    ${stdout}    is_connected: true    3
+
+
+
+
diff --git a/test/csit/suites/ha/015__c2_fails.txt b/test/csit/suites/ha/015__c2_fails.txt
new file mode 100644 (file)
index 0000000..a0b833d
--- /dev/null
@@ -0,0 +1,113 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+*** Test Cases ***
+Controller2 fails
+    Given C1 a controller in cluster of two controllers
+    And C2 a controller in cluster of two controllers
+    And all switches are introduced to both controllers
+    When C2 goes down
+    Then C1 takes over 
+    And the system is working with C1
+
+
+
+*** Keywords ***
+C2 goes down
+    Open Connection    ${Controller2_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL2}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL2}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+all switches are introduced to both controllers
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+the system is working with C1
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+
+C1 takes over 
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    is_connected: true    3
+
diff --git a/test/csit/suites/ha/020__c1_recovers.txt b/test/csit/suites/ha/020__c1_recovers.txt
new file mode 100644 (file)
index 0000000..2fde014
--- /dev/null
@@ -0,0 +1,130 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+*** Test Cases ***
+Controller1 recovers after failure
+    Given C1 goes down
+    And C2 takes over 
+#    And C2 a controller in cluster of two controllers
+#    And all switches are introduced to both controllers
+    When C1 recovers
+    Then the system is working with C1 and C2
+
+
+*** Keywords ***
+C1 goes down
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL1}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL1}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+all switches are introduced to both controllers
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+the system is working with C1 and C2 
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${nodeconn1}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn2}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn3}   2
+    Should Contain X Times  ${resp.content}   ${nodeconn4}   2
+
+
+C2 takes over 
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain X Times    ${stdout}    is_connected: true    3
+
+
+C1 recovers
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+
+
diff --git a/test/csit/suites/ha/025__two_controllers_fail.txt b/test/csit/suites/ha/025__two_controllers_fail.txt
new file mode 100644 (file)
index 0000000..e0a3e35
--- /dev/null
@@ -0,0 +1,113 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+*** Test Cases ***
+Controller1 and Controller2 fail
+    Given C1 a controller in cluster of two controllers
+    And C2 a controllers in cluster of two controllers
+    And all switches are introduced to both controllers
+    When C1 goes down
+    And C2 goes down
+    Then the system does not work any more
+
+
+*** Keywords ***
+C1 goes down
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL1}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL1}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+C2 goes down
+    Open Connection    ${Controller2_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL2}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL2}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+all switches are introduced to both controllers
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+the system does not work any more
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Not Contain    ${stdout}    is_connected: true 
+
+
diff --git a/test/csit/suites/ha/030__two_controller_see_flow.txt b/test/csit/suites/ha/030__two_controller_see_flow.txt
new file mode 100644 (file)
index 0000000..b44021a
--- /dev/null
@@ -0,0 +1,92 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+Suite Teardown    Delete All Sessions
+
+*** Test Cases ***
+The installed flow can be seen in a cluster of two controllers
+    Given C1 a controller in cluster of two controllers
+    And C2 a controller in cluster of two controllers
+    When a flow is installed in a bridge
+    Then C1 see the flow  
+    And C2 see the flow   
+
+
+*** Keywords ***
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+a flow is installed in a bridge
+    ${node}    Create Dictionary    type    OF    id    ${node_id}
+    ${actions}    Create List    OUTPUT=1
+    ${body}    Create Dictionary    name    ${name}    installInHw    true    node
+    ...    ${node}    priority    995    etherType    0x800    nwDst
+    ...    10.0.0.1/32    actions    ${actions}
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
+    ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
+    Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary    ${result}    ${key}
+    List Should Contain Value    ${content}    ${body}
+
+
+C1 see the flow
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT_2}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary   ${result}   actions
+    List Should Contain Value   ${content}  OUTPUT=1  
+
+C2 see the flow
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT_2}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary   ${result}   actions
+    List Should Contain Value   ${content}  OUTPUT=1  
+
+
+
diff --git a/test/csit/suites/ha/035__installed_flow_remains.txt b/test/csit/suites/ha/035__installed_flow_remains.txt
new file mode 100644 (file)
index 0000000..091de32
--- /dev/null
@@ -0,0 +1,143 @@
+*** Settings ***
+Documentation     ODL controller clustering test case using the gherkin syntax.
+...
+...               This test has a workflow similar to the keyword-driven
+...               examples. The difference is that the keywords use higher
+...               abstraction level and their arguments are embedded into
+...               the keyword names.
+...
+...               This kind of _gherkin_ syntax has been made popular by
+...               [http://cukes.info|Cucumber]. It works well especially when
+...               tests act as examples that need to be easily understood also
+...               by the business people.
+Resource          resource.txt
+Library           Selenium2Library
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+
+
+The installed flow remains in the bridge after the controller failure
+    Given C1 a controller in cluster of two controllers
+    And C2 a controller in cluster of two controllers
+    And both controllers get provisioned on all OVS bridges
+    And a flow is installed in a bridge
+    And C1 see the flow
+    And C2 see the flow
+    And C1 goes down
+    When C1 recovers
+    Then C1 see the flow
+     
+
+
+*** Keywords ***
+C1 a controller in cluster of two controllers
+#    Open Connection    ${Controller1_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    
+
+
+C2 a controller in cluster of two controllers
+#    Open Connection    ${Controller2_IP}    prompt=>
+#    Login    ${VM USERNAME}    ${VM PASSWORD}
+#    Write    cd controller-base/opendaylight
+#    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3    
+
+
+both controllers get provisioned on all OVS bridges
+    Open Connection    ${HOST}
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+#   ${stdout1}=    Execute Command    sudo ovs-vsctl set-controller s1 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s2 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+#   ${stdout2}=    Execute Command    sudo ovs-vsctl set-controller s3 tcp:${CONTROLLER1} tcp:${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl show
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Should Contain     ${stdout}    Bridge "s1"
+    Should Contain     ${stdout}    Bridge "s2"
+    Should Contain     ${stdout}    Bridge "s3"
+    Should Contain X Times    ${stdout}    is_connected: true    6
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s1"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s2"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+    ${stdout}=    Execute Command   sudo ovs-vsctl get-controller "s3"
+    Should Contain     ${stdout}    ${CONTROLLER1}
+    Should Contain     ${stdout}    ${CONTROLLER2}
+               
+
+a flow is installed in a bridge
+    ${node}    Create Dictionary    type    OF    id    ${node_id}
+    ${actions}    Create List    OUTPUT=1
+    ${body}    Create Dictionary    name    ${name}    installInHw    true    node
+    ...    ${node}    priority    999    etherType    0x800    nwDst
+    ...    10.0.0.1/32    actions    ${actions}
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080    headers=${headers}    auth=${auth}
+    ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
+    Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary    ${result}    ${key}
+    List Should Contain Value    ${content}    ${body}
+
+
+C1 goes down
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -stop
+    Set Selenium Speed    ${DELAY2}
+    Open Browser    ${LOGIN URL1}    ${BROWSER}
+    Maximize Browser Window
+    Set Selenium Speed    ${DELAY}
+    Location Should Be    ${ERROR URL1}
+    Title Should Be    Problem loading page
+    [Teardown]    Close Browser
+
+
+C1 recovers
+    Open Connection    ${Controller1_IP}    prompt=>
+    Login    ${VM USERNAME}    ${VM PASSWORD}
+    Write    cd controller-base/opendaylight
+    Write    sudo ./run.sh -Dsupernodes=${Controller1_IP}:${Controller2_IP} -start
+
+
+
+C1 see the flow
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller1_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT_2}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary   ${result}   actions
+    List Should Contain Value   ${content}  OUTPUT=1  
+
+
+
+C2 see the flow
+    ${headers}    Create Dictionary    Content-Type    application/json
+    Create Session    session    http://${Controller2_IP}:8080   headers=${headers}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT_2}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    ${result}    To JSON    ${resp.content}
+    ${content}    Get From Dictionary   ${result}   actions
+    List Should Contain Value   ${content}  OUTPUT=1  
+
+    
diff --git a/test/csit/suites/ha/__init__.txt b/test/csit/suites/ha/__init__.txt
new file mode 100644 (file)
index 0000000..703827c
--- /dev/null
@@ -0,0 +1,25 @@
+*** Settings ***
+Documentation     Test suite for the OpenDaylight base edition
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,2
+
+*** Keywords ***
+Start Suite  
+    Log    Start the test on the base edition
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any 
+    Write    ${start}
+    Sleep    65
+    Read
+Stop Suite
+    Log    Stop the test on the base edition
+    Write    exit 
+    Sleep    2
+    Write    sudo mn -c
+    Sleep    2
+    Read 
+    Close Connection 
diff --git a/test/csit/suites/ha/resource.txt b/test/csit/suites/ha/resource.txt
new file mode 100644 (file)
index 0000000..48ecf9b
--- /dev/null
@@ -0,0 +1,38 @@
+*** Settings ***
+Documentation     A resource file with reusable keywords and variables.
+...
+...               The system specific keywords created here form our own
+...               domain specific language. They utilize keywords provided
+...               by the imported Selenium2Library.
+
+*** Variables ***
+${CONTROLLER1}    192.168.56.101:6633
+${CONTROLLER2}    192.168.56.102:6633
+${Controller1_IP}    192.168.56.101
+${Controller2_IP}    192.168.56.102
+${HOST}              192.168.56.103
+${BROWSER}        Firefox
+${DELAY}          0
+${DELAY2}         40
+${USER}           admin
+${PASSWORD}       admin
+${SERVER1}        192.168.56.101:8080
+${SERVER2}        192.168.56.102:8080
+${LOGIN URL1}     http://${SERVER1}/
+${LOGIN URL2}     http://${SERVER2}/
+${ERROR URL1}     http://${SERVER1}/
+${ERROR URL2}     http://${SERVER2}/
+${VM USERNAME}    odluser
+${VM PASSWORD}    odluser1
+
+${nodeconn1}   NodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:01"},"id":"1"}
+${nodeconn2}   NodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:01"},"id":"2"}
+${nodeconn3}   NodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:02"},"id":"3"}
+${nodeconn4}   NodeConnector":{"type":"OF","node":{"type":"OF","id":"00:00:00:00:00:00:00:03"},"id":"3"}
+
+
+${name}           flow995
+${key}            flowConfig
+${node_id}        00:00:00:00:00:00:00:02
+${REST_CONTEXT}    /controller/nb/v2/flowprogrammer
+${REST_CONTEXT_2}    /controller/nb/v2/statistics/default/flow