a6fe714b779a3c921f7d6fa14221eee011c7e658
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 020__connection_manager.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           RequestsLibrary
8 Resource          ../../../libraries/SetupUtils.robot
9 Resource          ../../../libraries/Utils.robot
10 Resource          ../../../libraries/OVSDB.robot
11 Resource          ../../../variables/Variables.robot
12
13 *** Variables ***
14 ${BRIDGE1}        ovscon_br1
15 ${BRIDGE2}        ovscon_br2
16 @{NODE_LIST}      ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_NODE_PORT}
17 ${OVSDB_UUID}     ${EMPTY}
18
19 *** Test Cases ***
20 Connecting an OVS instance to the controller
21     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
22     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
23     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
24
25 Get Operational Topology to verify the ovs instance is connected to the controller
26     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
27     @{list} =    BuiltIn.Create List    ovsdb://uuid    "remote-ip":"${TOOLS_SYSTEM_IP}"    "local-port":${OVSDBPORT}
28     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}    pretty_print_json=True
29     ${OVSDB_UUID} =    OVSDB.Get OVSDB UUID    ${TOOLS_SYSTEM_IP}
30     BuiltIn.Set Suite Variable    ${OVSDB_UUID}
31
32 Verify OVS Not In Config Topology
33     [Documentation]    This request will fetch the configuration topology from configuration data store
34     Utils.Check For Elements Not At URI    ${CONFIG_TOPO_API}    ${NODE_LIST}    pretty_print_json=True
35
36 Create bridge manually
37     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br ${BRIDGE1}
38
39 Get Operational Topology to verify the bridge has been added
40     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
41     @{list} =    BuiltIn.Create List    ${BRIDGE1}
42     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}    pretty_print_json=True
43
44 Get Config Topology to verify the manually added bridge is not added to the config datastore
45     [Documentation]    This request will fetch the configuration topology from configuration data store
46     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
47     OVSDB.Log Request    ${resp.content}
48     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
49     BuiltIn.Should Not Contain    ${resp.content}    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}/bridge/${BRIDGE1}
50
51 Create a Bridge through controller
52     [Documentation]    This will create bridge on the specified OVSDB node.
53     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE2}    0000000000000002
54
55 Get Operational Topology to verify the bridge has been added through rest call
56     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
57     @{list} =    BuiltIn.Create List    ${BRIDGE2}
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 Get Config Topology to verify the entry added to the config datastore
61     [Documentation]    This request will fetch the configuration topology from configuration data store
62     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
63     OVSDB.Log Request    ${resp.content}
64     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
65     BuiltIn.Should Contain    ${resp.content}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
66
67 Create bridge of already added bridge
68     [Documentation]    This will add bridge to the config datastore
69     OVSDB.Add Bridge To Ovsdb Node    uuid/${OVSDB_UUID}    ${TOOLS_SYSTEM_IP}    ${BRIDGE1}    0000000000000001
70
71 Get Config Topology to verify the entry of existing bridge added to the config datastore
72     [Documentation]    This request will fetch the configuration topology from configuration data store
73     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
74     OVSDB.Log Request    ${resp.content}
75     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
76     BuiltIn.Should Contain    ${resp.content}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE1}
77
78 Delete bridge manually
79     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-br ${BRIDGE2}
80
81 Get Operational Topology to verify the bridge has been deleted manually
82     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
83     @{list} =    BuiltIn.Create List    ${BRIDGE2}
84     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
85
86 Config Topology Still Contains Bridge
87     [Documentation]    This request will fetch the configuration topology from configuration data store
88     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
89     OVSDB.Log Request    ${resp.content}
90     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
91     BuiltIn.Should Contain    ${resp.content}    ovsdb://uuid/${OVSDB_UUID}/bridge/${BRIDGE2}
92
93 Delete the Bridge through rest call
94     [Documentation]    This request will delete the bridge node from the config data store.
95     ${resp} =    RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
96     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
97
98 Get Operational Topology after Deletion of Bridge
99     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
100     @{list} =    BuiltIn.Create List    ${BRIDGE2}
101     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
102
103 Trunk And Vlan Tag Is Removed From Operational
104     [Documentation]    Verify that when the vlan tag is added and removed from an ovs port, it should be accurately reflected
105     ...    in the operational store. Also verify that when all trunks are cleared from ovs, it's accurate in operational.
106     [Tags]    8529    bug
107     OVSDB.Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
108     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT}
109     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br vlan-tag-br
110     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-port vlan-tag-br vlan-tag-port
111     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port tag=81
112     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port vlan-tag-port trunks=[181,182]
113     BuiltIn.Wait Until Keyword Succeeds    5s    1s    OVSDB.Verify OVS Reports Connected
114     OVSDB.Collect OVSDB Debugs
115     @{list}    BuiltIn.Create List    vlan-tag-br    vlan-tag-port    "ovsdb:vlan-tag":81    "trunk":181    "trunk":182
116     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}    pretty_print_json=True
117     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port tag
118     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl remove port vlan-tag-port trunks 181
119     @{list}    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181
120     OVSDB.Collect OVSDB Debugs
121     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
122     Utils.Run Command On Mininet    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl clear port vlan-tag-port trunks
123     @{list}    BuiltIn.Create List    "ovsdb:vlan-tag":81    "trunk":181    "trunk":182
124     OVSDB.Collect OVSDB Debugs
125     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
126     [Teardown]    Builtin.Run Keywords    Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
127     ...    AND    Utils.Report_Failure_Due_To_Bug    OVSDB-413
128
129 Check For Bug 4756
130     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
131     ...    case executed.
132     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
133     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
134
135 Check For Bug 4794
136     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
137     ...    case executed.
138     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
139     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
140
141 *** Keywords ***
142 Suite Teardown
143     [Documentation]    Cleans up test environment, close existing sessions.
144     @{uris} =    Builtin.Create List    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE1}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${OVSDB_UUID}%2Fbridge%2F${BRIDGE2}
145     OVSDB.Suite Teardown    ${uris}