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 ${START_CMD} sudo mn --topo linear,${SWITCHES}
21 @{CONTROLLER_NODES} ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
22 @{cntls_idx_list} ${1} ${2} ${3}
25 Start Mininet To All Nodes
27 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${TOOLS_SYSTEM_PROMPT}
28 BuiltIn.Set Suite Variable ${mininet_conn_id}
29 SSHLibrary.Login With Public Key ${TOOLS_SYSTEM_USER} ${USER_HOME}/.ssh/id_rsa any
30 SSHLibrary.Put File ${CURDIR}/../../../libraries/DynamicMininet.py .
31 SSHLibrary.Execute Command sudo ovs-vsctl set-manager ptcp:6644
32 SSHLibrary.Execute Command sudo mn -c
33 SSHLibrary.Write ${START_CMD}
34 SSHLibrary.Read Until mininet>
35 ${cntls_list} BuiltIn.Create List ${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP}
36 ${switch_list} BuiltIn.Create List
37 : FOR ${i} IN RANGE 0 ${SWITCHES}
38 \ ${sid}= BuiltIn.Evaluate ${i}+1
39 \ Collections.Append To List ${switch_list} s${sid}
40 BuiltIn.Set Suite Variable ${active_member} 1
41 OvsManager.Setup Clustered Controller For Switches ${switch_list} ${cntls_list}
42 BuiltIn.Wait Until Keyword Succeeds 15s 1s ClusterOpenFlow.Verify Switch Connections Running On Member ${SWITCHES} 1
44 Switches To Be Connected To All Nodes
45 [Documentation] Initial check for correct connected topology.
47 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
49 Isolating Owner Of Switch s1
51 [Teardown] Report_Failure_Due_To_Bug 6177
53 Switches Still Be Connected To All Nodes
55 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check All Switches Connected To All Cluster Nodes
56 [Teardown] Report_Failure_Due_To_Bug 6177
58 Stop Mininet And Verify No Owners
61 BuiltIn.Wait Until Keyword Succeeds 15x 1s Check No Device Owners In Controller
62 [Teardown] Report_Failure_Due_To_Bug 6177
66 SetupUtils.Setup_Utils_For_Setup_And_Teardown
69 ClusterManagement.Flush Iptables From List Or All
70 RequestsLibrary.Delete All Sessions
72 Check All Switches Connected To All Cluster Nodes
73 [Documentation] Verifies all switches are connected to all cluster nodes
74 OvsManager.Get Ovsdb Data
75 : FOR ${i} IN RANGE 0 ${SWITCHES}
76 \ ${sid}= BuiltIn.Evaluate ${i}+1
77 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_1_IP} update_data=${False}
78 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_2_IP} update_data=${False}
79 \ OvsManager.Should Be Connected s${sid} ${ODL_SYSTEM_3_IP} update_data=${False}
81 Isolating Node Scenario
82 [Arguments] ${switch_name}
83 [Documentation] Disconnect and connect owner and successor and check switch data to be consistent
84 BuiltIn.Set Test Variable ${isol_node} ${Empty}
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 ${old_owner} ${old_successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member}
96 ${old_master}= BuiltIn.Set Variable ${ODL_SYSTEM_${old_owner}_IP}
97 ${active_member}= Collections.Get From List ${old_successors} 0
98 BuiltIn.Set Suite Variable ${active_member}
99 Isolate Controller From The Cluster ${old_owner}
100 BuiltIn.Set Test Variable ${isol_node} ${old_owner}
101 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event ${old_successors}
102 ${new_master}= BuiltIn.Wait Until Keyword Succeeds 10x 3s Verify New Master Controller Node ${switch_name} ${old_master}
103 ${owner} ${successors}= ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx} ${active_member} ${old_successors}
104 BuiltIn.Should Be Equal As Strings ${new_master} ${ODL_SYSTEM_${owner}_IP}
105 BuiltIn.Set Suite Variable ${active_member} ${owner}
106 BuiltIn.Set Test Variable ${old_owner}
107 BuiltIn.Set Test Variable ${old_successors}
108 BuiltIn.Set Test Variable ${old_master}
109 BuiltIn.Set Test Variable ${owner}
110 BuiltIn.Set Test Variable ${new_master}
112 Rejoin Switchs Old Owner
113 [Arguments] ${switch_name}
114 Rejoin Controller To The Cluster ${old_owner}
115 BuiltIn.Set Test Variable ${isol_node} ${Empty}
116 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
117 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
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_node} ${old_successor}
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.Set Test Variable ${old_owner}
133 BuiltIn.Set Test Variable ${old_successors}
134 BuiltIn.Set Test Variable ${old_successor}
135 BuiltIn.Set Test Variable ${old_slave}
136 BuiltIn.Set Test Variable ${owner}
138 Rejoin Switchs Successor
139 [Arguments] ${switch_name}
140 Rejoin Controller To The Cluster ${old_successor}
141 BuiltIn.Set Test Variable ${isol_node} ${Empty}
142 ClusterOpenFlow.Check OpenFlow Shards Status After Cluster Event
143 ${new_owner} ${new_successors}= BuiltIn.Wait Until Keyword Succeeds 6x 10s ClusterOpenFlow.Get OpenFlow Entity Owner Status For One Device openflow:${idx}
146 Rejoin Controller To The Cluster
147 [Arguments] ${isolated_node}
148 ClusterManagement.Rejoin Member From List Or All ${isolated_node}
149 [Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
151 Isolate Controller From The Cluster
152 [Arguments] ${isolated_node}
153 ClusterManagement.Isolate Member From List Or All ${isolated_node}
154 [Teardown] SSHLibrary.Switch Connection ${mininet_conn_id}
156 Check No Device Owners In Controller
157 [Documentation] Check there is no owners in controllers
158 ${session} = Resolve_Http_Session_For_Member member_index=${active_member}
159 ${data} = TemplatedRequests.Get_As_Json_From_Uri uri=${ENTITY_OWNER_URI} session=${session}
160 #ofp-topology-manager entity is introduced in the OPNFLWPLUG-1022 bug fix, and this entity will
161 #always be present in the EOS output. All 3 controller nodes will be candidate, so EOS output will
163 BuiltIn.Should Contain X Times ${data} member 3
165 Verify New Master Controller Node
166 [Arguments] ${switch_name} ${old_master}
167 [Documentation] Checks if given node is different from actual master
168 ${idx}= BuiltIn.Evaluate "${switch_name}"[1:]
169 ${owner} ${successors}= ClusterManagement.Get Owner And Candidates For Device openflow:${idx} openflow ${active_member}
170 ${new_master} BuiltIn.Set Variable ${ODL_SYSTEM_${owner}_IP}
171 BuiltIn.Should Not Be Equal ${old_master} ${new_master}
172 Return From Keyword ${new_master}