Migrate Get Requests invocations(libraries)
[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 On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
65     Utils.Log Content    ${resp.text}
66     BuiltIn.Should Not Contain    ${resp.text}    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}/bridge/${BRIDGE1}
67
68 Create a Bridge through controller
69     [Documentation]    This will create bridge on the specified OVSDB node.
70     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE2}    0000000000000002
71
72 Get Operational Topology to verify the bridge has been added through rest call
73     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
74     @{list} =    BuiltIn.Create List    ${BRIDGE2}
75     BuiltIn.Wait Until Keyword Succeeds
76     ...    8s
77     ...    2s
78     ...    Utils.Check For Elements At URI
79     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
80     ...    ${list}
81     ...    pretty_print_json=True
82
83 Get Config Topology to verify the entry added to the config datastore
84     [Documentation]    This request will fetch the configuration topology from configuration data store
85     ${resp} =    RequestsLibrary.GET On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
86     Utils.Log Content    ${resp.text}
87     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
88
89 Create bridge of already added bridge
90     [Documentation]    This will add bridge to the config datastore
91     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE1}    0000000000000001
92
93 Get Config Topology to verify the entry of existing bridge added to the config datastore
94     [Documentation]    This request will fetch the configuration topology from configuration data store
95     ${resp} =    RequestsLibrary.GET On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
96     Utils.Log Content    ${resp.text}
97     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE1}
98
99 Delete bridge manually
100     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-br ${BRIDGE2}
101
102 Get Operational Topology to verify the bridge has been deleted manually
103     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
104     @{list} =    BuiltIn.Create List    ${BRIDGE2}
105     BuiltIn.Wait Until Keyword Succeeds
106     ...    8s
107     ...    2s
108     ...    Utils.Check For Elements Not At URI
109     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
110     ...    ${list}
111     ...    pretty_print_json=True
112
113 Config Topology Still Contains Bridge
114     [Documentation]    This request will fetch the configuration topology from configuration data store
115     ${resp} =    RequestsLibrary.GET On Session    session    url=${RFC8040_CONFIG_TOPO_API}    expected_status=200
116     Utils.Log Content    ${resp.text}
117     BuiltIn.Should Contain    ${resp.text}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
118
119 Delete the Bridge through rest call
120     [Documentation]    This request will delete the bridge node from the config data store.
121     RequestsLibrary.DELETE On Session
122     ...    session
123     ...    url=${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
124     ...    expected_status=204
125
126 Get Operational Topology after Deletion of Bridge
127     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
128     @{list} =    BuiltIn.Create List    ${BRIDGE2}
129     BuiltIn.Wait Until Keyword Succeeds
130     ...    8s
131     ...    2s
132     ...    Utils.Check For Elements Not At URI
133     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
134     ...    ${list}
135     ...    pretty_print_json=True
136
137 Trunk And Vlan Tag Is Removed From Operational
138     [Documentation]    Verify that when the vlan tag is added and removed from an ovs port, it should be accurately reflected
139     ...    in the operational store. Also verify that when all trunks are cleared from ovs, it's accurate in operational.
140     [Tags]    8529    bug    exclude
141     OVSDB.Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
142     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
143     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br vlan-tag-br
144     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-port vlan-tag-br vlan-tag-port
145     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port tag=81
146     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port trunks=[181,182]
147     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
148     OVSDB.Collect OVSDB Debugs
149     @{list} =    BuiltIn.Create List
150     ...    vlan-tag-br
151     ...    vlan-tag-port
152     ...    "ovsdb:vlan-tag":81
153     ...    "trunk":181
154     ...    "trunk":182
155     BuiltIn.Wait Until Keyword Succeeds
156     ...    8s
157     ...    2s
158     ...    Utils.Check For Elements At URI
159     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
160     ...    ${list}
161     ...    pretty_print_json=True
162     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port tag
163     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl remove port vlan-tag-port trunks 181
164     @{list} =    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181
165     OVSDB.Collect OVSDB Debugs
166     BuiltIn.Wait Until Keyword Succeeds
167     ...    8s
168     ...    2s
169     ...    Utils.Check For Elements Not At URI
170     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
171     ...    ${list}
172     ...    pretty_print_json=True
173     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port trunks
174     @{list} =    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181    "trunk":182
175     OVSDB.Collect OVSDB Debugs
176     BuiltIn.Wait Until Keyword Succeeds
177     ...    8s
178     ...    2s
179     ...    Utils.Check For Elements Not At URI
180     ...    ${RFC8040_OPERATIONAL_TOPO_OVSDB1_API}
181     ...    ${list}
182     ...    pretty_print_json=True
183     [Teardown]    Builtin.Run Keywords    Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
184     ...    AND    Utils.Report_Failure_Due_To_Bug    OVSDB-413
185
186 Check For Bug 4756
187     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
188     ...    case executed.
189     Utils.Check Karaf Log File Does Not Have Messages
190     ...    ${ODL_SYSTEM_IP}
191     ...    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
198     ...    ${ODL_SYSTEM_IP}
199     ...    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
200     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
201
202
203 *** Keywords ***
204 Suite Teardown
205     [Documentation]    Cleans up test environment, close existing sessions.
206     @{uris} =    Builtin.Create List
207     ...    ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE1}
208     ...    ${RFC8040_SOUTHBOUND_NODE_API}uuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
209     OVSDB.Suite Teardown    ${uris}