Add 125s timout to get singleton device owner 10/57810/5
authorPeter Gubka <pgubka@cisco.com>
Thu, 25 May 2017 12:31:32 +0000 (14:31 +0200)
committerVratko Polák <vrpolak@cisco.com>
Thu, 25 May 2017 16:57:43 +0000 (16:57 +0000)
Change-Id: Ifba1dcb5651bf351a73d3a827b472f9948843747
Signed-off-by: Peter Gubka <pgubka@cisco.com>
csit/libraries/ClusterManagement.robot
csit/libraries/controller/CsCommon.robot

index e92f807c77a7ce59a4ec14e02fb90f6a6e8a7900..cc635663593d7e7c3a27bc801e5bc382d21ac88c 100644 (file)
@@ -177,19 +177,20 @@ Verify_Owner_And_Successors_For_Device
     [Return]    ${owner}    ${index_list}
 
 Get_Owner_And_Successors_For_Device
-    [Arguments]    ${device_name}    ${device_type}    ${member_index}
+    [Arguments]    ${device_name}    ${device_type}    ${member_index}    ${http_timeout}=${EMPTY}
     [Documentation]    Returns the owner and a list of successors for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
     ...    Successors are those device candidates not elected as owner. The list of successors = (list of candidates) - (owner).
     ...    The returned successor list is sorted numerically.
     ...    Note that "candidate list" definition currently differs between Beryllium and Boron.
     ...    Use Verify_Owner_And_Successors_For_Device if you want the older semantics (inaccessible nodes not present in the list).
-    ${owner}    ${candidate_list} =    Get_Owner_And_Candidates_For_Device    device_name=${device_name}    device_type=${device_type}    member_index=${member_index}
+    # TODO: somewhere to introduce ${DEFAULT_RESTCONF_DATASTORE_TIMEOUT}. Value may depend on protocol (ask vs tell) and perhaps stream.
+    ${owner}    ${candidate_list} =    Get_Owner_And_Candidates_For_Device    device_name=${device_name}    device_type=${device_type}    member_index=${member_index}    http_timeout=${http_timeout}
     ${successor_list} =    BuiltIn.Create_List    @{candidate_list}    # Copy operation is not required, but new variable name requires a line anyway.
     Collections.Remove_Values_From_List    ${successor_list}    ${owner}
     [Return]    ${owner}    ${successor_list}
 
 Get_Owner_And_Candidates_For_Device_Old
-    [Arguments]    ${device_name}    ${device_type}    ${member_index}
+    [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}.
     ...    Candidates are all members that register to own a device, so the list of candiates includes the owner.
     ...    The returned candidate list is sorted numerically.
@@ -197,7 +198,7 @@ Get_Owner_And_Candidates_For_Device_Old
     ...    It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
     BuiltIn.Comment    TODO: Can this implementation be changed to call Get_Owner_And_Candidates_For_Type_And_Id?
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
-    ${data} =    TemplatedRequests.Get_As_Json_From_Uri    uri=${ENTITY_OWNER_URI}    session=${session}
+    ${data} =    TemplatedRequests.Get_As_Json_From_Uri    uri=${ENTITY_OWNER_URI}    session=${session}    http_timeout=${http_timeout}
     ${candidate_list} =    BuiltIn.Create_List
     ${entity_type} =    BuiltIn.Set_Variable_If    '${device_type}' == 'netconf'    netconf-node/${device_name}    ${device_type}
     ${clear_data} =    BuiltIn.Run_Keyword_If    '${device_type}' == 'openflow' or '${device_type}' == 'netconf'    Extract_OpenFlow_Device_Data    ${data}
@@ -224,31 +225,31 @@ Get_Owner_And_Candidates_For_Device_Old
     [Return]    ${owner}    ${candidate_list}
 
 Get_Owner_And_Candidates_For_Device_Singleton
-    [Arguments]    ${device_name}    ${device_type}    ${member_index}
+    [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}.
     ...    Parsing method is selected by device type
     ...    Separate kw for every supported device type must be defined
     BuiltIn.Keyword_Should_Exist    Get_Owner_And_Candidates_For_Device_Singleton_${device_type}
-    BuiltIn.Run_Keyword_And_Return    Get_Owner_And_Candidates_For_Device_Singleton_${device_type}    ${device_name}    ${member_index}
+    BuiltIn.Run_Keyword_And_Return    Get_Owner_And_Candidates_For_Device_Singleton_${device_type}    ${device_name}    ${member_index}    http_timeout=${http_timeout}
 
 Get_Owner_And_Candidates_For_Device_Singleton_Netconf
-    [Arguments]    ${device_name}    ${member_index}
+    [Arguments]    ${device_name}    ${member_index}    ${http_timeout}=${EMPTY}
     [Documentation]    Returns the owner and a list of candidates for the SB device ${device_name} of type netconf. Request is sent to member ${member_index}.
     ...    Parsing method is set as netconf (using netconf device id prefix and suffix)
     # Get election entity type results
     ${type} =    BuiltIn.Set_Variable    ${SINGLETON_ELECTION_ENTITY_TYPE}
     ${id} =    BuiltIn.Set_Variable    ${SINGLETON_NETCONF_DEVICE_ID_PREFIX}${device_name}${SINGLETON_NETCONF_DEVICE_ID_SUFFIX}
-    ${owner_1}    ${candidate_list_1} =    Get_Owner_And_Candidates_For_Type_And_Id    ${type}    ${id}    ${member_index}
+    ${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_NETCONF_DEVICE_ID_PREFIX}${device_name}${SINGLETON_NETCONF_DEVICE_ID_SUFFIX}
-    ${owner_2}    ${candidate_list_2} =    Get_Owner_And_Candidates_For_Type_And_Id    ${type}    ${id}    ${member_index}
+    ${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}
+    [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}.
     ...    If parsing as singleton failed, kw try to parse data in old way (without singleton).
     ...    Candidates are all members that register to own a device, so the list of candiates includes the owner.
@@ -257,29 +258,31 @@ Get_Owner_And_Candidates_For_Device
     ...    It is recommended to use Get_Owner_And_Successors_For_Device instead of this keyword, see documentation there.
     # Try singleton
     ${status}    ${results} =    BuiltIn.Run_Keyword_And_Ignore_Error    Get_Owner_And_Candidates_For_Device_Singleton    device_name=${device_name}    device_type=${device_type}    member_index=${member_index}
+    ...    http_timeout=${http_timeout}
     BuiltIn.Return_From_Keyword_If    "${status}"=="PASS"    ${results}
     # If singleton failed, try parsing in old way
     ${status}    ${results} =    BuiltIn.Run_Keyword_And_Ignore_Error    Get_Owner_And_Candidates_For_Device_Old    device_name=${device_name}    device_type=${device_type}    member_index=${member_index}
+    ...    http_timeout=${http_timeout}
     # previous 3 lines (BuilIn.Return.., # If singleton..., ${status}....) could be deleted when old way will not be supported anymore
     BuiltIn.Run_Keyword_If    '${status}'=='FAIL'    BuiltIn.Fail    Could not parse owner and candidates for device ${device_name}
     [Return]    @{results}
 
 Check_Old_Owner_Stays_Elected_For_Device
-    [Arguments]    ${device_name}    ${device_type}    ${old_owner}    ${node_to_ask}
+    [Arguments]    ${device_name}    ${device_type}    ${old_owner}    ${node_to_ask}    ${http_timeout}=${EMPTY}
     [Documentation]    Verify the owner remain the same as ${old_owner}
-    ${owner}    ${candidates} =    Get_Owner_And_Candidates_For_Device    ${device_name}    ${device_type}    ${node_to_ask}
+    ${owner}    ${candidates} =    Get_Owner_And_Candidates_For_Device    ${device_name}    ${device_type}    ${node_to_ask}    http_timeout=${http_timeout}
     BuiltIn.Should_Be_Equal_As_numbers    ${old_owner}    ${owner}
     BuiltIn.Return_From_Keyword    ${owner}    ${candidates}
 
 Check_New_Owner_Got_Elected_For_Device
-    [Arguments]    ${device_name}    ${device_type}    ${old_owner}    ${node_to_ask}
+    [Arguments]    ${device_name}    ${device_type}    ${old_owner}    ${node_to_ask}    ${http_timeout}=${EMPTY}
     [Documentation]    Verify new owner was elected comparing to ${old_owner}
-    ${owner}    ${candidates} =    Get_Owner_And_Candidates_For_Device    ${device_name}    ${device_type}    ${node_to_ask}
+    ${owner}    ${candidates} =    Get_Owner_And_Candidates_For_Device    ${device_name}    ${device_type}    ${node_to_ask}    http_timeout=${http_timeout}
     BuiltIn.Should_Not_Be_Equal_As_Numbers    ${old_owner}    ${owner}
     BuiltIn.Return_From_Keyword    ${owner}    ${candidates}
 
 Get_Owner_And_Candidates_For_Type_And_Id
-    [Arguments]    ${type}    ${id}    ${member_index}    ${require_candidate_list}=${EMPTY}
+    [Arguments]    ${type}    ${id}    ${member_index}    ${require_candidate_list}=${EMPTY}    ${http_timeout}=${EMPTY}
     [Documentation]    Returns the owner and a list of candidates for entity specified by ${type} and ${id}
     ...    Request is sent to member ${member_index}.
     ...    Candidates are all members that register to own a device, so the list of candiates includes the owner.
@@ -289,7 +292,7 @@ Get_Owner_And_Candidates_For_Type_And_Id
     ...    namely you cannot use \${EMPTY} to stand for "full list" in this keyword.
     BuiltIn.Comment    TODO: Find a way to unify and deduplicate code blocks in Get_Owner_And_Candidates_* keywords.
     ${session} =    Resolve_Http_Session_For_Member    member_index=${member_index}
-    ${data} =    TemplatedRequests.Get_As_Json_From_Uri    uri=${ENTITY_OWNER_URI}    session=${session}
+    ${data} =    TemplatedRequests.Get_As_Json_From_Uri    uri=${ENTITY_OWNER_URI}    session=${session}    http_timeout=${http_timeout}
     ${candidate_list} =    BuiltIn.Create_List
     ${json} =    RequestsLibrary.To_Json    ${data}
     ${entity_type_list} =    Collections.Get_From_Dictionary    &{json}[entity-owners]    entity-type
index 71542455ac198f306b9a04b08efc6200056ffc72..0f3da610bda877828057cac58f1237ac062b61ab 100644 (file)
@@ -109,7 +109,7 @@ Isolate_Owner_And_Verify_Isolated
     ${node_to_ask} =    Collections.Get_From_list    ${non_isolated_list}    0
     BuiltIn.Wait_Until_Keyword_Succeeds    60s    10s    ShardStability.Shards_Stability_Get_Details    ${DEFAULT_SHARD_LIST}    member_index_list=${non_isolated_list}
     BuiltIn.Wait_Until_Keyword_Succeeds    10s    2s    ClusterManagement.Check_New_Owner_Got_Elected_For_Device    ${CS_DEVICE_NAME}    ${CS_DEVICE_TYPE}    ${cs_isolated_index}
-    ...    ${node_to_ask}
+    ...    ${node_to_ask}    http_timeout=125
     Get_And_Save_Present_CsOwner_And_CsCandidates    ${node_to_ask}
     BuiltIn.Wait_Until_Keyword_Succeeds    60s    3s    Verify_Singleton_Constant_During_Isolation