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
11 Library ${CURDIR}/../../../libraries/ClusterEntities.py
12 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
13 Resource ${CURDIR}/../../../libraries/Utils.robot
14 Resource ${CURDIR}/../../../libraries/FlowLib.robot
15 Resource ${CURDIR}/../../../libraries/OvsManager.robot
16 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
17 Resource ${CURDIR}/../../../libraries/ClusterOpenFlow.robot
18 Resource ${CURDIR}/../../../variables/openflowplugin/Variables.robot
22 ${START_CMD} sudo mn --topo linear,${SWITCHES}
23 @{CONTROLLER_NODES} ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
24 @{cntls_idx_list} ${1} ${2} ${3}
27 Start Mininet To All Nodes
29 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
30 BuiltIn.Set Suite Variable ${mininet_conn_id}
31 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
32 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
33 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
34 SSHLibrary.Execute Command sudo mn -c
35 SSHLibrary.Write ${START_CMD}
36 SSHLibrary.Read Until mininet>
37 ${cntls_list} BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
38 ${switch_list} BuiltIn.Create List
39 FOR ${i} IN RANGE 0 ${SWITCHES}
40 ${sid}= BuiltIn.Evaluate ${i}+1
41 Collections.Append To List ${switch_list} s${sid}
43 BuiltIn.Set Suite Variable ${active_member} 1
44 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
45 BuiltIn.Wait Until Keyword Succeeds 15s 1s ClusterOpenFlow.Verify Switch Connections Running On Member ${SWITCHES} 1
47 Switches To Be Connected To All Nodes
48 [Documentation] Initial check for correct connected topology.
50 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
52 Isolating Owner Of Switch s1
54 [Teardown] Report_Failure_Due_To_Bug 6177
56 Switches Still Be Connected To All Nodes
58 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
59 [Teardown] Report_Failure_Due_To_Bug 6177
61 Stop Mininet And Verify No Owners
64 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check No Device Owners In Controller
65 [Teardown] Report_Failure_Due_To_Bug 6177
69 SetupUtils.Setup_Utils_For_Setup_And_Teardown
72 ClusterManagement.Flush Iptables From List Or All
73 RequestsLibrary.Delete All Sessions
75 Check All Switches Connected To All Cluster Nodes
76 [Documentation] Verifies all switches are connected to all cluster nodes
77 OvsManager.Get Ovsdb Data
78 FOR ${i} IN RANGE 0 ${SWITCHES}
79 ${sid}= BuiltIn.Evaluate ${i}+1
80 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
81 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
82 OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
85 Isolating Node Scenario
86 [Arguments] ${switch_name}
87 [Documentation] Disconnect and connect owner and successor and check switch data to be consistent
88 BuiltIn.Set Test Variable ${isol_node} ${Empty}
89 ${idx}= BuiltIn.Evaluate str("${switch_name}"[1:])
90 BuiltIn.Set Test Variable ${idx}
91 Isolate Switchs Old Owner ${switch_name}
92 Rejoin Switchs Old Owner ${switch_name}
93 Isolate Switchs Successor ${switch_name}
94 Rejoin Switchs Successor ${switch_name}
95 [Teardown] Run Keyword If "${isol_node}"!="${Empty}" Rejoin Controller To The Cluster ${isol_node}
97 Isolate Switchs Old Owner
98 [Arguments] ${switch_name}
99 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
100 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
101 ${active_member}= Collections.Get From List ${old_successors} 0
102 BuiltIn.Set Suite Variable ${active_member}
103 Isolate Controller From The Cluster ${old_owner}
104 BuiltIn.Set Test Variable ${isol_node} ${old_owner}
105 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${old_successors}
106 ${new_master}= BuiltIn.Wait Until Keyword Succeeds 10x 3s Verify New Master Controller Node ${switch_name} ${old_master}
107 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${old_successors}
108 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
109 BuiltIn.Set Suite Variable ${active_member} ${owner}
110 BuiltIn.Set Test Variable ${old_owner}
111 BuiltIn.Set Test Variable ${old_successors}
112 BuiltIn.Set Test Variable ${old_master}
113 BuiltIn.Set Test Variable ${owner}
114 BuiltIn.Set Test Variable ${new_master}
116 Rejoin Switchs Old Owner
117 [Arguments] ${switch_name}
118 Rejoin Controller To The Cluster ${old_owner}
119 BuiltIn.Set Test Variable ${isol_node} ${Empty}
120 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
121 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
124 Isolate Switchs Successor
125 [Arguments] ${switch_name}
126 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
127 ${old_successor}= Collections.Get From List ${old_successors} 0
128 ${old_slave}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_successor}_IP}
129 Isolate Controller From The Cluster ${old_successor}
130 BuiltIn.Set Test Variable ${isol_node} ${old_successor}
131 ${tmp_candidates}= BuiltIn.Create List @{ClusterManagement__member_index_list}
132 Collections.Remove Values From List ${tmp_candidates} ${old_successor}
133 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${tmp_candidates}
134 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${tmp_candidates}
135 BuiltIn.Should Be Equal ${owner} ${old_owner}
136 BuiltIn.Set Test Variable ${old_owner}
137 BuiltIn.Set Test Variable ${old_successors}
138 BuiltIn.Set Test Variable ${old_successor}
139 BuiltIn.Set Test Variable ${old_slave}
140 BuiltIn.Set Test Variable ${owner}
142 Rejoin Switchs Successor
143 [Arguments] ${switch_name}
144 Rejoin Controller To The Cluster ${old_successor}
145 BuiltIn.Set Test Variable ${isol_node} ${Empty}
146 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
147 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
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 Device Owners In Controller
161 [Documentation] Check there is no owners in controllers
162 ${ip} = Resolve_IP_Address_For_Member member_index=${active_member}
163 ${url} = BuiltIn.Catenate SEPARATOR= http:// ${ip} :8181 ${RFC8040_RESTCONF_ROOT}
164 ${data} = ClusterEntities.Get_Entities ${url}
165 ${data} = BuiltIn.Convert_To_String ${data}
166 #ofp-topology-manager entity is introduced in the OPNFLWPLUG-1022 bug fix, and this entity will
167 #always be present in the EOS output. All 3 controller nodes will be candidate, so EOS output will
168 #contain 6 members (members show 2 times).
169 BuiltIn.Should Contain X Times ${data} member 6
171 Verify New Master Controller Node
172 [Arguments] ${switch_name} ${old_master}
173 [Documentation] Checks if given node is different from actual master
174 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
175 ${owner} ${successors}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
176 ${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
177 BuiltIn.Should Not Be Equal ${old_master} ${new_master}
178 Return From Keyword ${new_master}