From ed99cd9b4ff437c955821f57639b051a7f919b8e Mon Sep 17 00:00:00 2001 From: Ivan Hrasko Date: Thu, 6 Sep 2018 16:52:25 +0200 Subject: [PATCH] SXP: Fix clustering tests Change-Id: I520fff58ad1838fdccea6421b692ccdfbeeb2e95 Signed-off-by: Ivan Hrasko --- csit/libraries/Sxp.py | 3 ++ csit/libraries/SxpClusterLib.robot | 28 +++++++++++-------- csit/libraries/SxpLib.robot | 6 +--- .../010_Connection_switchover.robot | 8 +++--- .../clustering/020_Bindings_consistency.robot | 19 ++++++------- .../clustering/030_RPC_functionality.robot | 24 ++++++++-------- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/csit/libraries/Sxp.py b/csit/libraries/Sxp.py index 0757687f75..e873b73b48 100644 --- a/csit/libraries/Sxp.py +++ b/csit/libraries/Sxp.py @@ -572,6 +572,9 @@ def add_connection_xml(version, mode, ip, port, node, password_, domain_name, bi 30 $timeout $timeout + 90 + 180 + 90 diff --git a/csit/libraries/SxpClusterLib.robot b/csit/libraries/SxpClusterLib.robot index 27b6c936bf..57fbb8fcd5 100644 --- a/csit/libraries/SxpClusterLib.robot +++ b/csit/libraries/SxpClusterLib.robot @@ -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} diff --git a/csit/libraries/SxpLib.robot b/csit/libraries/SxpLib.robot index 2e1c0e6a41..724e220eed 100644 --- a/csit/libraries/SxpLib.robot +++ b/csit/libraries/SxpLib.robot @@ -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} diff --git a/csit/suites/sxp/clustering/010_Connection_switchover.robot b/csit/suites/sxp/clustering/010_Connection_switchover.robot index 1d74bccc50..81c15d26bc 100644 --- a/csit/suites/sxp/clustering/010_Connection_switchover.robot +++ b/csit/suites/sxp/clustering/010_Connection_switchover.robot @@ -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 diff --git a/csit/suites/sxp/clustering/020_Bindings_consistency.robot b/csit/suites/sxp/clustering/020_Bindings_consistency.robot index 8ea0abfd53..d89df9d321 100644 --- a/csit/suites/sxp/clustering/020_Bindings_consistency.robot +++ b/csit/suites/sxp/clustering/020_Bindings_consistency.robot @@ -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} diff --git a/csit/suites/sxp/clustering/030_RPC_functionality.robot b/csit/suites/sxp/clustering/030_RPC_functionality.robot index 4eeaf73a2c..4d158f980d 100644 --- a/csit/suites/sxp/clustering/030_RPC_functionality.robot +++ b/csit/suites/sxp/clustering/030_RPC_functionality.robot @@ -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 -- 2.36.6