2 Documentation Collection of test cases to validate OVSDB projects bugs.
4 ... TODO: there seems to be some thoughts around never having one-off bug reproduction
5 ... test cases, but rather they should exist as another test case in some appropriate
6 ... suite. Also it was suggested that using bug ids for test case names was not ideal
7 ... this to-do is written in case it's decided to refactor all of these test cases out
8 ... of this suite and/or to rename the test cases at a later time.
10 Library OperatingSystem
11 Library RequestsLibrary
13 Resource ../../../libraries/KarafKeywords.robot
14 Resource ../../../libraries/OVSDB.robot
15 Resource ../../../libraries/SetupUtils.robot
16 Resource ../../../libraries/Utils.robot
17 Resource ../../../libraries/WaitForFailure.robot
18 Resource ../../../variables/Variables.robot
19 Resource ../../../variables/ovsdb/Variables.robot
21 Suite Setup Suite Setup
22 Suite Teardown Suite Teardown
24 Test Teardown Test Teardown
31 ${OVSDB_UUID} ${EMPTY}
32 ${OVSDB_UUID2} ${EMPTY}
36 Bug 7414 Same Endpoint Name
37 [Documentation] To help validate bug 7414, this test case will send a single rest request to create two
38 ... ports (one for each of two OVS instances connected). The port names will be the same.
39 ... If the bug happens, the request would be accepted, but internally the two creations are seen as the
40 ... same and there is a conflict such that neither ovs will receive the port create.
42 ${bridge} = BuiltIn.Set Variable ovsbug_br_7414
44 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
45 Utils.Run Command On Mininet
46 ... ${TOOLS_SYSTEM_2_IP}
47 ... sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
48 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
49 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
51 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${bridge}
52 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl add-br ${bridge}
53 # send one rest request to create a TP endpoint on each ovs (same name)
54 ${body} = OVSDB.Modify Multi Port Body vtep1 vtep1 ${bridge}
55 # check that each ovs has the correct endpoint
56 BuiltIn.Wait Until Keyword Succeeds
59 ... Verify TEP Creation on OVS
60 ... ${TOOLS_SYSTEM_IP}
61 ... ${TOOLS_SYSTEM_2_IP}
62 BuiltIn.Wait Until Keyword Succeeds
65 ... Verify TEP Creation on OVS
66 ... ${TOOLS_SYSTEM_2_IP}
67 ... ${TOOLS_SYSTEM_IP}
68 [Teardown] BuiltIn.Run Keywords Test Teardown
69 ... AND RequestsLibrary.Delete Request session ${RFC8040_TOPO_API} data=${body}
71 Bug 7414 Different Endpoint Name
72 [Documentation] This test case is supplemental to the other test case for bug 7414. Even when the other
73 ... test case would fail and no ovs would receive a port create because the port names are the same, this
74 ... case should still be able to create ports on the ovs since the port names are different. However,
75 ... another symptom of this bug is that multiple creations in the same request would end up creating
76 ... all the ports on all of the ovs, which is incorrect. Both test cases check for this, but in the
77 ... case where the other test case were to fail this would also help understand if this symptom is still
80 ${bridge} = BuiltIn.Set Variable ovsbug_br_7414
82 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
83 Utils.Run Command On Mininet
84 ... ${TOOLS_SYSTEM_2_IP}
85 ... sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
86 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
87 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
89 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${bridge}
90 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl add-br ${bridge}
91 # send one rest request to create a TP endpoint on each ovs (different name)
92 ${body} = OVSDB.Modify Multi Port Body vtep1 vtep2 ${bridge}
93 # check that each ovs has the correct endpoint
94 BuiltIn.Wait Until Keyword Succeeds
97 ... Verify TEP Creation on OVS
98 ... ${TOOLS_SYSTEM_IP}
99 ... ${TOOLS_SYSTEM_2_IP}
100 BuiltIn.Wait Until Keyword Succeeds
103 ... Verify TEP Creation on OVS
104 ... ${TOOLS_SYSTEM_2_IP}
105 ... ${TOOLS_SYSTEM_IP}
106 [Teardown] BuiltIn.Run Keywords Test Teardown
107 ... AND RequestsLibrary.Delete Request session ${RFC8040_TOPO_API} data=${body}
110 [Documentation] In the case that an ovs node is rebooted, or the ovs service is
111 ... otherwise restarted, a controller initiated connection should reconnect when
112 ... the ovs is ready and available.
114 ${bridge} = BuiltIn.Set Variable ovsbug_br_5221
115 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
116 OVSDB.Connect To OVSDB Node ${TOOLS_SYSTEM_IP}
117 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
118 @{list} = BuiltIn.Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
119 BuiltIn.Wait Until Keyword Succeeds
122 ... Utils.Check For Elements At URI
123 ... ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
125 ... pretty_print_json=True
126 OVSDB.Add Bridge To Ovsdb Node
127 ... ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
128 ... ${TOOLS_SYSTEM_IP}
131 @{list} = BuiltIn.Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}/bridge/${bridge}
132 BuiltIn.Wait Until Keyword Succeeds
135 ... Utils.Check For Elements At URI
136 ... ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
138 ... pretty_print_json=True
139 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl stop
140 BuiltIn.Wait Until Keyword Succeeds
143 ... Utils.Check For Elements Not At URI
144 ... ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
146 ... pretty_print_json=True
147 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl start
148 # Depending on when the retry timers are firing, it may take some 10s of seconds to reconnect, so setting to 30 to cover that.
149 BuiltIn.Wait Until Keyword Succeeds
152 ... Utils.Check For Elements At URI
153 ... ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
155 ... pretty_print_json=True
156 [Teardown] BuiltIn.Run Keywords Test Teardown
157 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${bridge}
158 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
161 [Documentation] This test case will recreate the bug using the same basic steps as
162 ... provided in the bug, and noted here:
163 ... 1) create bridge in config using the UUID determined in Suite Setup
164 ... 2) connect ovs (vsctl set-manager)
165 ... 3) Fail if node is not discovered in Operational Store
167 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
168 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
169 ${OVSDB_UUID} = Get OVSDB UUID ${TOOLS_SYSTEM_IP}
170 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
171 # Suite teardown wants this ${OVSDB_UUID} variable for it's best effort cleanup, so making it visible at suite level.
172 BuiltIn.Set Suite Variable ${OVSDB_UUID}
173 ${node} = BuiltIn.Set Variable uuid/${OVSDB_UUID}
174 OVSDB.Add Bridge To Ovsdb Node ${node} ${TOOLS_SYSTEM_IP} ${BRIDGE} 0000000000005177
175 ${resp} = RequestsLibrary.Get Request session ${RFC8040_CONFIG_TOPO_API}
176 OVSDB.Log Request ${resp.text}
177 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
178 BuiltIn.Should Contain ${resp.text} ${node}/bridge/${BRIDGE}
179 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
180 @{list} = BuiltIn.Create List ${BRIDGE}
181 BuiltIn.Wait Until Keyword Succeeds
184 ... Utils.Check For Elements At URI
185 ... ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
187 ... pretty_print_json=True
188 # Do not cleanup as the next test requires the steps done in this test
189 [Teardown] BuiltIn.Run Keywords Utils.Report_Failure_Due_To_Bug 5177
190 ... AND OVSDB.Log Config And Operational Topology
193 [Documentation] This test is dependent on the work done in the Bug 5177 test case so should
194 ... always be executed immediately after.
195 ... 1) delete bridge in config
196 ... 2) Poll and Fail if exception is seen in karaf.log
198 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
199 ${node_id} = BuiltIn.Set Variable uuid%2F${OVSDB_UUID}
200 Delete Bridge From Ovsdb Node ${node_id} ${BRIDGE}
201 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
202 # If the exception is seen in karaf.log within 10s, the following line will FAIL, which is the point.
203 Verify_Keyword_Does_Not_Fail_Within_Timeout
206 ... Utils.Check Karaf Log File Does Not Have Messages
208 ... Shard.*shard-topology-operational An exception occurred while preCommitting transaction
210 [Teardown] BuiltIn.Run Keywords Test Teardown
211 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}${node_id}%2Fbridge%2F${BRIDGE}
212 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}${node_id}
215 [Documentation] Any config created for a bridge (e.g. added ports) should be reconciled when a bridge is
216 ... reconnected. This test case will create two ports via REST and validate that the bridge has those
217 ... ports. At that point, the bridge will be disconnected from the controller and the 2nd created port
218 ... will be manually removed. The bridge will be reconnected and the 2nd port should be re-added to the
219 ... bridge. If not, then bug 8280 will be found and the test case will fail
221 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
222 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
223 ${OVSDB_UUID2} = Get OVSDB UUID ${TOOLS_SYSTEM_IP}
224 BuiltIn.Set Suite Variable ${OVSDB_UUID2}
225 OVSDB.Add Bridge To Ovsdb Node uuid/${OVSDB_UUID2} ${TOOLS_SYSTEM_IP} ${BRIDGE} 0000000000008280
226 OVSDB.Add Termination Point uuid/${OVSDB_UUID2} ${BRIDGE} port1
227 OVSDB.Add Termination Point uuid/${OVSDB_UUID2} ${BRIDGE} port2
228 ${config_store_elements} = BuiltIn.Create List ${BRIDGE} port1 port2
229 Utils.Check For Elements At URI ${RFC8040_CONFIG_TOPO_API} ${config_store_elements} pretty_print_json=True
230 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl show
231 BuiltIn.Log ${ovs_output}
232 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
233 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-port ${BRIDGE} port2
234 OVSDB.Verify Ovs-vsctl Output show Port "port2" ${TOOLS_SYSTEM_IP} False
235 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
236 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
237 Utils.Check For Elements At URI ${RFC8040_CONFIG_TOPO_API} ${config_store_elements} pretty_print_json=True
238 BuiltIn.Wait Until Keyword Succeeds 5s 1s Verify Ovs-vsctl Output show Port "port2"
239 [Teardown] BuiltIn.Run Keywords Test Teardown
240 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID2}%2Fbridge%2F${BRIDGE}
241 ... AND RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID2}
244 [Documentation] If this bug is reproduced, it's possible that the operational store will be
245 ... stuck with leftover nodes and further system tests could fail. It's advised to run this
246 ... test last if possible. See the bug description for high level steps to reproduce
247 ... https://bugs.opendaylight.org/show_bug.cgi?id=7160#c0
249 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
250 OVSDB.Connect To OVSDB Node ${TOOLS_SYSTEM_IP}
251 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
252 ${qos} = BuiltIn.Set Variable QOS-1
253 ${queue} = BuiltIn.Set Variable QUEUE-1
254 OVSDB.Create Ovsdb Node ${TOOLS_SYSTEM_IP}
255 OVSDB.Log Config And Operational Topology
256 OVSDB.Create Qos ${qos}
257 OVSDB.Log Config And Operational Topology
258 OVSDB.Create Qos Linked Queue
259 OVSDB.Log Config And Operational Topology
260 ${resp} = RequestsLibrary.Delete Request
262 ... ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${qos}/queue-list=0
263 OVSDB.Log Config And Operational Topology
264 ${resp} = RequestsLibrary.Delete Request
266 ... ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${qos}
267 OVSDB.Log Config And Operational Topology
268 ${resp} = RequestsLibrary.Delete Request
270 ... ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:queues=${queue}
271 OVSDB.Log Config And Operational Topology
272 ${resp} = RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_HOST1_API}
273 OVSDB.Log Config And Operational Topology
274 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
275 RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
276 OVSDB.Log Config And Operational Topology
277 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Config and Operational Topology Should Be Empty
282 SetupUtils.Setup_Utils_For_Setup_And_Teardown
283 KarafKeywords.Open Controller Karaf Console On Background
284 RequestsLibrary.Create Session
286 ... http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
288 ... headers=${HEADERS}
290 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
291 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
292 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
293 OVSDB.Log Config And Operational Topology
296 [Documentation] Cleans up test environment, close existing sessions.
298 # Best effort to clean config store, by deleting all the types of nodes that are used in this suite
299 RequestsLibrary.Delete Request
301 ... ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE}
302 RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}
303 RequestsLibrary.Delete Request
305 ... ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID2}%2Fbridge%2F${BRIDGE}
306 RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID2}
307 RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}
308 RequestsLibrary.Delete Request session ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
309 OVSDB.Log Config And Operational Topology
313 SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
316 OVSDB.Log Config And Operational Topology
318 Utils.Report_Failure_Due_To_Bug ${TEST_TAGS}
321 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
322 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
324 Verify TEP Creation on OVS
325 [Arguments] ${local_ip} ${remote_ip}
326 ${ovs_output} = Utils.Run Command On Mininet ${local_ip} sudo ovs-vsctl show
327 BuiltIn.Log ${ovs_output}
328 BuiltIn.Should Contain ${ovs_output} local_ip="${local_ip}", remote_ip="${remote_ip}"
329 BuiltIn.Should Not Contain ${ovs_output} local_ip="${remote_ip}", remote_ip="${local_ip}"