2 Documentation Test suite for entity ownership service and openflowplugin. Makes changes on controller side (isolating cluster node)
3 Suite Setup Start Suite
4 Suite Teardown End Suite
5 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Test Template Isolating Node Scenario
8 Library RequestsLibrary
10 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
11 Resource ${CURDIR}/../../../libraries/Utils.robot
12 Resource ${CURDIR}/../../../libraries/FlowLib.robot
13 Resource ${CURDIR}/../../../libraries/OvsManager.robot
14 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
15 Resource ${CURDIR}/../../../libraries/ClusterOpenFlow.robot
20 # 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
21 ${START_CMD} sudo mn --topo linear,${SWITCHES} --switch ovsk,protocols=OpenFlow13
22 @{CONTROLLER_NODES} ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
23 @{cntls_idx_list} ${1} ${2} ${3}
26 Start Mininet To All Nodes
28 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
29 BuiltIn.Set Suite Variable ${mininet_conn_id}
30 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
31 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
32 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
33 SSHLibrary.Execute Command sudo mn -c
34 SSHLibrary.Write ${START_CMD}
35 SSHLibrary.Read Until mininet>
36 ${cntls_list} BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
37 ${switch_list} BuiltIn.Create List
38 : FOR ${i} IN RANGE 0 ${SWITCHES}
39 \ ${sid}= BuiltIn.Evaluate ${i}+1
40 \ Collections.Append To List ${switch_list} s${sid}
41 BuiltIn.Set Suite Variable ${active_member} 1
42 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
43 BuiltIn.Wait Until Keyword Succeeds 15s 1s ClusterOpenFlow.Verify Switch Connections Running On Member ${SWITCHES} 1
45 Switches To Be Connected To All Nodes
46 [Documentation] Initial check for correct connected topology.
48 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
50 Isolating Owner Of Switch s1
52 [Teardown] Report_Failure_Due_To_Bug 6177
54 Switches Still Be Connected To All Nodes
56 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
57 [Teardown] Report_Failure_Due_To_Bug 6177
59 Stop Mininet And Verify No Owners
62 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check No Owners In Controller
63 [Teardown] Report_Failure_Due_To_Bug 6177
67 SetupUtils.Setup_Utils_For_Setup_And_Teardown
70 ClusterManagement.Flush Iptables From List Or All
71 RequestsLibrary.Delete All Sessions
73 Check All Switches Connected To All Cluster Nodes
74 [Documentation] Verifies all switches are connected to all cluster nodes
75 OvsManager.Get Ovsdb Data
76 : FOR ${i} IN RANGE 0 ${SWITCHES}
77 \ ${sid}= BuiltIn.Evaluate ${i}+1
78 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
79 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
80 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
82 Isolating Node Scenario
83 [Arguments] ${switch_name}
84 [Documentation] Disconnect and connect owner and successor and check switch data to be consistent
85 ${idx}= BuiltIn.Evaluate str("${switch_name}"[1:])
86 BuiltIn.Set Test Variable ${idx}
87 Isolate Switchs Old Owner ${switch_name}
88 Rejoin Switchs Old Owner ${switch_name}
89 Isolate Switchs Successor ${switch_name}
90 Rejoin Switchs Successor ${switch_name}
91 [Teardown] Run Keyword If "${isol_node}"!="${Empty}" Rejoin Controller To The Cluster ${isol_node}
93 Isolate Switchs Old Owner
94 [Arguments] ${switch_name}
95 BuiltIn.Set Test Variable ${isol_node} ${Empty}
96 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
97 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
98 ${active_member}= Collections.Get From List ${old_successors} 0
99 BuiltIn.Set Suite Variable ${active_member}
100 Isolate Controller From The Cluster ${old_owner}
101 BuiltIn.Set Test Variable ${isol_node} ${old_owner}
102 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${old_successors}
103 ${new_master}= BuiltIn.Wait Until Keyword Succeeds 10x 3s Verify New Master Controller Node ${switch_name} ${old_master}
104 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${old_successors}
105 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
106 BuiltIn.Set Suite Variable ${active_member} ${owner}
107 BuiltIn.Set Test Variable ${old_owner}
108 BuiltIn.Set Test Variable ${old_successors}
109 BuiltIn.Set Test Variable ${old_master}
110 BuiltIn.Set Test Variable ${owner}
111 BuiltIn.Set Test Variable ${new_master}
113 Rejoin Switchs Old Owner
114 [Arguments] ${switch_name}
115 Rejoin Controller To The Cluster ${old_owner}
116 BuiltIn.Set Test Variable ${isol_node} ${Empty}
117 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
118 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
120 BuiltIn.Should Be Equal ${owner} ${new_owner}
122 Isolate Switchs Successor
123 [Arguments] ${switch_name}
124 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
125 ${old_successor}= Collections.Get From List ${old_successors} 0
126 ${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_successor}_IP}
127 Isolate Controller From The Cluster ${old_successor}
128 BuiltIn.Set Test Variable ${isol_cntl} ${old_slave}
129 ${tmp_candidates}= BuiltIn.Create List @{ClusterManagement__member_index_list}
130 Collections.Remove Values From List ${tmp_candidates} ${old_successor}
131 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${tmp_candidates}
132 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${tmp_candidates}
133 BuiltIn.Should Be Equal ${owner} ${old_owner}
134 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
135 BuiltIn.Set Test Variable ${old_owner}
136 BuiltIn.Set Test Variable ${old_successors}
137 BuiltIn.Set Test Variable ${old_successor}
138 BuiltIn.Set Test Variable ${old_slave}
139 BuiltIn.Set Test Variable ${owner}
141 Rejoin Switchs Successor
142 [Arguments] ${switch_name}
143 Rejoin Controller To The Cluster ${old_successor}
144 BuiltIn.Set Test Variable ${isol_node} ${Empty}
145 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
146 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
148 BuiltIn.Should Be Equal ${old_owner} ${new_owner}
150 Rejoin Controller To The Cluster
151 [Arguments] ${isolated_node}
152 ClusterManagement.Rejoin Member From List Or All ${isolated_node}
153 [Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
155 Isolate Controller From The Cluster
156 [Arguments] ${isolated_node}
157 ClusterManagement.Isolate Member From List Or All ${isolated_node}
158 [Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
160 Check No Owners In Controller
161 [Documentation] Check there is no owners in controllers
162 ${session} = Resolve_Http_Session_For_Member member_index=${active_member}
163 ${data} = TemplatedRequests.Get_As_Json_From_Uri uri=${ENTITY_OWNER_URI} session=${session}
164 BuiltIn.Should Not Contain ${data} member
166 Verify New Master Controller Node
167 [Arguments] ${switch_name} ${old_master}
168 [Documentation] Checks if given node is different from actual master
169 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
170 ${owner} ${successors}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
171 ${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
172 BuiltIn.Should Not Be Equal ${old_master} ${new_master}
173 Return From Keyword ${new_master}