Refactor action proveder suites
[integration/test.git] / csit / suites / controller / dom_rpc_broker / action_provider_precedence.robot
index 7fab9bb6627f0f0dcf5c3750da18ea6c61df2268..ebeae20dfcd726c3a09480257f299ad4d7b4d141 100644 (file)
@@ -15,70 +15,49 @@ Suite Teardown    SSHLibrary.Close_All_Connections
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 Default Tags      critical
-Library           Collections
 Library           SSHLibrary
-Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
-Resource          ${CURDIR}/../../../libraries/MdsalLowlevel.robot
+Resource          ${CURDIR}/../../../libraries/controller/DrbCommons.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
-Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
 
 *** Variables ***
 ${UNREGISTERED_RPC_NODE}    ${1}
-${CONTEXT}        context
-${CONSTANT_PREFIX}    constant-
 
 *** Test Cases ***
 Register_Rpc_On_Each_Node
     [Documentation]    Register routed rpc on each node of the cluster.
-    : FOR    ${index}    IN    @{full_cluster_index_list}
-    \    MdsalLowlevel.Register_Bound_Constant    ${index}    ${CONTEXT}    ${CONSTANT_PREFIX}${index}
+    DrbCommons.Register_Action_On_Nodes    ${all_indices}
 
 Invoke_Rpc_On_Each_Node
     [Documentation]    Verify that the rpc response comes from the local node.
-    : FOR    ${index}    IN    @{full_cluster_index_list}
-    \    ${constant} =    MdsalLowlevel.Get_Contexted_Constant    ${index}    ${CONTEXT}
-    \    BuiltIn.Should_Be_Equal_As_Strings    ${CONSTANT_PREFIX}${index}    ${constant}
+    DrbCommons.Verify_Contexted_Constant_On_Registered_Nodes    ${all_indices}
 
 Unregister_Rpc_On_Node
     [Documentation]    Unregister the rpc on one of the cluster nodes.
-    MdsalLowlevel.Unregister_Bound_Constant    ${UNREGISTERED_RPC_NODE}    ${CONTEXT}
+    DrbCommons.Unregister_Action_And_Update_Possible_Constants    ${UNREGISTERED_RPC_NODE}
 
 Invoke_Rpc_On_Node_With_Unregistered_Rpc
     [Documentation]    Invoke rcp on the node with unregistered rpc. The response is expected
     ...    to come from other nodes where the rpc remained registered.
-    ${constant} =    MdsalLowlevel.Get_Contexted_Constant    ${UNREGISTERED_RPC_NODE}    ${CONTEXT}
-    Collections.List_Should_Contain_Value    ${allowed_values}    ${constant}
+    DrbCommons.Verify_Contexted_Constant_On_Unregistered_Node    ${UNREGISTERED_RPC_NODE}
 
 Invoke_Rpc_On_Remaining_Nodes
     [Documentation]    Verify that the rpc response comes from the local node.
-    : FOR    ${index}    IN    @{allowed_index_list}
-    \    ${constant} =    MdsalLowlevel.Get_Contexted_Constant    ${index}    ${CONTEXT}
-    \    BuiltIn.Should_Be_Equal_As_Strings    ${CONSTANT_PREFIX}${index}    ${constant}
+    DrbCommons.Verify_Contexted_Constant_On_Registered_Nodes    ${registered_indices}
 
 Reregister_Rpc_On_Node
     [Documentation]    Reregister the rpc.
-    MdsalLowlevel.Register_Bound_Constant    ${UNREGISTERED_RPC_NODE}    ${CONTEXT}    ${CONSTANT_PREFIX}${UNREGISTERED_RPC_NODE}
+    DrbCommons.Register_Action_And_Update_Possible_Constants    ${UNREGISTERED_RPC_NODE}
 
 Invoke_Rpc_On_Each_Node_Again
     [Documentation]    Verify that the rpc response comes from the local node.
-    : FOR    ${index}    IN    @{full_cluster_index_list}
-    \    ${constant} =    MdsalLowlevel.Get_Contexted_Constant    ${index}    ${CONTEXT}
-    \    BuiltIn.Should_Be_Equal_As_Strings    ${CONSTANT_PREFIX}${index}    ${constant}
+    DrbCommons.Verify_Contexted_Constant_On_Registered_Nodes    ${all_indices}
 
 Unregister_Rpc_On_Each_Node
     [Documentation]    Unregister rpc on every node.
-    : FOR    ${index}    IN    @{full_cluster_index_list}
-    \    MdsalLowlevel.Unregister_Bound_Constant    ${index}    ${CONTEXT}
+    DrbCommons.Unregister_Action_On_Nodes    ${all_indices}
 
 *** Keywords ***
 Setup_Keyword
     [Documentation]    Create a list of possible constant responses on the node with unregistered rpc.
     SetupUtils.Setup_Utils_For_Setup_And_Teardown    http_timeout=30
-    ${full_cluster_index_list} =    ClusterManagement.List_All_Indices
-    BuiltIn.Set_Suite_Variable    ${full_cluster_index_list}
-    ${allowed_values} =    BuiltIn.Create_List
-    ${allowed_index_list} =    ClusterManagement.List_Indices_Minus_Member    ${UNREGISTERED_RPC_NODE}    ${full_cluster_index_list}
-    : FOR    ${index}    IN    @{allowed_index_list}
-    \    Collections.Append_To_List    ${allowed_values}    ${CONSTANT_PREFIX}${index}
-    BuiltIn.Set_Suite_Variable    ${allowed_index_list}
-    BuiltIn.Set_Suite_Variable    ${allowed_values}
+    DrbCommons.DrbCommons_Init