Correctly space expected_status
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 010__configure_1_ovsdb_node.robot
1 *** Settings ***
2 Documentation       Test suite for Connection Manager
3
4 Library             OperatingSystem
5 Library             RequestsLibrary
6 Resource            ../../../libraries/OVSDB.robot
7 Resource            ../../../libraries/SetupUtils.robot
8 Resource            ../../../libraries/Utils.robot
9 Resource            ../../../variables/Variables.robot
10 Resource            ../../../variables/ovsdb/Variables.robot
11
12 Suite Setup         OVSDB.Suite Setup
13 Suite Teardown      Suite Teardown
14 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
15
16 Force Tags          southbound
17
18
19 *** Variables ***
20 ${BRIDGE}       ovsconf_br
21 ${PORT}         ovsconf_vx1
22 ${QOS}          QOS-1
23 ${QUEUE}        QUEUE-1
24 @{NODE_LIST}    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_NODE_PORT}
25
26
27 *** Test Cases ***
28 Make the OVS instance to listen for connection
29     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
30     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
31
32 Connect to OVSDB Node
33     [Documentation]    Initiate the connection to OVSDB node from controller
34     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
35     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
36
37 Get Operational Topology
38     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
39     BuiltIn.Wait Until Keyword Succeeds
40     ...    8s
41     ...    2s
42     ...    Utils.Check For Elements At URI
43     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
44     ...    ${NODE_LIST}
45     ...    pretty_print_json=True
46
47 Create a Bridge
48     [Documentation]    This will create bridge on the specified OVSDB node.
49     OVSDB.Add Bridge To Ovsdb Node
50     ...    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
51     ...    ${TOOLS_SYSTEM_IP}
52     ...    ${BRIDGE}
53     ...    0000000000000040
54
55 Get Config Topology with Bridge
56     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
57     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
58     OVSDB.Log Request    ${resp.text}
59     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
60     BuiltIn.Should Contain    ${resp.text}    ${BRIDGE}
61
62 Get Operational Topology with Bridge
63     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
64     @{list} =    BuiltIn.Create List    ${BRIDGE}
65     BuiltIn.Wait Until Keyword Succeeds
66     ...    8s
67     ...    2s
68     ...    Utils.Check For Elements At URI
69     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
70     ...    ${list}
71     ...    pretty_print_json=True
72
73 Create Port and Attach to a Bridge
74     [Documentation]    This request will creates port/interface and attach it to the specific bridge
75     OVSDB.Add Termination Point    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${BRIDGE}    ${PORT}    10.0.0.10
76
77 Get Operational Topology with Port
78     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
79     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
80     BuiltIn.Wait Until Keyword Succeeds
81     ...    8s
82     ...    2s
83     ...    Utils.Check For Elements At URI
84     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
85     ...    ${list}
86     ...    pretty_print_json=True
87
88 Delete the Port
89     [Documentation]    This request will delete the port node from the bridge node and data store.
90     ${resp} =    RequestsLibrary.Delete Request
91     ...    session
92     ...    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}/termination-point=${PORT}
93     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
94
95 Get Operational Topology after Deletion of Port
96     [Documentation]    This request will fetch the operational topology after the Port is deleted
97     @{list} =    BuiltIn.Create List    ${PORT}
98     BuiltIn.Wait Until Keyword Succeeds
99     ...    8s
100     ...    2s
101     ...    Utils.Check For Elements Not At URI
102     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
103     ...    ${list}
104     ...    pretty_print_json=True
105
106 Delete the Bridge
107     [Documentation]    This request will delete the bridge node from the config data store.
108     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}
109     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
110
111 Get Operational Topology after Deletion of Bridge
112     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
113     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
114     BuiltIn.Wait Until Keyword Succeeds
115     ...    8s
116     ...    2s
117     ...    Utils.Check For Elements Not At URI
118     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
119     ...    ${list}
120     ...    pretty_print_json=True
121
122 Verify Config Still Has OVS Info
123     [Documentation]    This will fetch the configuration topology from configuration data store to verify the node is still in the data store
124     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
125     OVSDB.Log Request    ${resp.text}
126     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
127     BuiltIn.Wait Until Keyword Succeeds
128     ...    8s
129     ...    2s
130     ...    Utils.Check For Elements At URI
131     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
132     ...    ${NODE_LIST}
133     ...    pretty_print_json=True
134
135 Delete the OVSDB Node
136     [Documentation]    This request will delete the OVSDB node
137     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
138     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
139
140 Get Operational Topology to make sure the connection has been deleted
141     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
142     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
143     BuiltIn.Wait Until Keyword Succeeds
144     ...    8s
145     ...    2s
146     ...    Utils.Check For Elements Not At URI
147     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
148     ...    ${list}
149     ...    pretty_print_json=True
150
151 Get Configuration Topology to make sure the connection has been deleted
152     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
153     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
154     BuiltIn.Wait Until Keyword Succeeds
155     ...    8s
156     ...    2s
157     ...    Utils.Check For Elements Not At URI
158     ...    ${RFC8040_CONFIG_TOPO_OVSDB1_API}
159     ...    ${list}
160     ...    pretty_print_json=True
161
162 Reconnect to OVSDB Node
163     [Documentation]    Initiate the connection to OVSDB node from controller
164     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
165
166 Get Operational Topology After Node Reconnect
167     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
168     BuiltIn.Wait Until Keyword Succeeds
169     ...    8s
170     ...    2s
171     ...    Utils.Check For Elements At URI
172     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
173     ...    ${NODE_LIST}
174     ...    pretty_print_json=True
175
176 Get Config Topology After Reconnect
177     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
178     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
179     OVSDB.Log Request    ${resp.text}
180     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
181     BuiltIn.Wait Until Keyword Succeeds
182     ...    8s
183     ...    2s
184     ...    Utils.Check For Elements At URI
185     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
186     ...    ${NODE_LIST}
187     ...    pretty_print_json=True
188
189 Create OVSDB NODE HOST1
190     [Documentation]    This request will create OVSDB NODE HOST1
191     OVSDB.Create Ovsdb Node    ${TOOLS_SYSTEM_IP}
192
193 Create QOS entry
194     [Documentation]    This request will create QOS entry
195     OVSDB.Create Qos    ${QOS}
196
197 Create Queue entry to the queues list of a ovsdb node
198     [Documentation]    This request will creates Queue entry in the queues list of a ovsdb node
199     OVSDB.Create Queue    ${QUEUE}
200
201 Update existing Queue entry to a OVSDB Node
202     [Documentation]    This request will update the existing queue entry to a OVSDB Node
203     OVSDB.Create Queue    ${queue}
204
205 Update QOS with a Linked queue entry to a OVSDB Node
206     [Documentation]    This request will update the QOS entry with a Linked queue entry to a OVSDB Node
207     OVSDB.Update Qos    ${QOS}
208
209 Get QOS Config Topology with port
210     [Documentation]    This will fetch the configuration topology from configuration data store to verify the QOS is added to the data store
211     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
212     OVSDB.Log Request    ${resp.text}
213     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
214     BuiltIn.Should Contain    ${resp.text}    ${QOS}
215
216 Get QOS Operational Topology with port
217     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the QOS is added to the data store
218     @{list} =    BuiltIn.Create List    ${QOS}
219     BuiltIn.Wait Until Keyword Succeeds
220     ...    8s
221     ...    2s
222     ...    Utils.Check For Elements At URI
223     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
224     ...    ${list}
225     ...    pretty_print_json=True
226
227 Get Queue Config Topology with port
228     [Documentation]    This request will fetch the configuration topology from configuration data store to verify the Queue is added to the data store
229     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
230     OVSDB.Log Request    ${resp.text}
231     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
232     BuiltIn.Should Contain    ${resp.text}    ${QUEUE}
233
234 Get Queue Operational Topology with port
235     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the Queue is added to the data store
236     @{list} =    BuiltIn.Create List    ${QUEUE}
237     BuiltIn.Wait Until Keyword Succeeds
238     ...    8s
239     ...    2s
240     ...    Utils.Check For Elements At URI
241     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
242     ...    ${list}
243     ...    pretty_print_json=True
244
245 Delete a Queue entry from a Qos entry
246     [Documentation]    This request will Delete a Queue entry from a Qos entry
247     ${resp} =    RequestsLibrary.Delete Request
248     ...    session
249     ...    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}/queue-list=0
250     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
251
252 Delete a QoS entry from a node
253     [Documentation]    This request will Delete a QoS entry from a node.
254     ${resp} =    RequestsLibrary.Delete Request
255     ...    session
256     ...    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}
257     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
258
259 Delete a Queue entry from an ovsdb node
260     [Documentation]    This request will Delete a Queue entry from an ovsdb node
261     ${resp} =    RequestsLibrary.Delete Request
262     ...    session
263     ...    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:queues=${QUEUE}
264     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
265
266 Delete the OVSDB Node HOST1
267     [Documentation]    This request will delete the OVSDB node
268     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}
269     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
270
271 Get Config Topology to verify that deleted configurations are cleaned from config datastore
272     [Documentation]    This request will fetch the configuration topology from configuration data store to verify OVSDB NODE is deleted frrom the configuration data store
273     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
274     OVSDB.Log Request    ${resp.text}
275     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
276     BuiltIn.Should Not Contain    ${resp.text}    ovsdb:HOST1
277
278 Check For Bug 4756
279     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
280     ...    case executed.
281     Utils.Check Karaf Log File Does Not Have Messages
282     ...    ${ODL_SYSTEM_IP}
283     ...    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
284     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
285
286 Check For Bug 4794
287     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
288     ...    case executed.
289     Utils.Check Karaf Log File Does Not Have Messages
290     ...    ${ODL_SYSTEM_IP}
291     ...    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
292     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
293
294
295 *** Keywords ***
296 Suite Teardown
297     [Documentation]    Cleans up test environment, close existing sessions.
298     @{uris} =    Builtin.Create List    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
299     OVSDB.Suite Teardown    ${uris}