SXP: Cluster suite fixes 64/75964/8
authorIvan Hrasko <ihrasko@cisco.com>
Tue, 11 Sep 2018 08:47:15 +0000 (10:47 +0200)
committerIvan Hrasko <ihrasko@cisco.com>
Wed, 12 Sep 2018 14:21:18 +0000 (14:21 +0000)
Change-Id: I3297a1899c5e199966232ad9d56668fb835bf339
Signed-off-by: Ivan Hrasko <ihrasko@cisco.com>
csit/libraries/SxpClusterLib.robot
csit/suites/sxp/cluster-routing/020_Sxp_Node_Switching.robot
csit/suites/sxp/clustering/020_Bindings_consistency.robot
csit/suites/sxp/clustering/030_RPC_functionality.robot

index 57fbb8fcd5845fbde8d02cfe5d3451fed9ce22b9..8340a4049611f0b48f657cc5ec8fd4877f80b87c 100644 (file)
@@ -39,7 +39,6 @@ Setup SXP Cluster Session With Device
 Clean SXP Cluster Session
     [Documentation]    Clean sessions asociated with SXP cluster setup
     ClusterManagement.Flush_Iptables_From_List_Or_All
-    ClusterManagement.Check_Cluster_Is_In_Sync
     RequestsLibrary.Delete All Sessions
     SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    INFO    ${SXP_PACKAGE}
 
@@ -65,9 +64,6 @@ Setup SXP Cluster
 
 Clean SXP Cluster
     [Documentation]    Disconnect SXP cluster topology
-    ClusterManagement.Flush_Iptables_From_List_Or_All
-    : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_True    ${i+1}
     SxpLib.Delete Node    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
     SxpLib.Delete Node    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
 
index c07d2a925e1d4f4f931597ba86ec275cd7e8ff01..c762361f4c02ab9292878e5c36dd7b9b13213d03 100644 (file)
@@ -4,7 +4,7 @@ Documentation     Test suite to test cluster connection and propagation switchov
 ...               Resources of this VM are not required. At suite start this node is shutted down to reduce routing conflicts.
 Suite Setup       Setup Custom SXP Cluster Session
 Suite Teardown    Clean Custom SXP Cluster Session
-Test Teardown     Clean SXP Cluster
+Test Teardown     Clean Custom SXP Cluster
 Library           ../../../libraries/Sxp.py
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/SxpClusterLib.robot
@@ -81,6 +81,11 @@ Setup Nodes And Connections
     BuiltIn.Wait Until Keyword Succeeds    120    1    Check Device is Connected    mode=${peer_mode}
     BuiltIn.Wait Until Keyword Succeeds    120    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=ClusterManagement__session_${controller_id}
 
+Clean Custom SXP Cluster
+    [Documentation]    Disconnect SXP cluster topology
+    SxpLib.Delete Node    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
+    SxpLib.Delete Node    ${CLUSTER_NODE_ID}    session=${CONTROLLER_SESSION}
+
 Add Bindings To Node
     [Arguments]    ${node}    ${session}
     [Documentation]    Setup initial bindings to SXP device
index d89df9d32107b5afe091427bd48aafd27cd0ce18..b84872be5262e3ab25ddbdb67b411f26510f3ec3 100644 (file)
@@ -2,62 +2,82 @@
 Documentation     Test suite to test cluster binding propagation
 Suite Setup       SxpClusterLib.Setup SXP Cluster Session With Device
 Suite Teardown    SxpClusterLib.Clean SXP Cluster Session
-Test Teardown     SxpClusterLib.Clean SXP Cluster
 Library           ../../../libraries/Sxp.py
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/SxpClusterLib.robot
 Resource          ../../../libraries/SxpLib.robot
 
-*** Test Cases ***
-Isolation of SXP service follower Test Listener Part
-    [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
-    SxpClusterLib.Check Shards Status
-    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
-    ${controller_index} =    SxpClusterLib.Get Owner Controller
-    Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+*** Variables ***
+${RUNNING_MEMBER}    ${EMPTY}
 
+*** Test Cases ***
 Isolation of SXP service follower Test Speaker Part
-    [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
-    SxpClusterLib.Check Shards Status
-    Setup Custom SXP Cluster    speaker
+    [Documentation]    Test SXP binding propagation from device to cluster after cluster owner is isolated
+    [Setup]    Setup Custom SXP Cluster    speaker
     ${controller_index} =    SxpClusterLib.Get Owner Controller
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
     Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${RUNNING_MEMBER}
+    UnIsolate SXP Controller    ${controller_index}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
+    [Teardown]    SxpClusterLib.Clean SXP Cluster
 
-Isolation of SXP noservice follower Test Listener Part
-    [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
-    SxpClusterLib.Check Shards Status
-    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
+Isolation of SXP noservice follower Test Speaker Part
+    [Documentation]    Test SXP binding propagation from device to cluster after cluster (not owner) node is isolated
+    [Setup]    Setup Custom SXP Cluster    speaker
     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
+    Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${RUNNING_MEMBER}
+    UnIsolate SXP Controller    ${controller_index}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${INADDR_ANY}    ClusterManagement__session_${controller_index}
+    [Teardown]    SxpClusterLib.Clean SXP Cluster
+
+Isolation of SXP service follower Test Listener Part
+    [Documentation]    Test SXP binding propagation from cluster to device after cluster owner is isolated
+    [Setup]    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    UnIsolate SXP Controller    ${controller_index}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    [Teardown]    SxpClusterLib.Clean SXP Cluster
 
-Isolation of SXP noservice follower Test Speaker Part
-    [Documentation]    Test SXP binding propagation only if Controller without SCS are isolated
-    SxpClusterLib.Check Shards Status
-    Setup Custom SXP Cluster    speaker
+Isolation of SXP noservice follower Test Listener Part
+    [Documentation]    Test SXP binding propagation from cluster to device after cluster (not owner) node is isolated
+    [Setup]    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
-    Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    UnIsolate SXP Controller    ${controller_index}
+    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
+    [Teardown]    SxpClusterLib.Clean SXP Cluster
 
 *** Keywords ***
 Setup Custom SXP Cluster
     [Arguments]    ${mode}    ${node}=${DEVICE_NODE_ID}    ${session}=${DEVICE_SESSION}
-    [Documentation]    Setup custom SXP cluster topology
+    [Documentation]    Setup custom SXP cluster topology with ${NUM_ODL_SYSTEM} nodes and one device
     SxpClusterLib.Setup SXP Cluster    ${mode}
     : FOR    ${i}    IN RANGE    1    25
     \    SxpLib.Add Bindings    ${i}0    ${i}.${i}.${i}.${i}/32    node=${node}    session=${session}
 
 Isolate SXP Controller
     [Arguments]    ${controller_index}    ${node}    ${session}=ClusterManagement__session_${controller_index}
-    [Documentation]    Isolate one of cluster nodes and perform check that bindings were propagated afterwards reverts isolation
+    [Documentation]    Isolate one of cluster nodes and perform check that device is connected
     @{running_members} =    ClusterManagement.Isolate_Member_From_List_Or_All    ${controller_index}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    BuiltIn.Set Test Variable    ${RUNNING_MEMBER}    ${running_member}
     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_False    ${controller_index}
     BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
-    ${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    ${node}    ${session}
+
+UnIsolate SXP Controller
+    [Arguments]    ${controller_index}
+    [Documentation]    Un-Isolate one of cluster nodes and perform check that device is connected
     ClusterManagement.Flush_Iptables_From_List_Or_All
     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_True    ${controller_index}
     BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
 
 Check Bindings
     [Arguments]    ${node}    ${session}
index 4d158f980d8cba4a42ad11dc06a84c8388491ce9..ebad48d34cdba5d2819f1501502ea6574b8c2cd6 100644 (file)
@@ -35,7 +35,7 @@ Isolate SXP Controller
     ${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}
-    \    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}
+    \    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.Sync_Status_Should_Be_True    ${controller_index}
     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Does Not Exist    ${owner_controller}