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.
9 Suite Setup Suite Setup
10 Suite Teardown Suite Teardown
12 Test Teardown Test Teardown
14 Library OperatingSystem
15 Library RequestsLibrary
17 Resource ../../../libraries/KarafKeywords.robot
18 Resource ../../../libraries/OVSDB.robot
19 Resource ../../../libraries/SetupUtils.robot
20 Resource ../../../libraries/Utils.robot
21 Resource ../../../libraries/WaitForFailure.robot
22 Resource ../../../variables/Variables.robot
26 ${OVSDB_UUID} ${EMPTY}
27 ${OVSDB_UUID2} ${EMPTY}
30 Bug 7414 Same Endpoint Name
31 [Documentation] To help validate bug 7414, this test case will send a single rest request to create two
32 ... ports (one for each of two OVS instances connected). The port names will be the same.
33 ... If the bug happens, the request would be accepted, but internally the two creations are seen as the
34 ... same and there is a conflict such that neither ovs will receive the port create.
36 ${bridge} = BuiltIn.Set Variable ovsbug_br_7414
38 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
39 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
40 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
41 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
43 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${bridge}
44 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl add-br ${bridge}
45 # send one rest request to create a TP endpoint on each ovs (same name)
46 ${body} = OVSDB.Modify Multi Port Body vtep1 vtep1 ${bridge}
47 # check that each ovs has the correct endpoint
48 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify TEP Creation on OVS ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
49 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify TEP Creation on OVS ${TOOLS_SYSTEM_2_IP} ${TOOLS_SYSTEM_IP}
50 [Teardown] BuiltIn.Run Keywords Test Teardown
51 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API} data=${body}
53 Bug 7414 Different Endpoint Name
54 [Documentation] This test case is supplemental to the other test case for bug 7414. Even when the other
55 ... test case would fail and no ovs would receive a port create because the port names are the same, this
56 ... case should still be able to create ports on the ovs since the port names are different. However,
57 ... another symptom of this bug is that multiple creations in the same request would end up creating
58 ... all the ports on all of the ovs, which is incorrect. Both test cases check for this, but in the
59 ... case where the other test case were to fail this would also help understand if this symptom is still
62 ${bridge} = BuiltIn.Set Variable ovsbug_br_7414
64 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
65 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
66 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
67 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
69 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${bridge}
70 Utils.Run Command On Mininet ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl add-br ${bridge}
71 # send one rest request to create a TP endpoint on each ovs (different name)
72 ${body} = OVSDB.Modify Multi Port Body vtep1 vtep2 ${bridge}
73 # check that each ovs has the correct endpoint
74 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify TEP Creation on OVS ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP}
75 BuiltIn.Wait Until Keyword Succeeds 60s 10s Verify TEP Creation on OVS ${TOOLS_SYSTEM_2_IP} ${TOOLS_SYSTEM_IP}
76 [Teardown] BuiltIn.Run Keywords Test Teardown
77 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API} data=${body}
80 [Documentation] In the case that an ovs node is rebooted, or the ovs service is
81 ... otherwise restarted, a controller initiated connection should reconnect when
82 ... the ovs is ready and available.
84 ${bridge} = BuiltIn.Set Variable ovsbug_br_5221
85 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
86 OVSDB.Connect To OVSDB Node ${TOOLS_SYSTEM_IP}
87 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
88 @{list} = BuiltIn.Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
89 BuiltIn.Wait Until Keyword Succeeds 8s 2s Utils.Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list} pretty_print_json=True
90 OVSDB.Add Bridge To Ovsdb Node ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT} ${TOOLS_SYSTEM_IP} ${bridge} 0000000000005221
91 @{list} = BuiltIn.Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}/bridge/${bridge}
92 BuiltIn.Wait Until Keyword Succeeds 8s 2s Utils.Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list} pretty_print_json=True
93 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl stop
94 BuiltIn.Wait Until Keyword Succeeds 8s 2s Utils.Check For Elements Not At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list} pretty_print_json=True
95 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl start
96 # Depending on when the retry timers are firing, it may take some 10s of seconds to reconnect, so setting to 30 to cover that.
97 BuiltIn.Wait Until Keyword Succeeds 30s 2s Utils.Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list} pretty_print_json=True
98 [Teardown] BuiltIn.Run Keywords Test Teardown
99 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:6634%2Fbridge%2F${bridge}
100 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:6634
103 [Documentation] This test case will recreate the bug using the same basic steps as
104 ... provided in the bug, and noted here:
105 ... 1) create bridge in config using the UUID determined in Suite Setup
106 ... 2) connect ovs (vsctl set-manager)
107 ... 3) Fail if node is not discovered in Operational Store
109 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
110 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
111 ${OVSDB_UUID} = Get OVSDB UUID ${TOOLS_SYSTEM_IP}
112 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
113 # Suite teardown wants this ${OVSDB_UUID} variable for it's best effort cleanup, so making it visible at suite level.
114 BuiltIn.Set Suite Variable ${OVSDB_UUID}
115 ${node} = BuiltIn.Set Variable uuid/${OVSDB_UUID}
116 OVSDB.Add Bridge To Ovsdb Node ${node} ${TOOLS_SYSTEM_IP} ${BRIDGE} 0000000000005177
117 ${resp} = RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
118 OVSDB.Log Request ${resp.content}
119 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
120 BuiltIn.Should Contain ${resp.content} ${node}/bridge/${BRIDGE}
121 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
122 @{list} = BuiltIn.Create List ${BRIDGE}
123 BuiltIn.Wait Until Keyword Succeeds 8s 2s Utils.Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list} pretty_print_json=True
124 # Do not cleanup as the next test requires the steps done in this test
125 [Teardown] BuiltIn.Run Keywords Utils.Report_Failure_Due_To_Bug 5177
126 ... AND OVSDB.Log Config And Operational Topology
129 [Documentation] This test is dependent on the work done in the Bug 5177 test case so should
130 ... always be executed immediately after.
131 ... 1) delete bridge in config
132 ... 2) Poll and Fail if exception is seen in karaf.log
134 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
135 ${node_id} = BuiltIn.Set Variable uuid%2F${OVSDB_UUID}
136 Delete Bridge From Ovsdb Node ${node_id} ${BRIDGE}
137 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
138 # If the exception is seen in karaf.log within 10s, the following line will FAIL, which is the point.
139 Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Utils.Check Karaf Log File Does Not Have Messages ${ODL_SYSTEM_IP} Shard.*shard-topology-operational An exception occurred while preCommitting transaction
141 [Teardown] BuiltIn.Run Keywords Test Teardown
142 ... AND RequestsLibrary.Delete Request session ${SOUTHBOUND_CONFIG_API}${node_id}%2Fbridge%2F${BRIDGE}
143 ... AND RequestsLibrary.Delete Request session ${SOUTHBOUND_CONFIG_API}${node_id}
146 [Documentation] Any config created for a bridge (e.g. added ports) should be reconciled when a bridge is
147 ... reconnected. This test case will create two ports via REST and validate that the bridge has those
148 ... ports. At that point, the bridge will be disconnected from the controller and the 2nd created port
149 ... will be manually removed. The bridge will be reconnected and the 2nd port should be re-added to the
150 ... bridge. If not, then bug 8280 will be found and the test case will fail
152 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
153 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
154 ${OVSDB_UUID2} = Get OVSDB UUID ${TOOLS_SYSTEM_IP}
155 BuiltIn.Set Suite Variable ${OVSDB_UUID2}
156 OVSDB.Add Bridge To Ovsdb Node uuid/${OVSDB_UUID2} ${TOOLS_SYSTEM_IP} ${BRIDGE} 0000000000008280
157 OVSDB.Add Termination Point uuid/${OVSDB_UUID2} ${BRIDGE} port1
158 OVSDB.Add Termination Point uuid/${OVSDB_UUID2} ${BRIDGE} port2
159 ${config_store_elements} = BuiltIn.Create List ${BRIDGE} port1 port2
160 Utils.Check For Elements At URI ${CONFIG_TOPO_API} ${config_store_elements} pretty_print_json=True
161 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl show
162 BuiltIn.Log ${ovs_output}
163 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
164 ${ovs_output} = Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-port ${BRIDGE} port2
165 OVSDB.Verify Ovs-vsctl Output show Port "port2" ${TOOLS_SYSTEM_IP} False
166 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
167 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
168 Utils.Check For Elements At URI ${CONFIG_TOPO_API} ${config_store_elements} pretty_print_json=True
169 BuiltIn.Wait Until Keyword Succeeds 5s 1s Verify Ovs-vsctl Output show Port "port2"
170 [Teardown] BuiltIn.Run Keywords Test Teardown
171 ... AND RequestsLibrary.Delete Request session ${SOUTHBOUND_CONFIG_API}uuid%2F${OVSDB_UUID2}%2Fbridge%2F${BRIDGE}
172 ... AND RequestsLibrary.Delete Request session ${SOUTHBOUND_CONFIG_API}uuid%2F${OVSDB_UUID2}
175 [Documentation] If this bug is reproduced, it's possible that the operational store will be
176 ... stuck with leftover nodes and further system tests could fail. It's advised to run this
177 ... test last if possible. See the bug description for high level steps to reproduce
178 ... https://bugs.opendaylight.org/show_bug.cgi?id=7160#c0
180 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
181 OVSDB.Connect To OVSDB Node ${TOOLS_SYSTEM_IP}
182 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
183 ${qos} = BuiltIn.Set Variable QOS-1
184 ${queue} = BuiltIn.Set Variable QUEUE-1
185 OVSDB.Create Ovsdb Node ${TOOLS_SYSTEM_IP}
186 OVSDB.Log Config And Operational Topology
187 OVSDB.Create Qos ${qos}
188 OVSDB.Log Config And Operational Topology
189 OVSDB.Create Qos Linked Queue
190 OVSDB.Log Config And Operational Topology
191 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${qos}/queue-list/0/
192 OVSDB.Log Config And Operational Topology
193 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${qos}/
194 OVSDB.Log Config And Operational Topology
195 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${queue}/
196 OVSDB.Log Config And Operational Topology
197 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1
198 OVSDB.Log Config And Operational Topology
199 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
200 ${node} BuiltIn.Set Variable ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
201 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
202 OVSDB.Log Config And Operational Topology
203 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Config and Operational Topology Should Be Empty
207 SetupUtils.Setup_Utils_For_Setup_And_Teardown
208 KarafKeywords.Open Controller Karaf Console On Background
209 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
211 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
212 BuiltIn.Wait Until Keyword Succeeds 5s 1s OVSDB.Verify OVS Reports Connected
213 Utils.Run Command On Mininet ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
214 OVSDB.Log Config And Operational Topology
217 [Documentation] Cleans up test environment, close existing sessions.
219 # Best effort to clean config store, by deleting all the types of nodes that are used in this suite
220 ${node} = BuiltIn.Set Variable ovsdb:%2F%2Fuuid%2F${OVSDB_UUID}
221 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
222 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
223 ${node} = BuiltIn.Set Variable ovsdb:%2F%2Fuuid%2F${OVSDB_UUID2}
224 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
225 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
226 ${node} = BuiltIn.Set Variable ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
227 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
228 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
229 OVSDB.Log Config And Operational Topology
233 SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
236 OVSDB.Log Config And Operational Topology
238 Utils.Report_Failure_Due_To_Bug ${TEST_TAGS}
241 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
242 OVSDB.Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
244 Verify TEP Creation on OVS
245 [Arguments] ${local_ip} ${remote_ip}
246 ${ovs_output} = Utils.Run Command On Mininet ${local_ip} sudo ovs-vsctl show
247 BuiltIn.Log ${ovs_output}
248 BuiltIn.Should Contain ${ovs_output} local_ip="${local_ip}", remote_ip="${remote_ip}"
249 BuiltIn.Should Not Contain ${ovs_output} local_ip="${remote_ip}", remote_ip="${local_ip}"