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