SXP: Check cluster is in sync
[integration/test.git] / csit / suites / sxp / clustering / 030_RPC_functionality.robot
index cbe59ce0719180198b5890c8839fd08322d11364..111d56b07f203936661f07d5a4a7bc948b271e53 100644 (file)
@@ -1,57 +1,55 @@
 *** Settings ***
 Documentation     Test suite to verify RPC funcionality on cluster
-Suite Setup       Setup SXP Cluster Session
-Suite Teardown    Clean SXP Cluster Session
-Test Setup        Setup SXP Cluster
-Test Teardown     Clean SXP Cluster
+Suite Setup       SxpClusterLib.Setup SXP Cluster Session With Device
+Suite Teardown    SxpClusterLib.Clean SXP Cluster Session
+Test Setup        SxpClusterLib.Setup SXP Cluster
+Test Teardown     SxpClusterLib.Clean SXP Cluster
 Library           ../../../libraries/Sxp.py
-Resource          ../../../libraries/SxpLib.robot
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/SxpClusterLib.robot
-
-*** Variables ***
-${SAMPLES}        1
+Resource          ../../../libraries/SxpLib.robot
 
 *** Test Cases ***
 Isolation of RCP service Test
     [Documentation]    Test SXP RPC functionality only if Controller with SCS is isolated
-    : FOR    ${i}    IN RANGE    0    ${SAMPLES}
-    \    ${controller_index}    Get Active Controller
-    \    Isolate SXP Controller    ${controller_index}
+    SxpClusterLib.Check Shards Status
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
+    Isolate SXP Controller    ${controller_index}
 
 Isolation of RPC noservice Test
     [Documentation]    Test SXP RPC functionality only if Controller without SCS are isolated
-    : FOR    ${i}    IN RANGE    0    ${SAMPLES}
-    \    ${controller_index}    Get Inactive Controller
-    \    Isolate SXP Controller    ${controller_index}
+    SxpClusterLib.Check Shards Status
+    ${controller_index} =    SxpClusterLib.Get Not Owner Controller
+    Isolate SXP Controller    ${controller_index}
 
 *** Keywords ***
 Isolate SXP Controller
     [Arguments]    ${controller_index}
     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
-    ${active_controller}    Get Active Controller
+    ${owner_controller} =    SxpClusterLib.Get Owner Controller
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    Add Binding    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
-    Isolate_Member_From_List_Or_All    ${controller_index}
-    Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_False    ${controller_index}
-    Wait Until Keyword Succeeds    30    1    Check Bindings Exist
-    ${active_controller}    Get Active Controller
+    \    SxpLib.Add Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
+    @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
+    BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Exist    ${owner_controller}
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    Delete Binding    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${active_controller}
-    Flush_Iptables_From_List_Or_All
-    Wait Until Keyword Succeeds    240    1    Sync_Status_Should_Be_True    ${controller_index}
-    Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist
+    \    SxpLib.Delete Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
+    ClusterManagement.Flush_Iptables_From_List_Or_All
+    BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Check_Cluster_Is_In_Sync
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist    ${owner_controller}
 
 Check Bindings Exist
+    [Arguments]    ${owner_controller}
     [Documentation]    Check that bindings exists in Cluster datastore
-    ${controller_index}    Get Active Controller
-    ${resp}    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
+    ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
+    \    SxpLib.Should Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
 
 Check Bindings Does Not Exist
+    [Arguments]    ${owner_controller}
     [Documentation]    Check that bindings does not exist in Cluster datastore
-    ${controller_index}    Get Active Controller
-    ${resp}    Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
+    ${resp} =    SxpLib.Get Bindings    node=${INADDR_ANY}    session=ClusterManagement__session_${owner_controller}
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32
+    \    SxpLib.Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32