Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / openflowplugin / EntityOwnership / 010_Switch_Disconnect.robot
index 303d1280b4ed20667341448a22510d921d253cd6..806569d3f632570173e7a29b02efcc3285b0237f 100644 (file)
@@ -2,11 +2,14 @@
 Documentation     Test suite for entity ownership service and openflowplugin. Makes changes on switch side.
 Suite Setup       Start Suite
 Suite Teardown    End Suite
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Template     Reconnecting Switch Scenario
 Library           SSHLibrary
 Library           RequestsLibrary
 Library           XML
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/Utils.robot
+Resource          ${CURDIR}/../../../libraries/FlowLib.robot
 Resource          ${CURDIR}/../../../libraries/OvsManager.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/ClusterOpenFlow.robot
@@ -14,8 +17,7 @@ Library           Collections
 
 *** Variables ***
 ${SWITCHES}       1
-# this is for mininet 2.2.1 ${START_CMD}    sudo mn --controller=remote,ip=${ODL_SYSTEM_1_IP} --controller=remote,ip=${ODL_SYSTEM_2_IP} --controller=remote,ip=${ODL_SYSTEM_3_IP} --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
-${START_CMD}      sudo mn --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
+${START_CMD}      sudo mn --topo linear,${SWITCHES}
 @{cntls_idx_list}    ${1}    ${2}    ${3}
 
 *** Test Cases ***
@@ -33,7 +35,7 @@ Switches Still Be Connected To All Nodes
 
 *** Keywords ***
 Start Suite
-    ClusterManagement.ClusterManagement Setup
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
     ${mininet_conn_id}=    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${TOOLS_SYSTEM_PROMPT}
     BuiltIn.Set Suite Variable    ${mininet_conn_id}
     SSHLibrary.Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/id_rsa    any
@@ -44,36 +46,32 @@ Start Suite
     SSHLibrary.Read Until    mininet>
     ${cntls_list}    BuiltIn.Create List    ${ODL_SYSTEM_1_IP}    ${ODL_SYSTEM_2_IP}    ${ODL_SYSTEM_3_IP}
     ${switch_list}    BuiltIn.Create List
-    : FOR    ${i}    IN RANGE    0    ${SWITCHES}
-    \    ${sid}=    BuiltIn.Evaluate    ${i}+1
-    \    Collections.Append To List    ${switch_list}    s${sid}
+    FOR    ${i}    IN RANGE    0    ${SWITCHES}
+        ${sid}=    BuiltIn.Evaluate    ${i}+1
+        Collections.Append To List    ${switch_list}    s${sid}
+    END
     BuiltIn.Set Suite Variable    ${active_member}    1
     OvsManager.Setup Clustered Controller For Switches    ${switch_list}    ${cntls_list}
-    BuiltIn.Wait Until Keyword Succeeds    10s    1s    Are Switches Connected Topo
+    BuiltIn.Wait Until Keyword Succeeds    10s    1s    ClusterOpenFlow.Verify Switch Connections Running On Member    ${SWITCHES}    1
 
 End Suite
     RequestsLibrary.Delete All Sessions
-    Utils.Stop Suite
-
-Are Switches Connected Topo
-    [Documentation]    Checks wheather switches are connected to controller
-    ${resp}=    ClusterManagement.Get From Member    ${OPERATIONAL_TOPO_API}/topology/flow:1    ${active_member}    access=${ACCEPT_XML}
-    BuiltIn.Log    ${resp}
-    ${count}=    XML.Get Element Count    ${resp}    xpath=node
-    BuiltIn.Should Be Equal As Numbers    ${count}    ${SWITCHES}
+    Utils.Stop Mininet
 
 Check All Switches Connected To All Cluster Nodes
     [Documentation]    Verifies all switches are connected to all cluster nodes
     OvsManager.Get Ovsdb Data
-    : FOR    ${i}    IN RANGE    0    ${SWITCHES}
-    \    ${sid}=    BuiltIn.Evaluate    ${i}+1
-    \    OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_1_IP}    update_data=${False}
-    \    OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_2_IP}    update_data=${False}
-    \    OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_3_IP}    update_data=${False}
+    FOR    ${i}    IN RANGE    0    ${SWITCHES}
+        ${sid}=    BuiltIn.Evaluate    ${i}+1
+        OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_1_IP}    update_data=${False}
+        OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_2_IP}    update_data=${False}
+        OvsManager.Should Be Connected    s${sid}    ${ODL_SYSTEM_3_IP}    update_data=${False}
+    END
 
 Reconnecting Switch Scenario
     [Arguments]    ${switch_name}
     [Documentation]    Disconnect and connect master and slave and check switch data to be consistent
+    BuiltIn.Set Test Variable    ${disc_cntl}    ${Empty}
     ${idx}=    BuiltIn.Evaluate    str("${switch_name}"[1:])
     BuiltIn.Set Test Variable    ${idx}
     Disconnect Switchs Old Master    ${switch_name}
@@ -84,13 +82,12 @@ Reconnecting Switch Scenario
 
 Disconnect Switchs Old Master
     [Arguments]    ${switch_name}
-    BuiltIn.Set Test Variable    ${disc_cntl}    ${Empty}
     ${old_owner}    ${old_successors}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:${idx}    ${active_member}
     ${old_master}=    BuiltIn.Set Variable    ${ODL_SYSTEM_${old_owner}_IP}
     OvsManager.Disconnect Switch From Controller And Verify Disconnected    ${switch_name}    ${old_master}
     BuiltIn.Set Test Variable    ${disc_cntl}    ${old_master}
+    ${owner}    ${successors}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:${idx}    ${active_member}    ${old_successors}    after_stop=True
     ${new_master}=    BuiltIn.Wait Until Keyword Succeeds    5x    3s    Verify New Master Controller Node    ${switch_name}    ${old_master}
-    ${owner}    ${successors}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:${idx}    ${active_member}    ${old_successors}
     BuiltIn.Should Be Equal As Strings    ${new_master}    ${ODL_SYSTEM_${owner}_IP}
     BuiltIn.Set Test Variable    ${old_owner}
     BuiltIn.Set Test Variable    ${old_successors}
@@ -114,7 +111,7 @@ Disconnect Switchs Slave
     BuiltIn.Set Test Variable    ${disc_cntl}    ${old_slave}
     ${tmp_candidates}=    BuiltIn.Create List    @{ClusterManagement__member_index_list}
     Collections.Remove Values From List    ${tmp_candidates}    ${old_successor}
-    ${owner}    ${successors}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:${idx}    ${active_member}    ${tmp_candidates}
+    ${owner}    ${successors}=    ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device    openflow:${idx}    ${active_member}    ${tmp_candidates}    after_stop=True
     BuiltIn.Should Be Equal    ${owner}    ${old_owner}
     BuiltIn.Should Be Equal As Strings    ${new_master}    ${ODL_SYSTEM_${owner}_IP}
     BuiltIn.Set Test Variable    ${old_owner}