- SxpLib.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} = BuiltIn.Create List
- : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
- \ ${resp} = RequestsLibrary.Get Request controller${i+1} /restconf/operational/entity-owners:entity-owners
- \ BuiltIn.Continue For Loop If ${resp.status_code} != 200
- \ ${controller} = Sxp.Get Active 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 Active Controller
- ${controller} = BuiltIn.Evaluate random.choice( filter( lambda i: i!=${active_controller}, range(1, ${NUM_ODL_SYSTEM} + 1))) random
+ 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