- [Documentation] Checks if SXP device is connected to at least one cluster node
- ${resp} Get Connections node=${node} session=${session}
- Should Contain Connection ${resp} ${TOOLS_SYSTEM_IP} ${port} ${mode} ${version}
-
-Get Active Controller
- [Documentation] Find cluster controller that is marked as leader for SXP service in cluster
- @{votes} Create List
- : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
- \ ${resp} RequestsLibrary.Get Request controller${i+1} /restconf/operational/entity-owners:entity-owners
- \ Continue For Loop If ${resp.status_code} != 200
- \ ${controller} Get Active Controller From Json ${resp.content} SxpControllerInstance
- \ Append To List ${votes} ${controller}
- ${length} Get Length ${votes}
- Should Not Be Equal As Integers ${length} 0
- ${active_controller} 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 Active Controller
- ${controller} Evaluate random.choice( filter( lambda i: i!=${active_controller}, range(1, ${NUM_ODL_SYSTEM} + 1))) random
+ [Documentation] Get SXP connections of cluster ${node} and verify that they contain a connection to the device ${DEVICE_NODE_ID} in state "on"
+ ${resp} = SxpLib.Get Connections node=${node} session=${session}
+ SxpLib.Should Contain Connection ${resp} ${DEVICE_NODE_ID} ${port} ${mode} ${version} on
+
+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 60x 1s 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