X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FSxpClusterLib.robot;h=57fbb8fcd5845fbde8d02cfe5d3451fed9ce22b9;hb=ed99cd9b4ff437c955821f57639b051a7f919b8e;hp=755ba15e9b509046b7ea81a74c9d23a0c13619f3;hpb=1eabc68b39f032c22dd6c342d5a43fbcdbe14679;p=integration%2Ftest.git diff --git a/csit/libraries/SxpClusterLib.robot b/csit/libraries/SxpClusterLib.robot index 755ba15e9b..57fbb8fcd5 100644 --- a/csit/libraries/SxpClusterLib.robot +++ b/csit/libraries/SxpClusterLib.robot @@ -11,13 +11,14 @@ Resource ./SxpLib.robot @{SXP_PACKAGE} org.opendaylight.sxp ${DEVICE_SESSION} device_1 ${CONTROLLER_SESSION} ClusterManagement__session_1 -${DEVICE_NODE_ID} 1.1.1.1 -${CLUSTER_NODE_ID} 2.2.2.2 ${SXP_LOG_LEVEL} INFO ${VIRTUAL_IP} ${TOOLS_SYSTEM_2_IP} ${VIRTUAL_IP_MASK} 255.255.255.0 ${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 @@ -26,11 +27,20 @@ Setup SXP Cluster Session SetupUtils.Setup_Utils_For_Setup_And_Teardown SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All ${SXP_LOG_LEVEL} ${SXP_PACKAGE} +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 @@ -42,30 +52,27 @@ 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=controller${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=controller${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 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} - ${controller_index} = Get Owner Controller SxpLib.Delete Node ${DEVICE_NODE_ID} session=${DEVICE_SESSION} - SxpLib.Delete Node ${CLUSTER_NODE_ID} session=controller${controller_index} + SxpLib.Delete Node ${INADDR_ANY} session=${CONTROLLER_SESSION} Check Cluster Node started - [Arguments] ${node} ${port}=64999 ${ip}=${EMPTY} + [Arguments] ${node} ${port}=64999 ${ip}=${node} [Documentation] Verify that SxpNode has data written to Operational datastore and Node is running on one of cluster nodes ${started} = BuiltIn.Set Variable ${False} : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} @@ -76,21 +83,20 @@ Check Cluster Node started Check Device is Connected [Arguments] ${node} ${version}=version4 ${port}=64999 ${session}=session - [Documentation] Checks if SXP device is connected to at least one cluster node - ${is_connected} = BuiltIn.Set Variable ${False} + [Documentation] Checks if SXP device is connected to the cluster. It means it has connection in state "on" with one of the cluster members. ${resp} = SxpLib.Get Connections node=${node} session=${session} + ${is_connected} = BuiltIn.Set Variable ${False} : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} - \ ${follower} = Sxp.Find Connection ${resp} ${version} any ${ODL_SYSTEM_${i+1}_IP} + \ ${is_connected} = Sxp.Find Connection ${resp} ${version} any ${ODL_SYSTEM_${i+1}_IP} \ ... ${port} on - \ ${is_connected} = BuiltIn.Run Keyword If ${follower} BuiltIn.Set Variable ${True} - \ ... ELSE BuiltIn.Set Variable ${is_connected} + \ BuiltIn.Exit For Loop If ${is_connected} BuiltIn.Should Be True ${is_connected} Check Cluster is Connected [Arguments] ${node} ${version}=version4 ${port}=64999 ${mode}=speaker ${session}=session - [Documentation] Checks if SXP device is connected to at least one cluster node + [Documentation] Get SXP connections from cluster and verify that they contain a connection to the device in state "on" ${resp} = SxpLib.Get Connections node=${node} session=${session} - SxpLib.Should Contain Connection ${resp} ${TOOLS_SYSTEM_IP} ${port} ${mode} ${version} + SxpLib.Should Contain Connection ${resp} ${DEVICE_NODE_ID} ${port} ${mode} ${version} on Get Owner Controller [Arguments] ${running_member}=1