Uploaded working AD-SAL cluster testcases
authorMadhusudhan <madhusudhan.opendaylight@yahoo.com>
Fri, 16 May 2014 05:06:42 +0000 (22:06 -0700)
committerMadhusudhan <madhusudhan.opendaylight@yahoo.com>
Fri, 16 May 2014 05:06:42 +0000 (22:06 -0700)
Change-Id: I03364380f6f87d36c9323893307be12d3a86e4ba
Signed-off-by: Madhusudhan <madhusudhan.opendaylight@yahoo.com>
test/tools/Robot_Tool/suites/cluster/010__bridge_topology.txt [new file with mode: 0644]
test/tools/Robot_Tool/suites/cluster/015__FRM.txt [new file with mode: 0644]
test/tools/Robot_Tool/suites/cluster/020__c1_fails.txt [new file with mode: 0644]
test/tools/Robot_Tool/suites/cluster/025__c2_fails.txt [new file with mode: 0644]
test/tools/Robot_Tool/suites/cluster/__init__.txt [new file with mode: 0644]

diff --git a/test/tools/Robot_Tool/suites/cluster/010__bridge_topology.txt b/test/tools/Robot_Tool/suites/cluster/010__bridge_topology.txt
new file mode 100644 (file)
index 0000000..1412907
--- /dev/null
@@ -0,0 +1,68 @@
+*** Settings ***
+Documentation     Introducing switches to both the controllers C1  and C2
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${node1}   "00:00:00:00:00:00:00:01"
+${node2}   "00:00:00:00:00:00:00:02"
+${node3}   "00:00:00:00:00:00:00:03"
+${REST_CONTEXT}    /controller/nb/v2/topology
+${REST_CONTEXT_ST}    /controller/nb/v2/statistics
+${CONTROLLER1}    10.125.136.38:6633
+${CONTROLLER2}    10.125.136.43:6633
+${Controller1_IP}    10.125.136.38
+${Controller2_IP}    10.125.136.43
+${CTRL_USER}      odluser
+${FLOW}           "10.0.0.1"
+
+*** Test Cases ***
+Switches are introduced to both the controllers C1 & C2
+    [Documentation]    Switches are introduced to both the controllers C1 & C2
+    [Tags]    Set-Bridges
+    Switch Connection    1
+    ${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
+    ${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}
+
+
+Verifying the topology in C1
+    [Documentation]    Get Topology for C1 and validate the result.
+    [Tags]    get
+    Create Session    session    http://${Controller1_IP}:8080   headers=${HEADERS}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Sleep    10
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${node1}   4
+    Should Contain X Times  ${resp.content}   ${node2}   2
+    Should Contain X Times  ${resp.content}   ${node3}   2
+
+Verifying the topology in C2
+    [Documentation]    Get Topology for C2 and validate the result.
+    [Tags]    get
+    Create Session    session    http://${Controller2_IP}:8080   headers=${HEADERS}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}
+    Sleep    10
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${node1}   4
+    Should Contain X Times  ${resp.content}   ${node2}   2
+    Should Contain X Times  ${resp.content}   ${node3}   2
+
diff --git a/test/tools/Robot_Tool/suites/cluster/015__FRM.txt b/test/tools/Robot_Tool/suites/cluster/015__FRM.txt
new file mode 100644 (file)
index 0000000..b82c286
--- /dev/null
@@ -0,0 +1,60 @@
+*** Settings ***
+Documentation     Introducing switches to both the controllers C1  and C2
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${node1}   "00:00:00:00:00:00:00:01"
+${node2}   "00:00:00:00:00:00:00:02"
+${node3}   "00:00:00:00:00:00:00:03"
+${key}            flowConfig
+${name}           flow1
+${REST_CONTEXT_P}    /controller/nb/v2/flowprogrammer
+${REST_CONTEXT_ST}    /controller/nb/v2/statistics
+${CONTROLLER1}    10.125.136.38:6633
+${CONTROLLER2}    10.125.136.43:6633
+${Controller1_IP}    10.125.136.38
+${Controller2_IP}    10.125.136.43
+${node_id}        00:00:00:00:00:00:00:02
+${FLOW}           "10.0.0.1"
+
+
+*** Test Cases ***
+Add a flow in C1
+    [Documentation]            Adding a flow, list to validate the result in C1
+    [Tags]    add
+    ${node}    Create Dictionary    type    OF    id    ${node_id}
+    ${actions}    Create List    OUTPUT=1
+    ${body}    Create Dictionary    name    ${name}    installInHw    true    node
+    ...    ${node}    priority    1    etherType    0x800    nwDst
+    ...    10.0.0.1/32    actions    ${actions}
+    Create Session    session    http://${Controller1_IP}:8080   auth=${AUTH}   headers=${HEADERS}
+    ${resp}    Put    session    ${REST_CONTEXT_P}/${CONTAINER}/node/OF/${node_id}/staticFlow/${name}    data=${body}
+    Should Be Equal As Strings    ${resp.status_code}    201
+
+
+Check flow stats in C1
+    [Documentation]    Checking the flow stats and validating the result in C1
+    [Tags]   get
+    Sleep   10
+    Create Session    session    http://${Controller1_IP}:8080   auth=${AUTH}   headers=${HEADERS}
+    ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain    ${resp.content}    ${FLOW}
+
+
+Check flow stats in C2
+    [Documentation]    Checking the flow stats and validating the result in C2
+    [Tags]   get
+    Sleep   10
+    Create Session    session    http://${Controller2_IP}:8080   auth=${AUTH}   headers=${HEADERS}
+    ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain    ${resp.content}    ${FLOW}
+
diff --git a/test/tools/Robot_Tool/suites/cluster/020__c1_fails.txt b/test/tools/Robot_Tool/suites/cluster/020__c1_fails.txt
new file mode 100644 (file)
index 0000000..2b74a6b
--- /dev/null
@@ -0,0 +1,67 @@
+*** Settings ***
+Documentation     controller1 fails
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${node1}   "00:00:00:00:00:00:00:01"
+${node2}   "00:00:00:00:00:00:00:02"
+${node3}   "00:00:00:00:00:00:00:03"
+${REST_CONTEXT}    /controller/nb/v2/topology
+${REST_CONTEXT_ST}    /controller/nb/v2/statistics
+${CONTROLLER1}    10.125.136.38:6633
+${CONTROLLER2}    10.125.136.43:6633
+${Controller1_IP}    10.125.136.38
+${Controller2_IP}    10.125.136.43
+${CTRL_USER}      odluser
+${FLOW}           "10.0.0.1"
+
+*** Test Cases ***
+C1 fails
+    [Documentation]    C1 fails suddenly
+    Open Connection    ${Controller1_IP}    prompt=$
+    Login With Public Key    odluser   ${USER_HOME}/.ssh/id_rsa   any
+    Write    cd controller-base/opendaylight
+    Write    ./run.sh -stop
+    Sleep    5
+    Read
+
+C2 takes over and verifying the bridges
+    [Documentation]    C2 is taking over from c1 failure 
+    Switch Connection    1
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Read
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+    Sleep    5
+    Should Contain X Times    ${stdout}    is_connected: true    3
+
+Verifying the topology in C2
+    [Documentation]    Get Topology for C2 and validate the result.
+    [Tags]    get
+    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 
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${node1}   4
+    Should Contain X Times  ${resp.content}   ${node2}   2
+    Should Contain X Times  ${resp.content}   ${node3}   2
+
+Check flow in flow stats in C2
+    [Documentation]    Checking the flow stats and validating the result in C2
+    [Tags]   get
+    Sleep   10
+    Create Session    session    http://${Controller2_IP}:8080   headers=${HEADERS}    auth=${auth}
+    ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain    ${resp.content}    ${FLOW}
+
+
+
+
+
+
+
diff --git a/test/tools/Robot_Tool/suites/cluster/025__c2_fails.txt b/test/tools/Robot_Tool/suites/cluster/025__c2_fails.txt
new file mode 100644 (file)
index 0000000..9532c34
--- /dev/null
@@ -0,0 +1,71 @@
+*** Settings ***
+Documentation     controller1 fails
+Library           SSHLibrary
+Library           Collections
+Library           ../../libraries/RequestsLibrary.py
+Library           ../../libraries/Common.py
+Variables         ../../variables/Variables.py
+
+*** Variables ***
+${node1}   "00:00:00:00:00:00:00:01"
+${node2}   "00:00:00:00:00:00:00:02"
+${node3}   "00:00:00:00:00:00:00:03"
+${REST_CONTEXT}    /controller/nb/v2/topology
+${REST_CONTEXT_ST}    /controller/nb/v2/statistics
+${CONTROLLER1}    10.125.136.38:6633
+${CONTROLLER2}    10.125.136.43:6633
+${Controller1_IP}    10.125.136.38
+${Controller2_IP}    10.125.136.43
+${CTRL_USER}      odluser
+${FLOW}           "10.0.0.1"
+
+*** Test Cases ***
+C1 recovers from failure
+    [Documentation]    C1 recovers from failure
+    Switch Connection    2
+    Write    cd controller-base/opendaylight
+    Write    ./run.sh -start
+    Sleep    60
+    Read
+
+C2 fails
+    [Documentation]    C2 fails suddenly
+    Open Connection    ${Controller2_IP}    prompt=$
+    Login With Public Key    odluser   ${USER_HOME}/.ssh/id_rsa   any
+    Write    cd controller-base/opendaylight
+    Write    ./run.sh -stop
+    Sleep    5
+    Read
+
+C1 takes over and verifying the bridges
+    [Documentation]    C1 is taking over from C2 
+    Switch Connection    1
+    ${stdout}=    Execute Command    sudo ovs-vsctl show
+    Read
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER1}"  3
+    Should Contain X Times    ${stdout}    Controller "tcp:${CONTROLLER2}"  3
+
+Verifying the topology in C1
+    [Documentation]    Get Topology for C1 and validate the result.
+    [Tags]    get
+    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 
+    Log    ${resp.content}
+    Should Contain X Times  ${resp.content}   ${node1}   4
+    Should Contain X Times  ${resp.content}   ${node2}   2
+    Should Contain X Times  ${resp.content}   ${node3}   2
+
+Check flow in flow stats in C1
+    [Documentation]    Checking the flow stats and validating the result in C1
+    [Tags]   get
+    Sleep   10
+    ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
+    Should Be Equal As Strings    ${resp.status_code}    200 
+    Log    ${resp.content}
+    Should Contain    ${resp.content}    ${FLOW}
+
+
+
+
+
diff --git a/test/tools/Robot_Tool/suites/cluster/__init__.txt b/test/tools/Robot_Tool/suites/cluster/__init__.txt
new file mode 100644 (file)
index 0000000..120a843
--- /dev/null
@@ -0,0 +1,27 @@
+*** Settings ***
+Documentation     Test suite for the OpenDaylight Cluster
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER},port=6633 --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    sudo mn -c
+    Sleep    5
+    Write    ${start}
+    Sleep    20
+    Read
+Stop Suite
+    Log    Stop the test on the base edition
+    Read
+    Write    exit 
+    Sleep    4
+    Read 
+    Close Connection 
+