Use RFC8040 URL for OVSDB tests
[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       OVSDB.Suite Setup
4 Suite Teardown    Suite Teardown
5 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Force Tags        Southbound
7 Library           OperatingSystem
8 Library           RequestsLibrary
9 Resource          ../../../libraries/OVSDB.robot
10 Resource          ../../../libraries/SetupUtils.robot
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../variables/Variables.robot
13 Resource          ../../../variables/ovsdb/Variables.robot
14
15 *** Variables ***
16 ${BRIDGE}         ovsconf_br
17 ${PORT}           ovsconf_vx1
18 ${QOS}            QOS-1
19 ${QUEUE}          QUEUE-1
20 @{NODE_LIST}      ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_NODE_PORT}
21
22 *** Test Cases ***
23 Make the OVS instance to listen for connection
24     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
25     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
26
27 Connect to OVSDB Node
28     [Documentation]    Initiate the connection to OVSDB node from controller
29     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
30     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
31
32 Get Operational Topology
33     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
34     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${NODE_LIST}    pretty_print_json=True
35
36 Create a Bridge
37     [Documentation]    This will create bridge on the specified OVSDB node.
38     OVSDB.Add Bridge To Ovsdb Node    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${BRIDGE}    0000000000000040
39
40 Get Config Topology with Bridge
41     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
42     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
43     OVSDB.Log Request    ${resp.text}
44     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
45     BuiltIn.Should Contain    ${resp.text}    ${BRIDGE}
46
47 Get Operational Topology with Bridge
48     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
49     @{list} =    BuiltIn.Create List    ${BRIDGE}
50     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
51
52 Create Port and Attach to a Bridge
53     [Documentation]    This request will creates port/interface and attach it to the specific bridge
54     OVSDB.Add Termination Point    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${BRIDGE}    ${PORT}    10.0.0.10
55
56 Get Operational Topology with Port
57     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
58     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
59     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
60
61 Delete the Port
62     [Documentation]    This request will delete the port node from the bridge node and data store.
63     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}/termination-point=${PORT}
64     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
65
66 Get Operational Topology after Deletion of Port
67     [Documentation]    This request will fetch the operational topology after the Port is deleted
68     @{list} =    BuiltIn.Create List    ${PORT}
69     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements Not At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
70
71 Delete the Bridge
72     [Documentation]    This request will delete the bridge node from the config data store.
73     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}%2Fbridge%2F${BRIDGE}
74     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
75
76 Get Operational Topology after Deletion of Bridge
77     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
78     @{list} =    BuiltIn.Create List    ${BRIDGE}    ${PORT}
79     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements Not At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
80
81 Verify Config Still Has OVS Info
82     [Documentation]    This will fetch the configuration topology from configuration data store to verify the node is still in the data store
83     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
84     OVSDB.Log Request    ${resp.text}
85     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
86     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${NODE_LIST}    pretty_print_json=True
87
88 Delete the OVSDB Node
89     [Documentation]    This request will delete the OVSDB node
90     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
91     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
92
93 Get Operational Topology to make sure the connection has been deleted
94     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
95     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
96     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements Not At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
97
98 Get Configuration Topology to make sure the connection has been deleted
99     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
100     @{list} =    BuiltIn.Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}
101     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements Not At URI    ${RFC8040_CONFIG_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
102
103 Reconnect to OVSDB Node
104     [Documentation]    Initiate the connection to OVSDB node from controller
105     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
106
107 Get Operational Topology After Node Reconnect
108     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
109     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${NODE_LIST}    pretty_print_json=True
110
111 Get Config Topology After Reconnect
112     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
113     ${resp}    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
114     OVSDB.Log Request    ${resp.text}
115     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
116     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${NODE_LIST}    pretty_print_json=True
117
118 Create OVSDB NODE HOST1
119     [Documentation]    This request will create OVSDB NODE HOST1
120     OVSDB.Create Ovsdb Node    ${TOOLS_SYSTEM_IP}
121
122 Create QOS entry
123     [Documentation]    This request will create QOS entry
124     OVSDB.Create Qos    ${QOS}
125
126 Create Queue entry to the queues list of a ovsdb node
127     [Documentation]    This request will creates Queue entry in the queues list of a ovsdb node
128     OVSDB.Create Queue    ${QUEUE}
129
130 Update existing Queue entry to a OVSDB Node
131     [Documentation]    This request will update the existing queue entry to a OVSDB Node
132     OVSDB.Create Queue    ${queue}
133
134 Update QOS with a Linked queue entry to a OVSDB Node
135     [Documentation]    This request will update the QOS entry with a Linked queue entry to a OVSDB Node
136     OVSDB.Update Qos    ${QOS}
137
138 Get QOS Config Topology with port
139     [Documentation]    This will fetch the configuration topology from configuration data store to verify the QOS is added to the data store
140     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
141     OVSDB.Log Request    ${resp.text}
142     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
143     BuiltIn.Should Contain    ${resp.text}    ${QOS}
144
145 Get QOS Operational Topology with port
146     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the QOS is added to the data store
147     @{list} =    BuiltIn.Create List    ${QOS}
148     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
149
150 Get Queue Config Topology with port
151     [Documentation]    This request will fetch the configuration topology from configuration data store to verify the Queue is added to the data store
152     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
153     OVSDB.Log Request    ${resp.text}
154     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
155     BuiltIn.Should Contain    ${resp.text}    ${QUEUE}
156
157 Get Queue Operational Topology with port
158     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the Queue is added to the data store
159     @{list} =    BuiltIn.Create List    ${QUEUE}
160     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}    ${list}    pretty_print_json=True
161
162 Delete a Queue entry from a Qos entry
163     [Documentation]    This request will Delete a Queue entry from a Qos entry
164     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}/queue-list=0
165     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
166
167 Delete a QoS entry from a node
168     [Documentation]    This request will Delete a QoS entry from a node.
169     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:qos-entries=${QOS}
170     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
171
172 Delete a Queue entry from an ovsdb node
173     [Documentation]    This request will Delete a Queue entry from an ovsdb node
174     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}/ovsdb:queues=${QUEUE}
175     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
176
177 Delete the OVSDB Node HOST1
178     [Documentation]    This request will delete the OVSDB node
179     ${resp} =    RequestsLibrary.Delete Request    session    ${RFC8040_SOUTHBOUND_NODE_HOST1_API}
180     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
181
182 Get Config Topology to verify that deleted configurations are cleaned from config datastore
183     [Documentation]    This request will fetch the configuration topology from configuration data store to verify OVSDB NODE is deleted frrom the configuration data store
184     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
185     OVSDB.Log Request    ${resp.text}
186     BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
187     BuiltIn.Should Not Contain    ${resp.text}    ovsdb:HOST1
188
189 Check For Bug 4756
190     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
191     ...    case executed.
192     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
193     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
194
195 Check For Bug 4794
196     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
197     ...    case executed.
198     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
199     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
200
201 *** Keywords ***
202 Suite Teardown
203     [Documentation]    Cleans up test environment, close existing sessions.
204     @{uris} =    Builtin.Create List    ${RFC8040_SOUTHBOUND_NODE_TOOLS_API}
205     OVSDB.Suite Teardown    ${uris}