Migrate Get Requests invocations(libraries)
[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 On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
58     Utils.Log Content    ${resp.text}
59     BuiltIn.Should Contain    ${resp.text}    ${BRIDGE}
60
61 Get Operational Topology with Bridge
62     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
63     @{list} =    BuiltIn.Create List    ${BRIDGE}
64     BuiltIn.Wait Until Keyword Succeeds
65     ...    8s
66     ...    2s
67     ...    Utils.Check For Elements At URI
68     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
69     ...    ${list}
70     ...    pretty_print_json=True
71
72 Create Port and Attach to a Bridge
73     [Documentation]    This request will creates port/interface and attach it to the specific bridge
74     OVSDB.Add Termination Point    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${BRIDGE}    ${PORT}    10.0.0.10
75
76 Get Operational Topology with Port
77     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
78     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
79     BuiltIn.Wait Until Keyword Succeeds
80     ...    8s
81     ...    2s
82     ...    Utils.Check For Elements At URI
83     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
84     ...    ${list}
85     ...    pretty_print_json=True
86
87 Delete the Port
88     [Documentation]    This request will delete the port node from the bridge node and data store.
89     RequestsLibrary.DELETE On Session
90     ...    session
91     ...    url=${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}/termination-point=${PORT}
92     ...    expected_status=204
93
94 Get Operational Topology after Deletion of Port
95     [Documentation]    This request will fetch the operational topology after the Port is deleted
96     @{list} =    BuiltIn.Create List    ${PORT}
97     BuiltIn.Wait Until Keyword Succeeds
98     ...    8s
99     ...    2s
100     ...    Utils.Check For Elements Not At URI
101     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
102     ...    ${list}
103     ...    pretty_print_json=True
104
105 Delete the Bridge
106     [Documentation]    This request will delete the bridge node from the config data store.
107     RequestsLibrary.DELETE On Session
108     ...    session
109     ...    url=${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}
110     ...    expected_status=204
111
112 Get Operational Topology after Deletion of Bridge
113     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
114     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
115     BuiltIn.Wait Until Keyword Succeeds
116     ...    8s
117     ...    2s
118     ...    Utils.Check For Elements Not At URI
119     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
120     ...    ${list}
121     ...    pretty_print_json=True
122
123 Verify Config Still Has OVS Info
124     [Documentation]    This will fetch the configuration topology from configuration data store to verify the node is still in the data store
125     ${resp} =    RequestsLibrary.GET On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
126     Utils.Log Content    ${resp.text}
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     RequestsLibrary.DELETE On Session    session    url=${RFC8040_SOUTHBOUND_NODE_TOOLS_API}    expected_status=204
138
139 Get Operational Topology to make sure the connection has been deleted
140     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
141     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
142     BuiltIn.Wait Until Keyword Succeeds
143     ...    8s
144     ...    2s
145     ...    Utils.Check For Elements Not At URI
146     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
147     ...    ${list}
148     ...    pretty_print_json=True
149
150 Get Configuration Topology to make sure the connection has been deleted
151     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
152     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
153     BuiltIn.Wait Until Keyword Succeeds
154     ...    8s
155     ...    2s
156     ...    Utils.Check For Elements Not At URI
157     ...    ${RFC8040_CONFIG_TOPO_OVSDB1_API}
158     ...    ${list}
159     ...    pretty_print_json=True
160
161 Reconnect to OVSDB Node
162     [Documentation]    Initiate the connection to OVSDB node from controller
163     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
164
165 Get Operational Topology After Node Reconnect
166     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
167     BuiltIn.Wait Until Keyword Succeeds
168     ...    8s
169     ...    2s
170     ...    Utils.Check For Elements At URI
171     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
172     ...    ${NODE_LIST}
173     ...    pretty_print_json=True
174
175 Get Config Topology After Reconnect
176     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
177     ${resp} =    RequestsLibrary.GET On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
178     Utils.Log Content    ${resp.text}
179     BuiltIn.Wait Until Keyword Succeeds
180     ...    8s
181     ...    2s
182     ...    Utils.Check For Elements At URI
183     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
184     ...    ${NODE_LIST}
185     ...    pretty_print_json=True
186
187 Create OVSDB NODE HOST1
188     [Documentation]    This request will create OVSDB NODE HOST1
189     OVSDB.Create Ovsdb Node    ${TOOLS_SYSTEM_IP}
190
191 Create QOS entry
192     [Documentation]    This request will create QOS entry
193     OVSDB.Create Qos    ${QOS}
194
195 Create Queue entry to the queues list of a ovsdb node
196     [Documentation]    This request will creates Queue entry in the queues list of a ovsdb node
197     OVSDB.Create Queue    ${QUEUE}
198
199 Update existing Queue entry to a OVSDB Node
200     [Documentation]    This request will update the existing queue entry to a OVSDB Node
201     OVSDB.Create Queue    ${queue}
202
203 Update QOS with a Linked queue entry to a OVSDB Node
204     [Documentation]    This request will update the QOS entry with a Linked queue entry to a OVSDB Node
205     OVSDB.Update Qos    ${QOS}
206
207 Get QOS Config Topology with port
208     [Documentation]    This will fetch the configuration topology from configuration data store to verify the QOS is added to the data store
209     ${resp} =    RequestsLibrary.GET On Session
210     ...    session
211     ...    url=${RFC8040_CONFIG_TOPO_API}
212     ...    expected_status=anything
213     Utils.Log Content    ${resp.text}
214     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
215     BuiltIn.Should Contain    ${resp.text}    ${QOS}
216
217 Get QOS Operational Topology with port
218     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the QOS is added to the data store
219     @{list} =    BuiltIn.Create List    ${QOS}
220     BuiltIn.Wait Until Keyword Succeeds
221     ...    8s
222     ...    2s
223     ...    Utils.Check For Elements At URI
224     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
225     ...    ${list}
226     ...    pretty_print_json=True
227
228 Get Queue Config Topology with port
229     [Documentation]    This request will fetch the configuration topology from configuration data store to verify the Queue is added to the data store
230     ${resp} =    RequestsLibrary.GET On Session
231     ...    session
232     ...    url=${RFC8040_CONFIG_TOPO_API}
233     ...    expected_status=anything
234     Utils.Log Content    ${resp.text}
235     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
236     BuiltIn.Should Contain    ${resp.text}    ${QUEUE}
237
238 Get Queue Operational Topology with port
239     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the Queue is added to the data store
240     @{list} =    BuiltIn.Create List    ${QUEUE}
241     BuiltIn.Wait Until Keyword Succeeds
242     ...    8s
243     ...    2s
244     ...    Utils.Check For Elements At URI
245     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
246     ...    ${list}
247     ...    pretty_print_json=True
248
249 Delete a Queue entry from a Qos entry
250     [Documentation]    This request will Delete a Queue entry from a Qos entry
251     ${resp} =    RequestsLibrary.DELETE On Session
252     ...    session
253     ...    url=${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}/queue-list=0
254     ...    expected_status=anything
255     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
256
257 Delete a QoS entry from a node
258     [Documentation]    This request will Delete a QoS entry from a node.
259     ${resp} =    RequestsLibrary.DELETE On Session
260     ...    session
261     ...    url=${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}
262     ...    expected_status=anything
263     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
264
265 Delete a Queue entry from an ovsdb node
266     [Documentation]    This request will Delete a Queue entry from an ovsdb node
267     ${resp} =    RequestsLibrary.DELETE On Session
268     ...    session
269     ...    url=${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:queues=${QUEUE}
270     ...    expected_status=anything
271     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
272
273 Delete the OVSDB Node HOST1
274     [Documentation]    This request will delete the OVSDB node
275     ${resp} =    RequestsLibrary.DELETE On Session
276     ...    session
277     ...    url=${RFC8040_SOUTHBOUND_NODE_HOST1_API}
278     ...    expected_status=anything
279     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
280
281 Get Config Topology to verify that deleted configurations are cleaned from config datastore
282     [Documentation]    This request will fetch the configuration topology from configuration data store to verify OVSDB NODE is deleted frrom the configuration data store
283     ${resp} =    RequestsLibrary.GET On Session
284     ...    session
285     ...    url=${RFC8040_CONFIG_TOPO_API}
286     ...    expected_status=anything
287     Utils.Log Content    ${resp.text}
288     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
289     BuiltIn.Should Not Contain    ${resp.text}    ovsdb:HOST1
290
291 Check For Bug 4756
292     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
293     ...    case executed.
294     Utils.Check Karaf Log File Does Not Have Messages
295     ...    ${ODL_SYSTEM_IP}
296     ...    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
297     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
298
299 Check For Bug 4794
300     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
301     ...    case executed.
302     Utils.Check Karaf Log File Does Not Have Messages
303     ...    ${ODL_SYSTEM_IP}
304     ...    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
305     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
306
307
308 *** Keywords ***
309 Suite Teardown
310     [Documentation]    Cleans up test environment, close existing sessions.
311     @{uris} =    Builtin.Create List    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
312     OVSDB.Suite Teardown    ${uris}