43c900c57efac51c9daa23d1b48e7f1d52e4e046
[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 Resource          ../../../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 Update existing Queue entry to a OVSDB Node
178     [Documentation]    This request will update the existing 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/ovsdb:queues/${QUEUE}/
181     Log    data: ${body}
182     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/    data=${body}
183     Log    ${resp.content}
184     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
185
186 Update QOS with a Linked queue entry to a OVSDB Node
187     [Documentation]    This request will update the QOS entry with a Linked queue entry to a OVSDB Node
188     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/update_existingqos.json
189     Log    URL is ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
190     Log    data: ${body}
191     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/    data=${body}
192     Log    ${resp.content}
193     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
194
195 Get QOS Config Topology with port
196     [Documentation]    This will fetch the configuration topology from configuration data store to verify the QOS is added to the data store
197     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
198     Log    ${resp.content}
199     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
200     Should Contain    ${resp.content}    ${QOS}
201
202 Get QOS Operational Topology with port
203     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the QOS is added to the data store
204     @{list}    Create List    ${QOS}
205     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
206
207 Get Queue Config Topology with port
208     [Documentation]    This request will fetch the configuration topology from configuration data store to verify the Queue is added to the data store
209     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
210     Log    ${resp.content}
211     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
212     Should Contain    ${resp.content}    ${QUEUE}
213
214 Get Queue Operational Topology with port
215     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the Queue is added to the data store
216     @{list}    Create List    ${QUEUE}
217     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
218
219 Delete a Queue entry from a Qos entry
220     [Documentation]    This request will Delete a Queue entry from a Qos entry
221     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/queue-list/0/
222     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
223
224 Delete a QoS entry from a node
225     [Documentation]    This request will Delete a QoS entry from a node.
226     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:qos-entries/${QOS}/
227     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
228
229 Delete a Queue entry from an ovsdb node
230     [Documentation]    This request will Delete a Queue entry from an ovsdb node
231     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1/ovsdb:queues/${QUEUE}/
232     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
233
234 Delete the OVSDB Node HOST1
235     [Documentation]    This request will delete the OVSDB node
236     ${resp}    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:HOST1
237     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
238
239 Get Config Topology to verify that deleted configurations are cleaned from config datastore
240     [Documentation]    This request will fetch the configuration topology from configuration data store to verify OVSDB NODE is deleted frrom the configuration data store
241     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
242     Log    ${resp.content}
243     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
244     Should not Contain    ${resp.content}    ovsdb:HOST1
245
246 Check For Bug 4756
247     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
248     ...    case executed.
249     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
250     [Teardown]    Report_Failure_Due_To_Bug    4756
251
252 Check For Bug 4794
253     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
254     ...    case executed.
255     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
256     [Teardown]    Report_Failure_Due_To_Bug    4794
257
258 *** Keywords ***
259 Configure 1 OVSDB Node Suite Setup
260     SetupUtils.Setup_Utils_For_Setup_And_Teardown
261     Open Controller Karaf Console On Background
262     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
263
264 Configure 1 OVSDB Node Suite Teardown
265     [Documentation]    Cleans up test environment, close existing sessions.
266     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
267     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
268     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
269     Log    ${resp.content}
270     Delete All Sessions