Documentation Resource housing Keywords common to several suites for cluster functional testing.
...
... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+... Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
...
... This program and the accompanying materials are made available under the
... terms of the Eclipse Public License v1.0 which accompanies this distribution,
...
...
... This resource holds private state (in suite variables),
-... which is generated once at Setup.
-... The state includes IP addresses and Http (RequestsLibrary) sessions.
-... Most functionality deals with stopping/starting controllers
-... and finding leaders/followers for a Shard.
+... which is generated once at Setup with ClusterManagement_Setup KW.
+... The state includes member indexes, IP addresses and Http (RequestsLibrary) sessions.
+... Cluster Keywords normally use member index, member list or nothing (all members) as argument.
...
+... Requirements:
... odl-jolokia is assumed to be installed.
...
-... Keywords are ordered from friendly ones to fiddly ones.
-... TODO: Figure out more deterministic but still user-friendly ordering.
+... Keywords are ordered as follows:
+... - Cluster Setup
+... - Shard state, leader and followers
+... - Entity Owner, candidates and successors
+... - Kill and Start Member
+... - Isolate and Rejoin Member
+... - Run Commands On Member
+... - REST requests and checks on Members
...
... TODO: Unify capitalization of Leaders and Followers.
-...
-... TODO: Move Keywords related to iptables manipulation from ClusterKeywords
-... here, or to separate Resource.
Library RequestsLibrary # for Create_Session and To_Json
Library Collections
Resource ${CURDIR}/TemplatedRequests.robot # for Get_As_Json_From_Uri
${JOLOKIA_CONF_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-config,type=DistributedConfigDatastore
${JOLOKIA_OPER_SHARD_MANAGER_URI} jolokia/read/org.opendaylight.controller:Category=ShardManager,name=shard-manager-operational,type=DistributedOperationalDatastore
${JOLOKIA_READ_URI} jolokia/read/org.opendaylight.controller
+${ENTITY_OWNER_URI} restconf/operational/entity-owners:entity-owners
${RESTCONF_MODULES_DIR} ${CURDIR}/../variables/restconf/modules
*** Keywords ***
${int_of_members} = BuiltIn.Set_Variable_If '${status}' != 'PASS' ${1} ${possibly_int_of_members}
ClusterManagement__Compute_Derived_Variables int_of_members=${int_of_members}
-Kill_Members_From_List_Or_All
- [Arguments] ${member_index_list}=${EMPTY} ${confirm}=True
- [Documentation] If the list is empty, kill all ODL instances. Otherwise, kill members based on present indices.
- ... If \${confirm} is True, sleep 1 second and verify killed instances are not there anymore.
- ${command} = BuiltIn.Set_Variable ps axf | grep java | grep karaf | awk '{print \"kill -9 \" $1}' | sh
- Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
- BuiltIn.Return_From_Keyword_If not ${confirm}
- # TODO: Convert to WUKS with configurable timeout if it turns out 1 second is not enough.
- BuiltIn.Sleep 1s Kill -9 closes open files, which may take longer than ssh overhead, but not long enough to warrant WUKS.
- ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
- : FOR ${index} IN @{index_list}
- \ Verify_Karaf_Is_Not_Running_On_Member member_index=${index}
-
-Isolate_Member_From_List_Or_All
- [Arguments] ${isolate_member_index} ${member_index_list}=${EMPTY}
- [Documentation] If the list is empty, isolate member from all ODL instances. Otherwise, isolate member based on present indices.
- ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
- ${source} = Get From Dictionary ${ClusterManagement__index_to_ip_mapping} ${isolate_member_index}
- : FOR ${index} IN @{index_list}
- \ ${destination} = Get From Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
- \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -I OUTPUT -p all --source ${source} --destination ${destination} -j DROP
- \ Run Keyword If "${index}" != "${isolate_member_index}" Run_Command_On_Member command=${command} member_index=${isolate_member_index}
- ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
- ${output} = Run_Command_On_Member command=${command} member_index=${isolate_member_index}
- Log ${output}
-
-Rejoin_Member_From_List_Or_All
- [Arguments] ${rejoin_member_index} ${member_index_list}=${EMPTY}
- [Documentation] If the list is empty, rejoin member from all ODL instances. Otherwise, rejoin member based on present indices.
- ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
- ${source} = Get From Dictionary ${ClusterManagement__index_to_ip_mapping} ${rejoin_member_index}
- : FOR ${index} IN @{index_list}
- \ ${destination} = Get From Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
- \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -D OUTPUT -p all --source ${source} --destination ${destination} -j DROP
- \ Run Keyword If "${index}" != "${rejoin_member_index}" Run_Command_On_Member command=${command} member_index=${rejoin_member_index}
- ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
- ${output} = Run_Command_On_Member command=${command} member_index=${rejoin_member_index}
- Log ${output}
-
-Flush_Iptables_From_List_Or_All
+Check_Cluster_Is_In_Sync
[Arguments] ${member_index_list}=${EMPTY}
- [Documentation] If the list is empty, flush IPTables in all ODL instances. Otherwise, flush member based on present indices.
- ${command} = BuiltIn.Set_Variable sudo iptables -v -F
- ${output} = Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
-
-ClusterManagement__Build_List
- [Arguments] ${member}
- ${member_int}= BuiltIn.Convert_To_Integer ${member}
- ${index_list}= BuiltIn.Create_List ${member_int}
- [Return] ${index_list}
-
-Kill_Single_Member
- [Arguments] ${member} ${confirm}=True
- [Documentation] Convenience keyword that kills the specified member of the cluster.
- ${index_list}= ClusterManagement__Build_List ${member}
- Kill_Members_From_List_Or_All ${index_list} ${confirm}
-
-Clean_Journals_And_Snapshots_On_List_Or_All
- [Arguments] ${member_index_list}=${EMPTY} ${karaf_home}=${WORKSPACE}${/}${BUNDLEFOLDER}
- [Documentation] Delete journal and snapshots directories on every node listed (or all).
+ [Documentation] Fail if no-sync is detected on a member from list (or any).
${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
- ${command} = Set Variable rm -rf "${karaf_home}/journal" "${karaf_home}/snapshots"
: FOR ${index} IN @{index_list} # usually: 1, 2, 3.
- \ Run_Command_On_Member command=${command} member_index=${index}
-
-Start_Members_From_List_Or_All
- [Arguments] ${member_index_list}=${EMPTY} ${wait_for_sync}=True ${timeout}=300s ${karaf_home}=${WORKSPACE}${/}${BUNDLEFOLDER} ${export_java_home}=${JAVA_HOME}
- [Documentation] If the list is empty, start all cluster members. Otherwise, start members based on present indices.
- ... If ${wait_for_sync}, wait for cluster sync on listed members.
- ... Optionally karaf_home can be overriden. Optionally specific JAVA_HOME is used for starting.
- ${base_command} = BuiltIn.Set_Variable ${karaf_home}/bin/start
- ${command} = BuiltIn.Set_Variable_If "${export_java_home}" export JAVA_HOME="${export_java_home}"; ${base_command} ${base_command}
- Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
- BuiltIn.Return_From_Keyword_If not ${wait_for_sync}
- BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} 1s Check_Cluster_Is_In_Sync member_index_list=${member_index_list}
- # TODO: Do we also want to check Shard Leaders here?
+ \ ${status} = Get_Sync_Status_Of_Member member_index=${index}
+ \ BuiltIn.Continue_For_Loop_If 'True' == '${status}'
+ \ BuiltIn.Fail Index ${index} has incorrect status: ${status}
-Start_Single_Member
- [Arguments] ${member} ${wait_for_sync}=True ${timeout}=300s
- [Documentation] Convenience keyword that starts the specified member of the cluster.
- ${index_list}= ClusterManagement__Build_List ${member}
- Start_Members_From_List_Or_All ${index_list} ${wait_for_sync} ${timeout}
+Get_Sync_Status_Of_Member
+ [Arguments] ${member_index}
+ [Documentation] Obtain IP, two GETs from jolokia URIs, return combined sync status as string.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ ${conf_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${JOLOKIA_CONF_SHARD_MANAGER_URI} session=${session}
+ ${conf_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${conf_text}
+ BuiltIn.Return_From_Keyword_If 'False' == ${conf_status} False
+ ${oper_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${JOLOKIA_OPER_SHARD_MANAGER_URI} session=${session}
+ ${oper_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${oper_text}
+ [Return] ${oper_status}
Verify_Leader_Exists_For_Each_Shard
[Arguments] ${shard_name_list} ${shard_type}=operational ${member_index_list}=${EMPTY} ${verify_restconf}=True
${leader} = Collections.Get_From_List ${leader_list} 0
[Return] ${leader} ${follower_list}
-Resolve_Http_Session_For_Member
- [Arguments] ${member_index}
- [Documentation] Return RequestsLibrary session alias pointing to node of given index.
- ${session} = BuiltIn.Set_Variable ClusterManagement__session_${member_index}
- [Return] ${session}
-
Get_State_Info_For_Shard
[Arguments] ${shard_name}=default ${shard_type}=operational ${validate}=False ${member_index_list}=${EMPTY} ${verify_restconf}=False
[Documentation] Return lists of Leader and Follower member indices from a given member index list
\ ... ELSE IF ${validate} BuiltIn.Fail Unrecognized Raft state: ${raft_state}
[Return] ${leader_list} ${follower_list}
-Check_Cluster_Is_In_Sync
- [Arguments] ${member_index_list}=${EMPTY}
- [Documentation] Fail if no-sync is detected on a member from list (or any).
+Get_Raft_State_Of_Shard_At_Member
+ [Arguments] ${shard_name} ${shard_type} ${member_index} ${verify_restconf}=False
+ [Documentation] Send request to Jolokia on indexed member, return extracted Raft status.
+ ... Optionally, check restconf works.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ # TODO: Does the used URI tend to generate large data which floods log.html?
+ BuiltIn.Run_Keyword_If ${verify_restconf} TemplatedRequests.Get_As_Json_Templated session=${session} folder=${RESTCONF_MODULES_DIR} verify=False
+ ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type}
+ ${uri} = BuiltIn.Set_Variable ${JOLOKIA_READ_URI}:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class}
+ ${data_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${uri} session=${session}
+ ${data_object} = RequestsLibrary.To_Json ${data_text}
+ ${value} = Collections.Get_From_Dictionary ${data_object} value
+ ${raft_state} = Collections.Get_From_Dictionary ${value} RaftState
+ [Return] ${raft_state}
+
+Verify_Owner_And_Successors_For_Device
+ [Arguments] ${device_name} ${device_type} ${member_index} ${candidate_list}=${EMPTY}
+ [Documentation] Returns the owner and successors for the SB device ${device_name} of type ${device_type}. Request is sent to member ${member_index}.
+ ... Extra check is done to verify owner and successors are within the ${candidate_list}. This KW is useful when combined with WUKS.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${candidate_list}
+ ${owner} ${successor_list} = Get_Owner_And_Successors_For_Device device_name=${device_name} device_type=${device_type} member_index=${member_index}
+ Collections.List_Should_Contain_Value ${index_list} ${owner} Owner ${owner} is not in candidate list ${index_list}
+ ${expected_successor_list} = BuiltIn.Create_List @{index_list}
+ Collections.Remove_Values_From_List ${expected_successor_list} ${owner}
+ Collections.Lists_Should_Be_Equal ${expected_successor_list} ${successor_list} Successor list ${successor_list} is not in candidate list ${index_list}
+ [Return] ${owner} ${successor_list}
+
+Get_Owner_And_Successors_For_device
+ [Arguments] ${device_name} ${device_type} ${member_index}
+ [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).
+ ${owner} ${candidate_list} = Get_Owner_And_Candidates_For_Device device_name=${device_name} device_type=${device_type} member_index=${member_index}
+ ${successor_list} = BuiltIn.Create_List @{candidate_list}
+ Collections.Remove_Values_From_List ${successor_list} ${owner}
+ [Return] ${owner} ${successor_list}
+
+Get_Owner_And_Candidates_For_Device
+ [Arguments] ${device_name} ${device_type} ${member_index}
+ [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.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ ${data} = TemplatedRequests.Get_As_Json_From_Uri uri=${ENTITY_OWNER_URI} session=${session}
+ ${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}
+ ... ELSE IF '${device_type}' == 'ovsdb' Extract_Ovsdb_Device_Data ${data}
+ ... ELSE Fail Not recognized device type: ${device_type}
+ ${json} = RequestsLibrary.To_Json ${clear_data}
+ ${entity_type_list} = Collections.Get_From_Dictionary &{json}[entity-owners] entity-type
+ ${entity_type_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_type_list} type ${entity_type}
+ BuiltIn.Should_Not_Be_Equal ${entity_type_index} -1 No Entity Owner found for ${device_type}
+ ${entity_list} = Collections.Get_From_Dictionary @{entity_type_list}[${entity_type_index}] entity
+ ${entity_index} = Utils.Get_Index_From_List_Of_Dictionaries ${entity_list} id ${device_name}
+ BuiltIn.Should Not Be Equal ${entity_index} -1 Device ${device_name} not found in Entity Owner ${device_type}
+ ${entity_owner} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] owner
+ BuiltIn.Should_Not_Be_Empty ${entity_owner} No owner found for ${device_name}
+ ${owner} = String.Replace_String ${entity_owner} member- ${EMPTY}
+ ${owner} = BuiltIn.Convert_To_Integer ${owner}
+ ${entity_candidates_list} = Collections.Get_From_Dictionary @{entity_list}[${entity_index}] candidate
+ : FOR ${entity_candidate} IN @{entity_candidates_list}
+ \ ${candidate} = String.Replace_String &{entity_candidate}[name] member- ${EMPTY}
+ \ ${candidate} = BuiltIn.Convert_To_Integer ${candidate}
+ \ Collections.Append_To_List ${candidate_list} ${candidate}
+ [Return] ${owner} ${candidate_list}
+
+Extract_OpenFlow_Device_Data
+ [Arguments] ${data}
+ [Documentation] Remove superfluous OpenFlow device data from Entity Owner printout.
+ ${clear_data} = String.Replace_String ${data} /general-entity:entity[general-entity:name=' ${EMPTY}
+ ${clear_data} = String.Replace_String ${clear_data} '] ${EMPTY}
+ Log ${clear_data}
+ [Return] ${clear_data}
+
+Extract_Ovsdb_Device_Data
+ [Arguments] ${data}
+ [Documentation] Remove superfluous OVSDB device data from Entity Owner printout.
+ ${clear_data} = String.Replace_String ${data} /network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id=' ${EMPTY}
+ ${clear_data} = String.Replace_String ${clear_data} '] ${EMPTY}
+ Log ${clear_data}
+ [Return] ${clear_data}
+
+Kill_Single_Member
+ [Arguments] ${member} ${confirm}=True
+ [Documentation] Convenience keyword that kills the specified member of the cluster.
+ ${index_list} = ClusterManagement__Build_List ${member}
+ Kill_Members_From_List_Or_All ${index_list} ${confirm}
+
+Kill_Members_From_List_Or_All
+ [Arguments] ${member_index_list}=${EMPTY} ${confirm}=True
+ [Documentation] If the list is empty, kill all ODL instances. Otherwise, kill members based on present indices.
+ ... If \${confirm} is True, sleep 1 second and verify killed instances are not there anymore.
+ ${command} = BuiltIn.Set_Variable ps axf | grep karaf | grep -v grep | awk '{print \"kill -9 \" $1}' | sh
+ Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
+ BuiltIn.Return_From_Keyword_If not ${confirm}
+ # TODO: Convert to WUKS with configurable timeout if it turns out 1 second is not enough.
+ BuiltIn.Sleep 1s Kill -9 closes open files, which may take longer than ssh overhead, but not long enough to warrant WUKS.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ : FOR ${index} IN @{index_list}
+ \ Verify_Karaf_Is_Not_Running_On_Member member_index=${index}
+
+Start_Single_Member
+ [Arguments] ${member} ${wait_for_sync}=True ${timeout}=300s
+ [Documentation] Convenience keyword that starts the specified member of the cluster.
+ ${index_list} = ClusterManagement__Build_List ${member}
+ Start_Members_From_List_Or_All ${index_list} ${wait_for_sync} ${timeout}
+
+Start_Members_From_List_Or_All
+ [Arguments] ${member_index_list}=${EMPTY} ${wait_for_sync}=True ${timeout}=300s ${karaf_home}=${WORKSPACE}${/}${BUNDLEFOLDER} ${export_java_home}=${JAVA_HOME}
+ [Documentation] If the list is empty, start all cluster members. Otherwise, start members based on present indices.
+ ... If ${wait_for_sync}, wait for cluster sync on listed members.
+ ... Optionally karaf_home can be overriden. Optionally specific JAVA_HOME is used for starting.
+ ${base_command} = BuiltIn.Set_Variable ${karaf_home}/bin/start
+ ${command} = BuiltIn.Set_Variable_If "${export_java_home}" export JAVA_HOME="${export_java_home}"; ${base_command} ${base_command}
+ Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
+ BuiltIn.Return_From_Keyword_If not ${wait_for_sync}
+ BuiltIn.Wait_Until_Keyword_Succeeds ${timeout} 1s Check_Cluster_Is_In_Sync member_index_list=${member_index_list}
+ # TODO: Do we also want to check Shard Leaders here?
+
+Clean_Journals_And_Snapshots_On_List_Or_All
+ [Arguments] ${member_index_list}=${EMPTY} ${karaf_home}=${WORKSPACE}${/}${BUNDLEFOLDER}
+ [Documentation] Delete journal and snapshots directories on every node listed (or all).
${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ ${command} = Set Variable rm -rf "${karaf_home}/journal" "${karaf_home}/snapshots"
: FOR ${index} IN @{index_list} # usually: 1, 2, 3.
- \ ${status} = Get_Sync_Status_Of_Member member_index=${index}
- \ BuiltIn.Continue_For_Loop_If 'True' == '${status}'
- \ BuiltIn.Fail Index ${index} has incorrect status: ${status}
+ \ Run_Command_On_Member command=${command} member_index=${index}
Verify_Karaf_Is_Not_Running_On_Member
[Arguments] ${member_index}
${count} = Count_Running_Karafs_On_Member member_index=${member_index}
BuiltIn.Should_Be_Equal 1 ${count} Wrong number of Karafs running: ${count}
+Count_Running_Karafs_On_Member
+ [Arguments] ${member_index}
+ [Documentation] Remotely execute grep for karaf process, return count as string.
+ ${command} = BuiltIn.Set_Variable ps axf | grep karaf | grep -v grep | wc -l
+ ${count} = Run_Command_On_Member command=${command} member_index=${member_index}
+ [Return] ${count}
+
+Isolate_Member_From_List_Or_All
+ [Arguments] ${isolate_member_index} ${member_index_list}=${EMPTY}
+ [Documentation] If the list is empty, isolate member from all ODL instances. Otherwise, isolate member based on present indices.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ ${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${isolate_member_index}
+ : FOR ${index} IN @{index_list}
+ \ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
+ \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -I OUTPUT -p all --source ${source} --destination ${destination} -j DROP
+ \ BuiltIn.Run_Keyword_If "${index}" != "${isolate_member_index}" Run_Command_On_Member command=${command} member_index=${isolate_member_index}
+ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
+ ${output} = Run_Command_On_Member command=${command} member_index=${isolate_member_index}
+ BuiltIn.Log ${output}
+
+Rejoin_Member_From_List_Or_All
+ [Arguments] ${rejoin_member_index} ${member_index_list}=${EMPTY}
+ [Documentation] If the list is empty, rejoin member from all ODL instances. Otherwise, rejoin member based on present indices.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ ${source} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${rejoin_member_index}
+ : FOR ${index} IN @{index_list}
+ \ ${destination} = Collections.Get_From_Dictionary ${ClusterManagement__index_to_ip_mapping} ${index}
+ \ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -D OUTPUT -p all --source ${source} --destination ${destination} -j DROP
+ \ BuiltIn.Run_Keyword_If "${index}" != "${rejoin_member_index}" Run_Command_On_Member command=${command} member_index=${rejoin_member_index}
+ ${command} = BuiltIn.Set_Variable sudo /sbin/iptables -L -n
+ ${output} = Run_Command_On_Member command=${command} member_index=${rejoin_member_index}
+ BuiltIn.Log ${output}
+
+Flush_Iptables_From_List_Or_All
+ [Arguments] ${member_index_list}=${EMPTY}
+ [Documentation] If the list is empty, flush IPTables in all ODL instances. Otherwise, flush member based on present indices.
+ ${command} = BuiltIn.Set_Variable sudo iptables -v -F
+ ${output} = Run_Command_On_List_Or_All command=${command} member_index_list=${member_index_list}
+
Run_Command_On_List_Or_All
[Arguments] ${command} ${member_index_list}=${EMPTY}
[Documentation] Cycle through indices (or all), run command on each.
: FOR ${index} IN @{index_list}
\ Run_Command_On_Member command=${command} member_index=${index}
-Get_Sync_Status_Of_Member
- [Arguments] ${member_index}
- [Documentation] Obtain IP, two GETs from jolokia URIs, return combined sync status as string.
- ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
- ${conf_text} = Get_As_Json_From_Uri uri=${JOLOKIA_CONF_SHARD_MANAGER_URI} session=${session}
- ${conf_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${conf_text}
- BuiltIn.Return_From_Keyword_If 'False' == ${conf_status} False
- ${oper_text} = Get_As_Json_From_Uri uri=${JOLOKIA_OPER_SHARD_MANAGER_URI} session=${session}
- ${oper_status} = ClusterManagement__Parse_Sync_Status shard_manager_text=${oper_text}
- [Return] ${oper_status}
-
Run_Command_On_Member
[Arguments] ${command} ${member_index}
[Documentation] Obtain IP, call Utils and return output. This does not preserve active ssh session.
${output} = Utils.Run_Command_On_Controller ${member_ip} ${command}
[Return] ${output}
-Count_Running_Karafs_On_Member
- [Arguments] ${member_index}
- [Documentation] Remotely execute grep for karaf process, return count as string.
- ${command} = BuiltIn.Set_Variable ps axf | grep karaf | grep -v grep | wc -l
- ${count} = Run_Command_On_Member command=${command} member_index=${member_index}
- [Return] ${count}
+Put_As_Json_And_Check_Member_List_Or_All
+ [Arguments] ${uri} ${data} ${member_index} ${member_index_list}=${EMPTY}
+ [Documentation] Send a PUT with the supplied uri ${uri} and body ${data} to member ${member_index}.
+ ... Then check data is replicated in all or some members defined in ${member_index_list}.
+ ${response_text} = Put_As_Json_To_Member uri=${uri} data=${data} member_index=${member_index}
+ Wait Until Keyword Succeeds 5s 1s Check_Json_Member_List_Or_All uri=${uri} expected_data=${data} member_index_list=${member_index_list}
+ [Return] ${response_text}
-Get_Raft_State_Of_Shard_At_Member
- [Arguments] ${shard_name} ${shard_type} ${member_index} ${verify_restconf}=False
- [Documentation] Send request to Jolokia on indexed member, return extracted Raft status.
- ... Optionally, check restconf works.
+Put_As_Json_To_Member
+ [Arguments] ${uri} ${data} ${member_index}
+ [Documentation] Send a PUT with the supplied uri and data to member ${member_index}.
${session} = Resolve_Http_Session_For_Member member_index=${member_index}
- # TODO: Does the used URI tend to generate large data which floods log.html?
- BuiltIn.Run_Keyword_If ${verify_restconf} TemplatedRequests.Get_As_Json_Templated session=${session} folder=${RESTCONF_MODULES_DIR} verify=False
- ${type_class} = Resolve_Shard_Type_Class shard_type=${shard_type}
- ${uri} = BuiltIn.Set_Variable ${JOLOKIA_READ_URI}:Category=Shards,name=member-${member_index}-shard-${shard_name}-${shard_type},type=${type_class}
- ${data_text} = TemplatedRequests.Get_As_Json_From_Uri uri=${uri} session=${session}
- ${data_object} = RequestsLibrary.To_Json ${data_text}
- ${value} = Collections.Get_From_Dictionary ${data_object} value
- ${raft_state} = Collections.Get_From_Dictionary ${value} RaftState
- [Return] ${raft_state}
+ ${response_text} = TemplatedRequests.Put_As_Json_To_Uri uri=${uri} data=${data} session=${session}
+ [Return] ${response_text}
+
+Post_As_Json_To_Member
+ [Arguments] ${uri} ${data} ${member_index}
+ [Documentation] Send a POST with the supplied uri and data to member ${member_index}.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ ${response_text} = TemplatedRequests.Post_As_Json_To_Uri uri=${uri} data=${data} session=${session}
+ [Return] ${response_text}
+
+Delete_And_Check_Member_List_Or_All
+ [Arguments] ${uri} ${member_index} ${member_index_list}=${EMPTY}
+ [Documentation] Send a DELETE with the supplied uri to the member ${member_index}.
+ ... Then check the data is removed from all members in ${member_index_list}.
+ ${response_text} = Delete_From_Member ${uri} ${member_index}
+ BuiltIn.Wait_Until_Keyword_Succeeds 5s 1s Check_No_Content_Member_List_Or_All uri=${uri} member_index_list=${member_index_list}
+ [Return] ${response_text}
+
+Delete_From_Member
+ [Arguments] ${uri} ${member_index}
+ [Documentation] Send a DELETE with the supplied uri to member ${member_index}.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ ${response_text} = TemplatedRequests.Delete_From_Uri uri=${uri} session=${session}
+ [Return] ${response_text}
+
+Check_Json_Member_List_Or_All
+ [Arguments] ${uri} ${expected_data} ${member_index_list}=${EMPTY}
+ [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
+ ... Then check received data is = ${expected data}.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ : FOR ${index} IN @{index_list}
+ \ ${data} = Get_From_Member uri=${uri} member_index=${index}
+ \ TemplatedRequests.Normalize_Jsons_And_Compare ${expected_data} ${data}
+
+Check_Item_Occurrence_Member_List_Or_All
+ [Arguments] ${uri} ${dictionary} ${member_index_list}=${EMPTY}
+ [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
+ ... Then check received for occurrences of items expressed in a dictionary ${dictionary}.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ : FOR ${index} IN @{index_list}
+ \ ${data} = Get_From_Member uri=${uri} member_index=${index}
+ \ Utils.Check Item Occurrence ${data} ${dictionary}
+
+Check_No_Content_Member_List_Or_All
+ [Arguments] ${uri} ${member_index_list}=${EMPTY}
+ [Documentation] Send a GET with the supplied uri to all or some members defined in ${member_index_list}.
+ ... Then check there is no content.
+ ${index_list} = ClusterManagement__Given_Or_Internal_Index_List given_list=${member_index_list}
+ : FOR ${index} IN @{index_list}
+ \ ${session} = Resolve_Http_Session_For_Member member_index=${index}
+ \ Utils.No_Content_From_URI ${session} ${uri}
+
+Get_From_Member
+ [Arguments] ${uri} ${member_index} ${access}=${ACCEPT_EMPTY}
+ [Documentation] Send a GET with the supplied uri to member ${member_index}.
+ ${session} = Resolve_Http_Session_For_Member member_index=${member_index}
+ ${response_text} = TemplatedRequests.Get_From_Uri uri=${uri} accept=${access} session=${session}
+ [Return] ${response_text}
+
+Resolve_Http_Session_For_Member
+ [Arguments] ${member_index}
+ [Documentation] Return RequestsLibrary session alias pointing to node of given index.
+ ${session} = BuiltIn.Set_Variable ClusterManagement__session_${member_index}
+ [Return] ${session}
Resolve_Shard_Type_Class
[Arguments] ${shard_type}
... ELSE IF '${shard_type}' == 'operational' BuiltIn.Return_From_Keyword DistributedOperationalDatastore
BuiltIn.Fail Unrecognized shard type: ${shard_type}
+ClusterManagement__Build_List
+ [Arguments] ${member}
+ ${member_int} = BuiltIn.Convert_To_Integer ${member}
+ ${index_list} = BuiltIn.Create_List ${member_int}
+ [Return] ${index_list}
+
ClusterManagement__Parse_Sync_Status
[Arguments] ${shard_manager_text}
[Documentation] Return sync status parsed out of given text. Called twice by Get_Sync_Status_Of_Member.
*** Settings ***
Documentation Cluster OpenFlow library. So far this library is only to be used by OpenFlow cluster test as it is very specific for this test.
Library RequestsLibrary
-Resource ClusterKeywords.robot
+Resource ClusterManagement.robot
Resource MininetKeywords.robot
Resource Utils.robot
Variables ../variables/Variables.py
*** Variables ***
+@{SHARD_OPER_LIST} inventory topology default entity-ownership
+@{SHARD_CONF_LIST} inventory topology default
${config_table_0} ${CONFIG_NODES_API}/node/openflow:1/table/0
${operational_table_0} ${OPERATIONAL_NODES_API}/node/openflow:1/table/0
${operational_port_1} ${OPERATIONAL_NODES_API}/node/openflow:1/node-connector/openflow:1:1
*** Keywords ***
Get InventoryConfig Shard Status
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Check Status for Inventory Config shard in OpenFlow application.
- ${inv_conf_leader} ${inv_conf_followers_list} Wait Until Keyword Succeeds 10s 1s ClusterKeywords.Get Cluster Shard Status ${controller_index_list}
- ... config inventory
+ ${inv_conf_leader} ${inv_conf_followers_list} Wait Until Keyword Succeeds 10s 1s ClusterManagement.Get_Leader_And_Followers_For_Shard shard_name=inventory
+ ... shard_type=config member_index_list=${controller_index_list}
Log config inventory Leader is ${inv_conf_leader} and followers are ${inv_conf_followers_list}
[Return] ${inv_conf_leader} ${inv_conf_followers_list}
Check OpenFlow Shards Status
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Check Status for all shards in OpenFlow application.
- ${inv_conf_leader} ${inv_conf_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} config inventory
- ${inv_oper_leader} ${inv_oper_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} operational inventory
- ${topo_oper_leader} ${topo_oper_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} operational topology
- ${owner_oper_leader} ${owner_oper_followers_list} ClusterKeywords.Get Cluster Shard Status ${controller_index_list} operational entity-ownership
- Log config inventory Leader is ${inv_conf_leader} and followers are ${inv_conf_followers_list}
- Log operational inventory Leader is ${inv_oper_leader} and followers are ${inv_oper_followers_list}
- Log operational topology Leader is ${topo_oper_leader} and followers are ${topo_oper_followers_list}
- Log operational entity-ownership Leader is ${owner_oper_leader} and followers are ${owner_oper_followers_list}
+ ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_OPER_LIST} shard_type=operational member_index_list=${controller_index_list}
+ ClusterManagement.Verify_Leader_Exists_For_Each_Shard shard_name_list=${SHARD_CONF_LIST} shard_type=config member_index_list=${controller_index_list}
Check OpenFlow Shards Status After Cluster Event
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Check Shards Status after some cluster event.
Wait Until Keyword Succeeds 90s 1s ClusterOpenFlow.Check OpenFlow Shards Status ${controller_index_list}
Get OpenFlow Entity Owner Status For One Device
- [Arguments] ${controller_index_list} ${device}
- [Documentation] Check Entity Owner Status and identify owner and candidate.
- ${owner} ${candidates_list} Wait Until Keyword Succeeds 10s 1s ClusterKeywords.Get Cluster Entity Owner ${controller_index_list}
- ... openflow ${device}
- [Return] ${owner} ${candidates_list}
+ [Arguments] ${device} ${controller_index} ${controller_index_list}=${EMPTY}
+ [Documentation] Check Entity Owner Status and identify owner and successors for the device ${device}. Request is sent to controller ${controller_index}.
+ ${owner} ${successor_list} Wait Until Keyword Succeeds 10s 1s ClusterManagement.Verify_Owner_And_Successors_For_Device device_name=${device}
+ ... device_type=openflow member_index=${controller_index} candidate_list=${controller_index_list}
+ [Return] ${owner} ${successor_list}
Check OpenFlow Network Operational Information For Sample Topology
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Check devices in tree,2 are in operational inventory and topology in all instances in ${controller_index_list}.
... Inventory should show 1x node_id per device 1x node_id per connector. Topology should show 2x node_id per device + 3x node_id per connector
... + 5x node_id per link termination. TODO: A Keyword that can calculate this based on mininet topology.
${dictionary} Create Dictionary openflow:1=4 openflow:2=5 openflow:3=5
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_NODES_API}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_NODES_API} dictionary=${dictionary} member_index_list=${controller_index_list}
${dictionary} Create Dictionary openflow:1=21 openflow:2=19 openflow:3=19
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}
Check No OpenFlow Network Operational Information
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Check device is not in operational inventory or topology in all cluster instances in ${controller_index_list}.
${dictionary} Create Dictionary openflow=0
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_NODES_API}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_NODES_API} dictionary=${dictionary} member_index_list=${controller_index_list}
${dictionary} Create Dictionary openflow=0
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}
Add Sample Flow And Verify
- [Arguments] ${controller_index_list} ${controller_index}
+ [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
[Documentation] Add sample flow in ${controller_index} and verify it gets applied in all instances in ${controller_index_list}.
${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/sample_flow_1.json
# There are slight differences on the way He and Li plugin display table information. He plugin has an additional Hashmap field
# replicating some of the matches in the flows section. Same comment applies for further keywords.
Run Keyword If '${ODL_OF_PLUGIN}' == 'helium' Set Test Variable &{dictionary} 10.0.1.0/24=2 "output-node-connector":"1"=1
Run Keyword If '${ODL_OF_PLUGIN}' == 'lithium' Set Test Variable &{dictionary} 10.0.1.0/24=1 "output-node-connector":"1"=1
- ClusterKeywords.Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${config_table_0}/flow/1 ${body}
- Wait Until Keyword Succeeds 15s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_table_0}
+ ClusterManagement.Put_As_Json_And_Check_Member_List_Or_All ${config_table_0}/flow/1 ${body} ${controller_index} ${controller_index_list}
+ Wait Until Keyword Succeeds 15s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_table_0} dictionary=${dictionary} member_index_list=${controller_index_list}
Modify Sample Flow And Verify
- [Arguments] ${controller_index_list} ${controller_index}
+ [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
[Documentation] Modify sample flow in ${controller_index} and verify it gets applied in all instances in ${controller_index_list}.
${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/sample_flow_2.json
Run Keyword If '${ODL_OF_PLUGIN}' == 'helium' Set Test Variable &{dictionary} 10.0.1.0/24=2 "output-node-connector":"2"=1
Run Keyword If '${ODL_OF_PLUGIN}' == 'lithium' Set Test Variable &{dictionary} 10.0.1.0/24=1 "output-node-connector":"2"=1
- ClusterKeywords.Put And Check At URI In Cluster ${controller_index_list} ${controller_index} ${config_table_0}/flow/1 ${body}
- Wait Until Keyword Succeeds 15s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_table_0}
+ ClusterManagement.Put_As_Json_And_Check_Member_List_Or_All ${config_table_0}/flow/1 ${body} ${controller_index} ${controller_index_list}
+ Wait Until Keyword Succeeds 15s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_table_0} dictionary=${dictionary} member_index_list=${controller_index_list}
Delete Sample Flow And Verify
- [Arguments] ${controller_index_list} ${controller_index}
+ [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
[Documentation] Delete sample flow in Owner and verify it gets removed from all instances.
${dictionary}= Create Dictionary 10.0.2.0/24=0
- ClusterKeywords.Delete And Check At URI In Cluster ${controller_index_list} ${controller_index} ${config_table_0}/flow/1
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_table_0}
+ ClusterManagement.Delete_And_Check_Member_List_Or_All ${config_table_0}/flow/1 ${controller_index} ${controller_index_list}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_table_0} dictionary=${dictionary} member_index_list=${controller_index_list}
Send RPC Add Sample Flow And Verify
- [Arguments] ${controller_index_list} ${controller_index}
+ [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
[Documentation] Add sample flow in ${controller_index} and verify it gets applied from all instances in ${controller_index_list}.
${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/add_flow_rpc.json
Run Keyword If '${ODL_OF_PLUGIN}' == 'helium' Set Test Variable &{dictionary} 10.0.1.0/24=2
Run Keyword If '${ODL_OF_PLUGIN}' == 'lithium' Set Test Variable &{dictionary} 10.0.1.0/24=1
- ${resp} RequestsLibrary.Post Request controller${controller_index} /restconf/operations/sal-flow:add-flow data=${body} headers=${HEADERS_YANG_JSON}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- Wait Until Keyword Succeeds 15s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_table_0}
+ ClusterManagement.Post_As_Json_To_Member uri=/restconf/operations/sal-flow:add-flow data=${body} member_index=${controller_index}
+ Wait Until Keyword Succeeds 15s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_table_0} dictionary=${dictionary} member_index_list=${controller_index_list}
Send RPC Delete Sample Flow And Verify
- [Arguments] ${controller_index_list} ${controller_index}
+ [Arguments] ${controller_index} ${controller_index_list}=${EMPTY}
[Documentation] Delete sample flow in ${controller_index} and verify it gets removed from all instances in ${controller_index_list}.
${body}= OperatingSystem.Get File ${CURDIR}/../variables/openflowplugin/delete_flow_rpc.json
${dictionary}= Create Dictionary 10.0.1.0/24=0
- ${resp} RequestsLibrary.Post Request controller${controller_index} /restconf/operations/sal-flow:remove-flow data=${body} headers=${HEADERS_YANG_JSON}
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_table_0}
+ ClusterManagement.Post_As_Json_To_Member uri=/restconf/operations/sal-flow:remove-flow data=${body} member_index=${controller_index}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_table_0} dictionary=${dictionary} member_index_list=${controller_index_list}
Take OpenFlow Device Link Down and Verify
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Take a link down and verify port status in all instances in ${controller_index_list}.
${dictionary}= Create Dictionary "link-down":true=1
${ouput}= MininetKeywords.Send Mininet Command ${mininet_conn_id} link s1 s2 down
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_port_1}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_port_1} dictionary=${dictionary} member_index_list=${controller_index_list}
${dictionary} Create Dictionary openflow:1=16 openflow:2=14 openflow:3=19
- Wait Until Keyword Succeeds 20s 2s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
+ Wait Until Keyword Succeeds 20s 2s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}
Take OpenFlow Device Link Up and Verify
- [Arguments] ${controller_index_list}
+ [Arguments] ${controller_index_list}=${EMPTY}
[Documentation] Take the link up and verify port status in all instances in ${controller_index_list}.
${dictionary}= Create Dictionary "link-down":true=0
${ouput}= MininetKeywords.Send Mininet Command ${mininet_conn_id} link s1 s2 up
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${operational_port_1}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${operational_port_1} dictionary=${dictionary} member_index_list=${controller_index_list}
${dictionary} Create Dictionary openflow:1=21 openflow:2=19 openflow:3=19
- Wait Until Keyword Succeeds 5s 1s ClusterKeywords.Check Item Occurrence At URI In Cluster ${controller_index_list} ${dictionary} ${OPERATIONAL_TOPO_API}
+ Wait Until Keyword Succeeds 5s 1s ClusterManagement.Check_Item_Occurrence_Member_List_Or_All uri=${OPERATIONAL_TOPO_API} dictionary=${dictionary} member_index_list=${controller_index_list}
*** Settings ***
Documentation Test suite for Cluster HA - Device Owner failover
-Suite Setup Create Controller Sessions
+Suite Setup ClusterManagement Setup
Suite Teardown Delete All Sessions
Library RequestsLibrary
Resource ../../../libraries/ClusterOpenFlow.robot
-Resource ../../../libraries/ClusterKeywords.robot
Resource ../../../libraries/MininetKeywords.robot
+Resource ../../../libraries/ClusterManagement.robot
Variables ../../../variables/Variables.py
*** Test Cases ***
-Create Original Cluster List
- [Documentation] Create original cluster list.
- ${original_cluster_list} ClusterKeywords.Create Controller Index List
- Set Suite Variable ${original_cluster_list}
-
Check Shards Status Before Fail
[Documentation] Check Status for all shards in OpenFlow application.
- ClusterOpenFlow.Check OpenFlow Shards Status ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Shards Status
Start Mininet Multiple Connections
[Documentation] Start mininet tree,2 with connection to all cluster instances.
- ${mininet_conn_id}= MininetKeywords.Start Mininet Multiple Controllers ${TOOLS_SYSTEM_IP} ${original_cluster_list} --topo tree,2 --switch ovsk,protocols=OpenFlow13
+ ${mininet_conn_id}= MininetKeywords.Start Mininet Multiple Controllers ${TOOLS_SYSTEM_IP} ${ClusterManagement__member_index_list} --topo tree,2 --switch ovsk,protocols=OpenFlow13
Set Suite Variable ${mininet_conn_id}
Check Entity Owner Status And Find Owner and Candidate Before Fail
[Documentation] Check Entity Owner Status and identify owner and candidate for first switch s1.
- ${original_owner} ${original_candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device ${original_cluster_list} openflow:1
- ${original_candidate}= Get From List ${original_candidates_list} 0
+ ${original_owner} ${original_candidate_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 1
+ ${original_candidate}= Get From List ${original_candidate_list} 0
Set Suite Variable ${original_owner}
+ Set Suite Variable ${original_candidate_list}
Set Suite Variable ${original_candidate}
Reconnect Extra Switches To Candidate And Check Entity Owner
[Documentation] Connect switches s2 and s3 to candidate instance.
OVSDB.Set Controller In OVS Bridge ${TOOLS_SYSTEM_IP} s2 tcp:${ODL_SYSTEM_${original_candidate}_IP}:6633
OVSDB.Set Controller In OVS Bridge ${TOOLS_SYSTEM_IP} s3 tcp:${ODL_SYSTEM_${original_candidate}_IP}:6633
- ${original_candidate_list}= Create List ${original_candidate}
- ${owner} ${candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device ${original_candidate_list} openflow:2
+ ${owner_list}= Create List ${original_candidate}
+ ${owner} ${candidate_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:2 1 ${owner_list}
Should Be Equal ${owner} ${original_candidate}
- ${owner} ${candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device ${original_candidate_list} openflow:3
+ ${owner} ${candidate_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:3 1 ${owner_list}
Should Be Equal ${owner} ${original_candidate}
Check Network Operational Information Before Fail
[Documentation] Check devices in operational inventory and topology in all cluster instances.
- ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology
Add Configuration In Owner and Verify Before Fail
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Add Sample Flow and Verify ${original_owner}
Modify Configuration In Owner and Verify Before Fail
[Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${original_owner}
Delete Configuration In Owner and Verify Before Fail
[Documentation] Delete Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${original_owner}
Add Configuration In Candidate and Verify Before Fail
- [Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${original_cluster_list} ${original_candidate}
+ [Documentation] Add Flow in Candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Add Sample Flow and Verify ${original_candidate}
Modify Configuration In Candidate and Verify Before Fail
- [Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${original_candidate}
+ [Documentation] Modify Flow in candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Modify Sample Flow and Verify ${original_candidate}
Delete Configuration In Candidate and Verify Before Fail
- [Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${original_candidate}
+ [Documentation] Delete Flow in Candidate and verify it gets removed from all instances.
+ ClusterOpenFlow.Delete Sample Flow and Verify ${original_candidate}
Send RPC Add to Owner and Verify Before Fail
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_owner}
Send RPC Delete to Owner and Verify Before Fail
[Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_owner}
Send RPC Add to Candidate and Verify Before Fail
[Documentation] Add Flow in Candidate and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${original_candidate}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_candidate}
Send RPC Delete to Candidate and Verify Before Fail
[Documentation] Delete Flow in Candidate and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${original_candidate}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_candidate}
Modify Network And Verify Before Fail
[Documentation] Take a link down and verify port status in all instances.
- ClusterOpenFlow.Take OpenFlow Device Link Down and Verify ${original_cluster_list}
+ ClusterOpenFlow.Take OpenFlow Device Link Down and Verify
Restore Network And Verify Before Fail
[Documentation] Take the link up and verify port status in all instances.
- ClusterOpenFlow.Take OpenFlow Device Link Up and Verify ${original_cluster_list}
+ ClusterOpenFlow.Take OpenFlow Device Link Up and Verify
Kill Owner Instance
[Documentation] Kill Owner Instance and verify it is dead
- ClusterKeywords.Kill Multiple Controllers ${original_owner}
- ${new_cluster_list} Create Controller Index List
- Remove Values From List ${new_cluster_list} ${original_owner}
- Set Suite Variable ${new_cluster_list}
+ ClusterManagement.Kill Single Member ${original_owner}
+ Set Suite Variable ${new_cluster_list} ${original_candidate_list}
Check Shards Status After Fail
[Documentation] Create original cluster list and check Status for all shards in OpenFlow application.
Check Entity Owner Status And Find Owner and Candidate After Fail
[Documentation] Check Entity Owner Status and identify owner and candidate.
- ${new_owner} ${new_candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device ${new_cluster_list} openflow:1
- Run Keyword And Continue On Failure List Should Not Contain Value ${new_candidates_list} ${original_owner} Original owner ${original_owner} still in candidate list.
- Remove Values From List ${new_candidates_list} ${original_owner}
- ${new_candidate}= Get From List ${new_candidates_list} 0
+ ${first_member}= Get From List ${new_cluster_list} 0
+ ${new_owner} ${new_candidate_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 ${first_member} ${new_cluster_list}
+ ${new_candidate}= Get From List ${new_candidate_list} 0
Set Suite Variable ${new_owner}
Set Suite Variable ${new_candidate}
- [Teardown] Utils.Report_Failure_Due_To_Bug 5004
Check Network Operational Information After Fail
[Documentation] Check devices in operational inventory and topology in all cluster instances.
Add Configuration In Owner and Verify After Fail
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${new_cluster_list} ${new_owner}
+ ClusterOpenFlow.Add Sample Flow and Verify ${new_owner} ${new_cluster_list}
Modify Configuration In Owner and Verify After Fail
[Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${new_cluster_list} ${new_owner}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${new_owner} ${new_cluster_list}
Delete Configuration In Owner and Verify After Fail
[Documentation] Delete Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${new_cluster_list} ${new_owner}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${new_owner} ${new_cluster_list}
Add Configuration In Candidate and Verify After Fail
- [Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${new_cluster_list} ${new_candidate}
+ [Documentation] Add Flow in Candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Add Sample Flow and Verify ${new_candidate} ${new_cluster_list}
Modify Configuration In Candidate and Verify After Fail
- [Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${new_cluster_list} ${new_candidate}
+ [Documentation] Modify Flow in Candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Modify Sample Flow and Verify ${new_candidate} ${new_cluster_list}
Delete Configuration In Candidate and Verify After Fail
- [Documentation] Delete Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${new_cluster_list} ${new_candidate}
+ [Documentation] Delete Flow in Candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Delete Sample Flow and Verify ${new_candidate} ${new_cluster_list}
Send RPC Add to Owner and Verify After Fail
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${new_cluster_list} ${new_owner}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${new_owner} ${new_cluster_list}
Send RPC Delete to Owner and Verify After Fail
[Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${new_cluster_list} ${new_owner}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${new_owner} ${new_cluster_list}
Send RPC Add to Candidate and Verify After Fail
- [Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${new_cluster_list} ${new_candidate}
+ [Documentation] Add Flow in Candidate and verify it gets applied from all instances.
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${new_candidate} ${new_cluster_list}
Send RPC Delete to Candidate and Verify After Fail
- [Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${new_cluster_list} ${new_candidate}
+ [Documentation] Delete Flow in Candidate and verify it gets removed from all instances.
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${new_candidate} ${new_cluster_list}
Modify Network and Verify After Fail
[Documentation] Take a link down and verify port status in all instances.
Start Old Owner Instance
[Documentation] Start old Owner Instance and verify it is up
- ClusterKeywords.Start Multiple Controllers 300s ${original_owner}
+ ClusterManagement.Start Single Member ${original_owner}
Check Shards Status After Recover
[Documentation] Create original cluster list and check Status for all shards in OpenFlow application.
- ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
Check Entity Owner Status After Recover
[Documentation] Check Entity Owner Status and identify owner and candidate.
- ${new_owner} ${new_candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device ${original_cluster_list} openflow:1
+ ${new_owner} ${new_candidates_list} ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:1 1
Set Suite Variable ${new_owner}
Check Network Operational Information After Recover
[Documentation] Check devices in operational inventory and topology in all cluster instances.
- ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Network Operational Information For Sample Topology
Add Configuration In Owner and Verify After Recover
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${original_cluster_list} ${new_owner}
+ ClusterOpenFlow.Add Sample Flow and Verify ${new_owner}
Modify Configuration In Owner and Verify After Recover
[Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${new_owner}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${new_owner}
Delete Configuration In Owner and Verify After Recover
[Documentation] Delete Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${new_owner}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${new_owner}
Add Configuration In Old Owner and Verify After Recover
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow and Verify ${originalcluster_list} ${original_owner}
+ ClusterOpenFlow.Add Sample Flow and Verify ${original_owner}
Modify Configuration In Old Owner and Verify After Recover
[Documentation] Modify Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${original_owner}
Delete Configuration In Old Owner and Verify After Recover
[Documentation] Delete Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${original_owner}
Send RPC Add to Owner and Verify After Recover
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${new_owner}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${new_owner}
Send RPC Delete to Owner and Verify After Recover
[Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${new_owner}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${new_owner}
Send RPC Add to Old Owner and Verify After Recover
[Documentation] Add Flow in Owner and verify it gets applied from all instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_owner}
Send RPC Delete to Old Owner and Verify After Recover
[Documentation] Delete Flow in Owner and verify it gets removed from all instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${original_owner}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_owner}
Modify Network and Verify After Recover
[Documentation] Take a link down and verify port status in all instances.
- ClusterOpenFlow.Take OpenFlow Device Link Down and Verify ${original_cluster_list}
+ ClusterOpenFlow.Take OpenFlow Device Link Down and Verify
Restore Network and Verify After Recover
[Documentation] Take the link up and verify port status in all instances.
- ClusterOpenFlow.Take OpenFlow Device Link Up and Verify ${original_cluster_list}
+ ClusterOpenFlow.Take OpenFlow Device Link Up and Verify
Stop Mininet and Exit
[Documentation] Stop mininet and exit connection.
Check No Network Operational Information
[Documentation] Check device is not in operational inventory or topology in all cluster instances.
- ClusterOpenFlow.Check No OpenFlow Network Operational Information ${original_cluster_list}
+ ClusterOpenFlow.Check No OpenFlow Network Operational Information
*** Settings ***
Documentation Test suite for Cluster HA - Device Leader Follower failover
-Suite Setup Create Controller Sessions
+Suite Setup ClusterManagement Setup
Suite Teardown Delete All Sessions
Library RequestsLibrary
Resource ../../../libraries/ClusterOpenFlow.robot
-Resource ../../../libraries/ClusterKeywords.robot
+Resource ../../../libraries/ClusterManagement.robot
Resource ../../../libraries/MininetKeywords.robot
Variables ../../../variables/Variables.py
-*** Variables ***
-${INVENTORY_SHARD} shard-inventory-config
-${START_TIMEOUT} 300s
-
*** Test Cases ***
-Create Original Cluster List
- [Documentation] Create original cluster list.
- ${original_cluster_list} ClusterKeywords.Create Controller Index List
- Set Suite Variable ${original_cluster_list}
-
Check Shards Status Before Leader Restart
[Documentation] Check Status for all shards in OpenFlow application.
- ClusterOpenFlow.Check OpenFlow Shards Status ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Shards Status
Get inventory Leader Before Leader Restart
[Documentation] Find leader in the inventory config shard
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Add Flows In Leader and Verify Before Leader Restart
[Documentation] Add Flow via Leader and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow And Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Add Sample Flow And Verify ${inventory_leader}
Modify Flows In Leader and Verify Before Leader Restart
[Documentation] Modify Flow in Leader and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${inventory_leader}
Delete Flows In Leader and Verify Before Leader Restart
[Documentation] Delete Flow in Leader and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${inventory_leader}
Send RPC Add to Leader and Verify Before Leader Restart
[Documentation] Add Flow in Leader and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${inventory_leader}
Send RPC Delete to Leader and Verify Before Leader Restart
[Documentation] Delete Flow in Owner and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${inventory_leader}
Send RPC Add to Follower Node1 and Verify Before Leader Restart
[Documentation] Add Flow in Follower and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${follower_node_1}
Send RPC Delete to Follower Node2 and Verify Before Leader Restart
[Documentation] Delete Flow in Follower and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${follower_node_2}
Stop Mininet Connected To Leader and Exit
[Documentation] Stop mininet and exit connection.
Restart Leader From Cluster Node
[Documentation] Kill Leader Node and Start it Up, Verify it is sync with other controller node.
- ClusterKeywords.Kill Multiple Controllers ${inventory_leader}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} ${inventory_leader}
+ ClusterManagement.Kill Single Member ${inventory_leader}
+ ClusterManagement.Start Single Member ${inventory_leader}
Get inventory Follower After Leader Restart
[Documentation] Find new Followers and Leader in the inventory config shard After Leader Restart
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Add Flows In Follower Node2 and Verify Before Follower Restart
[Documentation] Add Flow via cluster Follower Node2 and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow And Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Add Sample Flow And Verify ${follower_node_2}
Modify Flows In Follower Node2 and Verify Before Follower Restart
[Documentation] Modify Flow in Follower Node2 and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${follower_node_2}
Delete Flows In Follower Node2 and Verify Follower Restart
[Documentation] Delete Flow in Follower Node2 and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${follower_node_2}
Send RPC Add to Leader and Verify Before Follower Restart
[Documentation] Add Flow in Leader and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${inventory_leader}
Send RPC Delete to Leader and Verify Before Follower Restart
[Documentation] Delete Flow in Owner and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${inventory_leader}
Send RPC Add to First Follower Node1 and Verify Before Follower Restart
[Documentation] Add Flow in Follower and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${follower_node_1}
Send RPC Delete to Follower Node2 and Verify Before Follower Restart
[Documentation] Delete Flow in Follower Node2 and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${follower_node_2}
Stop Mininet Connected To Follower and Exit
[Documentation] Stop mininet and exit connection.
Restart Follower Node2
[Documentation] Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
- ClusterKeywords.Kill Multiple Controllers ${follower_node_2}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} ${follower_node_2}
+ ClusterManagement.Kill Single Member ${follower_node_2}
+ ClusterManagement.Start Single Member ${follower_node_2}
Get inventory Follower After Follower Restart
[Documentation] Find Followers and Leader in the inventory config shard After Follower Restart
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Add Flows In Follower Node1 and Verify Before Cluster Restart
[Documentation] Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow And Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Add Sample Flow And Verify ${follower_node_1}
Modify Flows In Follower Node1 and Verify Before Cluster Restart
[Documentation] Modify Flow in Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${follower_node_1}
Delete Flows In Follower Node1 and Verify Before Cluster Restart
[Documentation] Delete Flow in Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${follower_node_1}
Send RPC Add to Leader and Verify Before Cluster Restart
[Documentation] Add Flow in Leader and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${inventory_leader}
Send RPC Delete to Leader and Verify Before Cluster Restart
[Documentation] Delete Flow in Owner and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${inventory_leader}
Send RPC Add to Follower Node2 and Verify Before Cluster Restart
[Documentation] Add Flow in Follower and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${follower_node_2}
Send RPC Delete to Follower Node1 and Verify Before Cluster Restart
[Documentation] Delete Flow in Follower and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${follower_node_1}
Stop Mininet Connected To Other Follower and Exit
[Documentation] Stop mininet Connected To Other Follower and exit connection.
Restart Full Cluster
[Documentation] Kill all Cluster Nodes and Start it Up All.
- ClusterKeywords.Kill Multiple Controllers @{original_cluster_list}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} @{original_cluster_list}
+ ClusterManagement.Kill Members From List Or All
+ ClusterManagement.Start Members From List Or All
Get inventory Status After Cluster Restart
[Documentation] Find New Followers and Leader in the inventory config shard After Cluster Restart
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Add Flows In Follower Node1 and Verify After Cluster Restart
[Documentation] Add Flow via cluster Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow And Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Add Sample Flow And Verify ${follower_node_1}
Modify Flows In Follower Node1 and Verify After Cluster Restart
[Documentation] Modify Flow in Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Modify Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Modify Sample Flow and Verify ${follower_node_1}
Delete Flows In Follower Node1 and Verify After Cluster Restart
[Documentation] Delete Flow in Follower Node1 and verify it gets applied from all instances.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${follower_node_1}
Send RPC Add to Leader and Verify After Cluster Restart
[Documentation] Add Flow in Leader and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${inventory_leader}
Send RPC Delete to Leader and Verify After Cluster Restart
[Documentation] Delete Flow in Owner and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${inventory_leader}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${inventory_leader}
Send RPC Add to Follower Node2 and Verify After Cluster Restart
[Documentation] Add Flow in Follower and verify it gets applied from all Controller instances.
- ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Send RPC Add Sample Flow and Verify ${follower_node_2}
Send RPC Delete to Follower Node2 and Verify After Cluster Restart
[Documentation] Delete Flow in Follower and verify it gets removed from all Controller instances.
- ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Send RPC Delete Sample Flow and Verify ${follower_node_1}
Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
[Documentation] Stop mininet Connected To Other Follower and exit connection.
*** Settings ***
Documentation Test suite for Cluster HA - Data Recovery at Leader Follower failover and cluster restart
-Suite Setup Create Controller Sessions
+Suite Setup ClusterManagement Setup
Suite Teardown Delete All Sessions
Library RequestsLibrary
Resource ../../../libraries/ClusterOpenFlow.robot
-Resource ../../../libraries/ClusterKeywords.robot
+Resource ../../../libraries/ClusterManagement.robot
Resource ../../../libraries/MininetKeywords.robot
Variables ../../../variables/Variables.py
*** Variables ***
-${INVENTORY_SHARD} shard-inventory-config
-${START_TIMEOUT} 300s
${flow_count_per_switch} 1
${switch_count_per_node} 1
${operation_timeout} 15s
*** Test Cases ***
-Create Original Cluster List
- [Documentation] Create original cluster list.
- ${original_cluster_list} ClusterKeywords.Create Controller Index List
- Set Suite Variable ${original_cluster_list}
-
Check Shards Status Before Leader Restart
[Documentation] Check Status for all shards in OpenFlow application.
- ClusterOpenFlow.Check OpenFlow Shards Status ${original_cluster_list}
+ ClusterOpenFlow.Check OpenFlow Shards Status
Get inventory Leader Before Leader Restart
[Documentation] Find leader in the inventory config shard
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${inventory_leader_old} ${inventory_leader}
Add Flows In Follower Node2 and Verify Before Leader Restart
[Documentation] Add Flow via Follower Node2 and verify it gets applied from all instances.
- ClusterOpenFlow.Add Sample Flow And Verify ${original_cluster_list} ${follower_node_2}
+ ClusterOpenFlow.Add Sample Flow And Verify ${follower_node_2}
Stop Mininet Connected To Follower Node1 and Exit
[Documentation] Stop mininet and exit connection.
Restart Leader From Cluster Node
[Documentation] Kill Leader Node and Start it Up, Verify it is sync with other controller node.
- ClusterKeywords.Kill Multiple Controllers ${inventory_leader}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} ${inventory_leader}
+ ClusterManagement.Kill Single Member ${inventory_leader}
+ ClusterManagement.Start Single Member ${inventory_leader}
Get inventory Follower After Leader Restart
[Documentation] Find new Followers and Leader in the inventory config shard After Leader Restart.
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Restart Follower Node2
[Documentation] Kill Follower Node2 and Start it Up, Verify it is sync with other controller node.
- ClusterKeywords.Kill Multiple Controllers ${follower_node_2}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} ${follower_node_2}
+ ClusterManagement.Kill Single Member ${follower_node_2}
+ ClusterManagement.Start Single Member ${follower_node_2}
Get inventory Follower After Follower Restart
[Documentation] Find Followers and Leader in the inventory config shard After Follower Restart.
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Restart Full Cluster
[Documentation] Kill all Cluster Nodes and Start it Up All.
- ClusterKeywords.Kill Multiple Controllers @{original_cluster_list}
- ClusterKeywords.Start Multiple Controllers ${START_TIMEOUT} @{original_cluster_list}
+ ClusterManagement.Kill_Members_From_List_Or_All
+ ClusterManagement.Start_Members_From_List_Or_All
Get inventory Status After Cluster Restart
[Documentation] Find New Followers and Leader in the inventory config shard After Cluster Restart.
- ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status ${original_cluster_list}
+ ${inventory_leader} ${inventory_followers} ClusterOpenFlow.Get InventoryConfig Shard Status
${follower_node_1}= Get From List ${inventory_followers} 0
${follower_node_2}= Get From List ${inventory_followers} 1
Set Suite Variable ${follower_node_1}
Delete Flows In Follower Node1 and Verify After Leader Restart
[Documentation] Delete Flow in Follower Node1.
- ClusterOpenFlow.Delete Sample Flow and Verify ${original_cluster_list} ${follower_node_1}
+ ClusterOpenFlow.Delete Sample Flow and Verify ${follower_node_1}
Stop Mininet Connected To Follower Node2 and Exit After Cluster Restart
[Documentation] Stop mininet Connected To Other Follower and exit connection.
Library XML
Resource ${CURDIR}/../../../libraries/Utils.robot
Resource ${CURDIR}/../../../libraries/OvsManager.robot
-Resource ${CURDIR}/../../../libraries/ClusterKeywords.robot
+Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
Library Collections
*** Variables ***
*** Keywords ***
Start Suite
- BuiltIn.Log Start the test on the base edition
+ ClusterManagement.ClusterManagement Setup
${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
BuiltIn.Set Suite Variable ${mininet_conn_id}
SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
: FOR ${i} IN RANGE 0 ${SWITCHES}
\ ${sid}= BuiltIn.Evaluate ${i}+1
\ Collections.Append To List ${switch_list} s${sid}
- : FOR ${i} IN RANGE 0 ${NUM_ODL_SYSTEM}
- \ ${cid}= BuiltIn.Evaluate ${i}+1
- \ RequestsLibrary.Create Session controller${cid} http://${ODL_SYSTEM_${cid}_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
- BuiltIn.Set Suite Variable ${active_session} controller1
+ BuiltIn.Set Suite Variable ${active_member} 1
OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
BuiltIn.Wait Until Keyword Succeeds 10s 1s Are Switches Connected Topo
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= RequestsLibrary.Get Request ${active_session} ${OPERATIONAL_TOPO_API}/topology/flow:1 headers=${ACCEPT_XML}
- BuiltIn.Log ${resp.content}
- ${count}= XML.Get Element Count ${resp.content} xpath=node
+ ${resp}= ClusterManagement.Get From Member ${OPERATIONAL_TOPO_API}/topology/flow:1 ${active_member} access=${ACCEPT_XML}
+ BuiltIn.Log ${resp}
+ ${count}= XML.Get Element Count ${resp} xpath=node
BuiltIn.Should Be Equal As Numbers ${count} ${SWITCHES}
Check All Switches Connected To All Cluster Nodes
[Arguments] ${switch_name}
BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
Check Count Integrity ${switch_name} expected_controllers=3
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_master}
BuiltIn.Set Test Variable ${disc_cntl} ${old_master}
${new_master}= BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify New Master Controller Node ${switch_name} ${old_master}
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${old_followers} ${owner}
Check Count Integrity ${switch_name} expected_controllers=2
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_master}
BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify Follower Added ${switch_name} ${old_owner}
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Check Count Integrity ${switch_name} expected_controllers=3
BuiltIn.Should Be Equal ${owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_owner}
Disconnect Switchs Follower
[Arguments] ${switch_name}
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_follower}= Collections.Get From List ${old_followers} 0
${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_follower}_IP}
OvsManager.Disconnect Switch From Controller And Verify Disconnected ${switch_name} ${old_slave}
BuiltIn.Set Test Variable ${disc_cntl} ${old_slave}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=2
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${owner} ${old_owner}
Collections.List Should Not Contain Value ${followers} ${old_follower}
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
OvsManager.Reconnect Switch To Controller And Verify Connected ${switch_name} ${old_slave}
BuiltIn.Set Test Variable ${disc_cntl} ${Empty}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=3
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${old_owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_follower}
[Arguments] ${switch_name} ${expected_controllers}=3
[Documentation] Every switch must have only one master and rest must be followers and together must be of expected nodes count
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${candidates}= ClusterKeywords.Get Device Entity Owner And Candidates Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${candidates}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${count}= BuiltIn.Get Length ${candidates}
BuiltIn.Should Be Equal As Numbers ${expected_controllers} ${count}
[Arguments] ${switch_name} ${old_master}
[Documentation] Checks if given node is different from actual master
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
BuiltIn.Should Not Be Equal ${old_master} ${new_master}
Return From Keyword ${new_master}
[Arguments] ${switch_name} ${expected_node}
[Documentation] Checks if given node is in the list of active followers
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${followers} ${expected_node}
Library XML
Resource ${CURDIR}/../../../libraries/Utils.robot
Resource ${CURDIR}/../../../libraries/OvsManager.robot
-Resource ${CURDIR}/../../../libraries/ClusterKeywords.robot
+Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
Library Collections
*** Variables ***
*** Keywords ***
Start Suite
- BuiltIn.Log Start the test on the base edition
+ ClusterManagement.ClusterManagement Setup
${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
BuiltIn.Set Suite Variable ${mininet_conn_id}
SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
: FOR ${i} IN RANGE 0 ${SWITCHES}
\ ${sid}= BuiltIn.Evaluate ${i}+1
\ Collections.Append To List ${switch_list} s${sid}
- : FOR ${i} IN RANGE 0 ${NUM_ODL_SYSTEM}
- \ ${cid}= BuiltIn.Evaluate ${i}+1
- \ RequestsLibrary.Create Session controller${cid} http://${ODL_SYSTEM_${cid}_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
- BuiltIn.Set Suite Variable ${active_session} controller1
+ BuiltIn.Set Suite Variable ${active_member} 1
OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
BuiltIn.Wait Until Keyword Succeeds 10s 1s Are Switches Connected Topo
End Suite
+ ClusterManagement.Flush Iptables From List Or All
RequestsLibrary.Delete All Sessions
Utils.Stop Suite
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= RequestsLibrary.Get Request ${active_session} ${OPERATIONAL_TOPO_API}/topology/flow:1 headers=${ACCEPT_XML}
- BuiltIn.Log ${resp.content}
- ${count}= XML.Get Element Count ${resp.content} xpath=node
+ ${resp}= ClusterManagement.Get From Member ${OPERATIONAL_TOPO_API}/topology/flow:1 ${active_member} access=${ACCEPT_XML}
+ BuiltIn.Log ${resp}
+ ${count}= XML.Get Element Count ${resp} xpath=node
BuiltIn.Should Be Equal As Numbers ${count} ${SWITCHES}
Check All Switches Connected To All Cluster Nodes
[Arguments] ${switch_name}
BuiltIn.Set Test Variable ${isol_node} ${Empty}
Check Count Integrity ${switch_name} expected_controllers=3
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
- ${tmp_follower}= Collections.Get From List ${old_followers} 0
- BuiltIn.Set Suite Variable ${active_session} controller${tmp_follower}
- Isolate Controller From The Cluster ${old_master}
- BuiltIn.Set Test Variable ${isol_node} ${old_master}
- ${new_master}= BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify New Master Controller Node ${switch_name} ${old_master}
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${tmp_followers}= BuiltIn.Create List @{old_followers}
+ Collections.Remove Values From List ${tmp_followers} ${old_owner}
+ ${tmp_follower}= Collections.Get From List ${tmp_followers} 0
+ BuiltIn.Set Suite Variable ${active_member} ${tmp_follower}
+ Isolate Controller From The Cluster ${old_owner}
+ BuiltIn.Set Test Variable ${isol_node} ${old_owner}
+ ${new_master}= BuiltIn.Wait Until Keyword Succeeds 10x 3s Verify New Master Controller Node ${switch_name} ${old_master}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${old_followers} ${owner}
Check Count Integrity ${switch_name} expected_controllers=2
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
- BuiltIn.Set Suite Variable ${active_session} controller${owner}
+ BuiltIn.Set Suite Variable ${active_member} ${owner}
BuiltIn.Set Test Variable ${old_owner}
BuiltIn.Set Test Variable ${old_followers}
BuiltIn.Set Test Variable ${old_master}
Rejoin Switchs Old Owner
[Arguments] ${switch_name}
- Rejoin Controller To The Cluster ${old_master}
+ Rejoin Controller To The Cluster ${old_owner}
BuiltIn.Set Test Variable ${isol_node} ${Empty}
- BuiltIn.Wait Until Keyword Succeeds 50x 3s Verify Follower Added ${switch_name} ${old_owner}
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ BuiltIn.Wait Until Keyword Succeeds 10x 3s Verify Follower Added ${switch_name} ${old_owner}
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Check Count Integrity ${switch_name} expected_controllers=3
BuiltIn.Should Be Equal ${owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_owner}
Isolate Switchs Candidate
[Arguments] ${switch_name}
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_follower}= Collections.Get From List ${old_followers} 0
${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_follower}_IP}
- Isolate Controller From The Cluster ${old_slave}
+ Isolate Controller From The Cluster ${old_follower}
BuiltIn.Set Test Variable ${isol_cntl} ${old_slave}
- BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=2
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ BuiltIn.Wait Until Keyword Succeeds 10x 3s Check Count Integrity ${switch_name} expected_controllers=2
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${owner} ${old_owner}
Collections.List Should Not Contain Value ${followers} ${old_follower}
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
Rejoin Switchs Candidate
[Arguments] ${switch_name}
- Rejoin Controller To The Cluster ${old_slave}
+ Rejoin Controller To The Cluster ${old_follower}
BuiltIn.Set Test Variable ${isol_node} ${Empty}
- BuiltIn.Wait Until Keyword Succeeds 50x 3s Check Count Integrity ${switch_name} expected_controllers=3
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ BuiltIn.Wait Until Keyword Succeeds 10x 3s Check Count Integrity ${switch_name} expected_controllers=3
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${old_owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_follower}
Rejoin Controller To The Cluster
[Arguments] ${isolated_node}
- ClusterKeywords.Rejoin a Controller To Cluster ${isolated_node} @{CONTROLLER_NODES}
+ ClusterManagement.Rejoin Member From List Or All ${isolated_node}
[Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
Isolate Controller From The Cluster
[Arguments] ${isolated_node}
- ClusterKeywords.Isolate a Controller From Cluster ${isolated_node} @{CONTROLLER_NODES}
+ ClusterManagement.Isolate Member From List Or All ${isolated_node}
[Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
Check Count Integrity
[Arguments] ${switch_name} ${expected_controllers}=3
[Documentation] Every switch must have only one master and rest must be followers and together must be of expected nodes count
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${candidates}= ClusterKeywords.Get Device Entity Owner And Candidates Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${candidates}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${count}= BuiltIn.Get Length ${candidates}
BuiltIn.Should Be Equal As Numbers ${expected_controllers} ${count}
[Arguments] ${switch_name} ${old_master}
[Documentation] Checks if given node is different from actual master
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
BuiltIn.Should Not Be Equal ${old_master} ${new_master}
Return From Keyword ${new_master}
[Arguments] ${switch_name} ${expected_node}
[Documentation] Checks if given node is in the list of active followers
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${followers} ${expected_node}
Library XML
Resource ${CURDIR}/../../../libraries/Utils.robot
Resource ${CURDIR}/../../../libraries/OvsManager.robot
-Resource ${CURDIR}/../../../libraries/ClusterKeywords.robot
+Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
Library Collections
*** Variables ***
${SWITCHES} 1
# this is for mininet 2.2.1 ${START_CMD} sudo mn --controller=remote,ip=${ODL_SYSTEM_1_IP} --controller=remote,ip=${ODL_SYSTEM_2_IP} --controller=remote,ip=${ODL_SYSTEM_3_IP} --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
${START_CMD} sudo mn --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
-${START_TIMEOUT} 90s
${KARAF_HOME} ${WORKSPACE}${/}${BUNDLEFOLDER}
*** Test Cases ***
*** Keywords ***
Start Suite
- BuiltIn.Log Start the test on the base edition
+ ClusterManagement.ClusterManagement Setup
${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
BuiltIn.Set Suite Variable ${mininet_conn_id}
SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
: FOR ${i} IN RANGE 0 ${SWITCHES}
\ ${sid}= BuiltIn.Evaluate ${i}+1
\ Collections.Append To List ${switch_list} s${sid}
- : FOR ${i} IN RANGE 0 ${NUM_ODL_SYSTEM}
- \ ${cid}= BuiltIn.Evaluate ${i}+1
- \ RequestsLibrary.Create Session controller${cid} http://${ODL_SYSTEM_${cid}_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML}
- BuiltIn.Set Suite Variable ${active_session} controller1
+ BuiltIn.Set Suite Variable ${active_member} 1
OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
BuiltIn.Wait Until Keyword Succeeds 10s 1s Are Switches Connected Topo
Are Switches Connected Topo
[Documentation] Checks wheather switches are connected to controller
- ${resp}= RequestsLibrary.Get Request ${active_session} ${OPERATIONAL_TOPO_API}/topology/flow:1 headers=${ACCEPT_XML}
- BuiltIn.Log ${resp.content}
- ${count}= XML.Get Element Count ${resp.content} xpath=node
+ ${resp}= ClusterManagement.Get From Member ${OPERATIONAL_TOPO_API}/topology/flow:1 ${active_member} access=${ACCEPT_XML}
+ BuiltIn.Log ${resp}
+ ${count}= XML.Get Element Count ${resp} xpath=node
BuiltIn.Should Be Equal As Numbers ${count} ${SWITCHES}
Check All Switches Connected To All Cluster Nodes
[Arguments] ${switch_name}
BuiltIn.Set Test Variable ${stopped_karaf} ${Empty}
Check Count Integrity ${switch_name} expected_controllers=3
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
- ${tmp_follower}= Collections.Get From List ${old_followers} 0
- BuiltIn.Set Suite Variable ${active_session} controller${tmp_follower}
- Stop Controller Node And Verify ${old_master}
- BuiltIn.Set Test Variable ${stopped_karaf} ${old_master}
+ ${tmp_followers}= BuiltIn.Create List @{old_followers}
+ Collections.Remove Values From List ${tmp_followers} ${old_owner}
+ ${tmp_follower}= Collections.Get From List ${tmp_followers} 0
+ BuiltIn.Set Suite Variable ${active_member} ${tmp_follower}
+ Stop Controller Node And Verify ${old_owner}
+ BuiltIn.Set Test Variable ${stopped_karaf} ${old_owner}
${new_master}= BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify New Master Controller Node ${switch_name} ${old_master}
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${old_followers} ${owner}
Check Count Integrity ${switch_name} expected_controllers=2
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
- BuiltIn.Set Suite Variable ${active_session} controller${owner}
+ BuiltIn.Set Suite Variable ${active_member} ${owner}
BuiltIn.Set Test Variable ${old_owner}
BuiltIn.Set Test Variable ${old_followers}
BuiltIn.Set Test Variable ${old_master}
Restart Switchs Old Owner
[Arguments] ${switch_name}
- Start Controller Node And Verify ${old_master}
+ Start Controller Node And Verify ${old_owner}
BuiltIn.Set Test Variable ${stopped_karaf} ${Empty}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Verify Follower Added ${switch_name} ${old_owner}
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Check Count Integrity ${switch_name} expected_controllers=3
BuiltIn.Should Be Equal ${owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_owner}
Kill Switchs Candidate
[Arguments] ${switch_name}
- ${old_owner} ${old_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${old_owner} ${old_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${old_follower}= Collections.Get From List ${old_followers} 0
${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_follower}_IP}
- Stop Controller Node And Verify ${old_slave}
- BuiltIn.Set Test Variable ${stopped_karaf} ${old_slave}
+ Stop Controller Node And Verify ${old_follower}
+ BuiltIn.Set Test Variable ${stopped_karaf} ${old_follower}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=2
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${owner} ${old_owner}
Collections.List Should Not Contain Value ${followers} ${old_follower}
BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
Restart Switchs Candidate
[Arguments] ${switch_name}
- Start Controller Node And Verify ${old_slave}
+ Start Controller Node And Verify ${old_follower}
BuiltIn.Set Test Variable ${stopped_karaf} ${Empty}
BuiltIn.Wait Until Keyword Succeeds 5x 3s Check Count Integrity ${switch_name} expected_controllers=3
- ${new_owner} ${new_followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${new_owner} ${new_followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
BuiltIn.Should Be Equal ${old_owner} ${new_owner}
Collections.List Should Contain Value ${new_followers} ${old_follower}
[Arguments] ${switch_name} ${expected_controllers}=3
[Documentation] Every switch must have only one master and rest must be followers and together must be of expected nodes count
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${candidates}= ClusterKeywords.Get Device Entity Owner And Candidates Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${candidates}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${count}= BuiltIn.Get Length ${candidates}
BuiltIn.Should Be Equal As Numbers ${expected_controllers} ${count}
[Arguments] ${switch_name} ${old_master}
[Documentation] Checks if given node is different from actual master
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
BuiltIn.Should Not Be Equal ${old_master} ${new_master}
Return From Keyword ${new_master}
[Arguments] ${switch_name} ${expected_node}
[Documentation] Checks if given node is in the list of active followers
${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
- ${owner} ${followers}= ClusterKeywords.Get Device Entity Owner And Followers Indexes ${active_session} openflow openflow:${idx}
+ ${owner} ${followers}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
Collections.List Should Contain Value ${followers} ${expected_node}
Stop Controller Node And Verify
[Arguments] ${node}
[Documentation] Stops the given node
- ClusterKeywords.Stop Controller Node And Verify ${node}
+ ClusterManagement.Kill Single Member ${node}
[Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
Start Controller Node And Verify
[Arguments] ${node}
[Documentation] Starts the given node
- ClusterKeywords.Start Controller Node And Verify ${node} ${START_TIMEOUT}
+ ClusterManagement.Start Single Member ${node}
[Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}