SXP: Wait for RPC registration
[integration/test.git] / csit / libraries / SxpClusterLib.robot
index bac95cf69cd6194ac68f4b50b0c1d5b489584fec..ca593bdff229057a88c8117d9436db39d5ee468a 100644 (file)
@@ -14,7 +14,7 @@ ${CONTROLLER_SESSION}    ClusterManagement__session_1
 ${SXP_LOG_LEVEL}    INFO
 ${VIRTUAL_IP}     ${TOOLS_SYSTEM_2_IP}
 ${VIRTUAL_IP_MASK}    255.255.255.0
-${VIRTUAL_INTERFACE}    eth0
+${VIRTUAL_INTERFACE}    dummy0
 ${MAC_ADDRESS_TABLE}    &{EMPTY}
 ${DEVICE_NODE_ID}    ${TOOLS_SYSTEM_IP}
 ${CLUSTER_NODE_ID}    ${TOOLS_SYSTEM_2_IP}
@@ -58,14 +58,14 @@ Setup SXP Cluster
     ${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}
+    BuiltIn.Wait Until Keyword Succeeds    12x    10s    SxpLib.Check Node Started    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    12x    10s    Check Cluster Node started    ${INADDR_ANY}    ip=${EMPTY}
+    BuiltIn.Wait Until Keyword Succeeds    48x    10s    Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
 
 Clean SXP Cluster
     [Documentation]    Disconnect SXP cluster topology
     SxpLib.Delete Node    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
-    SxpLib.Delete Node    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    3x    10s    SxpLib.Delete Node    ${INADDR_ANY}    session=${CONTROLLER_SESSION}
 
 Check Cluster Node started
     [Arguments]    ${node}    ${port}=64999    ${ip}=${node}
@@ -77,6 +77,16 @@ Check Cluster Node started
     \    ${started} =    BuiltIn.Set Variable If    '${rc}' == '0'    ${True}    ${started}
     BuiltIn.Should Be True    ${started}
 
+Check Cluster Node stopped
+    [Arguments]    ${node}    ${port}=64999    ${ip}=${node}
+    [Documentation]    Verify that SxpNode has data removed from Operational datastore and Node is stopped
+    ${stopped} =    BuiltIn.Set Variable    ${False}
+    : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
+    \    ${rc} =    Utils.Run Command On Remote System    ${ODL_SYSTEM_${i+1}_IP}    netstat -tln | grep -q ${ip}:${port} && echo 0 || echo 1    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}
+    \    ...    prompt=${ODL_SYSTEM_PROMPT}
+    \    ${stopped} =    BuiltIn.Set Variable If    '${rc}' == '1'    ${True}    ${stopped}
+    BuiltIn.Should Be True    ${stopped}
+
 Check Device is Connected
     [Arguments]    ${node}    ${version}=version4    ${port}=64999    ${session}=session
     [Documentation]    Checks if SXP device is connected to the cluster. It means it has connection in state "on" with one of the cluster members.
@@ -97,7 +107,7 @@ Check Cluster is Connected
 Get Owner Controller
     [Arguments]    ${running_member}=1
     [Documentation]    Find cluster controller that is marked as cluster owner by requesting ownership data from ${running_member} node of the cluster
-    ${owner}    ${candidates} =    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    ClusterManagement.Get_Owner_And_Successors_For_Device    org.opendaylight.sxp.controller.boot.SxpControllerInstance
+    ${owner}    ${candidates} =    BuiltIn.Wait Until Keyword Succeeds    5x    2s    ClusterManagement.Get_Owner_And_Successors_For_Device    org.opendaylight.sxp.controller.boot.SxpControllerInstance
     ...    Sxp    ${running_member}
     [Return]    ${owner}
 
@@ -124,7 +134,7 @@ Map Followers To Mac Addresses
 Find Mac Address Of Ip Address
     [Arguments]    ${ip}
     [Documentation]    Finds out MAC-ADDRESS of specified IP by pinging it from TOOLS_SYSTEM machine
-    ${mac_address} =    Utils.Run Command On Remote System And Log    ${TOOLS_SYSTEM_IP}    ping -c 1 -W 10 ${ip} >/dev/null && arp -n | grep ${ip} | awk '{print $3}'    ${TOOLS_SYSTEM_USER}    ${TOOLS_SYSTEM_PASSWORD}
+    ${mac_address} =    Utils.Run Command On Remote System And Log    ${TOOLS_SYSTEM_IP}    ping -c 10 -W 10 ${ip} >/dev/null && sudo ip neighbor show ${ip} | awk '{print $5}'    ${TOOLS_SYSTEM_USER}    ${TOOLS_SYSTEM_PASSWORD}
     [Return]    ${mac_address}
 
 Ip Addres Should Not Be Routed To Follower
@@ -154,7 +164,6 @@ Create Virtual Interface
     [Documentation]    Create virtual interface on all of the cluster nodes
     : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
     \    Utils.Run Command On Remote System    ${ODL_SYSTEM_${i+1}_IP}    sudo modprobe dummy    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}
-    \    Utils.Run Command On Remote System    ${ODL_SYSTEM_${i+1}_IP}    sudo ip link set name ${VIRTUAL_INTERFACE} dev dummy0    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}
     \    Utils.Run Command On Remote System And Log    ${ODL_SYSTEM_${i+1}_IP}    sudo ip link show    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}
 
 Delete Virtual Interface