SXP: Use KWs from ClusterManagement 03/75503/10
authorIvan Hrasko <ihrasko@cisco.com>
Mon, 27 Aug 2018 12:19:53 +0000 (14:19 +0200)
committerIvan Hrasko <ihrasko@cisco.com>
Wed, 5 Sep 2018 07:14:25 +0000 (07:14 +0000)
- use keyword from ClusterManagement to get
cluster owner

- use keyword from ClusterManagement to get
all cluster sessions

- remove usage of cluster owner when it is
not needed - instead use ${CONTROLLER_SESSION}

Change-Id: I189fcc42c8eaff370fefbedef8cef0ea22974fe9
Signed-off-by: Ivan Hrasko <ihrasko@cisco.com>
csit/libraries/ClusterManagement.robot
csit/libraries/SxpClusterLib.robot
csit/libraries/SxpLib.robot
csit/suites/sxp/cluster-routing/010_Route_Switching.robot
csit/suites/sxp/cluster-routing/020_Sxp_Node_Switching.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 b28ae159785036f622fb7ab6bb987c60ac5459d8..bac88b7dcf2c5c52b3e04b1e9245071e47fb6987 100644 (file)
@@ -54,6 +54,8 @@ ${SINGLETON_NETCONF_DEVICE_ID_PREFIX}    /odl-general-entity:entity[odl-general-
 ${SINGLETON_NETCONF_DEVICE_ID_SUFFIX}    ]]]]}']
 ${SINGLETON_BGPCEP_DEVICE_ID_PREFIX}    /odl-general-entity:entity[odl-general-entity:name='
 ${SINGLETON_BGPCEP_DEVICE_ID_SUFFIX}    -service-group']
+${SINGLETON_SXP_DEVICE_ID_PREFIX}    /odl-general-entity:entity[odl-general-entity:name='
+${SINGLETON_SXP_DEVICE_ID_SUFFIX}    ']
 ${SINGLETON_ELECTION_ENTITY_TYPE}    org.opendaylight.mdsal.ServiceEntityType
 ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE}    org.opendaylight.mdsal.AsyncServiceCloseEntityType
 ${NODE_ROLE_INDEX_START}    1
@@ -280,6 +282,21 @@ Get_Owner_And_Candidates_For_Device_Singleton_Bgpcep
     BuiltIn.Should_Be_Equal_As_Integers    ${owner_1}    ${owner_2}    Owners for device ${device_name} are not same
     [Return]    ${owner_1}    ${candidate_list_1}
 
+Get_Owner_And_Candidates_For_Device_Singleton_Sxp
+    [Arguments]    ${device_name}    ${member_index}    ${http_timeout}=${EMPTY}
+    [Documentation]    Returns the owner and a list of candidates for the SB device ${device_name}. Request is sent to member ${member_index}.
+    # Get election entity type results
+    ${type} =    BuiltIn.Set_Variable    ${SINGLETON_ELECTION_ENTITY_TYPE}
+    ${id} =    BuiltIn.Set_Variable    ${SINGLETON_SXP_DEVICE_ID_PREFIX}${device_name}${SINGLETON_SXP_DEVICE_ID_SUFFIX}
+    ${owner_1}    ${candidate_list_1} =    Get_Owner_And_Candidates_For_Type_And_Id    ${type}    ${id}    ${member_index}    http_timeout=${http_timeout}
+    # Get change ownership entity type results
+    ${type} =    BuiltIn.Set_Variable    ${SINGLETON_CHANGE_OWNERSHIP_ENTITY_TYPE}
+    ${id} =    BuiltIn.Set_Variable    ${SINGLETON_SXP_DEVICE_ID_PREFIX}${device_name}${SINGLETON_SXP_DEVICE_ID_SUFFIX}
+    ${owner_2}    ${candidate_list_2} =    Get_Owner_And_Candidates_For_Type_And_Id    ${type}    ${id}    ${member_index}    http_timeout=${http_timeout}
+    # Owners must be same, if not, there is still some election or change ownership in progress
+    BuiltIn.Should_Be_Equal_As_Integers    ${owner_1}    ${owner_2}    Owners for device ${device_name} are not same
+    [Return]    ${owner_1}    ${candidate_list_1}
+
 Get_Owner_And_Candidates_For_Device
     [Arguments]    ${device_name}    ${device_type}    ${member_index}    ${http_timeout}=${EMPTY}
     [Documentation]    Returns the owner and a list of candidates for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
index 78626cbd56a57f2259eac406df6462c05d43570e..b92262e2dffd27adc952620795f18403578cfd78 100644 (file)
@@ -4,13 +4,13 @@ Library           RequestsLibrary
 Resource          ./ClusterManagement.robot
 Resource          ./SetupUtils.robot
 Resource          ./SxpLib.robot
-Resource          ../variables/Variables.robot
 
 *** Variables ***
 @{SHARD_OPER_LIST}    inventory    topology    default    entity-ownership
 @{SHARD_CONF_LIST}    inventory    topology    default
 @{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
@@ -22,9 +22,6 @@ ${MAC_ADDRESS_TABLE}    &{EMPTY}
 *** Keywords ***
 Setup SXP Cluster Session
     [Documentation]    Create sessions asociated with SXP cluster setup
-    : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    BuiltIn.Wait Until Keyword Succeeds    120    10    SxpLib.Prepare SSH Keys On Karaf    ${ODL_SYSTEM_${i+1}_IP}
-    \    SxpLib.Setup SXP Session    controller${i+1}    ${ODL_SYSTEM_${i+1}_IP}
     ClusterManagement.ClusterManagement_Setup
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    ${SXP_LOG_LEVEL}    ${SXP_PACKAGE}
@@ -64,7 +61,7 @@ Clean SXP Cluster
     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 Leader Controller
+    ${controller_index} =    Get Owner Controller
     SxpLib.Delete Node    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
     SxpLib.Delete Node    ${CLUSTER_NODE_ID}    session=controller${controller_index}
 
@@ -96,33 +93,17 @@ Check Cluster is Connected
     ${resp} =    SxpLib.Get Connections    node=${node}    session=${session}
     SxpLib.Should Contain Connection    ${resp}    ${TOOLS_SYSTEM_IP}    ${port}    ${mode}    ${version}
 
-Get Leader Controller
-    [Documentation]    Find cluster controller that is marked as leader in cluster with all members running
-    @{running_members} =    BuiltIn.Create List
-    : FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
-    \    Collections.Append To List    ${running_members}    ${i+1}
-    ${active_controller} =    Get Leader Controller From Running    @{running_members}
-    [Return]    ${active_controller}
-
-Get Leader Controller From Running
-    [Arguments]    @{running_members}
-    [Documentation]    Find cluster controller that is marked as leader in cluster with only some members running
-    BuiltIn.Log    ${running_members}
-    @{votes} =    BuiltIn.Create List
-    : FOR    ${i}    IN    @{running_members}
-    \    ${resp} =    RequestsLibrary.Get Request    controller${i}    /restconf/operational/entity-owners:entity-owners
-    \    BuiltIn.Continue For Loop If    ${resp.status_code} != 200
-    \    ${controller} =    Sxp.Get Leader Controller From Json    ${resp.content}    SxpControllerInstance
-    \    Collections.Append To List    ${votes}    ${controller}
-    ${length} =    BuiltIn.Get Length    ${votes}
-    BuiltIn.Should Not Be Equal As Integers    ${length}    0
-    ${active_controller} =    BuiltIn.Evaluate    collections.Counter(${votes}).most_common(1)[0][0]    collections
-    [Return]    ${active_controller}
-
-Get Inactive Controller
-    [Documentation]    Find cluster controller that is not marked as leader for SXP service in cluster
-    ${active_controller} =    Get Leader Controller
-    ${controller} =    BuiltIn.Evaluate    random.choice( filter( lambda i: i!=${active_controller}, range(1, ${NUM_ODL_SYSTEM} + 1)))    random
+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
+    ...    Sxp    ${running_member}
+    [Return]    ${owner}
+
+Get Not Owner Controller
+    [Documentation]    Find cluster controller that is not marked as owner for SXP service in cluster
+    ${owner_controller} =    Get Owner Controller
+    ${controller} =    BuiltIn.Evaluate    random.choice( filter( lambda i: i!=${owner_controller}, range(1, ${NUM_ODL_SYSTEM} + 1)))    random
     [Return]    ${controller}
 
 Get Any Controller
index 2db5fbc60395147a0e2ecdb28ddc55e4c434f9af..ccf5c2011fbd84ba311c070215cdc9d9b07a6296 100644 (file)
@@ -248,22 +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
 
-Prepare SSH Keys On Karaf
-    [Arguments]    ${system}=${ODL_SYSTEM_IP}    ${user}=${ODL_SYSTEM_USER}    ${passwd}=${ODL_SYSTEM_PASSWORD}    ${prompt}=${ODL_SYSTEM_PROMPT}    ${system_workspace}=${WORKSPACE}
-    [Documentation]    Executes client login on karaf VM in so that SSH keys will be generated by defualt karaf callback,
-    ...    expecting echo affter succesfull login. TODO: test on multiple runs if this aproach reduce SSHExceptions in robotframework
-    ${stdout} =    Utils.Run Command On Remote System    ${system}    ${system_workspace}${/}${BUNDLEFOLDER}/bin/client echo READY    ${user}    ${passwd}    prompt=${prompt}
-    BuiltIn.Should Match    "${stdout}"    "*READY"
-
-Setup SXP Session
-    [Arguments]    ${session}=session    ${controller}=${ODL_SYSTEM_IP}
-    [Documentation]    Create session to Controller
-    KarafKeywords.Verify Feature Is Installed    odl-sxp-controller    ${controller}
-    RequestsLibrary.Create Session    ${session}    url=http://${controller}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
-    ${resp} =    RequestsLibrary.Get Request    ${session}    ${MODULES_API}
-    BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
-    BuiltIn.Should Contain    ${resp.content}    ietf-restconf
-
 Clean SXP Session
     [Documentation]    Destroy created sessions
     RequestsLibrary.Delete All Sessions
index 40b12af1dfd1fed1bc4d4a0baf02b51ac4937474..4d0e2246d63cb37ae4c408d5eb2bf01e412ab0b1 100644 (file)
@@ -13,22 +13,22 @@ Resource          ../../../libraries/SxpClusterLib.robot
 Route Definition Test
     [Documentation]    Test Route update mechanism without cluster node isolation
     SxpClusterLib.Check Shards Status
-    ${active_controller} =    SxpClusterLib.Get Leader Controller
-    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_controller}
-    Add Route Definition To Cluster    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${active_controller}
-    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_controller}
-    SxpLib.Clean Routing Configuration To Controller    controller${active_controller}
-    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_controller}
-    Put Route Definition To Cluster    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${active_controller}
-    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_controller}
+    ${owner_controller} =    SxpClusterLib.Get Owner Controller
+    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${owner_controller}
+    Add Route Definition To Cluster    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${owner_controller}
+    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${owner_controller}
+    SxpLib.Clean Routing Configuration To Controller    ClusterManagement__session_${owner_controller}
+    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${owner_controller}
+    Put Route Definition To Cluster    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${owner_controller}
+    BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${owner_controller}
 
 Isolation of SXP service follower Test
     [Documentation]    Test Route update mechanism during Cluster isolation,
-    ...    after each isolation virtual ip should be pre-routed to new leader
+    ...    after each isolation virtual IP should be pre-routed to new leader
     SxpClusterLib.Check Shards Status
     ${any_controller} =    SxpClusterLib.Get Any Controller
     Add Route Definition To Cluster    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${any_controller}
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}
 
 *** Keywords ***
@@ -37,20 +37,19 @@ Put Route Definition To Cluster
     [Documentation]    Put Route definition to DS replacing all present
     ${route} =    Sxp.Route Definition Xml    ${virtual_ip}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}
     ${routes} =    Sxp.Route Definitions Xml    ${route}
-    SxpLib.Put Routing Configuration To Controller    ${routes}    controller${follower}
+    SxpLib.Put Routing Configuration To Controller    ${routes}    ClusterManagement__session_${follower}
 
 Add Route Definition To Cluster
     [Arguments]    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}    ${follower}
     [Documentation]    Add Route definition to DS
-    ${old_routes} =    SxpLib.Get Routing Configuration From Controller    controller${follower}
+    ${old_routes} =    SxpLib.Get Routing Configuration From Controller    ClusterManagement__session_${follower}
     ${route} =    Sxp.Route Definition Xml    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}
     ${routes} =    Sxp.Route Definitions Xml    ${route}    ${old_routes}
-    SxpLib.Put Routing Configuration To Controller    ${routes}    controller${follower}
+    SxpLib.Put Routing Configuration To Controller    ${routes}    ClusterManagement__session_${follower}
 
 Custom Clean SXP Cluster
     [Documentation]    Cleans up Route definitions
-    ${follower} =    SxpClusterLib.Get Leader Controller
-    SxpLib.Clean Routing Configuration To Controller    controller${follower}
+    SxpLib.Clean Routing Configuration To Controller    ${CONTROLLER_SESSION}
 
 Setup Custom SXP Cluster Session
     [Documentation]    Prepare topology for testing, creates sessions and generate Route definitions based on Cluster nodes ip
@@ -62,19 +61,19 @@ Setup Custom SXP Cluster Session
 
 Clean Custom SXP Cluster Session
     [Documentation]    Cleans up resources generated by test
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
-    SxpLib.Clean Routing Configuration To Controller    controller${controller_index}
+    SxpLib.Clean Routing Configuration To Controller    ${CONTROLLER_SESSION}
     SxpClusterLib.Clean SXP Cluster Session
     SxpClusterLib.Delete Virtual Interface
 
 Isolate SXP Controller
     [Arguments]    ${controller_index}
-    [Documentation]    Isolate one of cluster nodes and perform check that virtual ip is routed to another cluster node,
+    [Documentation]    Isolate the cluster leader node and perform check that virtual IP is routed to a new leader,
     ...    afterwards unisolate old leader.
     @{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    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${controller_index}
-    ${active_follower} =    SxpClusterLib.Get Leader Controller From Running    @{running_members}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    ${active_follower} =    SxpClusterLib.Get Owner Controller    ${running_member}
     BuiltIn.Wait Until Keyword Succeeds    240    1    SxpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_follower}
     ClusterManagement.Flush_Iptables_From_List_Or_All
     BuiltIn.Wait Until Keyword Succeeds    240    1    ClusterManagement.Sync_Status_Should_Be_True    ${controller_index}
index 59860a7a1ae6104c9655ca8d66c1ff8a49cbfcd2..6ce389c86b087ad1c80b84f36e4e428900651f5f 100644 (file)
@@ -14,16 +14,16 @@ Isolation of SXP service follower Test
     [Documentation]    Test SXP connection switchover only if Controller with SCS is isolated
     SxpClusterLib.Check Shards Status
     Setup Custom SXP Cluster    ${VIRTUAL_IP}    listener
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}    listener
 
 Isolation of SXP service follower Test Listener Part
     [Documentation]    Test SXP binding propagation only if Controller with SCS is isolated
     SxpClusterLib.Check Shards Status
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Setup Custom SXP Cluster    ${VIRTUAL_IP}    listener
-    Setup SXP Cluster Bindings    ${CLUSTER_NODE_ID}    controller${controller_index}
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    Setup SXP Cluster Bindings    ${CLUSTER_NODE_ID}    ClusterManagement__session_${controller_index}
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller With Bindings    ${controller_index}    ${DEVICE_NODE_ID}    listener    ${DEVICE_SESSION}
 
 Isolation of SXP service follower Test Speaker Part
@@ -32,7 +32,7 @@ Isolation of SXP service follower Test Speaker Part
     SxpClusterLib.Check Shards Status
     Setup Custom SXP Cluster    ${VIRTUAL_IP}    speaker
     Setup SXP Cluster Bindings    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller With Bindings    ${controller_index}    ${CLUSTER_NODE_ID}    speaker
 
 *** Keywords ***
@@ -40,17 +40,15 @@ Setup Custom SXP Cluster Session
     [Documentation]    Prepare topology for testing, creates sessions and generate Route definitions based on Cluster nodes ip
     SxpClusterLib.Shutdown Tools Node
     SxpClusterLib.Setup SXP Cluster Session
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
     ${mac_addresses} =    SxpClusterLib.Map Followers To Mac Addresses
     BuiltIn.Set Suite Variable    ${MAC_ADDRESS_TABLE}    ${mac_addresses}
     ${route} =    Sxp.Route Definition Xml    ${VIRTUAL_IP}    ${VIRTUAL_IP_MASK}    ${VIRTUAL_INTERFACE}
     ${routes} =    Sxp.Route Definitions Xml    ${route}
-    SxpLib.Put Routing Configuration To Controller    ${routes}    controller${controller_index}
+    SxpLib.Put Routing Configuration To Controller    ${routes}    ${CONTROLLER_SESSION}
 
 Clean Custom SXP Cluster Session
     [Documentation]    Cleans up resources generated by test
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
-    SxpLib.Clean Routing Configuration To Controller    controller${controller_index}
+    SxpLib.Clean Routing Configuration To Controller    ${CONTROLLER_SESSION}
     SxpClusterLib.Clean SXP Cluster Session
 
 Setup Custom SXP Cluster
@@ -61,11 +59,10 @@ Setup Custom SXP Cluster
     ...    ip=${EMPTY}
     ${cluster_mode} =    Sxp.Get Opposing Mode    ${peer_mode}
     SxpLib.Add Connection    version4    ${peer_mode}    ${peer_address}    64999    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
-    ${controller_id} =    SxpClusterLib.Get Leader Controller
-    SxpLib.Add Node    ${CLUSTER_NODE_ID}    ip=${peer_address}    session=controller${controller_id}
+    SxpLib.Add Node    ${CLUSTER_NODE_ID}    ip=${peer_address}    session=${CONTROLLER_SESSION}
     BuiltIn.Wait Until Keyword Succeeds    20    1    SxpClusterLib.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    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=controller${controller_id}
+    SxpLib.Add Connection    version4    ${cluster_mode}    ${TOOLS_SYSTEM_IP}    64999    ${CLUSTER_NODE_ID}    session=${CONTROLLER_SESSION}
+    BuiltIn.Wait Until Keyword Succeeds    120    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=${CONTROLLER_SESSION}
 
 Setup SXP Cluster Bindings
     [Arguments]    ${node}    ${session}
@@ -80,14 +77,15 @@ Isolate SXP 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    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${controller_index}
-    ${active_follower} =    SxpClusterLib.Get Leader Controller From Running    @{running_members}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    ${active_follower} =    SxpClusterLib.Get Owner Controller    ${running_member}
     BuiltIn.Wait Until Keyword Succeeds    240    1    SXpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_follower}
-    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=controller${active_follower}
+    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=ClusterManagement__session_${active_follower}
     BuiltIn.Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    ${VIRTUAL_IP}    ${peer_mode}
     ...    session=${DEVICE_SESSION}
     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 Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=controller${active_follower}
+    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=ClusterManagement__session_${active_follower}
     BuiltIn.Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    ${VIRTUAL_IP}    ${peer_mode}
     ...    session=${DEVICE_SESSION}
 
@@ -96,20 +94,21 @@ Isolate SXP Controller With Bindings
     [Documentation]    Isolate one of cluster nodes and perform check that bindings were propagated then revert isolation (and check connection again).
     ${find_session} =    BuiltIn.Set Variable If    '${session}' == '${EMPTY}'    ${True}    ${False}
     ${cluster_mode} =    Sxp.Get Opposing Mode    ${peer_mode}
-    ${session} =    BuiltIn.Set Variable If    ${find_session}    controller${controller_index}    ${session}
+    ${session} =    BuiltIn.Set Variable If    ${find_session}    ClusterManagement__session_${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    240    1    SxpClusterLib.Ip Addres Should Not Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${controller_index}
-    ${active_follower} =    SxpClusterLib.Get Leader Controller From Running    @{running_members}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    ${active_follower} =    SxpClusterLib.Get Owner Controller    ${running_member}
     BuiltIn.Wait Until Keyword Succeeds    240    1    SXpClusterLib.Ip Addres Should Be Routed To Follower    ${MAC_ADDRESS_TABLE}    ${VIRTUAL_IP}    ${active_follower}
-    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=controller${active_follower}
+    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=ClusterManagement__session_${active_follower}
     BuiltIn.Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    ${VIRTUAL_IP}    ${peer_mode}
     ...    session=${DEVICE_SESSION}
-    ${session} =    BuiltIn.Set Variable If    ${find_session}    controller${active_follower}    ${session}
+    ${session} =    BuiltIn.Set Variable If    ${find_session}    ClusterManagement__session_${active_follower}    ${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}
-    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=controller${active_follower}
+    BuiltIn.Wait Until Keyword Succeeds    60    1    SxpClusterLib.Check Cluster is Connected    ${CLUSTER_NODE_ID}    mode=${cluster_mode}    session=ClusterManagement__session_${active_follower}
     BuiltIn.Wait Until Keyword Succeeds    60    1    Check Device is Connected    ${DEVICE_NODE_ID}    ${VIRTUAL_IP}    ${peer_mode}
     ...    session=${DEVICE_SESSION}
     BuiltIn.Wait Until Keyword Succeeds    30    1    Check Bindings    ${node}    ${session}
index 0cf9ea05b7243468536452a4f45c2d0f74a19172..1d74bccc507004f6d6767b3f357cd1db8e7eeffa 100644 (file)
@@ -11,13 +11,13 @@ Resource          ../../../libraries/SxpClusterLib.robot
 Isolation of SXP service follower Test
     [Documentation]    Test SXP connection switchover only if Controller with SCS is isolated
     SxpClusterLib.Check Shards Status
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}
 
 Isolation of SXP noservice follower Test
     [Documentation]    Test SXP connection switchover only if Controller without SCS are isolated
     SxpClusterLib.Check Shards Status
-    ${controller_index} =    SxpClusterLib.Get Inactive Controller
+    ${controller_index} =    SxpClusterLib.Get Not Owner Controller
     Isolate SXP Controller    ${controller_index}
 
 *** Keywords ***
index a2767c79e1eda460eab506c6013812b4faae8471..8ea0abfd53a2fc72bd3ee9b9e4b678b90929c565 100644 (file)
@@ -13,28 +13,28 @@ 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
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
 
 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
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
 
 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
-    ${controller_index} =    SxpClusterLib.Get Inactive Controller
+    ${controller_index} =    SxpClusterLib.Get Not Owner Controller
     Isolate SXP Controller    ${controller_index}    ${DEVICE_NODE_ID}    ${DEVICE_SESSION}
 
 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
-    ${controller_index} =    SxpClusterLib.Get Inactive Controller
+    ${controller_index} =    SxpClusterLib.Get Not Owner Controller
     Isolate SXP Controller    ${controller_index}    ${CLUSTER_NODE_ID}
 
 *** Keywords ***
@@ -53,8 +53,9 @@ Isolate SXP 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    60    1    SxpClusterLib.Check Device is Connected    ${DEVICE_NODE_ID}    session=${DEVICE_SESSION}
-    ${active_controller} =    SxpClusterLib.Get Leader Controller From Running    @{running_members}
-    ${session} =    BuiltIn.Set Variable If    ${find_session}    controller${active_controller}    ${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 403b8d80562200dcf2c8c6920a59bd2f514bd19e..4eeaf73a2caca365d24184ce71f96bc711bd10bd 100644 (file)
@@ -13,42 +13,43 @@ Resource          ../../../libraries/SxpLib.robot
 Isolation of RCP service Test
     [Documentation]    Test SXP RPC functionality only if Controller with SCS is isolated
     SxpClusterLib.Check Shards Status
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     Isolate SXP Controller    ${controller_index}
 
 Isolation of RPC noservice Test
     [Documentation]    Test SXP RPC functionality only if Controller without SCS are isolated
     SxpClusterLib.Check Shards Status
-    ${controller_index} =    SxpClusterLib.Get Inactive Controller
+    ${controller_index} =    SxpClusterLib.Get Not Owner Controller
     Isolate SXP Controller    ${controller_index}
 
 *** Keywords ***
 Isolate SXP Controller
     [Arguments]    ${controller_index}
     [Documentation]    Isolate one of cluster nodes and perform check that RPC changes were performed afterwards reverts isolation
-    ${active_controller} =    SxpClusterLib.Get Leader Controller
+    ${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${active_controller}
+    \    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}
     @{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
-    ${active_controller} =    SxpClusterLib.Get Leader Controller From Running    @{running_members}
+    ${running_member} =    Collections.Get From List    ${running_members}    0
+    ${owner_controller} =    SxpClusterLib.Get Owner Controller    ${running_member}
     : 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${active_controller}
+    \    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}
     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
 
 Check Bindings Exist
     [Documentation]    Check that bindings exists in Cluster datastore
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     ${resp} =    SxpLib.Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
     : 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
     [Documentation]    Check that bindings does not exist in Cluster datastore
-    ${controller_index} =    SxpClusterLib.Get Leader Controller
+    ${controller_index} =    SxpClusterLib.Get Owner Controller
     ${resp} =    SxpLib.Get Bindings    node=${CLUSTER_NODE_ID}    session=controller${controller_index}
     : 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