Correctly space expected_status
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 020__connection_manager.robot
1 *** Settings ***
2 Documentation       Test suite for Connection Manager
3
4 Library             RequestsLibrary
5 Resource            ../../../libraries/SetupUtils.robot
6 Resource            ../../../libraries/Utils.robot
7 Resource            ../../../libraries/OVSDB.robot
8 Resource            ../../../variables/Variables.robot
9 Resource            ../../../variables/ovsdb/Variables.robot
10
11 Suite Setup         OVSDB.Suite Setup
12 Suite Teardown      Suite Teardown
13 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
14
15 Force Tags          southbound
16
17
18 *** Variables ***
19 ${BRIDGE1}          ovscon_br1
20 ${BRIDGE2}          ovscon_br2
21 @{NODE_LIST}        ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_NODE_PORT}
22 ${OVSDB_UUID}       ${EMPTY}
23
24
25 *** Test Cases ***
26 Connecting an OVS instance to the controller
27     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
28     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
29     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
30
31 Get Operational Topology to verify the ovs instance is connected to the controller
32     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
33     @{list} =    BuiltIn.Create List    ovsdb://uuid    "remote-ip":"${TOOLS_SYSTEM_IP}"    "local-port":${OVSDBPORT}
34     BuiltIn.Wait Until Keyword Succeeds
35     ...    8s
36     ...    2s
37     ...    Utils.Check For Elements At URI
38     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
39     ...    ${list}
40     ...    pretty_print_json=True
41     ${OVSDB_UUID} =    OVSDB.Get OVSDB UUID    ${TOOLS_SYSTEM_IP}
42     BuiltIn.Set Suite Variable    ${OVSDB_UUID}
43
44 Verify OVS Not In Config Topology
45     [Documentation]    This request will fetch the configuration topology from configuration data store
46     Utils.Check For Elements Not At URI    ${RFC8040_CONFIG_TOPO_API}    ${NODE_LIST}    pretty_print_json=True
47
48 Create bridge manually
49     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br ${BRIDGE1}
50
51 Get Operational Topology to verify the bridge has been added
52     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
53     @{list} =    BuiltIn.Create List    ${BRIDGE1}
54     BuiltIn.Wait Until Keyword Succeeds
55     ...    8s
56     ...    2s
57     ...    Utils.Check For Elements At URI
58     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
59     ...    ${list}
60     ...    pretty_print_json=True
61
62 Get Config Topology to verify the manually added bridge is not added to the config datastore
63     [Documentation]    This request will fetch the configuration topology from configuration data store
64     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
65     OVSDB.Log Request    ${resp.text}
66     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
67     BuiltIn.Should Not Contain    ${resp.text}    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}/bridge/${BRIDGE1}
68
69 Create a Bridge through controller
70     [Documentation]    This will create bridge on the specified OVSDB node.
71     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE2}    0000000000000002
72
73 Get Operational Topology to verify the bridge has been added through rest call
74     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
75     @{list} =    BuiltIn.Create List    ${BRIDGE2}
76     BuiltIn.Wait Until Keyword Succeeds
77     ...    8s
78     ...    2s
79     ...    Utils.Check For Elements At URI
80     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
81     ...    ${list}
82     ...    pretty_print_json=True
83
84 Get Config Topology to verify the entry added to the config datastore
85     [Documentation]    This request will fetch the configuration topology from configuration data store
86     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
87     OVSDB.Log Request    ${resp.text}
88     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
89     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
90
91 Create bridge of already added bridge
92     [Documentation]    This will add bridge to the config datastore
93     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE1}    0000000000000001
94
95 Get Config Topology to verify the entry of existing bridge added to the config datastore
96     [Documentation]    This request will fetch the configuration topology from configuration data store
97     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
98     OVSDB.Log Request    ${resp.text}
99     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
100     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE1}
101
102 Delete bridge manually
103     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-br ${BRIDGE2}
104
105 Get Operational Topology to verify the bridge has been deleted manually
106     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
107     @{list} =    BuiltIn.Create List    ${BRIDGE2}
108     BuiltIn.Wait Until Keyword Succeeds
109     ...    8s
110     ...    2s
111     ...    Utils.Check For Elements Not At URI
112     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
113     ...    ${list}
114     ...    pretty_print_json=True
115
116 Config Topology Still Contains Bridge
117     [Documentation]    This request will fetch the configuration topology from configuration data store
118     ${resp} =    RequestsLibrary.Get Request    session    ${RFC8040_CONFIG_TOPO_API}
119     OVSDB.Log Request    ${resp.text}
120     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
121     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
122
123 Delete the Bridge through rest call
124     [Documentation]    This request will delete the bridge node from the config data store.
125     ${resp} =    RequestsLibrary.Delete Request
126     ...    session
127     ...    ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
128     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    204
129
130 Get Operational Topology after Deletion of Bridge
131     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
132     @{list} =    BuiltIn.Create List    ${BRIDGE2}
133     BuiltIn.Wait Until Keyword Succeeds
134     ...    8s
135     ...    2s
136     ...    Utils.Check For Elements Not At URI
137     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
138     ...    ${list}
139     ...    pretty_print_json=True
140
141 Trunk And Vlan Tag Is Removed From Operational
142     [Documentation]    Verify that when the vlan tag is added and removed from an ovs port, it should be accurately reflected
143     ...    in the operational store. Also verify that when all trunks are cleared from ovs, it's accurate in operational.
144     [Tags]    8529    bug    exclude
145     OVSDB.Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
146     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
147     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br vlan-tag-br
148     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-port vlan-tag-br vlan-tag-port
149     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port tag=81
150     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port trunks=[181,182]
151     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
152     OVSDB.Collect OVSDB Debugs
153     @{list} =    BuiltIn.Create List
154     ...    vlan-tag-br
155     ...    vlan-tag-port
156     ...    "ovsdb:vlan-tag":81
157     ...    "trunk":181
158     ...    "trunk":182
159     BuiltIn.Wait Until Keyword Succeeds
160     ...    8s
161     ...    2s
162     ...    Utils.Check For Elements At URI
163     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
164     ...    ${list}
165     ...    pretty_print_json=True
166     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port tag
167     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl remove port vlan-tag-port trunks 181
168     @{list} =    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181
169     OVSDB.Collect OVSDB Debugs
170     BuiltIn.Wait Until Keyword Succeeds
171     ...    8s
172     ...    2s
173     ...    Utils.Check For Elements Not At URI
174     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
175     ...    ${list}
176     ...    pretty_print_json=True
177     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port trunks
178     @{list} =    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181    "trunk":182
179     OVSDB.Collect OVSDB Debugs
180     BuiltIn.Wait Until Keyword Succeeds
181     ...    8s
182     ...    2s
183     ...    Utils.Check For Elements Not At URI
184     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
185     ...    ${list}
186     ...    pretty_print_json=True
187     [Teardown]    Builtin.Run Keywords    Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
188     ...    AND    Utils.Report_Failure_Due_To_Bug    OVSDB-413
189
190 Check For Bug 4756
191     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
192     ...    case executed.
193     Utils.Check Karaf Log File Does Not Have Messages
194     ...    ${ODL_SYSTEM_IP}
195     ...    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
196     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
197
198 Check For Bug 4794
199     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
200     ...    case executed.
201     Utils.Check Karaf Log File Does Not Have Messages
202     ...    ${ODL_SYSTEM_IP}
203     ...    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
204     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
205
206
207 *** Keywords ***
208 Suite Teardown
209     [Documentation]    Cleans up test environment, close existing sessions.
210     @{uris} =    Builtin.Create List
211     ...    ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE1}
212     ...    ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
213     OVSDB.Suite Teardown    ${uris}