SXP: Fix clustering tests 17/75817/7
authorIvan Hrasko <ihrasko@cisco.com>
Thu, 6 Sep 2018 14:52:25 +0000 (16:52 +0200)
committerIvan Hrasko <ihrasko@cisco.com>
Mon, 10 Sep 2018 13:37:16 +0000 (15:37 +0200)
Change-Id: I520fff58ad1838fdccea6421b692ccdfbeeb2e95
Signed-off-by: Ivan Hrasko <ihrasko@cisco.com>
csit/libraries/Sxp.py
csit/libraries/SxpClusterLib.robot
csit/libraries/SxpLib.robot
csit/suites/sxp/clustering/010_Connection_switchover.robot
csit/suites/sxp/clustering/020_Bindings_consistency.robot
csit/suites/sxp/clustering/030_RPC_functionality.robot

index 0757687f7590971c4bdb3755d422efa70aefd489..e873b73b48f779e6a054b407ab5d88dfa6b721c5 100644 (file)
@@ -572,6 +572,9 @@ def add_connection_xml(version, mode, ip, port, node, password_, domain_name, bi
             <keep-alive-time>30</keep-alive-time>
             <reconciliation-time>$timeout</reconciliation-time>
             <delete-hold-down-time>$timeout</delete-hold-down-time>
+            <hold-time>90</hold-time>
+            <hold-time-max>180</hold-time-max>
+            <hold-time-min>90</hold-time-min>
          </connection-timers>
       </connection>
    </connections>
index 27b6c936bf483ae1e003c4cbc0a4db4228616878..57fbb8fcd5845fbde8d02cfe5d3451fed9ce22b9 100644 (file)
@@ -18,6 +18,7 @@ ${VIRTUAL_INTERFACE}    eth0
 ${MAC_ADDRESS_TABLE}    &{EMPTY}
 ${DEVICE_NODE_ID}    ${TOOLS_SYSTEM_IP}
 ${CLUSTER_NODE_ID}    ${TOOLS_SYSTEM_2_IP}
+${INADDR_ANY}     0.0.0.0
 
 *** Keywords ***
 Setup SXP Cluster Session
@@ -30,11 +31,16 @@ Setup Device Session
     [Documentation]    Create session on the SXP device
     RequestsLibrary.Create Session    ${DEVICE_SESSION}    url=http://${DEVICE_NODE_ID}:${RESTCONFPORT}    auth=${AUTH}    timeout=${DEFAULT_TIMEOUT_HTTP}    max_retries=0
 
+Setup SXP Cluster Session With Device
+    [Documentation]    Create sessions asociated with SXP cluster setup and one SXP device
+    Setup SXP Cluster Session
+    Setup Device Session
+
 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
-    SxpLib.Clean SXP Session
+    RequestsLibrary.Delete All Sessions
     SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    INFO    ${SXP_PACKAGE}
 
 Check Shards Status
@@ -46,18 +52,16 @@ Check Shards Status
 Setup SXP Cluster
     [Arguments]    ${peer_mode}=listener
     [Documentation]    Setup and connect SXP cluster topology
-    SxpLib.Add Node    ${DEVICE_NODE_ID}    ip=0.0.0.0    session=${DEVICE_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    20    1    SxpLib.Check Node Started    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}    system=${TOOLS_SYSTEM_IP}
-    ...    ip=${EMPTY}
-    ${cluster_mode} =    Sxp.Get Opposing Mode    ${peer_mode}
+    SxpLib.Add Node    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    SxpLib.Add Connection    version4    ${peer_mode}    ${ODL_SYSTEM_${i+1}_IP}    64999    ${DEVICE_NODE_ID}
+    \    SxpLib.Add Connection    version4    ${peer_mode}    ${ODL_SYSTEM_${i+1}_IP}    64999    node=${DEVICE_NODE_ID}
     \    ...    session=${DEVICE_SESSION}
-    ${controller_id} =    Get Any Controller
-    SxpLib.Add Node    ${CLUSTER_NODE_ID}    ip=0.0.0.0    session=ClusterManagement__session_${controller_id}
-    BuiltIn.Wait Until Keyword Succeeds    20    1    Check Cluster Node started    ${CLUSTER_NODE_ID}
-    SxpLib.Add Connection    version4    ${cluster_mode}    ${TOOLS_SYSTEM_IP}    64999    ${CLUSTER_NODE_ID}    session=ClusterManagement__session_${controller_id}
-    BuiltIn.Wait Until Keyword Succeeds    120    1    Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
+    ${cluster_mode} =    Sxp.Get Opposing Mode    ${peer_mode}
+    SxpLib.Add Node    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
+    SxpLib.Add Connection    version4    ${cluster_mode}    ${DEVICE_NODE_ID}    64999    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    1m    1x    SxpLib.Check Node Started    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    1m    1x    Check Cluster Node started    ${INADDR_ANY}    ip=${EMPTY}
+    BuiltIn.Wait Until Keyword Succeeds    4m    1x    Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
 
 Clean SXP Cluster
     [Documentation]    Disconnect SXP cluster topology
@@ -65,7 +69,7 @@ Clean SXP Cluster
     : 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    ${CLUSTER_NODE_ID}    session=${CONTROLLER_SESSION}
+    SxpLib.Delete Node    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
 
 Check Cluster Node started
     [Arguments]    ${node}    ${port}=64999    ${ip}=${node}
index 2e1c0e6a41869fa896e37f7b89327864afd49ce0..724e220eedce90fe908978e91213956422abe5b4 100644 (file)
@@ -248,10 +248,6 @@ Verify Snapshot Was Pushed
     ${output} =    Utils.Run Command On Controller    ${ODL_SYSTEM_IP}    cat ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log* | grep -c 'Successfully pushed configuration snapshot.*${snapshot_string}'
     BuiltIn.Should Not Be Equal As Strings    ${output}    0
 
-Clean SXP Session
-    [Documentation]    Destroy created sessions
-    RequestsLibrary.Delete All Sessions
-
 Add Domain
     [Arguments]    ${domain_name}    ${sgt}=None    ${prefixes}=None    ${origin}=LOCAL    ${node}=127.0.0.1    ${session}=session
     [Documentation]    Based on ODL version decide if domain's bindings will be added with or without origin type (introduced in Fluorine)
@@ -329,7 +325,7 @@ Clean SXP Environment
     : FOR    ${num}    IN RANGE    1    ${node_range}+1
     \    ${ip} =    Sxp.Get Ip From Number    ${num}
     \    Delete Node    ${ip}
-    Clean SXP Session
+    RequestsLibrary.Delete All Sessions
 
 Get Routing Configuration From Controller
     [Arguments]    ${session}
index 1d74bccc507004f6d6767b3f357cd1db8e7eeffa..81c15d26bc2582a0a7feafb5f4fd7e3145ad44b4 100644 (file)
@@ -1,9 +1,9 @@
 *** Settings ***
 Documentation     Test suite to test cluster connection switchover
-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
 Resource          ../../../libraries/ClusterManagement.robot
 Resource          ../../../libraries/SxpClusterLib.robot
 
index 8ea0abfd53a2fc72bd3ee9b9e4b678b90929c565..d89df9d32107b5afe091427bd48aafd27cd0ce18 100644 (file)
@@ -1,8 +1,8 @@
 *** Settings ***
 Documentation     Test suite to test cluster binding propagation
-Suite Setup       Setup SXP Cluster Session
-Suite Teardown    Clean SXP Cluster Session
-Test Teardown     Clean SXP Cluster
+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
@@ -12,7 +12,7 @@ Resource          ../../../libraries/SxpLib.robot
 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    ${CLUSTER_NODE_ID}    controller1
+    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}
 
@@ -21,12 +21,12 @@ Isolation of SXP service follower Test Speaker Part
     SxpClusterLib.Check Shards Status
     Setup Custom SXP Cluster    speaker
     ${controller_index} =    SxpClusterLib.Get Owner Controller
-    Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
+    Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
 
 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    ${CLUSTER_NODE_ID}    controller1
+    Setup Custom SXP Cluster    listener    ${INADDR_ANY}    ${CONTROLLER_SESSION}
     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
 
@@ -35,7 +35,7 @@ Isolation of SXP noservice follower Test Speaker Part
     SxpClusterLib.Check Shards Status
     Setup Custom SXP Cluster    speaker
     ${controller_index} =    SxpClusterLib.Get Not Owner Controller
-    Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
+    Isolate SXP Controller    ${controller_index}    ${INADDR_ANY}
 
 *** Keywords ***
 Setup Custom SXP Cluster
@@ -46,16 +46,13 @@ Setup Custom SXP Cluster
     \    SxpLib.Add Bindings    ${i}0    ${i}.${i}.${i}.${i}/32    node=${node}    session=${session}
 
 Isolate SXP Controller
-    [Arguments]    ${controller_index}    ${node}    ${session}=${EMPTY}
+    [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
-    ${find_session} =    BuiltIn.Set Variable If    '${session}' == ''    ${True}    ${False}
-    ${session} =    BuiltIn.Set Variable If    ${find_session}    controller${controller_index}    ${session}
     @{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}
     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}
-    ${session} =    BuiltIn.Set Variable If    ${find_session}    controller${owner_controller}    ${session}
     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
     ClusterManagement.Flush_Iptables_From_List_Or_All
     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_True    ${controller_index}
index 4eeaf73a2caca365d24184ce71f96bc711bd10bd..4d158f980d8cba4a42ad11dc06a84c8388491ce9 100644 (file)
@@ -1,9 +1,9 @@
 *** 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/ClusterManagement.robot
 Resource          ../../../libraries/SxpClusterLib.robot
@@ -28,28 +28,28 @@ Isolate SXP Controller
     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
     ${owner_controller} =    SxpClusterLib.Get Owner Controller
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    SxpLib.Add Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${owner_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}
-    BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings Exist
     ${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}
-    \    SXpLib.Delete Bindings    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32    node=${CLUSTER_NODE_ID}    session=controller${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
+    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} =    SxpClusterLib.Get Owner Controller
-    ${resp} =    SxpLib.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}
     \    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} =    SxpClusterLib.Get Owner Controller
-    ${resp} =    SxpLib.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}
     \    SxpLib.Should Not Contain Binding    ${resp}    ${i+1}0    ${i+1}0.${i+1}0.${i+1}0.${i+1}0/32