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