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 OVSDB Connection Manager Suite Setup
10 Suite Teardown OVSDB Connection Manager Suite Teardown
11 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
13 Library OperatingSystem
15 Library RequestsLibrary
16 Variables ../../../variables/Variables.py
17 Resource ../../../libraries/Utils.robot
18 Resource ../../../libraries/SetupUtils.robot
19 Resource ../../../libraries/WaitForFailure.robot
20 Resource ../../../libraries/OVSDB.robot
24 ${BRIDGE} ovsdb-csit-bug-validation
25 ${SOUTHBOUND_CONFIG_API} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
26 ${OVSDB_CONFIG_DIR} ${CURDIR}/../../../variables/ovsdb
29 Bug 7414 Same Endpoint Name
30 [Documentation] To help validate bug 7414, this test case will send a single rest request to create two
31 ... ports (one for each of two OVS instances connected). The port names will be the same.
32 ... If the bug happens, the request would be accepted, but internally the two creations are seen as the
33 ... same and there is a conflict such that neither ovs will receive the port create.
35 [Setup] Run Keywords Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
36 ... AND Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
38 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
39 Run Command On Remote System ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
40 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
41 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
43 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${BRIDGE}
44 Run Command On Remote System ${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}= Modify Multi Port Body vtep1 vtep1
47 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API} data=${body}
49 # check that each ovs has the correct endpoint
50 ${ovs_1_output}= Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl show
52 ${ovs_2_output}= Run Command On Remote System ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl show
54 Should Contain ${ovs_1_output} local_ip="${TOOLS_SYSTEM_IP}", remote_ip="${TOOLS_SYSTEM_2_IP}"
55 Should Not Contain ${ovs_1_output} local_ip="${TOOLS_SYSTEM_2_IP}", remote_ip="${TOOLS_SYSTEM_IP}"
56 Should Contain ${ovs_2_output} local_ip="${TOOLS_SYSTEM_2_IP}", remote_ip="${TOOLS_SYSTEM_IP}"
57 Should Not Contain ${ovs_2_output} local_ip="${TOOLS_SYSTEM_IP}", remote_ip="${TOOLS_SYSTEM_2_IP}"
58 [Teardown] Run Keywords RequestsLibrary.Delete Request session ${CONFIG_TOPO_API} data=${body}
59 ... AND Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
60 ... AND Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
62 Bug 7414 Different Endpoint Name
63 [Documentation] This test case is supplemental to the other test case for bug 7414. Even when the other
64 ... test case would fail and no ovs would receive a port create because the port names are the same, this
65 ... case should still be able to create ports on the ovs since the port names are different. However,
66 ... another symptom of this bug is that multiple creations in the same request would end up creating
67 ... all the ports on all of the ovs, which is incorrect. Both test cases check for this, but in the
68 ... case where the other test case were to fail this would also help understand if this symptom is still
71 [Setup] Clean OVSDB Test Environment
73 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
74 Run Command On Remote System ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
75 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected ${TOOLS_SYSTEM_IP}
76 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected ${TOOLS_SYSTEM_2_IP}
78 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl add-br ${BRIDGE}
79 Run Command On Remote System ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl add-br ${BRIDGE}
80 # send one rest request to create a TP endpoint on each ovs (different name)
81 ${body}= Modify Multi Port Body vtep1 vtep2
82 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API} data=${body}
84 # check that each ovs has the correct endpoint
85 ${ovs_1_output}= Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl show
87 ${ovs_2_output}= Run Command On Remote System ${TOOLS_SYSTEM_2_IP} sudo ovs-vsctl show
89 Should Contain ${ovs_1_output} local_ip="${TOOLS_SYSTEM_IP}", remote_ip="${TOOLS_SYSTEM_2_IP}"
90 Should Not Contain ${ovs_1_output} local_ip="${TOOLS_SYSTEM_2_IP}", remote_ip="${TOOLS_SYSTEM_IP}"
91 Should Contain ${ovs_2_output} local_ip="${TOOLS_SYSTEM_2_IP}", remote_ip="${TOOLS_SYSTEM_IP}"
92 Should Not Contain ${ovs_2_output} local_ip="${TOOLS_SYSTEM_IP}", remote_ip="${TOOLS_SYSTEM_2_IP}"
93 [Teardown] Run Keywords RequestsLibrary.Delete Request session ${CONFIG_TOPO_API} data=${body}
94 ... AND Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
95 ... AND Clean OVSDB Test Environment ${TOOLS_SYSTEM_2_IP}
98 [Documentation] In the case that an ovs node is rebooted, or the ovs service is
99 ... otherwise restarted, a controller initiated connection should reconnect when
100 ... the ovs is ready and available.
101 [Setup] Clean OVSDB Test Environment
102 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_PORT}
103 Connect Controller To OVSDB Node
104 @{list} Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
105 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
106 Create Bridge ${TOOLS_SYSTEM_IP}:6634 ${BRIDGE}
107 @{list} Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}/bridge/${BRIDGE}
108 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
109 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl stop
110 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
111 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl start
112 # Depending on when the retry timers are firing, it may take some 10s of seconds to reconnect, so setting to 30 to cover that.
113 Wait Until Keyword Succeeds 30s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
114 [Teardown] Run Keywords Clean OVSDB Test Environment
115 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:6634%2Fbridge%2F${BRIDGE}
116 ... AND RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:6634
117 ... AND Report_Failure_Due_To_Bug 5221
120 [Documentation] This test case will recreate the bug using the same basic steps as
121 ... provided in the bug, and noted here:
122 ... 1) create bridge in config using the UUID determined in Suite Setup
123 ... 2) connect ovs (vsctl set-manager)
124 ... 3) Fail if node is not discovered in Operational Store
125 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
126 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected
127 ${ovsdb_uuid}= Get OVSDB UUID ${TOOLS_SYSTEM_IP}
128 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
129 # Suite teardown wants this ${ovsdb_uuid} variable for it's best effort cleanup, so making it visible at suite level.
130 Set Suite Variable ${ovsdb_uuid}
131 ${node} Set Variable uuid/${ovsdb_uuid}
132 Create Bridge ${node} ${BRIDGE}
133 ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
135 Should Be Equal As Strings ${resp.status_code} 200 Response status code error
136 Should Contain ${resp.content} ${node}/bridge/${BRIDGE}
137 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
138 @{list} Create List ${BRIDGE}
139 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
140 [Teardown] Run Keywords Clean OVSDB Test Environment
141 ... AND Report_Failure_Due_To_Bug 5177
144 [Documentation] This test is dependent on the work done in the Bug 5177 test case so should
145 ... always be executed immediately after.
146 ... 1) delete bridge in config
147 ... 2) Poll and Fail if exception is seen in karaf.log
148 ${node} Set Variable ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
149 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
150 Should Be Equal As Strings ${resp.status_code} 200 Response status code error
151 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
152 # If the exception is seen in karaf.log within 10s, the following line will FAIL, which is the point.
153 Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Check Karaf Log File Does Not Have Messages ${ODL_SYSTEM_IP} Shard.*shard-topology-operational An exception occurred while preCommitting transaction
155 [Teardown] Run Keywords Clean OVSDB Test Environment
156 ... AND Report_Failure_Due_To_Bug 4794
159 [Documentation] If this bug is reproduced, it's possible that the operational store will be
160 ... stuck with leftover nodes and further system tests could fail. It's advised to run this
161 ... test last if possible. See the bug description for high level steps to reproduce
162 ... https://bugs.opendaylight.org/show_bug.cgi?id=7160#c0
163 [Setup] Run Keywords SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
164 ... AND Clean OVSDB Test Environment
165 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_PORT}
166 Connect Controller To OVSDB Node
167 ${QOS}= Set Variable QOS-1
168 ${QUEUE}= Set Variable QUEUE-1
169 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_node.json
170 ${sample1} Replace String ${sample} 127.0.0.1 ${TOOLS_SYSTEM_IP}
171 ${body} Replace String ${sample1} 61644 ${OVSDB_PORT}
172 ${resp} RequestsLibrary.Post Request session ${CONFIG_TOPO_API}/topology/ovsdb:1 data=${body}
173 Log Config And Operational Topology
174 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_qos.json
175 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/ data=${body}
176 Log Config And Operational Topology
177 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_queue.json
178 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/ data=${body}
179 Log Config And Operational Topology
180 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/bug_7160/create_qoslinkedqueue.json
181 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1 data=${body}
182 Log Config And Operational Topology
183 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/queue-list/0/
184 Log Config And Operational Topology
185 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
186 Log Config And Operational Topology
187 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/
188 Log Config And Operational Topology
189 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1
190 Log Config And Operational Topology
191 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
192 ${node} Set Variable ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
193 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
194 Log Config And Operational Topology
195 Wait Until Keyword Succeeds 5s 1s Config and Operational Topology Should Be Empty
196 [Teardown] Run Keywords Clean OVSDB Test Environment
197 ... AND Report_Failure_Due_To_Bug 7160
200 OVSDB Connection Manager Suite Setup
201 SetupUtils.Setup_Utils_For_Setup_And_Teardown
202 Open Controller Karaf Console On Background
203 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
204 Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
205 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
206 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected
207 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
209 OVSDB Connection Manager Suite Teardown
210 [Documentation] Cleans up test environment, close existing sessions.
211 Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
212 # Best effort to clean config store, by deleting all the types of nodes that are used in this suite
213 ${node} Set Variable ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
214 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
215 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
216 ${node} Set Variable ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
217 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
218 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
219 ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
222 # TODO: both Create Bridge and Connect Controller To OVSDB Node keywords below should be moved to a library
223 # and all the suites using this kind of work can move to using the library instead of
224 # doing all this work each time.
227 [Arguments] ${node_string} ${bridge}
228 [Documentation] This will create bridge on the specified OVSDB node.
229 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_bridge.json
230 ${body} Replace String ${body} ovsdb://127.0.0.1:61644 ovsdb://${node_string}
231 ${body} Replace String ${body} tcp:127.0.0.1:6633 tcp:${ODL_SYSTEM_IP}:6633
232 ${body} Replace String ${body} 127.0.0.1 ${TOOLS_SYSTEM_IP}
233 ${body} Replace String ${body} br01 ${bridge}
234 ${body} Replace String ${body} 61644 ${OVSDB_PORT}
235 ${node_string} Replace String ${node_string} / %2F
236 ${uri}= Set Variable ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${node_string}%2Fbridge%2F${bridge}
239 ${resp} RequestsLibrary.Put Request session ${uri} data=${body}
240 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
242 Connect Controller To OVSDB Node
243 [Documentation] Initiate the connection to OVSDB node from controller
244 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/connect.json
245 ${sample1} Replace String ${sample} 127.0.0.1 ${TOOLS_SYSTEM_IP}
246 ${body} Replace String ${sample1} 61644 ${OVSDB_PORT}
248 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT} data=${body}
250 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
251 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected
253 Log Config And Operational Topology
254 [Documentation] For debugging purposes, this will log both config and operational topo data stores
255 ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
257 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}
260 Config and Operational Topology Should Be Empty
261 [Documentation] This will check that only the expected output is there for both operational and config
262 ... topology data stores. Empty probably means that only ovsdb:1 is there.
263 ${config_resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
264 ${operational_resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}
265 Should Contain ${config_resp.content} {"topology-id":"ovsdb:1"}
266 Should Contain ${operational_resp.content} {"topology-id":"ovsdb:1"}
268 Modify Multi Port Body
269 [Arguments] ${ovs_1_port_name} ${ovs_2_port_name}
270 [Documentation] these steps are needed multiple times in bug reproductions above.
271 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/bug_7414/create_multiple_ports.json
272 ${ovs_1_ovsdb_uuid}= Get OVSDB UUID ${TOOLS_SYSTEM_IP}
273 ${ovs_2_ovsdb_uuid}= Get OVSDB UUID ${TOOLS_SYSTEM_2_IP}
274 ${body} Replace String ${body} OVS_1_UUID ${ovs_1_ovsdb_uuid}
275 ${body} Replace String ${body} OVS_2_UUID ${ovs_2_ovsdb_uuid}
276 ${body} Replace String ${body} OVS_1_BRIDGE_NAME ${BRIDGE}
277 ${body} Replace String ${body} OVS_2_BRIDGE_NAME ${BRIDGE}
278 ${body} Replace String ${body} OVS_1_IP ${TOOLS_SYSTEM_IP}
279 ${body} Replace String ${body} OVS_2_IP ${TOOLS_SYSTEM_2_IP}
280 ${body} Replace String ${body} OVS_1_PORT_NAME ${ovs_1_port_name}
281 ${body} Replace String ${body} OVS_2_PORT_NAME ${ovs_2_port_name}