Adding testcases for Qos and Queue Create/Read/Delete --passivemode
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 010__configure_1_ovsdb_node.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       Configure 1 OVSDB Node Suite Setup
4 Suite Teardown    Configure 1 OVSDB Node Suite Teardown
5 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Force Tags        Southbound
7 Library           OperatingSystem
8 Library           String
9 Library           RequestsLibrary
10 Variables         ../../../variables/Variables.robot
11 Resource          ../../../libraries/SetupUtils.robot
12 Resource          ../../../libraries/Utils.robot
13 Resource          ../../../libraries/OVSDB.robot
14
15 *** Variables ***
16 ${OVSDB_PORT}     6634
17 ${BRIDGE}         ovsdb-csit-test-bridge
18 ${QOS}            QOS-1
19 ${QUEUE}          QUEUE-1
20 ${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
21 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
22 @{node_list}      ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_PORT}
23
24 *** Test Cases ***
25 Make the OVS instance to listen for connection
26     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
27     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_PORT}
28
29 Connect to OVSDB Node
30     [Documentation]    Initiate the connection to OVSDB node from controller
31     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
32     ${sample1}    Replace String    ${sample}    127.0.0.1    ${TOOLS_SYSTEM_IP}
33     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
34     Log    URL is ${SOUTHBOUND_CONFIG_API}
35     Log    data: ${body}
36     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
37     Log    ${resp.content}
38     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
39     Wait Until Keyword Succeeds    5s    1s    Verify OVS Reports Connected
40
41 Get Operational Topology
42     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
43     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
44
45 Create a Bridge
46     [Documentation]    This will create bridge on the specified OVSDB node.
47     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
48     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${ODL_SYSTEM_IP}:6633
49     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${TOOLS_SYSTEM_IP}
50     ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
51     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
52     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
53     Log    data: ${body}
54     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
55     Log    ${resp.content}
56     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
57
58 Get Config Topology with Bridge
59     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
60     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
61     Log    ${resp.content}
62     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
63     Should Contain    ${resp.content}    ${BRIDGE}
64
65 Get Operational Topology with Bridge
66     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
67     @{list}    Create List    ${BRIDGE}
68     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
69
70 Create Port and attach to a Bridge
71     [Documentation]    This request will creates port/interface and attach it to the specific bridge
72     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
73     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
74     Log    data: ${body}
75     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
76     Log    ${resp.content}
77     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
78
79 Get Operational Topology with Port
80     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
81     @{list}    Create List    ${BRIDGE}    vxlanport
82     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
83
84 Delete the Port
85     [Documentation]    This request will delete the port node from the bridge node and data store.
86     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
87     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
88
89 Get Operational Topology after Deletion of Port
90     [Documentation]    This request will fetch the operational topology after the Port is deleted
91     @{list}    Create List    vxlanport
92     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
93
94 Delete the Bridge
95     [Documentation]    This request will delete the bridge node from the config data store.
96     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
97     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
98
99 Get Operational Topology after Deletion of Bridge
100     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
101     @{list}    Create List    ${BRIDGE}    vxlanport
102     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
103
104 Verify Config Still Has OVS Info
105     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
106     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
107     Log    ${resp.content}
108     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
109     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
110
111 Delete the OVSDB Node
112     [Documentation]    This request will delete the OVSDB node
113     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}
114     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
115
116 Get Operational Topology to make sure the connection has been deleted
117     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
118     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
119     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
120
121 Get Configuration Topology to make sure the connection has been deleted
122     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
123     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
124     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/ovsdb:1    ${node_list}
125
126 Reconnect 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}
131     Log    URL is ${SOUTHBOUND_CONFIG_API}
132     Log    data: ${body}
133     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
134     Log    ${resp.content}
135     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
136
137 Get Operational Topology After Node Reconnect
138     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
139     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
140
141 Get Config Topology After Reconnect
142     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
143     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
144     Log    ${resp.content}
145     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
146     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
147
148 Create OVSDB NODE HOST1
149     [Documentation]    This request will create OVSDB NODE HOST1 and attach it to the specific bridge
150     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_node.json
151     ${sample1}    Replace String    ${sample}    127.0.0.1    ${TOOLS_SYSTEM_IP}
152     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
153     Log    URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/
154     Log    data: ${body}
155     ${resp}    RequestsLibrary.Post Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1    data=${body}
156     Log    ${resp.content}
157     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
158
159 Create QOS entry
160     [Documentation]    This request will create QOS entry
161     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_qos.json
162     Log    URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
163     Log    data: ${body}
164     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/    data=${body}
165     Log    ${resp.content}
166     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
167
168 Create Queue entry to the queues list of a ovsdb node
169     [Documentation]    This request will creates Queue entry in the queues list of a ovsdb node
170     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_queue.json
171     Log    URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/
172     Log    data: ${body}
173     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/    data=${body}
174     Log    ${resp.content}
175     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
176
177 Create a QOS and a Linked queue entry to a OVSDB Node
178     [Documentation]    This request will create a QOS and a Linked queue entry to a OVSDB Node
179     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_qoslinkedqueue.json
180     Log    URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1
181     Log    data: ${body}
182     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1    data=${body}
183     Log    ${resp.content}
184     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
185
186 Get QOS Config Topology with port
187     [Documentation]    This will fetch the configuration topology from configuration data store to verify the QOS is added to the data store
188     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
189     Log    ${resp.content}
190     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
191     Should Contain    ${resp.content}    ${QOS}
192
193 Get QOS Operational Topology with port
194     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the QOS is added to the data store
195     @{list}    Create List    ${QOS}
196     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
197
198 Get Queue Config Topology with port
199     [Documentation]    This request will fetch the configuration topology from configuration data store to verify the Queue is added to the data store
200     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
201     Log    ${resp.content}
202     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
203     Should Contain    ${resp.content}    ${QUEUE}
204
205 Get Queue Operational Topology with port
206     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the Queue is added to the data store
207     @{list}    Create List    ${QUEUE}
208     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
209
210 Delete a Queue entry from a Qos entry
211     [Documentation]    This request will Delete a Queue entry from a Qos entry
212     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/queue-list/0/
213     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
214
215 Delete a QoS entry from a node
216     [Documentation]    This request will Delete a QoS entry from a node.
217     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
218     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
219
220 Delete a Queue entry from an ovsdb node
221     [Documentation]    This request will Delete a Queue entry from an ovsdb node
222     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/
223     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
224
225 Delete the OVSDB Node HOST1
226     [Documentation]    This request will delete the OVSDB node
227     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1
228     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
229
230 Get Config Topology to verify that deleted configurations are cleaned from config datastore
231     [Documentation]    This request will fetch the configuration topology from configuration data store to verify OVSDB NODE is deleted frrom the configuration data store
232     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
233     Log    ${resp.content}
234     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
235     Should not Contain    ${resp.content}    ovsdb:HOST1
236
237 Check For Bug 4756
238     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
239     ...    case executed.
240     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
241     [Teardown]    Report_Failure_Due_To_Bug    4756
242
243 Check For Bug 4794
244     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
245     ...    case executed.
246     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
247     [Teardown]    Report_Failure_Due_To_Bug    4794
248
249 *** Keywords ***
250 Configure 1 OVSDB Node Suite Setup
251     SetupUtils.Setup_Utils_For_Setup_And_Teardown
252     Open Controller Karaf Console On Background
253     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
254
255 Configure 1 OVSDB Node Suite Teardown
256     [Documentation]    Cleans up test environment, close existing sessions.
257     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
258     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
259     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
260     Log    ${resp.content}
261     Delete All Sessions