TCs Resorganization part 4 - DO NOT MERGE
[integration/test.git] / test / tools / Robot_Tool / suites / ha / 030__two_controller_see_flow.txt
diff --git a/test/tools/Robot_Tool/suites/ha/030__two_controller_see_flow.txt b/test/tools/Robot_Tool/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  
+
+
+