2 Documentation Collection of test cases to validate OVSDB projects bugs.
3 ... - https://bugs.opendaylight.org/show_bug.cgi?id=5221
4 ... - https://bugs.opendaylight.org/show_bug.cgi?id=5177
5 ... - https://bugs.opendaylight.org/show_bug.cgi?id=4794
6 Suite Setup OVSDB Connection Manager Suite Setup
7 Suite Teardown OVSDB Connection Manager Suite Teardown
8 Test Setup Log Testcase Start To Controller Karaf
10 Library OperatingSystem
12 Library RequestsLibrary
13 Variables ../../../variables/Variables.py
14 Resource ../../../libraries/Utils.robot
15 Resource ../../../libraries/WaitForFailure.robot
16 Resource ../../../libraries/OVSDB.robot
20 ${BRIDGE} ovsdb-csit-test-5177
21 ${SOUTHBOUND_CONFIG_API} ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
22 ${OVSDB_CONFIG_DIR} ${CURDIR}/../../../variables/ovsdb
26 [Documentation] In the case that an ovs node is rebooted, or the ovs service is
27 ... otherwise restarted, a controller initiated connection should reconnect when
28 ... the ovs is ready and available.
29 [Setup] Clean OVSDB Test Environment
30 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager ptcp:${OVSDB_PORT}
31 Connect Controller To OVSDB Node
32 @{list} Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
33 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
34 Create Bridge ${TOOLS_SYSTEM_IP}:6634 ${BRIDGE}
35 @{list} Create List ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}/bridge/${BRIDGE}
36 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
37 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl stop
38 Wait Until Keyword Succeeds 8s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
39 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo /usr/share/openvswitch/scripts/ovs-ctl start
40 # Depending on when the retry timers are firing, it may take some 10s of seconds to reconnect, so setting to 30 to cover that.
41 Wait Until Keyword Succeeds 30s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
42 [Teardown] Run Keywords Clean OVSDB Test Environment
43 ... AND Report_Failure_Due_To_Bug 5221
46 [Documentation] This test case will recreate the bug using the same basic steps as
47 ... provided in the bug, and noted here:
48 ... 1) create bridge in config using the UUID determined in Suite Setup
49 ... 2) connect ovs (vsctl set-manager)
50 ... 3) Fail if node is not discovered in Operational Store
51 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
52 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected
53 ${ovsdb_uuid}= Get OVSDB UUID ${TOOLS_SYSTEM_IP}
54 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
55 # Suite teardown wants this ${ovsdb_uuid} variable for it's best effort cleanup, so making it visible at suite level.
56 Set Suite Variable ${ovsdb_uuid}
57 ${node} Set Variable uuid/${ovsdb_uuid}
58 Create Bridge ${node} ${BRIDGE}
59 ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
61 Should Be Equal As Strings ${resp.status_code} 200 Response status code error
62 Should Contain ${resp.content} ${node}/bridge/${BRIDGE}
63 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
64 @{list} Create List ${BRIDGE}
65 Wait Until Keyword Succeeds 8s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API}/topology/ovsdb:1 ${list}
66 [Teardown] Run Keywords Clean OVSDB Test Environment
67 ... AND Report_Failure_Due_To_Bug 5177
70 [Documentation] This test is dependent on the work done in the Bug 5177 test case so should
71 ... always be executed immediately after.
72 ... 1) delete bridge in config
73 ... 2) Poll and Fail if exception is seen in karaf.log
74 ${node} Set Variable ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
75 ${resp} RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
76 Should Be Equal As Strings ${resp.status_code} 200 Response status code error
77 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
78 # If the exception is seen in karaf.log within 10s, the following line will FAIL, which is the point.
79 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
81 [Teardown] Run Keywords Clean OVSDB Test Environment
82 ... AND Report_Failure_Due_To_Bug 4794
85 OVSDB Connection Manager Suite Setup
86 Open Controller Karaf Console On Background
87 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
88 Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
89 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
90 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected
91 Run Command On Remote System ${TOOLS_SYSTEM_IP} sudo ovs-vsctl del-manager
93 OVSDB Connection Manager Suite Teardown
94 [Documentation] Cleans up test environment, close existing sessions.
95 Clean OVSDB Test Environment ${TOOLS_SYSTEM_IP}
96 # Best effort to clean config store, by deleting all the types of nodes that are used in this suite
97 ${node} Set Variable ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}
98 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
99 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
100 ${node} Set Variable ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
101 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}
102 RequestsLibrary.Delete Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/${node}%2Fbridge%2F${BRIDGE}
103 ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API}
106 # TODO: both Create Bridge and Connect Controller To OVSDB Node keywords below should be moved to a library
107 # and all the suites using this kind of work can move to using the library instead of
108 # doing all this work each time.
111 [Arguments] ${node_string} ${bridge}
112 [Documentation] This will create bridge on the specified OVSDB node.
113 ${body} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/create_bridge.json
114 ${body} Replace String ${body} ovsdb://127.0.0.1:61644 ovsdb://${node_string}
115 ${body} Replace String ${body} tcp:127.0.0.1:6633 tcp:${ODL_SYSTEM_IP}:6633
116 ${body} Replace String ${body} 127.0.0.1 ${TOOLS_SYSTEM_IP}
117 ${body} Replace String ${body} br01 ${bridge}
118 ${body} Replace String ${body} 61644 ${OVSDB_PORT}
119 ${node_string} Replace String ${node_string} / %2F
120 ${uri}= Set Variable ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${node_string}%2Fbridge%2F${bridge}
123 ${resp} RequestsLibrary.Put Request session ${uri} data=${body}
124 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
126 Connect Controller To OVSDB Node
127 [Documentation] Initiate the connection to OVSDB node from controller
128 ${sample} OperatingSystem.Get File ${OVSDB_CONFIG_DIR}/connect.json
129 ${sample1} Replace String ${sample} 127.0.0.1 ${TOOLS_SYSTEM_IP}
130 ${body} Replace String ${sample1} 61644 ${OVSDB_PORT}
132 ${resp} RequestsLibrary.Put Request session ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT} data=${body}
134 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
135 Wait Until Keyword Succeeds 5s 1s Verify OVS Reports Connected